CN113760929A - Data synchronization method and device, electronic equipment and computer readable medium - Google Patents

Data synchronization method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN113760929A
CN113760929A CN202110314167.5A CN202110314167A CN113760929A CN 113760929 A CN113760929 A CN 113760929A CN 202110314167 A CN202110314167 A CN 202110314167A CN 113760929 A CN113760929 A CN 113760929A
Authority
CN
China
Prior art keywords
data
servers
target
local cache
identifier
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.)
Pending
Application number
CN202110314167.5A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian Technology 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 Beijing Jingdong Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202110314167.5A priority Critical patent/CN113760929A/en
Publication of CN113760929A publication Critical patent/CN113760929A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The embodiment of the disclosure discloses a data synchronization method, a data synchronization device, an electronic device and a computer readable medium. One embodiment of the method comprises: selecting a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server in a target time period to obtain a target data identifier set; and synchronizing the target data identification set to other servers in the distributed server cluster, wherein the target data identification set is used for storing corresponding data in local caches corresponding to the other servers. The implementation method improves the probability of data operation requests hitting data in the local cache, and is also beneficial to improving the response speed of the cluster.

Description

Data synchronization method and device, electronic equipment and computer readable medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a data synchronization method, apparatus, electronic device, and computer-readable medium.
Background
The use of the local cache can effectively improve the performance of the system and reduce the dependence of high-concurrency scenes on databases such as redis and the like. The related local cache open source frameworks are guava, ehcache and the like.
However, the inventors found that these open source frameworks often have the following technical problems when applied:
first, these frameworks are all data caching on a single device, and are difficult to be directly applied to a device cluster.
Second, since these frames perform data caching on a single device, even if the frames are forcibly applied to a cluster, each node performs data caching only in isolation. This may cause that the local cache of each node does not store the hot spot data that should be currently stored most, which causes a waste of storage resources.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter. Some embodiments of the present disclosure propose data synchronization methods, apparatuses, electronic devices and computer readable media to solve one or more of the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a data synchronization method, which is applied to servers in a distributed server cluster, where each server corresponds to a local cache, and the method includes: selecting a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server in a target time period to obtain a target data identifier set; and synchronizing the target data identification set to other servers in the distributed server cluster, wherein the target data identification set is used for storing corresponding data in local caches corresponding to the other servers.
In a second aspect, some embodiments of the present disclosure provide a data synchronization apparatus, which is applied to servers in a distributed server cluster, where each server corresponds to a local cache, and the apparatus includes: the selecting unit is configured to select data identifiers meeting preset conditions from a non-local cache data identifier set corresponding to a data operation request set received by the server within a target time period to obtain a target data identifier set; and the synchronization unit is configured to synchronize the target data identification set to other servers in the distributed server cluster, wherein the target data identification set is used for storing corresponding data in local caches corresponding to the other servers.
In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method described in any of the implementations of the first aspect.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium on which a computer program is stored, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect.
The above embodiments of the present disclosure have the following advantages: the local cache is set for each server in the cluster, so that the cache of the data in the cluster is realized. In addition, the current hot point data is cached in each server through synchronization among different local caches in the cluster. And hot data are most likely to be accessed, so that the probability of data operation requests hitting data in the local cache is improved, and the response speed of the cluster is improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.
FIG. 1 is an architectural diagram of an exemplary system in which some embodiments of the present disclosure may be applied;
FIG. 2 is a flow diagram of some embodiments of a data synchronization method according to the present disclosure;
FIG. 3 is a flow diagram of further embodiments of a data synchronization method according to the present disclosure;
FIG. 4 is a schematic block diagram of some embodiments of a data synchronization apparatus according to the present disclosure;
FIG. 5 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 of a data synchronization method or data synchronization apparatus to which some embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include a distributed server cluster 101, terminals 102, and a data storage unit 103. The server cluster 101, the terminal 102, and the data storage unit 103 may communicate with each other via a network. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use a terminal 102 to interact with the distributed server cluster 101 over a network to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal device 102.
The terminal 102 may be hardware or software. When hardware, it may be a variety of electronic devices including, but not limited to, smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When it is software, it can be installed in the electronic devices listed above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
The distributed server cluster 101 may be a server providing various services, for example, a background server that may support a shopping webpage displayed on the terminal device 102 in an e-commerce application scenario.
The data storage unit 103 may be Redis, Kafka, or the like. The servers in the distributed server cluster 101 may all read data from the data storage unit 103 and load the data into their respective local caches.
It should be noted that the data synchronization method provided by the embodiment of the present disclosure is generally performed by the servers in the server cluster 101. Accordingly, the data synchronization apparatus may be provided in the server.
It should be understood that the number of terminals, message middleware, and servers in fig. 1 are merely illustrative. There may be any number of terminals, message middleware, and servers, as desired for an implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a data synchronization method according to the present disclosure is shown. The data synchronization method is applied to servers in a distributed server cluster, each server corresponds to a local cache, and the method comprises the following steps:
step 201, selecting a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server within a target time period to obtain a target data identifier set.
In some embodiments, the execution subject of the data synchronization method may be any server in a distributed server cluster. A distributed server cluster may contain multiple servers that provide services to the outside. Each server in the distributed server cluster corresponds to a local cache. The local cache may store corresponding data as needed. For example, data that queries more frequently may be stored, so that query response time may be shortened. The data in the local cache can be loaded from other cache units or some persistent storage units.
In some embodiments, a user may interact with a cluster of servers over a network using a terminal. For example, in an e-market scenario, when a user performs various operations such as shopping, placing an order, and settling a bill, the terminal needs to perform data interaction with the distributed server cluster. In the process, the terminal may send various data operation requests to the server, including data addition, deletion, modification and search. For example, when a user purchases a commodity, the terminal needs to transmit a commodity information inquiry request. Often, these data operation requests include data identifiers. The data identifier is used for identifying data corresponding to the data operation request. For data stored in the form of key-value pairs, the data identification may be a key (key). As an example, for merchandise information, the key may be a merchandise SKU. That is, for each data operation request, there is a data identification corresponding to it. For the data operation request set received by the server in the target time period, a data identification set corresponds to the data operation request set. For the data identification set, the corresponding data may be divided into a local cache data identification set or a non-local cache data identification set according to whether the data is stored locally in the server. In other words, data corresponding to the data identifier in the non-local cache data identifier set is not stored in the local cache. The target time period may be a preset time period or a time period determined according to a certain condition. For example, 1 second may be specified.
On this basis, the execution main body may select a data identifier satisfying a preset condition from a non-local cache data identifier set corresponding to the data operation request set received by the server within the target time period, so as to obtain a target data identifier set. As an example, the preset condition may be that the number of occurrences in the non-local cached data identification set is greater than a preset threshold. The more occurrences in the non-locally cached data identification set, the higher the corresponding data heat. The data with high heat degree is cached, and the response speed is improved.
In some embodiments, the non-local cached data identification set is obtained by: responding to a received data operation request sent by a terminal, wherein the data operation request comprises a data identifier, and determining whether data corresponding to the data identifier is stored in a local cache or not; and in response to the fact that the data corresponding to the data operation request does not exist in the local cache, reading the data corresponding to the data identification from the data storage unit to return to the terminal, and adding the data identification into the non-local cache data identification set.
In these implementations, a data storage unit (e.g., storage unit 103 in fig. 1) may be used to connect the database and the local cache, and may protect the database from direct access by requests.
Step 202, synchronizing the target data identification set to other servers in the server cluster, where the target data identification set is used to store corresponding data in local caches corresponding to the other servers.
In some embodiments, the execution agent may synchronize the target data set to other servers in the server cluster. After receiving the target data identifier set, the other servers may load data corresponding to each data identifier in the target data identifier set into the local cache. Specifically, for each data identifier, the other servers may first query whether there is data corresponding to the data identifier in the local cache, and if so, may skip. If not, it needs to be loaded from other cache units (e.g. storage unit 103 in fig. 1), or some persistent storage units.
In practice, the above steps may be performed periodically, as desired.
In some embodiments, the data in the cluster is cached by setting a local cache for each server in the cluster. In addition, the cache of the current hot point data in each server is realized through the synchronization among different local caches in the cluster. And hot data are most likely to be accessed, so that the probability of data operation requests hitting data in the local cache is improved, and the response speed of the cluster is improved.
With further reference to fig. 3, a flow 400 of further embodiments of a data synchronization method is shown. The process 300 of the data synchronization method includes the following steps:
step 301, selecting a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server within a target time period to obtain a target data identifier set.
In some embodiments, specific implementation of step 301 and technical effects brought by the implementation may refer to those embodiments corresponding to fig. 2, and are not described herein again.
Step 302, publishing the target data identification set to a target channel in a message middleware, where the message middleware is configured to send the target data identification set to other servers subscribing to the target channel, so as to synchronize the target data identification set to other servers in the distributed server cluster.
In some embodiments, synchronization between different servers may be accomplished through message middleware. As an example, for each server in the distributed server cluster, a corresponding channel may be set. When a certain server needs to be published, the channel A is published to the channel A corresponding to the server. And other servers can receive the target data identification set published by the server by subscribing to the channel A. Through the communication mechanism of the middleware, high availability and high performance of the cluster can be ensured.
Step 303, in response to receiving an insertion or modification request for data in the local cache sent by the terminal, generating a data change message.
In some embodiments, the execution body may change the data in the local cache in response to receiving an insertion or modification request for the data in the local cache sent by the terminal. In addition, data change messages may also be generated. Wherein, the data change message may include: data identification, changed values, etc.
And 304, issuing a data change message to other servers in the distributed server cluster, wherein the data change message is used for updating data in local caches corresponding to the other servers.
In some embodiments, the execution agent may publish the data change message to other servers in the distributed server cluster. If necessary, the publication can also be performed through some message middleware. After receiving the data change message, the other message servers can update the data in the respective local caches, thereby realizing synchronous update of the cache data of different servers and avoiding the situation that the terminal obtains wrong data due to the inconsistency of the respective local caches of the servers.
As can be seen from fig. 3, the flow 300 of the data synchronization method in some embodiments corresponding to fig. 3 adds a step of data synchronization between local caches of different servers, compared to the description of some embodiments corresponding to fig. 2. The terminal is prevented from obtaining wrong data due to the fact that local cache data of the servers are inconsistent. In addition, through the communication mechanism of the middleware, high availability and high performance of the cluster can be ensured.
With further reference to fig. 4, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a data synchronization apparatus, which correspond to those shown in fig. 2, and which may be applied in various electronic devices in particular.
As shown in fig. 4, a data synchronization apparatus 400 of some embodiments is applied to servers in a distributed server cluster, each server corresponding to a local cache, and the apparatus 400 includes: a selecting unit 401 and a synchronizing unit 402. The selecting unit 401 is configured to select a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server within a target time period, so as to obtain a target data identifier set. The synchronization unit 402 is configured to synchronize a target data identification set to other servers in the distributed server cluster, the target data identification set being used to store corresponding data in local caches corresponding to the other servers.
In an alternative implementation of some embodiments, the non-local cached data identification set is obtained by: responding to a received data operation request sent by a terminal, wherein the data operation request comprises a data identifier, and determining whether data corresponding to the data identifier is stored in a local cache or not; and in response to the fact that the data corresponding to the data operation request does not exist in the local cache, reading the data corresponding to the data identification from the data storage unit to return to the terminal, and adding the data identification into the non-local cache data identification set.
In an optional implementation of some embodiments, the synchronization unit 402 is further configured to: and publishing the target data identification set to a target channel in message middleware, wherein the message middleware is used for sending the target data identification set to other servers subscribed to the target channel so as to synchronize the target data identification set to other servers in the distributed server cluster.
In an optional implementation of some embodiments, the apparatus 400 further comprises: the device comprises a generating unit and a publishing unit. Wherein the generating unit is configured to generate the data change message in response to receiving an insertion or modification request for the data in the local cache sent by the terminal. The publishing unit is configured to publish a data change message to other servers in the distributed server cluster, where the data change message is used to update data in local caches corresponding to the other servers.
It will be understood that the elements described in the apparatus 400 correspond to various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 400 and the units included therein, and will not be described herein again.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., the server of fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 5 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: the method is applied to servers in a distributed server cluster, each server corresponds to a local cache, and the method comprises the following steps: selecting a data identifier meeting a preset condition from a non-local cache data identifier set corresponding to a data operation request set received by a server in a target time period to obtain a target data identifier set; and synchronizing the target data identification set to other servers in the distributed server cluster, wherein the target data identification set is used for storing corresponding data in local caches corresponding to the other servers.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes a selection unit and a synchronization unit. The names of the units do not form a limitation on the units themselves in some cases, for example, a selection unit may also be described as a "unit that selects data identifiers satisfying a preset condition".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (10)

1. A data synchronization method is applied to servers in a distributed server cluster, each server corresponds to a local cache, and the method comprises the following steps:
selecting data identifiers meeting preset conditions from a non-local cache data identifier set corresponding to a data operation request set received by the server in a target time period to obtain a target data identifier set;
synchronizing the target data identification set to other servers in the distributed server cluster, wherein the target data identification set is used for storing corresponding data in local caches corresponding to the other servers.
2. The method of claim 1, wherein the non-locally cached data identification set is obtained by:
responding to a received data operation request sent by a terminal, wherein the data operation request comprises a data identifier, and determining whether data corresponding to the data identifier is stored in a local cache or not;
and in response to the fact that the data corresponding to the data operation request does not exist in the local cache, reading the data corresponding to the data identifier from a data storage unit to return to the terminal, and adding the data identifier into the non-local cache data identifier set.
3. The method of claim 1, wherein said synchronizing the target data identification set to other servers in the distributed server cluster comprises:
and publishing the target data identification set to a target channel in message middleware, wherein the message middleware is used for sending the target data identification set to other servers subscribed to the target channel so as to synchronize the target data identification set to other servers in the distributed server cluster.
4. The method of claim 3, wherein the method further comprises:
generating a data change message in response to receiving an insertion or modification request aiming at data in a local cache and sent by a terminal;
and issuing the data change message to other servers in the distributed server cluster, wherein the data change message is used for updating data in local caches corresponding to the other servers.
5. A data synchronization device is applied to servers in a distributed server cluster, each server corresponds to a local cache, and the device comprises:
the selecting unit is configured to select data identifiers meeting preset conditions from a non-local cache data identifier set corresponding to a data operation request set received by the server in a target time period to obtain a target data identifier set;
a synchronization unit configured to synchronize the target data identification set to other servers in the distributed server cluster, the target data identification set being used to store corresponding data in local caches corresponding to the other servers.
6. The apparatus of claim 5, wherein the non-locally cached data identification set is obtained by:
responding to a received data operation request sent by a terminal, wherein the data operation request comprises a data identifier, and determining whether data corresponding to the data identifier is stored in a local cache or not;
and in response to the fact that the data corresponding to the data operation request does not exist in the local cache, reading the data corresponding to the data identifier from a data storage unit to return to the terminal, and adding the data identifier into the non-local cache data identifier set.
7. The apparatus of claim 1, wherein the synchronization unit is further configured to:
and publishing the target data identification set to a target channel in message middleware, wherein the message middleware is used for sending the target data identification set to other servers subscribed to the target channel so as to synchronize the target data identification set to other servers in the distributed server cluster.
8. The apparatus of claim 3, wherein the apparatus further comprises:
the generating unit is configured to respond to the received insertion or modification request which is sent by the terminal and aims at the data in the local cache and generate a data change message;
and the issuing unit is configured to issue the data change message to other servers in the distributed server cluster, where the data change message is used to update data in local caches corresponding to the other servers.
9. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-4.
CN202110314167.5A 2021-03-24 2021-03-24 Data synchronization method and device, electronic equipment and computer readable medium Pending CN113760929A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110314167.5A CN113760929A (en) 2021-03-24 2021-03-24 Data synchronization method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110314167.5A CN113760929A (en) 2021-03-24 2021-03-24 Data synchronization method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN113760929A true CN113760929A (en) 2021-12-07

Family

ID=78786753

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110314167.5A Pending CN113760929A (en) 2021-03-24 2021-03-24 Data synchronization method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN113760929A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115134373A (en) * 2022-06-28 2022-09-30 中国工商银行股份有限公司 Data synchronization method and device, storage medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115134373A (en) * 2022-06-28 2022-09-30 中国工商银行股份有限公司 Data synchronization method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN110019350B (en) Data query method and device based on configuration information
CN111800513B (en) Method and device for pushing information and computer readable medium of electronic equipment
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN110909521A (en) Synchronous processing method and device for online document information and electronic equipment
CN111510466B (en) Data updating method and device for client, electronic equipment and readable medium
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN113760536A (en) Data caching method and device, electronic equipment and computer readable medium
CN113760991A (en) Data operation method and device, electronic equipment and computer readable medium
CN112948498A (en) Method and device for generating global identification of distributed system
CN113760929A (en) Data synchronization method and device, electronic equipment and computer readable medium
CN112948138A (en) Method and device for processing message
CN113553206B (en) Data event execution method and device, electronic equipment and computer readable medium
CN113824675B (en) Method and device for managing login state
CN115658171A (en) Method and system for solving dynamic refreshing of java distributed application configuration in lightweight mode
CN112507676B (en) Method and device for generating energy report, electronic equipment and computer readable medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN112949326B (en) Information query method, device, equipment and computer readable medium
CN113760927A (en) Data processing method and device, electronic equipment and computer readable medium
CN111580890A (en) Method, apparatus, electronic device, and computer-readable medium for processing features
CN112100205A (en) Data processing method, device, equipment and computer readable medium
CN112163176A (en) Data storage method and device, electronic equipment and computer readable medium
CN112115154A (en) Data processing and data query method, device, equipment and computer readable medium
CN112685075A (en) Gray scale distribution method and device, electronic equipment and computer readable medium
CN111459893A (en) File processing method and device and electronic equipment
CN113127416A (en) Data query method and device

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