CN103593485A - Method and device for achieving real-time operation on data base - Google Patents

Method and device for achieving real-time operation on data base Download PDF

Info

Publication number
CN103593485A
CN103593485A CN201310648091.5A CN201310648091A CN103593485A CN 103593485 A CN103593485 A CN 103593485A CN 201310648091 A CN201310648091 A CN 201310648091A CN 103593485 A CN103593485 A CN 103593485A
Authority
CN
China
Prior art keywords
memory
memory block
data
database
systems share
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310648091.5A
Other languages
Chinese (zh)
Other versions
CN103593485B (en
Inventor
郑锦荣
吴肇宣
娄振林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Media Technology Beijing Co Ltd
Original Assignee
Netease Media Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Media Technology Beijing Co Ltd filed Critical Netease Media Technology Beijing Co Ltd
Priority to CN201310648091.5A priority Critical patent/CN103593485B/en
Publication of CN103593485A publication Critical patent/CN103593485A/en
Application granted granted Critical
Publication of CN103593485B publication Critical patent/CN103593485B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification

Abstract

The invention provides a method for achieving real-time operation on a data base on one hand. The method includes the steps that the data base is created in operation system shared memory on a server; responding to a request for operation on the data base, a memory block at which the operation aims is determined in the operation system shared memory; and operation is carried out on the determined memory block. The data base is created in the operation system shared memory on the server, in this way, the real-time operation on the data base can be effectively ensured, and further system resources occupied in the process of real-time operation on the data base are reduced. The invention provides a device, such as software installed on the server, for achieving the real-time operation on the data base on the other hand.

Description

The method and apparatus of fulfillment database true-time operation
Technical field
Embodiments of the present invention relate to database field, and more specifically, embodiments of the present invention relate to the method and apparatus of fulfillment database true-time operation.
Background technology
The embodiments of the present invention that be intended to for stating in claims this part provide background or context.Description herein can comprise the concept that can probe into, but the concept of having expected or having probed into not necessarily.Therefore, unless at this, point out, the content of describing in this part is not prior art for the application's instructions and claims, and not because be included in just admit it is prior art in this part.
A typical real-time price quotations application system, in stock market system, the user who is positioned at client wishes to view up-to-date price data.In such system, need to be with a data library storage price data.Meanwhile, also need to realize " the real-time operation " to price data.
So-called " real-time operation " generally refers to, rapidly by up-to-date price data write into Databasce to replace old price data, and rapidly price data is read out and offers client from database, make to mate most between the data that read and the data that write.
In the prior art, the database that has occurred some types.As, relevant database and memory database.Wherein, relevant database is the database that saves the data in the enterprising line operate of disk, and memory database is to save the data in the database operating in internal memory.
Summary of the invention
But the inventor finds in research process, in the prior art, no matter is relevant database, or memory database, for writing process and reading for process, all need to have the memory headroom of oneself.When writing process data writing, be data to be transferred to from the memory headroom of oneself in internal memory or disk, when reading process reading out data, be that data are transferred in the memory headroom of oneself from internal memory or disk.
Therefore according to prior art, when above-mentioned database is operated, owing to need to experiencing the transfer process of data,, data are transferred to the process of internal memory or disk from memory headroom, and data transfer to the process of memory headroom from internal memory or disk, and transfer process itself need to take certain hour, therefore, cannot effective guarantee " real-time operation " requirement.
In addition, the memory headroom using in transfer process also can occupying system resources.
For this reason, be starved of a kind of method and apparatus of improved fulfillment database true-time operation, cannot this technical matters of effective guarantee " real-time operation " to the operation of database in prior art to solve.Further, also need to reduce to the shared system resource of database true-time operation process.
In the present context, embodiments of the present invention expectation provides a kind of method and apparatus of fulfillment database true-time operation.
In the first aspect of embodiment of the present invention, a kind of method of fulfillment database true-time operation is provided, comprising: creation database in the operation systems share internal memory on server; In response to the request to the operation of described database, from described operation systems share internal memory, determine described operation for memory block; Definite memory block is operated.
Preferably, described operation comprises data writing operation and read data operation.
Preferably, described method also comprises: by the data-mapping in described operation systems share internal memory in the disk on described server.
Preferably, described method also comprises: by the data-mapping in described operation systems share internal memory in the operating system memory file on described server.
Preferably, for creating the memory address of the described operation systems share internal memory of described database, at run duration, by operating system, do not discharged and reclaim.
Preferably, described method also comprises: when occupied memory block is idle in described operation systems share internal memory, the memory address that idle memory block is corresponding is put into the presets list.
Preferably, the memory block that the memory address in described the presets list is corresponding can be reused for the data of preserving described database.
Preferably, when the number of the memory address in described the presets list is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
Preferably, describedly memory address corresponding to idle memory block put into the presets list comprise: according to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, and memory address corresponding to memory block varying in size put in different the presets lists.
Preferably, described definite memory block is operated and comprised: according to HashMap data structure, definite memory block is operated.
Preferably, when described, be operating as data writing when operation, use single-threaded writing data in definite memory block.
Preferably, when described, while being operating as read data operation, can use multithreading reading out data from definite memory block.
In the second aspect of embodiment of the present invention, a kind of equipment of fulfillment database true-time operation is provided, comprising: database creation unit, for the operation systems share internal memory creation database on server; Memory block determining unit, for the request in response to the operation of described database, from described operation systems share internal memory, determine described operation requests for memory block; Operating unit, operates for the memory block to definite.
Preferably, described operation comprises data writing operation and read data operation.
Preferably, described equipment also comprises: the first map unit, for by the data-mapping of described operation systems share internal memory in the disk on described server.
Preferably, described equipment also comprises: the second map unit, for by the data-mapping of described operation systems share internal memory in the operating system memory file on described server.
Preferably, for creating the memory address of the described operation systems share internal memory of described database, at run duration, by operating system, do not discharged and reclaim.
Preferably, described equipment also comprises: memory block management unit, for when the occupied memory block of described operation systems share internal memory is idle, the memory address that idle memory block is corresponding is put into the presets list.
Preferably, the memory block that the memory address in described the presets list is corresponding can be reused for the data of preserving described database.
Preferably, when the number of the memory address in described the presets list is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
Preferably, described memory block management cell location is: according to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, and memory address corresponding to memory block varying in size put in different the presets lists.
Preferably, described operating unit is configured to: according to HashMap data structure, definite memory block is operated.
Preferably, when described, be operating as data writing when operation, described operating unit is configured to: use single-threaded writing data in definite memory block.
Preferably, when described, while being operating as read data operation, described operating unit concrete configuration is: can use multithreading reading out data from definite memory block.
In embodiment of the present invention, because database is to create in the operation systems share internal memory on server, therefore, the process that writes can directly as the machine internal memory is operated operate database with the process of reading, and without carrying out data transfer, thereby time and the system resource that can save factor data transfer process and consume, and then effectively ensure " real-time operation " requirement to database.
In addition, by the presets list, idle memory block is reclaimed and reused, not only avoided the generation of memory fragmentation, but also reached the controlled object of memory block.
Also in addition, adopt without the mode of lock and avoid read/write conflict, simplified system architecture, greatly improved system performance.
summary of the invention
The inventor finds, due to relevant database of the prior art and memory database are being operated, for writing process and reading for process, all need to have the memory headroom of oneself, when writing process data writing, that data are transferred in internal memory or disk from the memory headroom of oneself, when reading process reading out data, that data are transferred in the memory headroom of oneself from internal memory or disk, therefore, must experience repeatedly the operation of data transfer process ability database.And data transfer process itself needs to take certain hour, like this, will certainly affect the true-time operation to database, and then cannot effective guarantee " real-time operation " requirement to database.
In addition, the memory headroom using in data transfer process also can occupying system resources.If can reduce when database is operated or even avoid data transfer process, just can save factor data transfer process and the time and the system resource that consume, and then effectively ensure " real-time operation " requirement to database.
After having introduced ultimate principle of the present invention, lower mask body is introduced various non-limiting embodiment of the present invention.
application scenarios overview
First with reference to figure 2, Fig. 2 schematically shows an exemplary application scene of embodiments of the present invention.Wherein, on the operation systems share internal memory of server 20, create and have database 201, the process that reads 21 on server 20, in response to user's request, reads existing data from database 201, offers user.And the process that writes 22 on server 20 writes up-to-date data to database 201.Server 20 can be Web server, can be also the server of other types, for example APP server.It will be understood by those skilled in the art that the schematic diagram shown in Fig. 2 is only the example that embodiments of the present invention can be achieved therein.The scope of application of embodiment of the present invention is not subject to the restriction of this any aspect of framework.
illustrative methods
Below in conjunction with the application scenarios of Fig. 2, be described with reference to Figure 3 according to exemplary embodiment of the invention, for the method for fulfillment database true-time operation.It should be noted that above-mentioned application scenarios is only to illustrate for the ease of understanding spirit of the present invention and principle, embodiments of the present invention are unrestricted in this regard.On the contrary, any scene that embodiments of the present invention can be applied to be suitable for.
Refer to Fig. 3, it schematically shows the process flow diagram of the method for fulfillment database true-time operation according to the embodiment of the present invention, and method concrete example is as comprised:
Step 301: creation database in the operation systems share internal memory on server.
Wherein, shared drive be mainstream operation system (as, Linux, Unix and Windows operating system) a kind of system bottom mechanism all supported, if creation database in shared drive, for the data on server, write process and data read process, when when being positioned at the database of shared drive and operating, without extra memory headroom.That is to say, when writing process data writing, directly write data in the database of shared drive, when reading process reading out data, is also direct reading out data from the database of shared drive.
According to the embodiment of the present invention, first, by writing process initialization database.When carrying out data base initialize, write process and first can carry out applying operation system shared drive by send mmap system call request to operating system, this operation systems share internal memory can hold all data.
In addition, data are stored in database in the mode of key-value pair (key-value), key and value are character string type, as, stock code 600100 is stored in content in database: " symbol ": and " 600100 ", " price ": 8.0, " high ": 8.03, " low ": 7.79, " time ": " 2013/08/1215:03:05 " ....Wherein symbol, price, high, low, time are key, and 600100,8.0,8.03,7.79,2013/08/1215:03:05 is the value of key symbol, price, high, low, time.
Step 302: in response to the request to the operation of described database, from described operation systems share internal memory, determine described operation for memory block.
Step 303: definite memory block is operated.
According to an embodiment of the invention, described operation comprises data writing operation and read data operation.
For example, shown in figure 2, the request sending the read data operation of database 201 with user orientation server 20, the process that reads 21 on server 20 is in response to the request of this read data operation, from operation systems share internal memory, determine this read data operation for memory block, and further definite memory block is carried out to read data operation.Or the process that writes 22 on server 20 is in response to the request of data writing operation, from operation systems share internal memory, determine this data writing operation for memory block, and further definite memory block is carried out to data write operation.
Creation database in operation systems share internal memory, data are to be temporarily kept in shared drive, once reboot operation system, the data in database will be lost.Therefore, according to this embodiment, solved in prior art server cannot effective guarantee " real-time operation " to the operation of database, and, when having solved database true-time operation process and expend the problem of system resource, also there is the unsettled problem of data.
In order further to solve the unsettled problem of data, according to the first optimal way, method also comprises: by the data-mapping in described operation systems share internal memory in the disk on described server.
Like this, data are permanently kept in disk, even because reboot operation system causes the loss of data in database, also can from disk, find and recover the data of losing.
In the specific implementation, be to be controlled the data-mapping in operation systems share internal memory in the disk on server by operating system.For example, when the data in shared drive reach some data volumes, operating system will be automatically by data-mapping in the disk on server.But according to this scheme, the frequency that operating system is carried out data-mapping is often higher, thereby produce too much I/O operation, consume a large amount of operating system overheads.
In order not make to produce too much I/O operation and a large amount of operating system overheads, according to the another kind of optimal way of replacing above-mentioned the first optimal way, method also comprises: by the data-mapping in described operation systems share internal memory in the operating system memory file on described server.
For example, by the data-mapping in operation systems share internal memory in operating system memory file/dev/shm.If in operating system memory file, this mapping process can not produce any I/O operation, thereby just can not consume operating system overhead yet by the data-mapping in operation systems share internal memory.
In addition, there is equally the unsettled problem of data in the data that are mapped in operating system memory file, in order to address this problem, after in the operating system memory file to described server by the data-mapping in described operation systems share internal memory, method can further include: the data in described operating system memory file are backuped in the disk on described server.
It is emphasized that, the process that data in operating system memory file are backuped in the disk on server is not controlled by operating system, but can be controlled by user's process, that is to say, user's process can by controlling the frequency of data backup, that is, reduce the frequency of data backup, and then reduce the I/O number of operations that data backup process produces, thereby also reduced operating system overhead.
For fear of producing memory fragmentation, reach the controlled object of internal memory, according to one embodiment of the present invention, adopted a kind of special shared-memory management mechanism, that is, for creating the memory address of the described operation systems share internal memory of described database, at run duration, by operating system, do not discharged and reclaim.Based on this, method also comprises: when occupied memory block is idle in described operation systems share internal memory, the memory address that idle memory block is corresponding is put into the presets list.Wherein, the memory block that the memory address in described the presets list is corresponding can be reused for the data of preserving described database.
For fear of the read/write conflict causing due to concurrent reading and writing, according to one embodiment of the present invention, when in described the presets list, the number of memory address is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
In addition, for more convenient and quicker find the memory block being applicable at every turn for data storage in all memory blocks corresponding to memory address from distributed the presets list, according to one embodiment of the present invention, memory address corresponding to idle memory block put into the presets list to be comprised: according to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, memory address corresponding to memory block varying in size put in different the presets lists.
For example, in operation systems share internal memory, be to take the memory block of fixed size to carry out Memory Allocation and recovery as unit.According to concrete scene, the size of memory block, between 64 byte to 1024 bytes, increases progressively with the amplitude of every 64 bytes, and as shown in Figure 4, it shows the schematic diagram that memory block distributes.When if the data of storage are 12 byte, use size is that the memory block of 64 bytes is stored this data, if the data of storage are 68 bytes, use size is that the memory block of 128 bytes is stored this data.
For each big or small memory block, memory address corresponding to memory block that size is identical put in same the presets list, memory address corresponding to the memory block varying in size put in different the presets lists.Fig. 5 shows according to the schematic diagram of the presets list of one embodiment of the present invention.As shown in Figure 5, memory address corresponding to memory block that is 64 bytes by all sizes put into (call number is 0) in first the presets list, memory address corresponding to memory block that is 128 bytes by all sizes put into (call number is 1) in second the presets list, memory address corresponding to memory block that is 192 bytes by all sizes put into (call number is 2) in the 3rd the presets list, memory address corresponding to memory block that is 256 bytes by all sizes put into (call number is 3) in the 4th the presets list, the like.
In order to realize the fast operating to database, that is, to database, write data fast, and, reading out data from database, according to an embodiment of the invention, operates and comprises definite memory block: according to HashMap data structure, definite memory block is operated fast.
Fig. 6 shows according to the schematic diagram of the HashMap data structure of one embodiment of the present invention.As shown in Figure 6, in the starting position of operation systems share internal memory, retain a little block space, for preserving HashMap header (Header) and bucket (Bucket) array.Each Bucket preserves pointer, the pointer of last node (Last Entry) and the size (size) of this node listing of pointing to first node (First Entry) in the corresponding node listing of this Bucket.Each node (Entry) comprises respectively the pointer of previous node (PreEntry) and the pointer of a rear node (Next Entry), the pointer of Hash (Hash) value of key (Key) and key (Key) and value (Value).
Based on above-mentioned HashMap data structure, the mode that the process that writes is carried out data writing operation is: first the key that will write is carried out to Hash (Hash) computing, obtain the position of Bucket; Then travel through the Entry list that Bucket is corresponding, check whether the key that will write exists, and if there is no, the key that will write adds the end of Entry list to, if existed, replaces the value of key.
For each data writing operation, if replaced old value, memory address corresponding to memory block of storing so this old value just need to be reentered in the presets list, during with the new data writing action need memory block of box lunch, can be according to the size of data, reuse memory block corresponding to memory address in the presets list, thereby reach the object that internal memory is reused.
Based on above-mentioned HashMap data structure, the process that reads is carried out the mode of read data operation and is: first the key that will read is carried out to Hash (Hash) computing, obtain the position of Bucket; Then travel through the Entry list that Bucket is corresponding, from Entry list, search the key that will read, and return to the value of the key that will read.
For fear of the conflict that writes producing when the operation of a plurality of data writings of executed in parallel, according to an embodiment of the invention, when described, while being operating as data writing operation, use single-threaded writing data in definite memory block.
But, according to an embodiment of the invention, when described, while being operating as read data operation, can use multithreading reading out data from definite memory block.
For example, take Nginx as example, develop the Nginx module of a standard as reading process.This Nginx module is the request of (can support multithreading) parsing read data operation simultaneously, obtain the parameter (parameter is one or more key) comprising in the request of this read data operation, the fetch interface providing according to key calling data storehouse obtains the value of key, and the response by read data operation after the value obtaining is encapsulated returns to user.
Wherein, the fetch interface that database provides supports multikey value to read simultaneously, and for example, the request of a read data operation is:
http://www.example.com/query?key=001,002,003,004。The process that reads in server is when calling fetch interface, and by key=001,002,003,004 passes to this fetch interface, and fetch interface reads the value of each key from memory block, and to the process of reading, returns to the value of each key.
In addition, according to an embodiment of the invention, provide simple DLL (dynamic link library), for fulfillment database initialization, data writing, reading out data and staqtistical data base state:
1, data base initialize interface (need to specify shared drive size)
bool?map_init(int?capacity,int?mem_size,const?char*data_file_path);
2, data writing interface (if key exists, covering the value of key)
void?map_put(const?char*key,const?char*value);
3, reading out data interface (obtaining the value of key)
char*map_get(const?char*key);
4, obtain the interface of the current statistic behavior of database
void?map_stat(int*key_stat,int*value_stat)。
It should be noted that, the various DLL (dynamic link library) of database can be used C language to realize, database writes process and the process that reads can be used the program development language of any support C language binding to realize, and includes but not limited to: C, C++, Java, Python and NodeJs etc.
According to the present invention, because database is to create in the operation systems share internal memory on server, therefore, the process that writes can directly as the machine internal memory is operated operate database with the process of reading, and without carrying out data transfer.Thereby time and the system resource that can save factor data transfer process and consume, and then effectively ensure " real-time operation " requirement to database.
In addition, by the presets list, idle memory block is reclaimed and reused, not only avoided the generation of memory fragmentation, but also reached the controlled object of memory block.
Also in addition, adopt without the mode of lock and avoid read/write conflict, simplified system architecture, has improved system performance greatly.
exemplary apparatus
After having introduced method, next, with reference to figure 7, the structural framing figure that it schematically shows according to the equipment of one embodiment of the present invention, describes the equipment for fulfillment database true-time operation.Particularly, this equipment for example can comprise:
Database creation unit 701, for the operation systems share internal memory creation database on server;
Memory block determining unit 702, for the request in response to the operation of described database, from described operation systems share internal memory, determine described operation requests for memory block;
Operating unit 703, operates for the memory block to definite.
According to an embodiment of the invention, described operation comprises data writing operation and read data operation.
According to an embodiment of the invention, when described, be operating as data writing when operation, described operating unit is configured to: use single-threaded writing data in definite memory block; When described, while being operating as read data operation, described operating unit is configured to: can use multithreading reading out data from definite memory block.
According to an embodiment of the invention, described operating unit is configured to:
According to HashMap data structure, definite memory block is operated.
According to some embodiment of the present invention, equipment can also comprise:
The first map unit, for by the data-mapping of described operation systems share internal memory in the disk on described server.
According to some embodiment of the present invention, equipment can also comprise:
The second map unit, for by the data-mapping of described operation systems share internal memory in the operating system memory file on described server.
According to some embodiment of the present invention, for creating the memory address of the described operation systems share internal memory of described database, at run duration, by operating system, do not discharged and reclaim.
According to some embodiment of the present invention, equipment can also comprise:
Memory block management unit, for when the occupied memory block of described operation systems share internal memory is idle, puts into the presets list by the memory address that idle memory block is corresponding.
According to an embodiment of the invention, described memory block management cell location is:
According to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, and memory address corresponding to memory block varying in size put in different the presets lists.
According to an embodiment of the invention, memory block corresponding to memory address in described the presets list can be reused for the data of preserving described database.
According to an embodiment of the invention, when the number of the memory address in described the presets list is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
According to the present invention, because database is to create in the operation systems share internal memory on server, therefore, the process that writes can directly as the machine internal memory is operated operate database with the process of reading, and without carrying out data transfer.Thereby time and the system resource that can save factor data transfer process and consume, and then effectively ensure " real-time operation " requirement to database.
In addition, by the presets list, idle memory block is reclaimed and reused, not only avoided the generation of memory fragmentation, but also reached the controlled object of memory block.
Also in addition, adopt without the mode of lock and avoid read/write conflict, simplified system architecture, has improved system performance greatly.
Although it should be noted that some devices or the sub-device of the equipment of having mentioned fulfillment database true-time operation in above-detailed, this division is only show row not enforceable.In fact, according to the embodiment of the present invention, the feature of above-described two or more devices and function can realize in a device.Or on the contrary, the feature of an above-described device and function can Further Division for to be realized by a plurality of devices.
In addition, although described in the accompanying drawings the operation of the inventive method with particular order,, this not requires or hint must be carried out these operations according to this particular order, or the operation shown in must carrying out all could realize the result of expectation.On the contrary, the step of describing in process flow diagram can change execution sequence.Additionally or alternatively, can omit some step, a plurality of steps be merged into a step and carry out, and/or a step is decomposed into a plurality of steps carries out.
The verb of mentioning in application documents " comprises ", those elements or the element step or the existence of step of recording in application documents do not got rid of in " comprising " and paradigmatic use thereof.Article before element " one " or " one " do not get rid of the existence of a plurality of this elements.
Although described spirit of the present invention and principle with reference to some embodiments, but should be appreciated that, the present invention is not limited to disclosed embodiment, the division of each side is not meant that to the feature in these aspects can not combine to be benefited yet, and this division is only the convenience in order to explain.The present invention is intended to contain interior included various modifications and the equivalent arrangements of spirit and scope of claims.The scope of claims meets the most wide in range explanation, thereby comprises all such modifications and equivalent structure and function.
Accompanying drawing explanation
By reference to accompanying drawing, read detailed description below, above-mentioned and other objects of exemplary embodiment of the invention, the feature and advantage easy to understand that will become.In the accompanying drawings, in exemplary and nonrestrictive mode, show some embodiments of the present invention, wherein:
Fig. 1 shows the block diagram of the exemplary computer system that is suitable for realizing embodiment of the present invention;
Fig. 2 schematically shows an exemplary application scene of embodiments of the present invention;
Fig. 3 schematically shows the process flow diagram of the method for fulfillment database true-time operation according to the embodiment of the present invention;
Fig. 4 shows according to the schematic diagram of the memory block management of one embodiment of the present invention;
Fig. 5 shows according to the schematic diagram of the presets list of one embodiment of the present invention;
Fig. 6 shows according to the schematic diagram of the HashMap data structure of one embodiment of the present invention;
Fig. 7 schematically shows the structural framing figure according to the equipment of one embodiment of the present invention.
In the accompanying drawings, identical or corresponding label represents identical or corresponding part.
Embodiment
Below with reference to some illustrative embodiments, principle of the present invention and spirit are described.Should be appreciated that providing these embodiments is only used to make those skilled in the art can understand better and then realize the present invention, and not limit the scope of the invention by any way.On the contrary, it is in order to make the disclosure more thorough and complete that these embodiments are provided, and the scope of the present disclosure intactly can be conveyed to those skilled in the art.
Fig. 1 shows the block diagram of the exemplary computer system 100 that is suitable for realizing embodiment of the present invention.As shown in Figure 1, computing system 100 can comprise: CPU (central processing unit) (CPU) 101, random-access memory (ram) 102, ROM (read-only memory) (ROM) 103, system bus 104, hard disk controller 105, keyboard controller 106, serial interface controller 107, parallel interface controller 108, display controller 109, hard disk 110, keyboard 111, serial external unit 112, parallel external unit 113 and display 114.In these equipment, with system bus 104 coupling have CPU101, RAM102, ROM103, hard disk controller 105, keyboard controller 106, serial interface controller 107, parallel interface controller 108 and a display controller 109.Hard disk 110 and hard disk controller 105 couplings, keyboard 111 and keyboard controller 106 couplings, serial external unit 112 and serial interface controller 107 couplings, parallel external unit 113 and parallel interface controller 108 couplings, and display 114 and display controller 109 couplings.Should be appreciated that the structured flowchart described in Fig. 1 is only used to the object of example, rather than limitation of the scope of the invention.In some cases, can increase as the case may be or reduce some equipment.
Art technology technician knows, embodiments of the present invention can be implemented as a kind of system, method or computer program.Therefore, the disclosure can specific implementation be following form, that is: hardware, software (comprising firmware, resident software, microcode etc.), or the form of hardware and software combination completely completely, be commonly referred to as " circuit ", " module " or " system " herein.In addition, in certain embodiments, the present invention can also be embodied as the form of the computer program in one or more computer-readable mediums, comprises computer-readable program code in this computer-readable medium.
Can adopt the combination in any of one or more computer-readable media.Computer-readable medium can be computer-readable signal media or computer-readable recording medium.Computer-readable recording medium for example may be, but not limited to,, electricity, magnetic, optical, electrical magnetic, infrared ray or semi-conductive system, device or device, or the combination arbitrarily.The example more specifically of computer-readable recording medium (non exhaustive example) for example can comprise: have the electrical connection, portable computer diskette, hard disk, random-access memory (ram), ROM (read-only memory) (ROM), erasable type programmable read only memory (EPROM or flash memory), optical fiber, Portable, compact disk ROM (read-only memory) (CD-ROM), light storage device, magnetic memory device of one or more wires or the combination of above-mentioned any appropriate.In presents, computer-readable recording medium can be any comprising or stored program tangible medium, and this program can be used or be combined with it by instruction execution system, device or device.
Computer-readable signal media can be included in base band or the data-signal of propagating as a carrier wave part, has wherein carried computer-readable program code.The data-signal of this propagation can adopt various ways, includes but not limited to the combination of electromagnetic signal, light signal or above-mentioned any appropriate.Computer-readable signal media can also be any computer-readable medium beyond computer-readable recording medium, and this computer-readable medium can send, propagates or transmit the program for being used or be combined with it by instruction execution system, device or device.
The program code comprising on computer-readable medium can be with any suitable medium transmission, includes but not limited to wireless, electric wire, optical cable, RF etc., or the combination of above-mentioned any appropriate.
Can combine to write for carrying out the computer program code of the present invention's operation with one or more programming languages or its, described programming language comprises object-oriented programming language-such as Java, Smalltalk, C++, also comprises conventional process type programming language-such as " C " language or similar programming language.Program code can fully be carried out, partly on subscriber computer, carries out, as an independently software package execution, part part on subscriber computer, carry out or on remote computer or server, carry out completely on remote computer on subscriber computer.In relating to the situation of remote computer, remote computer can be connected to subscriber computer by the network (comprising LAN (Local Area Network) (LAN) or wide area network (WAN)) of any kind, or, can be connected to outer computer (for example utilizing ISP to pass through Internet connection).
The process flow diagram of method and the block diagram of equipment (or system) below with reference to the embodiment of the present invention are described embodiments of the present invention.The combination that should be appreciated that each square frame in each square frame of process flow diagram and/or block diagram and process flow diagram and/or block diagram can be realized by computer program instructions.These computer program instructions can offer the processor of multi-purpose computer, special purpose computer or other programmable data treating apparatus, thereby produce a kind of machine, these computer program instructions are carried out by computing machine or other programmable data treating apparatus, have produced the device of the function/operation of stipulating in the square frame in realization flow figure and/or block diagram.
Also these computer program instructions can be stored in and can make in computing machine or the computer-readable medium of other programmable data treating apparatus with ad hoc fashion work, like this, the instruction being stored in computer-readable medium just produces a product that comprises the command device of the function/operation of stipulating in the square frame in realization flow figure and/or block diagram.
Also computer program instructions can be loaded on computing machine, other programmable data treating apparatus or miscellaneous equipment, make to carry out sequence of operations step on computing machine, other programmable data treating apparatus or miscellaneous equipment, to produce computer implemented process, thus the process of function/operation that the instruction that makes to carry out on computing machine or other programmable device is stipulated during the square frame in realization flow figure and/or block diagram can be provided.
A kind of method and apparatus of fulfillment database true-time operation has been proposed according to the embodiment of the present invention.
In this article, it will be appreciated that, any number of elements in accompanying drawing is all unrestricted for example, and any name is all only for distinguishing, and does not have any limitation.
Below with reference to some representative embodiments of the present invention, explain in detail principle of the present invention and spirit.

Claims (24)

1. a method, comprising:
Creation database in operation systems share internal memory on server;
In response to the request to the operation of described database, from described operation systems share internal memory, determine described operation for memory block;
Definite memory block is operated.
2. method according to claim 1, wherein, described operation comprises data writing operation and read data operation.
3. method according to claim 1, also comprises:
By the data-mapping in described operation systems share internal memory in the disk on described server.
4. method according to claim 1, also comprises:
By the data-mapping in described operation systems share internal memory in the operating system memory file on described server.
5. method according to claim 1, wherein, is not discharged by operating system and reclaims at run duration for creating the memory address of the described operation systems share internal memory of described database.
6. method according to claim 5, also comprises:
When occupied memory block is idle in described operation systems share internal memory, the memory address that idle memory block is corresponding is put into the presets list.
7. method according to claim 6, wherein, memory block corresponding to memory address in described the presets list can be reused for the data of preserving described database.
8. method according to claim 7, wherein, when the number of the memory address in described the presets list is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
9. method according to claim 6, wherein, describedly memory address corresponding to idle memory block put into the presets list comprise:
According to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, and memory address corresponding to memory block varying in size put in different the presets lists.
10. method according to claim 1, wherein, describedly operates and comprises definite memory block:
According to HashMap data structure, definite memory block is operated.
11. methods according to claim 2, wherein, are operating as data writing when operation when described, use single-threaded writing data in definite memory block.
12. methods according to claim 2, wherein, while being operating as read data operation, can be used multithreading reading out data from definite memory block when described.
13. 1 kinds of equipment, comprising:
Database creation unit, for the operation systems share internal memory creation database on server;
Memory block determining unit, for the request in response to the operation of described database, from described operation systems share internal memory, determine described operation requests for memory block;
Operating unit, operates for the memory block to definite.
14. equipment according to claim 13, wherein, described operation comprises data writing operation and read data operation.
15. equipment according to claim 13, also comprise:
The first map unit, for by the data-mapping of described operation systems share internal memory in the disk on described server.
16. equipment according to claim 13, also comprise:
The second map unit, for by the data-mapping of described operation systems share internal memory in the operating system memory file on described server.
17. equipment according to claim 13, wherein, are not discharged by operating system and reclaim at run duration for creating the memory address of the described operation systems share internal memory of described database.
18. equipment according to claim 17, also comprise:
Memory block management unit, for when the occupied memory block of described operation systems share internal memory is idle, puts into the presets list by the memory address that idle memory block is corresponding.
19. equipment according to claim 18, wherein,
Memory block corresponding to memory address in described the presets list can be reused for the data of preserving described database.
20. equipment according to claim 19, wherein,
When the number of the memory address in described the presets list is greater than or equal to 2, memory block corresponding to memory address in described the presets list is just reused for the data of preserving described database.
21. equipment according to claim 18, wherein, described memory block management cell location is:
According to the size of memory block, memory address corresponding to memory block put in corresponding the presets list, identical memory address corresponding to memory block of size put in same the presets list, and memory address corresponding to memory block varying in size put in different the presets lists.
22. equipment according to claim 13, wherein, described operating unit is configured to:
According to HashMap data structure, definite memory block is operated.
23. equipment according to claim 14, wherein, are operating as data writing when operation when described, and described operating unit is configured to:
Use single-threaded writing data in definite memory block.
24. equipment according to claim 14, wherein, when described, while being operating as read data operation, described operating unit is configured to:
Can use multithreading reading out data from definite memory block.
CN201310648091.5A 2013-12-04 2013-12-04 The method and apparatus for realizing database real-time operation Active CN103593485B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310648091.5A CN103593485B (en) 2013-12-04 2013-12-04 The method and apparatus for realizing database real-time operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310648091.5A CN103593485B (en) 2013-12-04 2013-12-04 The method and apparatus for realizing database real-time operation

Publications (2)

Publication Number Publication Date
CN103593485A true CN103593485A (en) 2014-02-19
CN103593485B CN103593485B (en) 2017-06-16

Family

ID=50083626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310648091.5A Active CN103593485B (en) 2013-12-04 2013-12-04 The method and apparatus for realizing database real-time operation

Country Status (1)

Country Link
CN (1) CN103593485B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868228A (en) * 2014-11-25 2016-08-17 Sap欧洲公司 In-memory database system providing lockless read and write operations for OLAP and OLTP transactions
CN105989049A (en) * 2015-02-05 2016-10-05 天脉聚源(北京)科技有限公司 Data middle layer realizing method and system
CN107506375A (en) * 2017-07-17 2017-12-22 上海斐讯数据通信技术有限公司 Date storage method and device
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing
US10699070B2 (en) 2018-03-05 2020-06-30 Sap Se Dynamic retrieval and rendering of user interface content

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1427342A (en) * 2001-12-21 2003-07-02 上海贝尔有限公司 Internal storage management system and its distribution method
CN1851676A (en) * 2006-05-25 2006-10-25 浙江大学 Embedded system buffer internal memory distribution method
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base
US20090125574A1 (en) * 2007-11-12 2009-05-14 Mejdrich Eric O Software Pipelining On a Network On Chip
CN101582092A (en) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 Method and device for realizing the store of date in memory
CN102420814A (en) * 2011-11-21 2012-04-18 航天科工深圳(集团)有限公司 Data access method and device, and server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1427342A (en) * 2001-12-21 2003-07-02 上海贝尔有限公司 Internal storage management system and its distribution method
CN1851676A (en) * 2006-05-25 2006-10-25 浙江大学 Embedded system buffer internal memory distribution method
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base
US20090125574A1 (en) * 2007-11-12 2009-05-14 Mejdrich Eric O Software Pipelining On a Network On Chip
CN101582092A (en) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 Method and device for realizing the store of date in memory
CN102420814A (en) * 2011-11-21 2012-04-18 航天科工深圳(集团)有限公司 Data access method and device, and server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
薛竹飙: "实时内存数据库关键技术的研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868228A (en) * 2014-11-25 2016-08-17 Sap欧洲公司 In-memory database system providing lockless read and write operations for OLAP and OLTP transactions
CN105868228B (en) * 2014-11-25 2021-04-20 Sap欧洲公司 In-memory database system providing lock-free read and write operations for OLAP and OLTP transactions
CN105989049A (en) * 2015-02-05 2016-10-05 天脉聚源(北京)科技有限公司 Data middle layer realizing method and system
CN107506375A (en) * 2017-07-17 2017-12-22 上海斐讯数据通信技术有限公司 Date storage method and device
US10699070B2 (en) 2018-03-05 2020-06-30 Sap Se Dynamic retrieval and rendering of user interface content
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing

Also Published As

Publication number Publication date
CN103593485B (en) 2017-06-16

Similar Documents

Publication Publication Date Title
CN109032706B (en) Intelligent contract execution method, device, equipment and storage medium
US9530006B2 (en) Method and system for performing a memory safety check of a program written in an unmanaged programming language
US10083030B1 (en) Asynchronous dependency resolution
CN103593485A (en) Method and device for achieving real-time operation on data base
US20210011768A1 (en) Thread associated memory allocation and memory architecture aware allocation
CN108509215B (en) System software replacing method and device, terminal equipment and storage medium
CN103517141A (en) Sectional type data upgrading method based on IP set top box
CN104731569A (en) Data processing method and relevant equipment
JP6052406B2 (en) Distributed processing system, distributed processing apparatus, distributed processing method, and distributed processing program
CN114398318B (en) File operation method of user space file system and user space file system
US20120011166A1 (en) Skip list generation
US20130297881A1 (en) Performing zero-copy sends in a networked file system with cryptographic signing
CN103647811A (en) A method and an apparatus for application's accessing backstage service
US7689971B2 (en) Method and apparatus for referencing thread local variables with stack address mapping
US11314443B2 (en) Method, device, and computer program product for managing image of container
US8630979B2 (en) Non-blocking input output based storage
US10120796B2 (en) Memory allocation for long-lived objects
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN116560878A (en) Memory sharing method and related device
JP5528054B2 (en) Method, program, and apparatus for improved direct memory access transfer efficiency
US20220261238A1 (en) Method and system for deploying third-party application to microcontroller by means of edge assistance
Taboada et al. Device level communication libraries for high‐performance computing in Java
US11797277B2 (en) Neural network model conversion method server, and storage medium
CN103902469A (en) Data prefetching method and system
CN107643892B (en) Interface processing method, device, storage medium and processor

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant