CN107948318B - Method and system for synchronizing cache among multiple nodes - Google Patents

Method and system for synchronizing cache among multiple nodes Download PDF

Info

Publication number
CN107948318B
CN107948318B CN201711451424.XA CN201711451424A CN107948318B CN 107948318 B CN107948318 B CN 107948318B CN 201711451424 A CN201711451424 A CN 201711451424A CN 107948318 B CN107948318 B CN 107948318B
Authority
CN
China
Prior art keywords
cache
synchronization
request instruction
synchronization server
server
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
Application number
CN201711451424.XA
Other languages
Chinese (zh)
Other versions
CN107948318A (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.)
Tianyi Shilian Technology Co ltd
Original Assignee
CENTURY DRAGON INFORMATION NETWORK 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 CENTURY DRAGON INFORMATION NETWORK CO LTD filed Critical CENTURY DRAGON INFORMATION NETWORK CO LTD
Priority to CN201711451424.XA priority Critical patent/CN107948318B/en
Publication of CN107948318A publication Critical patent/CN107948318A/en
Application granted granted Critical
Publication of CN107948318B publication Critical patent/CN107948318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Hardware Redundancy (AREA)
  • Multi Processors (AREA)

Abstract

The present invention relates to the field of data transmission technologies, and in particular, to a method and a system for synchronizing a cache among multiple nodes. The method for synchronizing the cache among the multiple nodes comprises the following steps: receiving a synchronous request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction; calling a corresponding interface according to the interface parameter of the synchronous request instruction; and sending the synchronization request instruction to each preset cache synchronization server through an interface, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction. According to the scheme, the synchronization request instruction is sent to the cache synchronization server of the cache node to be synchronized, and then the cache synchronization server performs cache synchronization operation according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, occurrence of synchronization request accumulation is reduced, and system response speed is improved.

Description

Method and system for synchronizing cache among multiple nodes
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a method and a system for synchronizing a cache among multiple nodes.
Background
With the increase of the user data scale, the architecture of the business system is continuously optimized, and many business systems need to use distributed cache services in business processes, such as a memcache cluster, a redis cluster and the like. Meanwhile, in order to deal with the situations of high system load or even unavailable use caused by emergency and sudden service increase, a whole set of service is selected to be deployed at a plurality of geographic positions including independent distributed cache clusters, and each set of independent service system is called as a node. When the service jockey of the main node cannot be used, the service jockey can be switched to a standby node, and if the service cache data of the standby node is inconsistent with the service cache data of the main node, the operation experience of a user in cross-node is inconsistent, and even the service jockey cannot be used. Therefore, the caches between the main node and the backup node must be completely consistent and kept synchronous to ensure the normal use of the user. However, in the conventional technology, cache synchronization occupies too many resources of a service system, which results in accumulation of cache synchronization requests, reduction of system response speed, and even possible downtime.
Disclosure of Invention
Based on this, it is necessary to provide a method and a system for synchronizing caches among multiple nodes, aiming at the problems of accumulation of synchronization requests and reduction of system response speed.
A cache synchronization method among multiple nodes comprises the following steps:
receiving a synchronous request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction;
calling a corresponding interface according to the interface parameter of the synchronous request instruction;
and sending the synchronization request instruction to each preset cache synchronization server through the interface, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
According to the method for cache synchronization among the multiple nodes, the synchronization request instruction is sent to the cache synchronization server of the cache node to be synchronized, and then the cache synchronization server performs cache synchronization operation according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, accumulation of synchronization requests is reduced, and the response speed of the system is improved.
In one embodiment, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
receiving a synchronization success prompt message returned by the cache synchronization server; the synchronization success prompt information is prompt information sent by the cache synchronization server after the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction;
and returning first cache success prompt information to the service system according to the synchronization success prompt information.
In one embodiment, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
if the cache synchronization server cannot receive the synchronization request instruction, storing the synchronization request instruction into a retry pool;
and sending the synchronization request instruction to the cache synchronization server according to a certain time period within a preset time threshold, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
In one embodiment, after the step of sending the synchronization request instruction to the cache synchronization server according to a certain time period within a preset time threshold, the method further includes the following steps:
and receiving a synchronization success prompt message returned by the cache synchronization server, and deleting the synchronization request instruction from the retry pool, wherein the synchronization success prompt message is a prompt message sent by the cache synchronization server after receiving the synchronization request instruction and executing a cache operation instruction in the synchronization request instruction.
A cache synchronization method among multiple nodes comprises the following steps:
receiving a synchronization request instruction sent by a cache synchronization server, wherein the synchronization request instruction comprises a cache operation instruction, cache data and a cache identifier;
positioning a cache service according to the cache identifier of the synchronization request instruction;
and updating the cache data to the cache service according to the cache operation instruction.
According to the method for cache synchronization among the multiple nodes, the synchronous request instruction is sent by the cache synchronization server side which receives the synchronous cache initiating node, and cache synchronization operation is carried out according to the synchronous request instruction, so that occupation of cache synchronization on service system resources is reduced, occurrence of synchronous request accumulation is reduced, and response speed of the system is improved.
In one embodiment, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
receiving second cache success prompt information returned by the cache service;
and sending a synchronization success prompt message to the cache synchronization server according to the second cache success prompt message.
A cache synchronization method among multiple nodes comprises the following steps:
a first cache synchronization server receives a synchronization request instruction of a service system; the synchronization request instruction comprises an interface parameter, a cache operation instruction, a cache value and a cache identifier, and the first cache synchronization server comprises a cache synchronization server of a synchronization cache initiating node;
the first cache synchronization server calls a corresponding interface according to the interface parameter of the synchronization request instruction, and sends the synchronization request instruction to a second cache synchronization server through the interface, wherein the second cache synchronization server comprises a cache synchronization server of a cache node to be synchronized;
the second cache synchronization server receives a synchronization request instruction sent by the first cache synchronization server, and locates cache service according to a cache identifier of the synchronization request instruction;
and the second cache synchronization server side updates the cache data into the cache service according to the cache operation instruction.
According to the method for cache synchronization among the multiple nodes, the cache synchronization server of the synchronization cache initiating node sends the synchronization request instruction, and after the cache synchronization server of the synchronization cache node receives the synchronization request instruction, cache synchronization operation is performed according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, accumulation of synchronization requests is reduced, and the response speed of the system is improved.
In one embodiment, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
the second cache synchronization server receives second cache success prompt information returned by the cache service, and sends synchronization success prompt information to the first cache synchronization server according to the second cache success prompt information;
and the first cache synchronization server receives the synchronization success prompt message and returns a first cache success prompt message to the service system according to the synchronization success prompt message.
A system for inter-node cache synchronization, comprising:
the first synchronous request instruction receiving module is used for receiving a synchronous request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction;
the interface calling module is used for calling a corresponding interface according to the interface parameter of the synchronous request instruction;
and the synchronous request instruction sending module is used for sending the synchronous request instruction to each preset cache synchronous server through the interface, wherein the cache synchronous server obtains the synchronous request instruction and executes a cache operation instruction in the synchronous request instruction.
According to the cache synchronization system among the multiple nodes, the synchronization request instruction is sent to the cache synchronization server of the cache node to be synchronized, and then the cache synchronization server performs cache synchronization operation according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, accumulation of synchronization requests is reduced, and the response speed of the system is improved.
A system for inter-node cache synchronization, comprising:
the second synchronization request instruction receiving module is used for receiving a synchronization request instruction sent by a cache synchronization server, wherein the synchronization request instruction comprises a cache operation instruction, cache data and a cache identifier;
the cache service positioning module is used for positioning cache service according to the cache identifier of the synchronization request instruction;
and the cache data updating module is used for updating the cache data into the cache service according to the cache operation instruction.
According to the cache synchronization system among the multiple nodes, the cache synchronization server side of the node which receives the synchronization cache sends the synchronization request instruction, and cache synchronization operation is carried out according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, accumulation of synchronization requests is reduced, and the response speed of the system is improved.
Drawings
FIG. 1 is a flow chart of a method for cache synchronization between multiple nodes according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for cache synchronization among multiple nodes according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for cache synchronization among multiple nodes according to another embodiment of the present invention;
FIG. 4 is a diagram illustrating an application environment of a method for cache synchronization between multiple nodes according to an embodiment of the present invention;
FIG. 5 is a block diagram illustrating a cache synchronization system among multiple nodes according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a structure of a cache synchronization system among multiple nodes according to another embodiment of the present invention;
FIG. 7 is a block diagram of a system for cache synchronization between multiple nodes according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a method for cache synchronization among multiple nodes in an embodiment of the present invention, where the embodiment takes a cache synchronization server side of a cache synchronization initiating node as an example for description, and the method for cache synchronization among multiple nodes includes the following steps:
step S110: receiving a synchronous request instruction of a service system; the synchronization request instruction comprises an interface parameter and a cache operation instruction.
In this step, the local cache synchronization server receives a synchronization request instruction sent by the service system, where the synchronization request instruction is triggered and sent when a certain service system in the local nodes performs an operation of caching data, where the local node is used as a cache synchronization initiating node, and the synchronization request instruction may record an interface parameter to be called and a synchronous cache operation instruction.
Step S120: and calling the corresponding interface according to the interface parameter of the synchronous request instruction.
In this step, the local cache synchronization server calls a corresponding interface according to the interface parameter of the synchronization request instruction.
Step S130: and sending the synchronization request instruction to each preset cache synchronization server through an interface, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
After the synchronization request instruction is sent to the cache synchronization server of the remote to-be-synchronized cache node through the interface, the cache synchronization server of the remote to-be-synchronized cache node obtains the synchronization request instruction, and performs synchronous caching according to the synchronization request instruction.
Optionally, a communication Protocol between the local cache synchronization server and the cache synchronization server of the remote node to be synchronized may use an HTTP (HyperText Transfer Protocol) Protocol, or may also use an interactive Protocol such as a TCP (Transmission Control Protocol) or a thread Protocol.
Furthermore, the selection of the remote cache node to be synchronized can be realized through the routing control among the nodes. Before synchronous caching, the remote nodes needing synchronous caching can be set by adjusting routing control among the nodes, so that the cache data of one node is synchronized into the cache of another appointed remote node, or the cache data synchronization value of one node is synchronized into the caches of a plurality of appointed remote nodes.
In the above embodiment, the synchronization request instruction is sent to the cache synchronization server of the node to be synchronized, and then the cache synchronization server performs cache synchronization operation according to the synchronization request instruction, so that occupation of cache synchronization on service system resources is reduced, occurrence of synchronization request accumulation is reduced, system response speed is improved, cache synchronization among multiple nodes is realized, cache service data among the multiple nodes is consistent, user imperceptibility of the service system when the node is switched can be ensured, situations that a large number of concurrent requests puncture a database to cause service opportunities due to cache data inconsistency when the node is switched by the service system are reduced, and stability of each service system in each node is ensured.
In one embodiment, the method for synchronizing the cache among the multiple nodes may further include the following steps:
receiving a synchronization success prompt message returned by the cache synchronization server; the cache synchronization server side sends a synchronization request instruction to a cache synchronization server side, wherein the synchronization success prompt information is prompt information sent by the cache synchronization server side after the cache synchronization server side obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction; and returning the first cache success prompt message to the service system according to the synchronization success prompt message.
And when the cache synchronization server of the remote node to be synchronized obtains the synchronization request instruction, performing synchronous caching according to the synchronization request instruction, returning the synchronization success prompt information to the local cache synchronization server after cache synchronization is realized, and returning the cache success prompt information to the service system by the local cache synchronization server according to the synchronization success prompt information.
Further, in the process of performing cache synchronization, when the network fluctuates or the network is abnormal, the cache synchronization server of the remote to-be-synchronized cache node cannot receive the synchronization request instruction, and cannot synchronize the cache data into the cache, and the local cache synchronization server can ensure the final consistency of the cache data through a retry mechanism. As an embodiment, the method for cache synchronization among multiple nodes may further include the following steps:
if the cache synchronization server cannot receive the synchronization request command, the synchronization request command is stored in a retry pool;
and sending the synchronization request instruction to a cache synchronization server according to a certain time period within a preset time threshold, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
The retry scheme can effectively avoid the accumulation of synchronous requests, reduce the occupation of system resources, improve the response speed and reduce the downtime.
Further, after the step of sending the synchronization request instruction to the cache synchronization server according to a certain time period within a preset time threshold, the method further comprises the following steps:
and receiving a synchronization success prompt message returned by the cache synchronization server, and deleting the synchronization request instruction from the retry pool, wherein the synchronization success prompt message is a prompt message sent by the cache synchronization server after receiving the synchronization request instruction and executing a cache operation instruction in the synchronization request instruction.
Specifically, the local cache synchronization server sends the synchronization request instruction in the retry pool to the cache synchronization server of the remote to-be-synchronized cache node, and deletes the synchronization request instruction in the retry pool after receiving the synchronization success prompt message returned by the cache synchronization server of the remote to-be-synchronized cache node, so that the storage space of the retry pool is saved, and the same synchronization request instruction is prevented from being repeatedly sent.
Referring to fig. 2, fig. 2 is a flowchart of a method for cache synchronization among multiple nodes in another embodiment of the present invention, which is described by taking a cache synchronization server side of a cache node to be synchronized as an example, and includes the following steps:
step S210: receiving a synchronization request instruction sent by a cache synchronization server, wherein the synchronization request instruction comprises a cache operation instruction, cache data and a cache identifier.
In this step, the cache synchronization server of the node to be synchronized receives a synchronization request instruction sent by the cache synchronization server of the node to be synchronized, where the synchronization request instruction is triggered and sent when a certain service system in the node to be synchronized performs a data caching operation, and the synchronization request instruction may record a synchronized cache operation instruction, cache data to be synchronized, and a cache identifier for locating to the cache service.
Step S220: and positioning the cache service according to the cache identification of the synchronization request instruction.
Step S230: and updating the cache data into the cache service according to the cache operation instruction.
The cache operation instruction may include a write instruction, a modify instruction, a delete instruction, and the like, and according to the cache operation instruction, writing the cache data into the cache service, deleting the cache data from the cache service, and modifying the data in the cache service may be implemented.
In this embodiment, after the cache synchronization server of the node to be synchronized receives the synchronization request instruction sent by the cache synchronization server of the node initiating the synchronization cache, the cache synchronization operation is performed according to the synchronization request instruction, so that the occupation of the cache synchronization on the service system resources is reduced, the occurrence of the synchronization request accumulation is reduced, and the system response speed is improved.
Further, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
receiving a second cache success prompt message returned by the cache service; and sending the synchronization success prompt information to the cache synchronization server according to the second cache success prompt information.
After the cache synchronization server of the cache node to be synchronized updates the cache data in the cache service, the cache service returns cache success prompt information to the cache synchronization server of the cache node to be synchronized, and the cache synchronization server of the cache node to be synchronized sends the synchronization success prompt information to the cache synchronization server of the cache synchronization initiating node according to the cache success prompt information.
Referring to fig. 3, fig. 3 is a flowchart of a cache synchronization method among multiple nodes in another embodiment of the present invention, which is described by taking an example of interaction between a cache synchronization server of a cache synchronization initiating node and a cache synchronization server of a cache node to be synchronized, and includes the following steps:
step S310: a first cache synchronization server receives a synchronization request instruction of a service system; the first cache synchronization server comprises a cache synchronization server of a synchronization cache initiating node;
step S320: the first cache synchronization server calls a corresponding interface according to the interface parameter of the synchronization request instruction, and sends the synchronization request instruction to a second cache synchronization server through the interface, wherein the second cache synchronization server comprises a cache synchronization server of a cache node to be synchronized;
step S330: the second cache synchronization server receives the synchronization request instruction sent by the first cache synchronization server, and locates the cache service according to the cache identifier of the synchronization request instruction;
step S340: and the second cache synchronization server side updates the cache data into the cache service according to the cache operation instruction.
In this embodiment, the cache synchronization server of the synchronization cache initiating node sends the synchronization request instruction, and after receiving the synchronization request instruction, the cache synchronization server of the synchronization cache node performs cache synchronization operation according to the synchronization request instruction, so as to reduce occupation of cache synchronization on service system resources, reduce occurrence of synchronization request accumulation, improve system response speed, and improve system response speed.
Specifically, the first cache synchronization server is a cache synchronization server of the cache synchronization initiating node, and the second cache synchronization server is a cache synchronization server of the cache node to be synchronized. The cache data of a certain service system in a node is operated, the service system sends a synchronization request instruction to a local cache synchronization server, the node is used as a cache synchronization initiating node, and the local cache synchronization server of the node is used as a first cache synchronization server. After receiving the synchronization request instruction, the first cache synchronization server calls a corresponding interface according to the interface parameter of the synchronization request instruction, and simultaneously sends the synchronization request instruction to a remote second cache synchronization server through the interface; after the remote second cache synchronization server obtains the synchronization request instruction, the cache service to the node is positioned according to the cache identification of the synchronization request instruction, cache data in the cache service is updated according to cache operation instructions, such as a write-in instruction, a modification instruction, a deletion instruction and the like, cache synchronization among multiple nodes is realized, cache service data among the multiple nodes are consistent, a user can be ensured not to be aware when the service system switches the nodes, the situations that a large number of concurrent requests break down a database to cause server computers and the like due to cache data inconsistency of the service system when the nodes are switched are reduced, and the stability of each service system in each node is ensured.
Further, the first cache synchronization server may implement selection of the second cache synchronization server through inter-node routing control. In the process of synchronous caching, the routing control among the nodes is adjusted, the remote nodes needing synchronous caching are selected, and the cache data of one node is synchronized into the cache of one appointed remote node or the cache data synchronization value of one node is synchronized into the caches of a plurality of appointed remote nodes.
In one embodiment, the method for synchronizing the cache among the multiple nodes further comprises the following steps:
the second cache synchronization server receives second cache success prompt information returned by the cache service, and sends synchronization success prompt information to the first cache synchronization server according to the second cache success prompt information;
and the first cache synchronization server receives the synchronization success prompt message and returns the first cache success prompt message to the service system according to the synchronization success prompt message.
And informing the service system of the synchronous cache initiating node of completing cache synchronization through the synchronization success prompt message.
Further, in the process of performing cache synchronization, when the network fluctuates or the network is abnormal, the second cache synchronization server cannot receive the synchronization request instruction, and cannot synchronize the cache data into the cache, and the first cache synchronization server ensures the final consistency of the cache data through a retry mechanism. As an embodiment, the method for cache synchronization among multiple nodes may further include the following steps:
if the second cache synchronization server cannot receive the synchronization request instruction sent by the first cache synchronization server, the first cache synchronization server stores the synchronization request instruction into a retry pool;
and within a preset time threshold, the first cache synchronization server sends the synchronization request instruction to the second cache synchronization server according to a certain time period, wherein the second cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
The first cache synchronization server side stores the synchronization request instruction into a retry pool, and in the effective time of the synchronization request instruction, the first cache synchronization server side sends the synchronization request instruction to the second cache synchronization server side again at intervals, so that the final consistency of cache data is guaranteed, request accumulation is avoided, occupation of system resources is reduced, the response speed is improved, and downtime is reduced.
Further, within a preset time threshold, after the step of sending the synchronization request instruction to the cache synchronization server by the first cache synchronization server according to a certain time period, the method further includes the following steps:
and the first cache synchronization server receives synchronization success prompt information returned by the second cache synchronization server, and deletes the synchronization request instruction from the retry pool, wherein the synchronization success prompt information is prompt information sent after the second cache synchronization server receives the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
And the first cache synchronization server sends the synchronization request instruction in the retry pool to the second cache synchronization server, and deletes the synchronization request instruction in the retry pool after receiving the synchronization success prompt message returned by the second cache synchronization server, so that the storage space of the retry pool is saved, and the synchronization request instruction is prevented from being sent to the second cache synchronization server again.
For clearer clarity of the technical solution of the present invention, a method for synchronizing a cache between multiple nodes according to an embodiment of the present invention is described with reference to fig. 4 as an example.
Fig. 4 is a diagram of an application environment of a cache synchronization method among multiple nodes in an embodiment of the present invention, where the application environment includes multiple nodes, and each node deploys a complete set of services, including an independent distributed cache cluster, for example, a node 400A includes a system group 410A, a cache synchronization server 420A, and a distributed cache cluster 430A; the system group 410 includes one or more business systems, and the distributed cache service cluster 430 includes one or more cache services.
In the node 400A, the service system of the system group 410A operates to cache data, and the service system sends a synchronization request command to the local cache synchronization server 420A. Node 400A acts as the cache synchronization initiating node. After receiving the synchronization request instruction, the cache synchronization server 420a calls a corresponding interface according to the interface parameter of the synchronization request instruction, and sends the synchronization request instruction to one or more cache synchronization servers of the remote node through the interface, for example, to the cache synchronization server 420b, the cache synchronization server 420z, and the cache synchronization server 420 y. After the cache synchronization server of the remote node obtains the synchronization request instruction, the cache service to the node is positioned according to the cache identification of the synchronization request instruction, cache data in the cache service is updated according to cache operation instructions, such as a write-in instruction, a modification instruction, a deletion instruction and the like, cache synchronization among multiple nodes is realized, cache service data among the multiple nodes are consistent, the condition that a user does not sense when the service system switches the nodes can be guaranteed, the condition that a large number of concurrent requests break down a database due to cache data inconsistency of the service system when the nodes are switched is reduced, and the stability of each service system in each node is guaranteed.
According to the above method for synchronizing a cache between multiple nodes, the present invention further provides a system for synchronizing a cache between multiple nodes, and embodiments of the system for synchronizing a cache between multiple nodes according to the present invention are described in detail below.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a multi-node cache synchronization system according to an embodiment of the present invention. In this embodiment, a cache synchronization server side of a cache synchronization initiating node is taken as an example for explanation, and a cache synchronization system among multiple nodes includes:
a first synchronization request instruction receiving module 510, configured to receive a synchronization request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction;
an interface calling module 520, configured to call a corresponding interface according to the interface parameter of the synchronization request instruction;
a synchronization request instruction sending module 530, configured to send a synchronization request instruction to each preset cache synchronization server through an interface, where the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
In this embodiment, the first synchronization request instruction receiving module 510 sends the synchronization request instruction to the cache synchronization server of the to-be-synchronized cache node, and then the cache synchronization server performs cache synchronization operation according to the synchronization request instruction, so as to reduce occupation of cache synchronization on service system resources, reduce occurrence of synchronization request accumulation, and improve system response speed.
In one embodiment, the system for cache synchronization among multiple nodes further comprises a first feedback information receiving module, configured to receive a synchronization success prompt message returned by the cache synchronization server; the cache synchronization server side sends a synchronization request instruction to a cache synchronization server side, wherein the synchronization success prompt information is prompt information sent by the cache synchronization server side after the cache synchronization server side obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction; and returning the first cache success prompt message to the service system according to the synchronization success prompt message.
In one embodiment, the synchronization request instruction sending module 530 stores the synchronization request instruction into the retry pool when the cache synchronization server cannot receive the synchronization request instruction; and sending the synchronization request instruction to a cache synchronization server according to a certain time period within a preset time threshold, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
In one embodiment, the first feedback information receiving module receives synchronization success prompt information returned by the cache synchronization server, and deletes the synchronization request instruction from the retry pool, where the synchronization success prompt information is prompt information sent by the cache synchronization server after receiving the synchronization request instruction and executing a cache operation instruction in the synchronization request instruction.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a multi-node cache synchronization system according to another embodiment of the present invention. This embodiment is described by taking a cache synchronization server side of a cache node to be synchronized as an example, and the system for synchronizing caches among multiple nodes includes:
a second synchronization request instruction receiving module 610, configured to receive a synchronization request instruction sent by a cache synchronization server, where the synchronization request instruction includes a cache operation instruction, cache data, and a cache identifier;
a cache service positioning module 620, configured to position a cache service according to the cache identifier of the synchronization request instruction;
and a cache data updating module 630, configured to update the cache data to the cache service according to the cache operation instruction.
In one embodiment, the system for cache synchronization among multiple nodes further includes a second feedback information receiving module, configured to receive a second cache success prompt message returned by the cache service; and sending the synchronization success prompt information to the cache synchronization server according to the second cache success prompt information.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a multi-node cache synchronization system according to another embodiment of the present invention. In this embodiment, a cache synchronization server of a cache synchronization initiating node and a cache synchronization server of a cache node to be synchronized are used for example to describe, the multi-node cache synchronization system includes a first synchronization request instruction receiving module 510, an interface calling module 520, a synchronization request instruction sending module 530, a second synchronization request instruction receiving module 610, a cache service positioning module 620, and a cache data updating module 630.
The first synchronization request instruction receiving module 510 receives a synchronization request instruction of a service system; the synchronous request instruction comprises an interface parameter, a cache operation instruction, a cache value and a cache identifier;
the interface calling module 520 calls a corresponding interface according to the interface parameter of the synchronization request instruction;
the synchronization request instruction transmitting module 530 transmits the synchronization request instruction to the second synchronization request instruction receiving module 610 through the interface;
the second synchronization request instruction receiving module 610 receives a synchronization request instruction sent by the first cache synchronization server;
the cache service positioning module 620 positions the cache service to be cached synchronously according to the cache identifier of the synchronization request instruction;
the cache data updating module 630 updates the cache data to the cache service according to the cache operation instruction.
In one embodiment, the inter-node cache synchronization system further includes a second feedback information receiving module and a first feedback information receiving module;
the second feedback information receiving module receives second cache success prompt information returned by the cache service and sends synchronization success prompt information to the first feedback information receiving module according to the second cache success prompt information;
and the first feedback information receiving module receives the synchronization success prompt information and returns the cache success prompt information to the service system according to the synchronization success prompt information.
In one embodiment, the synchronization request instruction sending module 530 stores the synchronization request instruction into the retry pool when the second synchronization request instruction receiving module 610 cannot receive the synchronization request instruction; and sending the synchronization request instruction to a cache synchronization server according to a certain time period within a preset time threshold, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
In one embodiment, the first feedback information receiving module receives synchronization success prompt information returned by the second feedback information receiving module, and deletes the synchronization request instruction from the retry pool, where the synchronization success prompt information is prompt information sent by the cache synchronization server after receiving the synchronization request instruction and executing a cache operation instruction in the synchronization request instruction.
The technical features and the advantageous effects described in the embodiments of the inter-node cache synchronization method are applicable to the embodiments of the inter-node cache synchronization system, and thus it is stated that the inter-node cache synchronization system and the inter-node cache synchronization method of the present invention correspond to each other one by one.
In one embodiment, a computer device is further provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the inter-node cache synchronization method as in any one of the above embodiments.
When the processor of the computer device executes a program, the method for cache synchronization among multiple nodes is realized, so that the occupation of the cache synchronization on the service system resources can be reduced, the occurrence of synchronization request accumulation is reduced, and the system response speed is improved.
In addition, it can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiments may be implemented by instructing the relevant hardware through a computer program, where the program may be stored in a non-volatile computer-readable storage medium, and in the embodiments of the present invention, the program may be stored in the storage medium of the computer system and executed by at least one processor in the computer system, so as to implement the processes of the embodiments including the above-described cache synchronization method between multiple nodes.
In one embodiment, a storage medium is further provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the inter-multi-node cache synchronization method according to any one of the above embodiments. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The computer storage medium and the computer program stored in the computer storage medium realize the flow including the embodiment of the cache synchronization method among the multiple nodes, so that the occupation of the cache synchronization on the service system resources can be reduced, the occurrence of synchronization request accumulation is reduced, and the system response speed is improved.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (12)

1. A cache synchronization method among multiple nodes is characterized by comprising the following steps:
receiving a synchronous request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction; the synchronous request instruction is triggered and sent when the operation of caching data occurs in the service system;
calling a corresponding interface according to the interface parameter of the synchronous request instruction;
sending the synchronization request instruction to each preset cache synchronization server through the interface, so that the cache data are synchronized to the cache service of one or more preset cache synchronization servers; the cache synchronization server side obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction;
the sending the synchronization request instruction to each preset cache synchronization server through the interface comprises:
determining a remote node needing synchronous caching through routing control, and using the remote node as the preset cache synchronous server; communicating with the preset cache synchronization server by adopting a preset communication protocol;
the preset cache synchronization server is a cache synchronization server in one or more remote nodes; the remote node comprises a system group, the cache synchronization server and a distributed cache cluster; the system group comprises one or more business systems, and the distributed cache cluster comprises one or more cache services.
2. The method for cache synchronization between multiple nodes according to claim 1, further comprising the steps of:
receiving a synchronization success prompt message returned by the cache synchronization server; the synchronization success prompt information is prompt information sent by the cache synchronization server after the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction;
and returning first cache success prompt information to the service system according to the synchronization success prompt information.
3. The method for cache synchronization between multiple nodes according to claim 1, further comprising the steps of:
if the cache synchronization server cannot receive the synchronization request instruction, storing the synchronization request instruction into a retry pool;
and sending the synchronization request instruction to the cache synchronization server according to a certain time period within a preset time threshold, wherein the cache synchronization server obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction.
4. The method for cache synchronization among multiple nodes according to claim 3, wherein after the step of sending the synchronization request command to the cache synchronization server according to a certain time period within a preset time threshold, the method further comprises the following steps:
and receiving a synchronization success prompt message returned by the cache synchronization server, and deleting the synchronization request instruction from the retry pool, wherein the synchronization success prompt message is a prompt message sent by the cache synchronization server after receiving the synchronization request instruction and executing a cache operation instruction in the synchronization request instruction.
5. A cache synchronization method among multiple nodes is characterized by comprising the following steps:
receiving a synchronization request instruction sent by a cache synchronization server through a preset communication protocol, wherein the synchronization request instruction comprises a cache operation instruction, cache data and a cache identifier; the synchronous request instruction is triggered and sent when the operation of caching data occurs in the service system; the cache data are synchronized to cache services of one or more preset cache synchronization service ends by a synchronization request instruction sent by the cache synchronization service end;
positioning a cache service according to the cache identifier of the synchronization request instruction;
updating the cache data to the cache service according to the cache operation instruction;
the cache synchronization server is a cache synchronization server in one or more remote nodes; the remote node comprises a system group, the cache synchronization server and a distributed cache cluster; the system group comprises one or more business systems, and the distributed cache cluster comprises one or more cache services.
6. The inter-node cache synchronization method according to claim 5, further comprising the steps of:
receiving second cache success prompt information returned by the cache service;
and sending a synchronization success prompt message to the cache synchronization server according to the second cache success prompt message.
7. A cache synchronization method among multiple nodes is characterized by comprising the following steps:
a first cache synchronization server receives a synchronization request instruction of a service system; the synchronization request instruction comprises an interface parameter, a cache operation instruction, a cache value and a cache identifier, and the first cache synchronization server comprises a cache synchronization server of a synchronization cache initiating node; the synchronous request instruction is triggered and sent when the operation of caching data occurs in the service system;
the first cache synchronization server side calls a corresponding interface according to the interface parameter of the synchronization request instruction, and sends the synchronization request instruction to a second cache synchronization server side through the interface, so that the cache data are synchronized to the cache service of one or more second cache synchronization server sides; the second cache synchronization server comprises a cache synchronization server of a cache node to be synchronized;
the second cache synchronization server receives a synchronization request instruction sent by the first cache synchronization server, and locates cache service according to a cache identifier of the synchronization request instruction;
the second cache synchronization server side updates the cache data into the cache service according to the cache operation instruction;
the sending the synchronization request instruction to a second cache synchronization server through the interface includes:
determining a remote node needing synchronous caching as the second cache synchronous server through routing control; communicating with the second cache synchronization server by adopting a preset communication protocol;
the second cache synchronization server is a cache synchronization server in one or more remote nodes; the remote node comprises a system group, the cache synchronization server and a distributed cache cluster; the system group comprises one or more business systems, and the distributed cache cluster comprises one or more cache services.
8. The inter-node cache synchronization method according to claim 7, further comprising the steps of:
the second cache synchronization server receives second cache success prompt information returned by the cache service, and sends synchronization success prompt information to the first cache synchronization server according to the second cache success prompt information;
and the first cache synchronization server receives the synchronization success prompt message and returns a first cache success prompt message to the service system according to the synchronization success prompt message.
9. A system for synchronizing a cache among a plurality of nodes, comprising:
the first synchronous request instruction receiving module is used for receiving a synchronous request instruction of a service system; the synchronous request instruction comprises an interface parameter and a cache operation instruction; the synchronous request instruction is triggered and sent when the operation of caching data occurs in the service system;
the interface calling module is used for calling a corresponding interface according to the interface parameter of the synchronous request instruction;
a synchronization request instruction sending module, configured to send the synchronization request instruction to each preset cache synchronization server through the interface, so that cache data is synchronized to a cache service of one or more preset cache synchronization servers; the cache synchronization server side obtains the synchronization request instruction and executes a cache operation instruction in the synchronization request instruction;
the synchronization request instruction sending module is further configured to determine, through routing control, a remote node that needs to be cached synchronously as the preset cache synchronization server; communicating with the preset cache synchronization server by adopting a preset communication protocol;
the preset cache synchronization server is a cache synchronization server in one or more remote nodes; the remote node comprises a system group, the cache synchronization server and a distributed cache cluster; the system group comprises one or more business systems, and the distributed cache cluster comprises one or more cache services.
10. A system for synchronizing a cache among a plurality of nodes, comprising:
the second synchronization request instruction receiving module is used for receiving a synchronization request instruction sent by a cache synchronization server through a preset communication protocol, wherein the synchronization request instruction comprises a cache operation instruction, cache data and a cache identifier; the synchronous request instruction is triggered and sent when the operation of caching data occurs in the service system; the cache data are synchronized to cache services of one or more preset cache synchronization service ends by a synchronization request instruction sent by the cache synchronization service end;
the cache service positioning module is used for positioning cache service according to the cache identifier of the synchronization request instruction;
the cache data updating module is used for updating the cache data into the cache service according to the cache operation instruction;
the cache synchronization server is a cache synchronization server in one or more remote nodes; the remote node comprises a system group, the cache synchronization server and a distributed cache cluster; the system group comprises one or more business systems, and the distributed cache cluster comprises one or more cache services.
11. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
CN201711451424.XA 2017-12-27 2017-12-27 Method and system for synchronizing cache among multiple nodes Active CN107948318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711451424.XA CN107948318B (en) 2017-12-27 2017-12-27 Method and system for synchronizing cache among multiple nodes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711451424.XA CN107948318B (en) 2017-12-27 2017-12-27 Method and system for synchronizing cache among multiple nodes

Publications (2)

Publication Number Publication Date
CN107948318A CN107948318A (en) 2018-04-20
CN107948318B true CN107948318B (en) 2021-02-19

Family

ID=61940518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711451424.XA Active CN107948318B (en) 2017-12-27 2017-12-27 Method and system for synchronizing cache among multiple nodes

Country Status (1)

Country Link
CN (1) CN107948318B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413418B (en) * 2019-06-25 2022-04-05 北京三快在线科技有限公司 Cache synchronization device and method, cache synchronization system and electronic equipment
CN110825758B (en) * 2019-10-31 2022-11-15 ***股份有限公司 Transaction processing method and device
CN111159233B (en) * 2019-12-18 2024-03-08 金蝶软件(中国)有限公司 Distributed caching method, system, computer equipment and storage medium
CN111324668B (en) * 2020-02-18 2023-11-21 中国联合网络通信集团有限公司 Database data synchronous processing method, device and storage medium
CN113760975A (en) * 2020-09-21 2021-12-07 北京沃东天骏信息技术有限公司 Local cache processing method, device and equipment and computer readable storage medium
CN113761037A (en) * 2020-09-28 2021-12-07 西安京迅递供应链科技有限公司 Import and export method, device, server, medium and service system
CN113392132B (en) * 2021-05-07 2023-04-11 杭州数知梦科技有限公司 Distributed caching method and system for IOT scene

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101437179A (en) * 2008-12-17 2009-05-20 烽火通信科技股份有限公司 Method for implementing batch synchronization multi-configuration data based on EPON system
CN101146127B (en) * 2007-10-30 2010-06-09 金蝶软件(中国)有限公司 A client buffer update method and device in distributed system
CN103973727A (en) * 2013-01-28 2014-08-06 深圳市腾讯计算机***有限公司 Data synchronizing method and device
CN104301990A (en) * 2014-10-10 2015-01-21 大唐移动通信设备有限公司 Data synchronizing method and device
CN104734838A (en) * 2013-12-20 2015-06-24 深圳市国微电子有限公司 Method, system and switching matrix for synchronizing data
CN106202365A (en) * 2016-07-07 2016-12-07 帅斌鹏 Method, system and the data-base cluster that database update synchronizes
CN107018170A (en) * 2016-10-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of method of data synchronization and equipment
CN107153644A (en) * 2016-03-02 2017-09-12 阿里巴巴集团控股有限公司 A kind of method of data synchronization and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1277217C (en) * 2002-12-31 2006-09-27 中兴通讯股份有限公司 Mobile customer high performance HLR/AUC mobile customer data bank implementing method
CN100512094C (en) * 2004-11-17 2009-07-08 中兴通讯股份有限公司 Method for realizing synchronous information between multiple nodes
CN106033474A (en) * 2016-04-21 2016-10-19 苏州奖多多科技有限公司 Data synchronization updating method and device, and electronic device
CN106790705A (en) * 2017-02-27 2017-05-31 郑州云海信息技术有限公司 A kind of Distributed Application local cache realizes system and implementation method
CN107071059B (en) * 2017-05-25 2018-10-02 腾讯科技(深圳)有限公司 Distributed caching service implementing method, device, terminal, server and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101146127B (en) * 2007-10-30 2010-06-09 金蝶软件(中国)有限公司 A client buffer update method and device in distributed system
CN101437179A (en) * 2008-12-17 2009-05-20 烽火通信科技股份有限公司 Method for implementing batch synchronization multi-configuration data based on EPON system
CN103973727A (en) * 2013-01-28 2014-08-06 深圳市腾讯计算机***有限公司 Data synchronizing method and device
CN104734838A (en) * 2013-12-20 2015-06-24 深圳市国微电子有限公司 Method, system and switching matrix for synchronizing data
CN104301990A (en) * 2014-10-10 2015-01-21 大唐移动通信设备有限公司 Data synchronizing method and device
CN107153644A (en) * 2016-03-02 2017-09-12 阿里巴巴集团控股有限公司 A kind of method of data synchronization and device
CN106202365A (en) * 2016-07-07 2016-12-07 帅斌鹏 Method, system and the data-base cluster that database update synchronizes
CN107018170A (en) * 2016-10-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of method of data synchronization and equipment

