CN107103055B - Hourglass method for intensive program for memory updating - Google Patents
Hourglass method for intensive program for memory updating Download PDFInfo
- Publication number
- CN107103055B CN107103055B CN201710237896.9A CN201710237896A CN107103055B CN 107103055 B CN107103055 B CN 107103055B CN 201710237896 A CN201710237896 A CN 201710237896A CN 107103055 B CN107103055 B CN 107103055B
- Authority
- CN
- China
- Prior art keywords
- data
- memory
- checkpoint
- hourglass
- pointer
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Computer Security & Cryptography (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Debugging And Monitoring (AREA)
- Retry When Errors Occur (AREA)
Abstract
The invention discloses a Hourglass and Piggyback algorithm oriented to a memory update intensive program, the excellent performance of the Hourglass and Piggyback algorithm is derived from a pointer exchange technology between an updater thread and a dumper thread, and a large amount of data copying can be avoided. It periodically takes place the role swap of the updater and dumper threads, which can be periodically reused endlessly, swapping up and down roles once the upper part is empty. Less memory and substantially no jitter delay effects can be achieved. It is one of the lightweight checkpoint algorithms, Hourglass combines the two currently best algorithms, zig-zag and pingpong, to take advantage of the two advantageous pointer swapping and bit flags. The Piggyback algorithm improves performance by providing a full snapshot that can support real-time olap and oltp applications. The method has the advantages of smaller memory occupation, full snapshot overhead, smaller delay and more uniform delay.
Description
Technical Field
The invention relates to the technical field of backup recovery of a memory database, in particular to a Hourglass method oriented to a memory update intensive program, which belongs to a lightweight checkpoint algorithm.
Background
One large class of applications involves data intensive update operations, most of which seek transient response, high throughput, and highly available performance. For example, at the end of the 20 th century, the performance of the back-office Electronic Trading System (ETS) of large stock exchanges, such as the shanghai stock exchange, has reached 100000 transactions per second and can guarantee zero loss of transactions at the time of disaster recovery. There are also more examples, such as large online games (MMOS) and e-commerce systems that are sufficient to support black Friday performance scenarios. These data update intensive programs are typically implemented using memory computing techniques. One strategy is to employ an in-memory database, which can provide faster and predictable performance advantages over disk databases (since data is directly accessible in memory).
High availability of in-memory databases relies on a more sophisticated recovery subsystem. Since conventional recovery mechanisms for disk databases (DRDBs) are not specifically directed to update-intensive programs, overall system performance may be limited by the recovery system if the previous recovery system is employed directly without any modification. Based on this, we believe that the recovery system of the in-memory database, especially the transaction log and checkpoint subsystems, needs to be redesigned.
For the transaction log, due to the high throughput performance of the memory database, more logs are generated in a unit time, so that the cost of IO is increased, and in order to prevent the transaction log from becoming the bottleneck of system performance, many relevant optimization methods are proposed, such as accelerating the IO performance (by means of novel hardware), reducing the IO frequency (transaction group commit strategy), or reducing the IO size (log compression, log rewriting). This part of the study is currently relatively thorough.
For the checkpoint technique, we can achieve the goal of reducing the log by periodically generating snapshots and truncating the log. Clearly, the more frequent and faster checkpoints are generated the better, with the benefit that the amount of logs generated between checkpoints is relatively smaller. However, the overhead of performing checkpoints so frequently is not negligible. First, the increased latency due to the execution of checkpoints can have a large impact on system throughput and response time. Second, unlike disk checkpoints, memory checkpoints require that a fully consistent copy of data be maintained in memory before the data is flushed to disk. Improper processing can result in significant jitter in the delay and even system stall.
Consistency checkpoint algorithm under serial transaction model. The difficulty in requiring a checkpoint algorithm to backup consistent data without excessive throughput loss is how to generate consistent memory snapshots in memory as quickly as possible and then asynchronously backup the data to disk. The most straightforward algorithm isSnapshot (ns), which creates a copy of the data by locking all the data. However, NS utilizes a coarse-grained lock operation, which results in a very noticeable latency jitter. Another algorithm, Copy On Update (COU), takes the form of a shadow Copy, at the time of the first data write. The snapshot generation phase does not cause an oversized card shell of the system, but requires memory copy operation and fine-grained lock operation for each data access. Both the NS and the COU need to maintain a consistent state with lock operations. In order to ensure that the system has low delay and no jamming phenomenon, the algorithm design of lock free is significant.
To our knowledge, only a few studies have involved the consistency checkpoint algorithm for lock free, and the typical work is that Tuan cao proposed two checkpoint algorithms for wait free, Zigzag and Pingpong. The main idea is to avoid the use of locks by using extra memory and bit arrays and to eliminate the delay jitter. Unfortunately, Zigzag still has severe jitter when the amount of data is large. The Pingpong algorithm requires 3 to 4 times the memory footprint and relies on a redundant write. Although large capacity high speed physical memory has been abundant, the use of memory as little as possible is reasonable from both a price and energy perspective, especially for update-intensive programs. Therefore, it is necessary to design a lightweight lock-free memory checkpoint algorithm by comprehensively considering memory overhead and performance (low latency, uniform latency distribution, fast recovery).
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a Hourglass and Piggyback algorithm for intensive memory update programs, which belong to a lightweight check point algorithm. Can solve the defects of the prior art and has better high availability.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a Hourglass algorithm for a memory update intensive program, comprising the steps of:
s1, assuming that the update-intensive program will periodically reach a consistent state, describing the characteristic of the transaction that periodically reaches the consistent state by the concept of tick 1/T, where T is the duration of tick; one tick represents the interval between the time points at which the dataset reaches the coherency state twice;
s2, at time t, D is assumed to be the state of data DtIndicating that D is a data set in the memory; one checkpoint C being responsible for maintenance DtA compact data snapshot to the disk device, but guaranteed to be at t + tcBefore the moment of time, where tcIs the execution cycle of the checkpoint;
s3, abstracting the data D into a continuous memory space, and organizing the data D according to the form of a memory page; any additional memory area for performing checkpointingIs expressed in terms of form;
s4, the recovery system of the simulated IMDB is two concurrent threads of an Updater thread and a Dumper thread, D andaccessed by two threads of different algorithms;
s5, dividing the periodic check into a preparation stage and a dump stage; dtThe actual generation time of the checkpoint is at the end time of each dump phase, tpAnd tdRespectively representing the duration of the preamble and dump phases; total time overhead t to perform checkpointso=tp+tdTime t of check point period is not exceededc=tp+k(k∈N+) That is to say to≤tc;
S6, using pingpong pointer exchange technique and zigzag bit check technique to obtain a uniform access delay and ensure only two memories, data sets D and shadow copy numbersAccording to Each data set is accompanied by a bit arrayAnd
the value of (D) represents D [ i]Whether it is updated in the current checkpoint period and whether it needs to be backed up in the next checkpoint period;the value of (D) represents D [ i]Whether it needs to be persisted within the current checkpoint period;
s7, in a checking period, for updated data set (D or) Indicated by the "pU" pointer, and the "pD" pointer, which is used for backup, is used for another data set;
s8, the pointer exchange occurs in the starting period of each check point; to ensure that the update thread does not read dirty data, additional flag bit data is providedFor indicating which data is used to read the most recent dataI.e. from D [ i ]]Read data, otherwise fromAnd reading the data.
As an improvement to the above solution, the Updater thread represents an update-intensive program, and the Dumper thread is responsible for periodic execution checkpoints.
The invention also provides a memory update intensive program oriented Piggyback algorithm, which comprises the following steps:
s1, pointing the pointers pU and pD to D and pD respectivelyThe dump thread copies the data pointed by the persistent pD in batch, and the Piggyback maintains an array of one bit and two bits
There are three states, {0, 1, 2}, which represent from which data we need to read the latest data;updater read data page i is a line from any one data set becauseWhen D is presentb[i]1, updater from D [ i]The data page i is read. When D is presentb[i]2, updater fromReading a data page;
pU and pD point to D and pD, respectivelyInitialized bits are all 0 s, and in the first checkpoint cycle, assume that the Updater thread updated numbersAccording to page D [0],D[2]And D [3 ]]The corresponding flag bit is set to 1;
s2, starting at the second check point, exchanging the pointers pU and pD, and backing up the data of D pointed by the current pD in a full-scale mode; at the same time, the user can select the desired position,receiving update operation of updater; around the second checkpointPeriod of timeAt the end of the time, the data in D is the current latest state,
s3, define additional Dumper: : writetonline () function. And the data of the corresponding position in the pU is covered by the latest data in the latest state of the pD.
Compared with the prior art, the invention has the advantages and positive effects that:
the Hourglass and Piggyback algorithms for the memory update-intensive programs of the present invention derive their excellent performance from pointer swapping techniques between the updater and dumper threads, which can avoid large data copies. It periodically takes the role of the updater and dumper threads to swap, as if it were an hourglass, and can be periodically reused endlessly, swapping up and down roles once the upper part is empty. Less memory and substantially no jitter delay effects can be achieved.
Both of the above algorithms belong to one of the lightweight checkpoint algorithms, and Hourglass combines the two best algorithms at present, namely zigzag and pingpong, thereby utilizing the two advantageous pointer exchange and bit flag. The Piggyback algorithm improves performance by providing a full snapshot that can support real-time olap and oltp applications. The method has the advantages of smaller memory occupation, full snapshot overhead, smaller delay and more uniform delay.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived from the embodiments of the present invention by a person skilled in the art without any creative effort, should be included in the protection scope of the present invention.
The Hourglass algorithm facing the intensive program with memory updating comprises the following steps:
s1, dataset D and shadow copy dataEach data set is accompanied by a bit arrayAndthe value of (D) represents D [ i]Whether it is updated in the current checkpoint period and whether it needs to be backed up in the next checkpoint period;the value of (D) represents D [ i]Whether it needs to be persisted within the current checkpoint period;
s2, in the first checking period, the data set D for updating is indicated by "pU" pointer, and the other data set for backup is indicated by "pD" pointer. Meanwhile, when update updates data, the update needs to be setThe data of (1). Dumper thread direct backupThe data in (c).
S3, the pointer exchange occurs in the starting period of the next check point; to ensure that the update thread does not read dirty data, additional flag bit data is providedFor indicating which data is used to read the most recent dataI.e. from D [ i ]]Read data, otherwise fromAnd reading the data.
As an improvement on the above technical solution, the present invention further provides a Piggyback algorithm for a memory update intensive program, including the following steps:
s1, pointing the pointers pU and pD to D and pD respectivelyThe dump thread copies the data pointed by the persistent pD in batch, and the Piggyback maintains an array of one bit and two bits
There are three states, {0, 1, 2}, which represent from which data we need to read the latest data;updater read data page i is a line from any one data set becauseWhen D is presentb[i]1, updater from D [ i]The data page i is read. When D is presentb[i]2, updater fromReading a data page;
pU and pD point to D and pD, respectivelyThe initialized bits are all 0 s, and in the first checkpoint cycle, assume that the Updater thread updated data page D [0 ]],D[2]And D [3 ]]The corresponding flag bit is set to 1;
s2, starting at the second check point, exchanging the pointers pU and pD, and backing up the data of D pointed by the current pD in a full-scale mode; at the same time, the user can select the desired position,receiving update operation of updater; around the second checkpointPeriod of timeAt the end time, the data in D are all in the current latest state;
s3, define additional Dumper: : a writetonline () function; for correcting the data in the pU, the latest data state is guaranteed at the beginning of the checkpoint.
Compared with the prior art, the invention has the advantages and positive effects that:
the Hourglass and Piggyback algorithms for the memory update-intensive programs of the present invention derive their excellent performance from pointer swapping techniques between the updater and dumper threads, which can avoid large data copies. It periodically takes the role of the updater and dumper threads to swap, as if it were an hourglass, and can be periodically reused endlessly, swapping up and down roles once the upper part is empty. Less memory and substantially no jitter delay effects can be achieved.
Both of the above algorithms belong to one of the lightweight checkpoint algorithms, and Hourglass combines the two best algorithms at present, zigzag and Ping-Pong, thereby utilizing the two advantageous pointer swapping and bit flag. The Piggyback algorithm improves performance by providing a full snapshot that can support real-time olap and oltp applications. The method has the advantages of smaller memory occupation, full snapshot overhead, smaller delay and more uniform delay.
The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are given by way of illustration of the principles of the present invention, and that various changes and modifications may be made without departing from the spirit and scope of the invention as defined by the appended claims. The scope of the invention is defined by the appended claims and equivalents thereof.
Claims (1)
1. A Hourglass method for intensive memory update programs, which is characterized in that: the method comprises the following steps:
s1, assuming that the update-intensive program will periodically reach a consistent state, describing the characteristic of the transaction that periodically reaches the consistent state by the concept of tick 1/T, where T is the duration of tick; one tick represents the interval between the time points at which the dataset reaches the coherency state twice;
s2, at time t, D is assumed to be the state of data DtIndicating that D is a data set in the memory; one checkpoint C being responsible for maintenance DtA compact data snapshot to the disk device, but guaranteed to be at t + tcBefore the moment of time, where tcIs the execution cycle of the checkpoint;
s3, abstracting the data D into a continuous memory space, and organizing the data D according to the form of a memory page; d shadow copy data, withIs expressed in terms of form;
s4, the recovery system of the simulated IMDB is two concurrent threads of an Updater thread and a Dumper thread, D andaccessed by two threads of different algorithms;
s5, dividing the periodic check into a preparation stage and a dump stage; dtThe actual generation time of the checkpoint is at the end time of each dump phase, tpAnd tdRespectively representing the duration of the preamble and dump phases; total time overhead t to perform checkpointso=tp+tdTime t of check point period is not exceededo=tp+ k being that to≤tc;
S6, using the pointer exchange technique of pingpong and the bit check technique of zigzagObtaining a uniform access delay but still ensuring that only two copies of memory, dataset D and shadow copy data are neededEach data set is accompanied by a bit arrayAnd
the value of (D) represents D [ i]Whether it is updated in the current checkpoint period and whether it needs to be backed up in the next checkpoint period;the value of (D) represents D [ i]Whether it needs to be persisted within the current checkpoint period;
s7, in a checking period, the data set used for updating is indicated by a 'pU' pointer, and the other data set used for backup is indicated by a 'pD' pointer;
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710237896.9A CN107103055B (en) | 2017-03-29 | 2017-03-29 | Hourglass method for intensive program for memory updating |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710237896.9A CN107103055B (en) | 2017-03-29 | 2017-03-29 | Hourglass method for intensive program for memory updating |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107103055A CN107103055A (en) | 2017-08-29 |
CN107103055B true CN107103055B (en) | 2020-05-12 |
Family
ID=59676053
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710237896.9A Active CN107103055B (en) | 2017-03-29 | 2017-03-29 | Hourglass method for intensive program for memory updating |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107103055B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1787532A (en) * | 2004-12-07 | 2006-06-14 | Nvlsoft有限公司 | System and method for providing 3D image production service |
CN101395602A (en) * | 2005-12-29 | 2009-03-25 | 亚马逊科技公司 | Method and apparatus for a distributed file storage and indexing service |
CN103051474A (en) * | 2012-12-19 | 2013-04-17 | 浪潮电子信息产业股份有限公司 | Method of large scale cluster network cabling |
-
2017
- 2017-03-29 CN CN201710237896.9A patent/CN107103055B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1787532A (en) * | 2004-12-07 | 2006-06-14 | Nvlsoft有限公司 | System and method for providing 3D image production service |
CN101395602A (en) * | 2005-12-29 | 2009-03-25 | 亚马逊科技公司 | Method and apparatus for a distributed file storage and indexing service |
CN103051474A (en) * | 2012-12-19 | 2013-04-17 | 浪潮电子信息产业股份有限公司 | Method of large scale cluster network cabling |
Non-Patent Citations (2)
Title |
---|
基于SSC-tree流聚类的入侵检测算法;程春玲等;《系统工程与电子技术》;20120315;第625-630页 * |
基于动态链接库进行BLOB数据交换的方法;袁梅宇;《微计算机应用》;20000815;第242-244页 * |
Also Published As
Publication number | Publication date |
---|---|
CN107103055A (en) | 2017-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Liu et al. | LB+ Trees: Optimizing persistent index performance on 3DXPoint memory | |
Agawal et al. | Memory-reference characteristics of multiprocessor applications under MACH | |
Levandoski et al. | High performance transactions in deuteronomy | |
Loesing et al. | On the design and scalability of distributed shared-data databases | |
US5574874A (en) | Method for implementing a checkpoint between pairs of memory locations using two indicators to indicate the status of each associated pair of memory locations | |
Graefe | A survey of B-tree logging and recovery techniques | |
US7853571B2 (en) | Techniques for file system recovery | |
LaMarca | A performance evaluation of lock-free synchronization protocols | |
CN110515705B (en) | Extensible persistent transactional memory and working method thereof | |
Ni et al. | Reducing {NVM} writes with optimized shadow paging | |
Eich | Main memory database research directions | |
Tam et al. | Fast recovery in distributed shared virtual memory systems | |
CN112214171B (en) | SQLite database-oriented non-volatile memory buffer area design method | |
CN107103055B (en) | Hourglass method for intensive program for memory updating | |
Frank et al. | Synapse tightly coupled multiprocessors: a new approach to solve old problems | |
Kumar et al. | Performance measurement of main memory database recovery algorithms based on update-in-place and shadow approaches | |
CN115422182A (en) | Read-write performance optimization method based on persistent memory B + tree index | |
Wei et al. | CCHL: compression-consolidation hardware logging for efficient failure-atomic persistent memory updates | |
Damani et al. | Optimistic recovery in multi-threaded distributed systems | |
Shu et al. | Shadowing-based crash recovery schemes for real-time database systems | |
Wang et al. | Dodo: A scalable optimistic deterministic concurrency control protocol | |
Lee et al. | Checkpointing schemes for fast restart in main memory database systems | |
Nuth et al. | Named state and efficient context switching | |
Woo et al. | An effective recovery under fuzzy checkpointing in main memory databases | |
Sul et al. | Fast journaling made simple with nvm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |