CN109558425A - A kind of backup method and device of caching - Google Patents
A kind of backup method and device of caching Download PDFInfo
- Publication number
- CN109558425A CN109558425A CN201811377489.9A CN201811377489A CN109558425A CN 109558425 A CN109558425 A CN 109558425A CN 201811377489 A CN201811377489 A CN 201811377489A CN 109558425 A CN109558425 A CN 109558425A
- Authority
- CN
- China
- Prior art keywords
- data
- local cache
- corresponding data
- cache
- local
- 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.)
- Withdrawn
Links
Classifications
-
- 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/1458—Management of the backup or restore process
- G06F11/1464—Management of the backup or restore process for networked environments
Abstract
The present invention provides a kind of backup method of caching, the method is applied to distributed data cache system, which comprises whether there is corresponding data according to data query command detection local cache;If the corresponding data is not present, the corresponding data is obtained from local data base and is put into the local cache;First update message is sent to other nodes of the distributed data cache system;The more new content of the local cache is had recorded in first update message.Using method provided by the invention, the update message of local cache can be sent to other nodes of distributed data cache system, to realize the synchronized update cached between each node and backup.The present invention also provides a kind of back-up devices of caching.
Description
Technical field
The present invention relates to computer data processing technology field more particularly to the backup methods and device of a kind of caching.
Background technique
With the extension of the scale of modern enterprise Internet application and the complication of affairs, the server of enterprise is used
Data buffering system handle a large amount of concurrent requests ability it is more and more important.In the framework of entire distributed data cache system
In, the access speed of data Layer can become the bottleneck that whole system handles a large amount of concurrent requests.It is existing general using data buffer storage
Technology will be cached in local device the query result of database, when accessing same data next time, can directly postpone
Acquisition is deposited without inquiring from database again, the access load capacity of database layer can be effectively reduced in this way.
But being continuously increased due to the network user, the performance of a server are not enough to handle simultaneously a large amount of concurrent
Request, such case are required using server cluster, and need to use data buffering system under distributed type assemblies environment,
And existing data buffering system be suitable for single node, be often difficult to realize when applied to distributed type assemblies environment each node it
Between data synchronizing redundant backup, therefore also can not some node data lose when realize corresponding node data restore.
Summary of the invention
In order to solve above-mentioned technical problem of the existing technology, this application provides a kind of backup method of caching and dresses
Set, the update message of local cache can be sent to other nodes of distributed data cache system, with realize each node it
Between the synchronized update that caches and backup.
This application provides a kind of backup method of caching, the method is applied to distributed data cache system, described
Method includes:
It whether there is corresponding data according to data query command detection local cache;
If the corresponding data is not present, the corresponding data is obtained from local data base and is put into the local and is delayed
It deposits;
First update message is sent to other nodes of the distributed data cache system;First update message
In have recorded the more new content of the local cache.
Optionally, the method also includes:
If there are the corresponding datas in the local cache, the corresponding number is directly acquired from the local cache
According to.
Optionally, the method also includes:
When the corresponding data is put into the local cache, mark life cycle is added in the corresponding data;Institute
State life cycle mark for identify the corresponding data in the local cache there are the times, with the determination corresponding number
According to whether expired.
Optionally, the method also includes:
It detects in the local cache with the presence or absence of stale data, and if it exists, the stale data that will test is from institute
It states in local cache and deletes, and the second update message is sent to other nodes of the distributed data cache system;It is described
Second update message is for making stale data described in other knot removals of the distributed data cache system.
Optionally, when directly acquiring the corresponding objects from the local cache, the existence of the corresponding objects is updated
Period indication.
The embodiment of the present application also provides a kind of back-up devices of caching, which is characterized in that described device is applied to distribution
Formula data buffering system, described device include: detection module, obtain module and communication module;
The detection module, for whether there is corresponding data according to data query command detection local cache;
The acquisition module obtains the corresponding data if being not present for the corresponding data from local data base
And it is put into the local cache;
The communication module, for the first update message to be sent to other sections of the distributed data cache system
Point;The more new content of the local cache is had recorded in first update message.
Optionally, the acquisition module is also used to:
If there are the corresponding datas in the local cache, the corresponding number is directly acquired from the local cache
According to.
Optionally, described device further include: mark module;
The mark module when for the corresponding data to be put into the local cache, adds in the corresponding data
Add identify life cycle;Mark life cycle is for identifying presence week of the corresponding data in the local cache
It is phase, whether expired with the determination corresponding data.
Optionally, described device further include: cycle module;
The cycle module, for detecting in the local cache with the presence or absence of stale data, and if it exists, will test
The stale data is deleted from the local cache, and the second update message is sent to the distributed data cache system
Other nodes;Second update message is expired described in other knot removals of the distributed data cache system for making
Data.
Optionally, when the acquisition module directly acquires the corresponding objects from the local cache, the period mould
Block is also used to update mark life cycle of the corresponding objects.
The present invention provides a kind of backup method of caching, the method is applied to distributed data cache system: first
It whether there is corresponding data according to data query command detection local cache;If the corresponding data is not present, from local data
The corresponding data is obtained in library and is put into the local cache, and the corresponding data can directly be accessed by local cache;
First update message is sent to other nodes of the distributed data cache system, is had recorded in first update message
The more new content of the local cache, so that other nodes complete cache synchronization according to first update message.It utilizes
Method provided by the invention can send the update message of local cache to other nodes of distributed data cache system,
To realize the synchronized update cached between each node and backup.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The some embodiments recorded in application, for those of ordinary skill in the art, without creative efforts,
It can also be obtained according to these attached drawings other attached drawings.
Fig. 1 is the flow chart of the backup method for the caching that the embodiment of the present application one provides;
Fig. 2 is the schematic diagram of the backup method for the caching that the embodiment of the present application two provides;
Fig. 3 is a kind of schematic diagram of the back-up device for caching that the embodiment of the present application three provides;
Fig. 4 is the schematic diagram of the back-up device for another caching that the embodiment of the present application four provides.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only this
Invention a part of the embodiment, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art exist
Every other embodiment obtained under the premise of creative work is not made, shall fall within the protection scope of the present invention.
Embodiment one:
The embodiment of the present application one provides a kind of backup method of caching, is specifically described with reference to the accompanying drawing.
Referring to Fig. 1, which is a kind of flow chart of the backup method for caching that the embodiment of the present application one provides.
The embodiment of the present application the method is applied to distributed data cache system, and the backup of caching is exactly to make each node
Between there are consistent cache contents, each node has a data cached full backup.
The embodiment of the present application the described method comprises the following steps:
S101: corresponding data whether there is according to data query command detection local cache.
After local node receives data query instruction, it is according in the infomation detection local cache of data query instruction
It is no to have existed corresponding data.If the corresponding data is not present in local cache, S102 is executed;Otherwise, S104 is executed.
S102: the corresponding data is obtained from local data base and is put into the local cache.
It should be noted that since the data volume in local data base is generally large, and the capacity of local cache is limited, such as
Fruit is all permanently stored in all in local cache from the data inquired in local data base, will lead to the number in local cache
Become very huge because gradually accumulating according to amount, this will affect the reading performance of local cache, simultaneously because the visit of some data
It asks that frequency is extremely low or even certain data are not just using after accessing for the first time, therefore the data of all access is all permanently put into
It also will cause the waste of the capacity of local cache in local cache.
To solve the above-mentioned problems, the real-time example of the application the method also includes:
When the corresponding data is put into the local cache, mark life cycle is added in the corresponding data;Institute
State life cycle mark for identify the corresponding data in the local cache there are the times, with the determination corresponding number
According to whether expired.
By the above method, each data for being put into local cache can have a corresponding life cycle, the life
The time span of cycle of deposit can be distributed unitedly when the corresponding data is put into local cache or be carried out according to actual needs
Individually distribution, the application are not especially limited this.
In addition, as start time at the time of the life cycle can be put into local cache using the corresponding data.
By the life cycles of the data being periodically detected in local cache mark with detect in the local cache whether
There are stale data, the stale data that will test is deleted from the local cache, and frequency of use is too low even
Data again not visited are deleted from local cache after maiden visit, reduce the data bulk of local cache storage,
Simultaneously because the data bulk that local cache is placed is reduced, the reading performance of local cache can also be mentioned to a certain extent
It rises.
S103: the first update message is sent to other nodes of the distributed data cache system.
The more new content of the local cache is had recorded in first update message.It may include in the update message
The data query instruction, other nodes are according to data query instruction execution operation identical with local node;It is described more
New information can also be directly comprising the corresponding data updated in local cache, and other nodes directly receive first data and will
It is saved in the buffer;The update message can also be operational order, will be right in database for controlling other node execution
Answer the operation of data storage in the buffer.The update message can also be the other local cache more new contents of capable of recording
Form, the application are not especially limited this.
It should be noted that mark life cycle may be embodied in first update message, more by first
New information is sent to other nodes, can also only be retained in local node, and the application is not especially limited this.
In addition, if detecting in the local cache stale data that will test there are stale data from described
After deleting in local cache, local node can also send second and update to other nodes of the distributed data cache system to disappear
Breath, second update message is for making stale data described in other knot removals of the distributed data cache system.
S104: the corresponding data is directly acquired from the local cache.
If detecting in local cache there are the corresponding data, show the corresponding data be accessed before this and
All nodes are had backed up, directly obtain the corresponding data from the local cache at this time, are not needed to other nodes
Send the first update message.
But it should be noted that mark life cycle for needing to update the corresponding data at this time, i.e., by the corresponding number
According to the acquisition moment as life cycle at the beginning of restart calculate life cycle, it is too early to avoid the corresponding data
It is deleted from local cache.
The embodiment of the present application provides a kind of backup method of caching, and the method is applied to distributed data cache system
System: corresponding data whether there is according to data query command detection local cache first;If the corresponding data is not present, from this
The corresponding data is obtained in ground database and is put into the local cache, and the correspondence can directly be accessed by local cache
Data;First update message is sent to other nodes of the distributed data cache system, in first update message
The more new content of the local cache is had recorded, so that other nodes complete caching together according to first update message
Step.Using the backup method of caching provided by the embodiments of the present application, distribution can be sent by the update message of local cache
Other nodes of data buffering system, to realize the synchronized update cached between each node and backup.
Embodiment two:
Backup method based on the caching that embodiment one provides, the reality of the method is illustrated below with reference to concrete application scene
Existing process.
Referring to fig. 2, which is the schematic diagram of the backup method for the caching that the embodiment of the present application two provides.
The present invention is not specifically limited the number of nodes in distributed data cache system, for convenience of explanation, this hair
Data buffering system for three nodes comprising being illustrated in a distributed manner for bright embodiment, wherein node 1 is selected as local node.
The method specifically includes the following steps:
S201: detection local cache whether there is corresponding data.
Node 1 receives data query instruction and according to the data query command detection local cache with the presence or absence of correspondence
Data, and if it exists, execute S205;Otherwise, S202 is executed.
S202: corresponding data is obtained from local data base.
According to data query instruction, inquiry obtains corresponding data in the local data base of node 1.
S203: mark life cycle is added in corresponding data, is put into the local cache.
The life cycle mark for identify the corresponding data in the local cache there are the times, with determination
Whether the corresponding data is expired, as life cycle at the time of the corresponding data being put into 1 local cache of node
At the beginning of.
S204: the first update message is sent to other nodes.
The more new content of the local cache is had recorded in first update message.Node 1 is updated described first to disappear
Breath is sent to node 2 and node 3, so that node 2 and node 3 are according to the number in synchronous its local cache of first update message
According to.
S205: corresponding data is directly acquired from local cache.
S206: mark life cycle of the corresponding objects is updated.
Using the acquisition moment of the corresponding data as life cycle at the beginning of restart calculate life cycle, with
The corresponding data is avoided to delete too early from the local cache of node 1.
S207: it whether there is stale data in detection local cache, the stale data that will test is deleted from local cache
It removes, and the second update message is sent to other nodes.
Node 1 is identified by the life cycle for the data being periodically detected in local cache to detect in the local cache
With the presence or absence of stale data, the stale data that will test is deleted from the local cache, and frequency of use is too low
Data even again not visited after maiden visit are deleted from local cache, while sending second to node 2 and node 3
Update message, second update message realize synchronized update for making node 2 and node 3 delete the stale data.
Embodiment three:
The backup method of the caching provided based on the above embodiment, the embodiment of the present application also provides a kind of backups of caching
Device is specifically described with reference to the accompanying drawing.
Referring to Fig. 3, which is a kind of schematic diagram of the back-up device for caching that the embodiment of the present application three provides.
The embodiment of the present application described device is applied to distributed data cache system, and described device includes: detection module
301, module 302 and communication module 303 are obtained.
The detection module 301, for whether there is corresponding data according to data query command detection local cache.
The acquisition module 302 obtains the corresponding number if being not present for the corresponding data from local data base
According to and be put into the local cache.
The acquisition module 302, it is slow from the local if being also used in the local cache there are the corresponding data
The corresponding data is directly acquired in depositing.
The communication module 303, for the first update message to be sent to the other of the distributed data cache system
Node;The more new content of the local cache is had recorded in first update message.
The embodiment of the present application provides a kind of back-up device of caching, and described device is by detection module according to data query
Command detection local cache whether there is corresponding data;If the corresponding data is not present, module is obtained from local data base
It obtains the corresponding data and is put into the local cache, the corresponding data can directly be accessed by local cache;Communication
First update message is sent to other nodes of the distributed data cache system by module, is remembered in first update message
The more new content of the local cache is recorded, so that other nodes complete cache synchronization according to first update message.
Using device provided by the embodiments of the present application, the synchronized update cached between each node and backup can be realized.
Example IV:
The embodiment of the present application also provides the back-up devices of another kind caching, are specifically described with reference to the accompanying drawing.
Referring to fig. 4, which is the schematic diagram of the back-up device for another caching that the embodiment of the present application four provides.
The embodiment of the present application described device increases on the basis of three described device of embodiment: mark module 401 and week
Phase module 402.
The mark module 401, when for the corresponding data to be put into the local cache, in the corresponding data
Add mark life cycle;Mark life cycle is for identifying presence week of the corresponding data in the local cache
It is phase, whether expired with the determination corresponding data.
The cycle module 402, for detecting in the local cache with the presence or absence of stale data, will test described in
Stale data is deleted from the local cache, and the second update message is sent to its of the distributed data cache system
Its node;Second update message crosses issue for making described in other knot removals of the distributed data cache system
According to.
When the acquisition module 302 directly acquires the corresponding objects from the local cache, the cycle module 402
It is also used to update mark life cycle of the corresponding objects.
Using device described in the embodiment of the present application, the same of the synchronized update and backup cached between each node is being realized
When, it can be too low by frequency of use or even again not visited data are deleted from local cache after maiden visit, it reduces
The data bulk of local cache storage, simultaneously because the data bulk that local cache is placed is reduced, the reading of local cache
It can also can be promoted to a certain extent.
It in above-described embodiment, all emphasizes particularly on different fields for the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
It should be appreciated that in this application, " at least one (item) " refers to one or more, and " multiple " refer to two or two
More than a."and/or" indicates may exist three kinds of relationships, for example, " A and/or B " for describing the incidence relation of affiliated partner
It can indicate: only exist A, only exist B and exist simultaneously tri- kinds of situations of A and B, wherein A, B can be odd number or plural number.Word
Symbol "/" typicallys represent the relationship that forward-backward correlation object is a kind of "or"." at least one of following (a) " or its similar expression, refers to
Any combination in these, any combination including individual event (a) or complex item (a).At least one of for example, in a, b or c
(a) can indicate: a, b, c, " a and b ", " a and c ", " b and c ", or " a and b and c ", and wherein a, b, c can be individually, can also
To be multiple.
The above described is only a preferred embodiment of the present invention, being not intended to limit the present invention in any form.Though
So the present invention has been disclosed as a preferred embodiment, and however, it is not intended to limit the invention.It is any to be familiar with those skilled in the art
Member, without departing from the scope of the technical proposal of the invention, all using the methods and technical content of the disclosure above to the present invention
Technical solution makes many possible changes and modifications or equivalent example modified to equivalent change.Therefore, it is all without departing from
The content of technical solution of the present invention, according to the technical essence of the invention any simple modification made to the above embodiment, equivalent
Variation and modification, all of which are still within the scope of protection of the technical scheme of the invention.
Claims (10)
1. a kind of backup method of caching, which is characterized in that the method is applied to distributed data cache system, the method
Include:
It whether there is corresponding data according to data query command detection local cache;
If the corresponding data is not present, the corresponding data is obtained from local data base and is put into the local cache;
First update message is sent to other nodes of the distributed data cache system;Remember in first update message
The more new content of the local cache is recorded.
2. the backup method of caching according to claim 1, which is characterized in that the method also includes:
If there are the corresponding datas in the local cache, the corresponding data is directly acquired from the local cache.
3. the backup method of caching according to claim 1, which is characterized in that the method also includes:
When the corresponding data is put into the local cache, mark life cycle is added in the corresponding data;The life
Cycle of deposit mark for identify the corresponding data in the local cache there are the times, be with the determination corresponding data
It is no expired.
4. the backup method of caching according to claim 3, which is characterized in that the method also includes:
It detects in the local cache with the presence or absence of stale data, and if it exists, the stale data that will test is from described
It is deleted in ground caching, and the second update message is sent to other nodes of the distributed data cache system;Described second
Update message is for making stale data described in other knot removals of the distributed data cache system.
5. the backup method of caching according to claim 4, which is characterized in that directly acquire institute from the local cache
When stating corresponding objects, mark life cycle of the corresponding objects is updated.
6. a kind of back-up device of caching, which is characterized in that described device is applied to distributed data cache system, described device
Include: detection module, obtain module and communication module;
The detection module, for whether there is corresponding data according to data query command detection local cache;
The acquisition module obtains the corresponding data and is put from local data base if being not present for the corresponding data
Enter the local cache;
The communication module, for the first update message to be sent to other nodes of the distributed data cache system;Institute
State the more new content that the local cache is had recorded in the first update message.
7. the back-up device of caching according to claim 6, which is characterized in that the acquisition module is also used to:
If there are the corresponding datas in the local cache, the corresponding data is directly acquired from the local cache.
8. the back-up device of caching according to claim 6, which is characterized in that described device further include: mark module;
The mark module when for the corresponding data to be put into the local cache, adds life in the corresponding data
Cycle of deposit mark;The life cycle mark for identify the corresponding data in the local cache there are the period, with
Determine whether the corresponding data is expired.
9. the back-up device of caching according to claim 8, which is characterized in that described device further include: cycle module;
The cycle module, for detecting in the local cache with the presence or absence of stale data, and if it exists, described in will test
Stale data is deleted from the local cache, and the second update message is sent to its of the distributed data cache system
Its node;Second update message crosses issue for making described in other knot removals of the distributed data cache system
According to.
10. the back-up device of caching according to claim 9, which is characterized in that the acquisition module is slow from the local
When directly acquiring the corresponding objects in depositing, the cycle module is also used to update mark life cycle of the corresponding objects.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811377489.9A CN109558425A (en) | 2018-11-19 | 2018-11-19 | A kind of backup method and device of caching |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811377489.9A CN109558425A (en) | 2018-11-19 | 2018-11-19 | A kind of backup method and device of caching |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109558425A true CN109558425A (en) | 2019-04-02 |
Family
ID=65866793
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811377489.9A Withdrawn CN109558425A (en) | 2018-11-19 | 2018-11-19 | A kind of backup method and device of caching |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109558425A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110457162A (en) * | 2019-06-20 | 2019-11-15 | 广州南方卫星导航仪器有限公司 | A kind of backup method of data, terminal device, storage medium |
CN111611090A (en) * | 2020-05-13 | 2020-09-01 | 浙江创邻科技有限公司 | Distributed message processing method and system |
-
2018
- 2018-11-19 CN CN201811377489.9A patent/CN109558425A/en not_active Withdrawn
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110457162A (en) * | 2019-06-20 | 2019-11-15 | 广州南方卫星导航仪器有限公司 | A kind of backup method of data, terminal device, storage medium |
CN110457162B (en) * | 2019-06-20 | 2024-01-09 | 广州南方卫星导航仪器有限公司 | Data backup method, terminal equipment and storage medium |
CN111611090A (en) * | 2020-05-13 | 2020-09-01 | 浙江创邻科技有限公司 | Distributed message processing method and system |
CN111611090B (en) * | 2020-05-13 | 2021-12-28 | 浙江创邻科技有限公司 | Distributed message processing method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210056074A1 (en) | File System Data Access Method and File System | |
EP3596619B1 (en) | Methods, devices and systems for maintaining consistency of metadata and data across data centers | |
US11507594B2 (en) | Bulk data distribution system | |
JP6416279B2 (en) | Scalable file storage service | |
CN109960686B (en) | Log processing method and device for database | |
US8250033B1 (en) | Replication of a data set using differential snapshots | |
JP5274772B2 (en) | System and method for maintaining temporal data in data storage | |
CN100410883C (en) | A method, apparatus and computer program for processing a queue of messages | |
CN104111804B (en) | A kind of distributed file system | |
US20170315882A1 (en) | Protected write-back cache transaction replication | |
JP2017510002A (en) | Atomic writing for multiple extent operations | |
CN104281506A (en) | Data maintenance method and system for file system | |
US20200364185A1 (en) | Method for data replication in a data analysis system | |
JP5686034B2 (en) | Cluster system, synchronization control method, server device, and synchronization control program | |
CN105183400B (en) | It is a kind of based on content addressed object storage method and system | |
US8095678B2 (en) | Data processing | |
CN103595797B (en) | Caching method for distributed storage system | |
CN101819577A (en) | Method, system and apparatus for maintaining file system client directory caches | |
EP2380090B1 (en) | Data integrity in a database environment through background synchronization | |
US20170091215A1 (en) | Write-back cache transaction replication to object-based storage | |
US20170091262A1 (en) | Object storage backed file system cache | |
US8423517B2 (en) | System and method for determining the age of objects in the presence of unreliable clocks | |
JP2007241486A (en) | Memory system | |
US8640136B2 (en) | Sharing objects between computer systems | |
CN110019340A (en) | Data storage/read method, apparatus and system |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20190402 |
|
WW01 | Invention patent application withdrawn after publication |