Also Published As

Publication number Publication date
CN107948318A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN107948318B (en) Method and system for synchronizing cache among multiple nodes
CN112260876B (en) Dynamic gateway route configuration method, platform, computer equipment and storage medium
CN108566291B (en) Event processing method, server and system
CN109842651B (en) Uninterrupted service load balancing method and system
EP2988220B1 (en) Computer system, computer-system management method, and program
US10114848B2 (en) Ensuring the same completion status for transactions after recovery in a synchronous replication environment
CN104935654A (en) Caching method, write point client and read client in server cluster system
WO2016177130A1 (en) Method and device for selecting communication node
CN105338078A (en) Data storage method and device used for storing system
JP6582445B2 (en) Thin client system, connection management device, virtual machine operating device, method, and program
WO2023071999A1 (en) User matching method and apparatus, and device and storage medium
JP6405255B2 (en) COMMUNICATION SYSTEM, QUEUE MANAGEMENT SERVER, AND COMMUNICATION METHOD
CN113094430B (en) Data processing method, device, equipment and storage medium
CN112367182B (en) Configuration method and device of disaster recovery main and standby equipment
CN111159233A (en) Distributed caching method, system, computer device and storage medium
CN113010549A (en) Data processing method based on remote multi-active system, related equipment and storage medium
EP2416526B1 (en) Task switching method, server node and cluster system
CN106559452B (en) Data processing method and device under cluster environment
CN112965837A (en) Configuration and service hot overload updating method, device, computer equipment and storage medium
CN110895521A (en) OSD and MON connection method, device, equipment and storage medium
CN108037897B (en) Metadata diffusion method, computer device and readable storage medium
CN112783982B (en) Data processing method, device, system, computer equipment and storage medium
JP4485560B2 (en) Computer system and system management program
CN105491101B (en) The treating method and apparatus of data
CN114629783B (en) State monitoring method, system, equipment and computer readable storage medium

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
CB03 Change of inventor or designer information

Inventor after: Xiao Feng

Inventor before: Xiao Fengshen

CB03 Change of inventor or designer information
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220216

Address after: Room 1423, No. 1256 and 1258, Wanrong Road, Jing'an District, Shanghai 200040

Patentee after: Tianyi Digital Life Technology Co.,Ltd.

Address before: 1 / F and 2 / F, East Garden, Huatian International Plaza, 211 Longkou Middle Road, Tianhe District, Guangzhou, Guangdong 510630

Patentee before: Century Dragon Information Network Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240321

Address after: Unit 1, Building 1, China Telecom Zhejiang Innovation Park, No. 8 Xiqin Street, Wuchang Street, Yuhang District, Hangzhou City, Zhejiang Province, 311100

Patentee after: Tianyi Shilian Technology Co.,Ltd.

Country or region after: Zhong Guo

Address before: Room 1423, No. 1256 and 1258, Wanrong Road, Jing'an District, Shanghai 200040

Patentee before: Tianyi Digital Life Technology Co.,Ltd.

Country or region before: Zhong Guo

TR01 Transfer of patent right