Data synchronization method, device, equipment, medium and program product
By establishing long connections and managing task queues during data synchronization, the problems of high system complexity and high resource consumption are solved, enabling real-time data push and efficient multi-terminal data synchronization.
Patent Information
- Application Number
- CN202511034567.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-11-07
AI Technical Summary
Existing data synchronization methods result in high system complexity, high network and server resource consumption, and are not user-friendly, making it difficult to effectively respond to the data synchronization needs of the sending and receiving ends.
By establishing a long connection, the data to be synchronized for the data synchronization event is obtained. The associated receiving end is searched in the database, and the task queue is allocated within a preset time period to synchronize the data according to the priority of the task queue.
It enables real-time data push updates, reduces network overhead and service resource consumption, improves data synchronization efficiency, and supports configurable hierarchical synchronization between multiple devices.
Smart Images

Figure CN120910158A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present document relates to the technical field of data processing, and particularly relates to a data synchronization method and device, equipment, medium and program product. BACKGROUND
[0002] With the continuous development of Internet technology and the continuous construction of informatization, online data synchronization scenarios introduce various data synchronization methods, such as a data synchronization method implemented through a callback mechanism, a data synchronization method implemented through a message queue, and WebSocket data synchronization. However, the above data synchronization methods require the sending end to continuously send requests to the server through polling or long polling, which increases the system complexity and consumes a large amount of network and server resources. Therefore, in the existing application system, the coverage is wide, the data synchronization transmission scene is multiple in the business processing flow, the system itself has the problems of old technology and high coupling degree. Under the premise of the above-mentioned data synchronization method, although some problems can be solved, it is necessary to increase the component or upgrade the protocol, which is not friendly to the system, and the complexity is high. How to better respond to the data synchronization needs of the sending end and the receiving end has become a problem of concern to all parties. SUMMARY
[0003] An embodiment of the present specification aims to provide a data synchronization method, device, equipment, medium and program product to solve the problem of high complexity of the data synchronization system submitted by the user and large consumption of network and server resources.
[0004] To solve the above technical problems, an embodiment of the present specification is implemented as follows: In a first aspect, an embodiment of the present specification provides a data synchronization method, which comprises: obtaining, based on a long connection established with a sending end, to-be-synchronized data of each data synchronization event, and searching, in a database, for a receiving end associated with an event identifier of the each data synchronization event; if it is detected that the number of events of the each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue; synchronizing, according to the priority of the each task queue, the to-be-synchronized data of the each data synchronization event in the each task queue to the receiving end.
[0005] In a second aspect, another embodiment of the present specification provides a data synchronization device, which comprises: a to-be-synchronized data obtaining module, configured to obtain, based on a long connection established with a sending end, to-be-synchronized data of each data synchronization event, and search, in a database, for a receiving end associated with an event identifier of the each data synchronization event; if the number of events of the data synchronization events in the preset time period is greater than the number of tasks of the task queues, running an event allocation module, the event allocation module is used for allocating the data synchronization events to the task queues; synchronizing the to-be-synchronized data of the data synchronization events in the task queues to the receiving end according to the priority of the task queues.
[0006] In a third aspect, a further embodiment of the present specification provides a data synchronization device, comprising: a memory, a processor, and computer executable instructions stored on the memory and executable on the processor, when the computer executable instructions are executed by the processor, the steps of the data synchronization method of the first aspect are implemented.
[0007] In a fourth aspect, a further embodiment of the present specification provides a computer readable storage medium for storing computer executable instructions, when the computer executable instructions are executed by a processor, the steps of the data synchronization method of the first aspect are implemented.
[0008] In a fifth aspect, a further embodiment of the present specification provides a computer program product, the computer program product comprises a data synchronization program, when the data synchronization program is executed by a processor, the steps of the data synchronization method of the first aspect are implemented.
[0009] The data synchronization method provided by the embodiment has the characteristics of simple use, easy development and maintenance, realizes the function of real-time data push update, and can immediately push the new data of the sending end to the receiving end. In addition, the long connection makes the network overhead and service resource consumption less. Then, the receiving end associated with the event identifier of each data synchronization event is found in the database. By associating the sending end, the receiving end and the data synchronization event in advance, the data synchronization efficiency is improved. Thirdly, if the number of events of the data synchronization events in the preset time period is greater than the number of tasks of the task queues, the data synchronization events are allocated to the task queues, the to-be-synchronized data of the data synchronization events in the task queues are synchronized to the receiving end according to the priority of the task queues, and the configurable data hierarchical synchronization between multiple terminals is realized. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to make one or more embodiments of the present specification or the prior art clearer, the drawings needed in the embodiment or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present specification, and for those skilled in the art, other drawings can be obtained without creative work. Figure 1 A data synchronization method processing flowchart provided by one or more embodiments of the present specification; Figure 2 A multi-end data synchronization diagram provided by one or more embodiments of the present specification; Figure 3 A middle-end module diagram provided by one or more embodiments of the present specification; Figure 4 A data synchronization flowchart between ends provided by one or more embodiments of the present specification; Figure 5 A data synchronization method processing flowchart applied to a government data synchronization scene provided by one or more embodiments of the present specification; Figure 6 A data synchronization device diagram provided by one or more embodiments of the present specification; Figure 7 A data synchronization device structure diagram provided by one or more embodiments of the present specification. DETAILED DESCRIPTION
[0011] In order to make one or more embodiments of the present specification or the prior art clearer, the drawings needed in the embodiment or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present specification, and for those skilled in the art, other drawings can be obtained without creative work.
[0012] An embodiment of the data synchronization method provided by the present specification: Referring to Figure 1 , a data synchronization method processing flowchart provided by the present embodiment is shown, referring to Figure 5 , a data synchronization method processing flowchart applied to a government data transmission scene provided by the present embodiment is shown.
[0013] Referring to Figure 1 , the data synchronization method provided by the present embodiment specifically includes the following steps S102 to S106.
[0014] In step S102, the to-be-synchronized data of each data synchronization event is acquired based on the long connection established with the sending end, and a receiving end associated with an event identifier of the each data synchronization event is searched for in a database.
[0015] The sending end (source end) and the receiving end (target end) described in the embodiment can be a system with data sending and / or receiving functions, or can also be a service with data sending and / or receiving functions, and in addition, can be a server. When the sending end has data update, the updated data needs to be sent to the receiving end in real time. For example, after a government affair system updates government affair data, the updated data is synchronized to a sub-government affair service system. The government affair system is the sending end, and the sub-government affair service system is the receiving end. In the embodiment, the number of the sending end and the receiving end can be one or multiple.
[0016] The data synchronization method provided in the embodiment can be applied to an intermediate end connected with the sending end and the receiving end, or can also be applied to a listening module of the intermediate end. The intermediate end can be connected with multiple sending ends and receiving ends at the same time, and a global mesh structure of multiple-to-multiple data pushing is constructed. The intermediate end can be a system, a service or a server with data synchronization functions, used for receiving the to-be-synchronized data sent by the sending end and synchronizing the to-be-synchronized data to the receiving end. Here, the intermediate end is taken as an example to describe the data synchronization relationship between the intermediate end and the receiving end and the sending end. The data of a single sending end can be received by multiple receiving ends, and the data of a single receiving end can also be received from multiple sending ends. At the same time, the intermediate end is responsible for hierarchical allocation and synchronization of data between the sending end and the receiving end. It needs to be noted that the data synchronization relationship between each sending end and receiving end in the figure is only exemplary, and the data synchronization relationship can be set according to actual needs in actual application. The embodiment does not limit this. Here, the intermediate end can be a listening allocator, used for providing data synchronization services. Figure 2
[0017] The long connection, also known as a persistent connection, is not closed immediately after a request / response interaction between the receiving end and the sending end is completed after being established, but remains open to process subsequent requests. This approach can significantly improve efficiency and reduce the delay and overhead caused by establishing a new connection for each request. The long connection in the embodiment can be an SSE (Server-Sent Events) connection, which is a server push technology based on the HTTP protocol. It establishes a persistent connection between the two ends and realizes real-time data push through the connection. Since it is based on the HTTP protocol, it is simple to use, easy to develop and maintain. SSE realizes real-time updating and event notification, and the sending end can immediately push data to the receiving end when there is new data, realizing real-time data push updating. In addition, its use of a single persistent connection and low protocol complexity makes network overhead and service resource consumption less than WebSocket.
[0018] The data synchronization event refers to an event of synchronizing data. Specifically, the data synchronization event can be divided according to the data type of the data to be synchronized, for example, a user incremental data synchronization event for user incremental data type. The data synchronization event is configured with an event priority or an event synchronization priority.
[0019] In the specific execution process, the listening module configured by the intermediate end can listen to the registered sending end. When the data to be synchronized sent by the sending end is received, the event identifier (eventCode) carrying the data synchronization event is used to push the data. The listening module receives the data to be synchronized of each data synchronization event by listening to the SSE connection object (i.e., the sending end), and pushes the data to the data receiving API of the receiving end according to the receiving end associated with the data synchronization event and the priority of the data synchronization event. After the receiving end receives the data, it can distinguish different data push events according to the event identifier, and process them according to the internal processing logic of the receiving end.
[0020] In actual application, in order to ensure data security, service registration needs to be performed on the intermediate end before data synchronization, and only after becoming a registered sending end or receiving end can data transmission be performed based on the intermediate end. In an optional implementation provided in the embodiment, service registration is performed as follows: The service registration module receives the sending end registration request of the sending end to the data synchronization service and the receiving end registration request of the receiving end to the data synchronization service; The sending end is registered according to the sending end information contained in the sending end registration request, and the receiving end is registered according to the receiving end information contained in the receiving end registration request.
[0021] The service registration module can be configured on the intermediate end, and is used for unified management of each end requiring data synchronization, and determining whether the service type registered by each end is a sending end or a receiving end. The sending end needs to develop an API or a route capable of processing an SSE request according to a standard requirement before service registration. Since the SSE is based on the HTTP long connection feature, the API or the route sets a response header Content-Type as text / event-stream, indicating that the data to be sent by the sending end is an event stream. In addition, the receiving end needs to develop an API for receiving data.
[0022] In the process of service registration, each end is registered in the service registration module, and the information of each end, API and / or route information to which each end belongs, and the selection of the type to which each end belongs, that is, the sending or receiving, are recorded. Each end has a unique identification code. The service registration module has a gateway function and can proxy the API or route developed by each service according to the standard requirement. It should be noted that the information of each end can be stored in a service information library.
[0023] In the specific execution process, after each end is registered in the service registration module, the creation of a data synchronization event can be performed. In an optional embodiment provided by the embodiment, the data synchronization event is created in the following manner: The event management module obtains a creation request for each data synchronization event. The event priority of each data synchronization event is determined according to the event information of each data synchronization event contained in the creation request.
[0024] Specifically, the creation of the data synchronization event can be performed by the registered sending end or receiving end, and the creation of the data synchronization event can also be performed by the management personnel of the intermediate end. The event management module can be configured on the intermediate end, and is used for managing the data synchronization event and creating different data synchronization events. Each event has an event identification, that is, a unique identification code (eventCode). In addition, when the data synchronization event is created, a priority can also be configured for each data synchronization event. For example, the priority can be a real-time level, and the real-time level can be divided into three levels, that is, high, medium and low. Each data synchronization event will be controlled according to the real-time level requirement of the event as the center of data pushing and transmission. It should be noted that the event information of the data synchronization event is stored in an event information library.
[0025] For example, when the data synchronization event is created in the event management module, the event priority of the data synchronization event is configured according to the timeliness level of the data synchronization event. Here, each data pushing event is denoted as E, and n events are contained .
[0026] In the specific implementation process, after the service registration at each end and the creation of each data synchronization event, the ends and the data synchronization events need to be associated to explicitly indicate which sending end needs to send the data to be synchronized under the data synchronization event to which receiving end. In an optional implementation provided by the embodiment, the association of the sending end, the receiving end and the data synchronization event is performed in the following manner: The sending end, the receiving end and the data synchronization events are associated by the end and event association module. The association relationship of the sending end, the receiving end and the data synchronization events is stored in the database.
[0027] Specifically, the end and event association module can be configured in the intermediate end, is used for associating the registered receiving end, sending end and data push event, and establishing the connection of the sending end to the intermediate end and the intermediate end to the receiving end. The specific process is as follows: the registered ends are associated according to the receiving end and the sending end and the data push event. The method provided by the embodiment supports many-to-many data synchronization, so that one data synchronization event can be associated with multiple receiving ends and multiple sending ends, and many-to-many data synchronization is realized. It should be noted that the association relationship of the end and the event is stored in the database (i.e., the end and event association library).
[0028] In the specific implementation process, after the association relationship is established, the intermediate end carries the unique identifier (eventCode) of the data synchronization event to request the API or the route of the sending end, and establishes a long connection with the sending end. In an optional implementation provided by the embodiment, the long connection is established in the following manner: According to the data receiving request sent by the receiving end and carrying the event identifier, the sending end associated with the event identifier is found in the database. A link establishment request is sent to the sending end, and the long connection is established after the response of the sending end to the link establishment request is received.
[0029] Specifically, the data receiving request initiated by the receiving end to the intermediate end carries the event identifier (eventCode) of the data synchronization event, which is used to distinguish the category of the data required by the receiving end. The intermediate end queries the database to find all the sending ends associated with the data synchronization event by the receiving end. Here, the data required by the receiving end can be provided by multiple receiving ends, so all the above receiving ends meeting the requirements are stored in an array. The array is traversed, and a long connection request is initiated to all the sending ends meeting the requirements in sequence. The event identifier (eventCode) and the receiving end information (targetId) are added to the route address of the connection request.
[0030] For example, the routing request address initiated by the intermediate end is: xxxx.com / sse?eventCode=aaaaa&targetId=1111; wherein "xxxx.com" is the connection address of a sending end of the intermediate end agent, "sse" is the connection request type, "eventCode=aaaaa&targetId=1111" is the data synchronization event information and the receiving end information, after the sending end receives the connection request, the data synchronization event identifier in the routing address is parsed to determine the data type sent by the connection, and the receiving end information in the routing address is parsed to establish a long connection.
[0031] The following is an example of Figure 3 For example, the intermediate end is configured with a service registration module, an event management module, an end and event association module, and a listening module; the service registration module is used for data synchronization service registration according to the type of the to-be-registered end, the event management module is used for creating a data synchronization event and determining the event priority of the data synchronization event, the end and event association module is used for associating each registered end with a data synchronization event, and the listening module is used for receiving the to-be-synchronized data of the data synchronization event sent by the sending end based on the established long connection, searching for the receiving end associated with the event identifier of the data synchronization event in the database, and sending the to-be-synchronized data to the receiving end.
[0032] In step S104, if it is detected that the number of events of the data synchronization events in the preset time period is greater than the number of tasks of the task queues, the data synchronization events are allocated to the task queues.
[0033] After searching for the receiving end associated with the event identifier of each data synchronization event in the database, in this step, if the number of events of the data synchronization events in the preset time period is greater than the number of tasks of the task queues, the data synchronization events are allocated to the task queues, so that the to-be-synchronized data of the data synchronization events in the task queues is synchronized to the receiving end according to the priority of the task queues; if the number of events of the data synchronization events in the preset time period is less than or equal to the number of tasks of the task queues, the data is synchronized to the receiving end according to the event order (first-in first-out, FIFO) of the data synchronization events.
[0034] In the process of allocating the data synchronization events to the task queues, the data synchronization events with the same event priority can be allocated to the same task queue. In an optional embodiment provided by the present embodiment, the data synchronization events are allocated to the task queues in the following manner: determining the event priority of the data synchronization events; Data synchronization events with the same event priority will be assigned to the same task queue.
[0035] The event priority of the data synchronization event corresponds one-to-one with the queue priority of the task queue.
[0036] For example, the middleware assigns a scheduling task to each data push event, and the total number of schedulable tasks is denoted as T. Within a certain time period, there are numerous data push scenarios. When the number of elements N in the data push event set E is greater than the total number of tasks T, that is... At that time, each data synchronization event is allocated to each task queue, wherein each data push event is denoted as E, containing n events. Data synchronization events with the same priority are stored in queue Q, which only stores the unique identifier of the event. The priorities of the queues, from highest to lowest, are as follows: .
[0037] Step S106: According to the priority of each task queue, synchronize the data to be synchronized for each data synchronization event in each task queue to the receiving end.
[0038] After allocating the data synchronization events to the task queues as described above, in this step, the data to be synchronized for each data synchronization event in each task queue is synchronized to the receiving end according to the priority of each task queue.
[0039] Continuing with the previous example, the middleware assigns a scheduling task to each data push event, and the total number of schedulable tasks is denoted as T. Within a certain timeframe, there are numerous data push scenarios. When the number of elements N in the data push event set E exceeds the total number of tasks T, i.e. At this time, the middleware allocates tasks according to the queue priority Q, from high to low, allowing events in high-priority queues to push data while events in low-priority queues wait. When the tasks scheduled in the high-priority queues are finished, the first waiting event queue with lower priority is then used for scheduling. Furthermore, when the number of elements N in the data push event set E is less than or equal to the total number of scheduled tasks T, that is... At this time, the system normally schedules each data push event, that is, each event pushes data to the receiving end in a first-in-first-out (FIFO) manner. It should be noted that after allocating each data synchronization event to each task queue and synchronizing the data to be synchronized for each data synchronization event in each task queue to the receiving end according to the priority of each task queue, it can meet the requirements. In this scenario, data is pushed to the receiving end in a first-in, first-out (FIFO) manner.
[0040] The following are Figure 4For example, the process of synchronizing data between the end and the end is described as a whole: first, when the service registration module and the event management module perform service registration and event creation, the service information of the data synchronization service and the event information of the data synchronization event are initialized; then the receiving end of data reception, the sending end of data sending and the data synchronization event are associated, one data synchronization event can be associated with multiple receiving ends and sending ends, supporting a many-to-many data synchronization mode; after that, a receiving end initiates a request to receive data, and the event identifier (eventCode) of the data synchronization event is carried in the request to distinguish the category of data required by the receiving end; the intermediate end queries the database to obtain all sending ends associated with the data synchronization event of the receiving end; the event synchronization data required by a receiving end can be provided by multiple sending ends, so the system stores all the above sending ends that meet the requirements in an array and traverses the array; based on the above traversal array requirements, an SSE connection request is initiated to all sending ends that meet the requirements, and the event identifier (eventCode) and the receiving end identifier (targetId) are added to the routing address of the connection request; after the sending end receives the connection request, the data synchronization event identifier in the routing address is parsed to determine the type of data sent by this connection, and the receiving end information in the routing address is parsed and identified, and the connection is established; when the sending end service has data pushing, the data packet carries the data synchronization event identifier, the system queries the corresponding event identifier and all receiving ends that receive data, and stores the involved receiving ends in an array; the system traverses the array and sends the data to the corresponding receiving end in turn, and the receiving end performs corresponding logical processing.
[0041] In summary, the one or more data synchronization methods provided by the embodiment have the characteristics of being simple to use, easy to develop and maintain, and realize the function of real-time data push update. When the sending end has new data, it can be immediately pushed to the receiving end. In addition, the long connection makes the network overhead and service resource consumption less. Secondly, the receiving ends associated with the event identifiers of the data synchronization events are found in the database. By pre-associating the sending ends, receiving ends and data synchronization events, the data synchronization efficiency is improved. Thirdly, if it is detected that the number of events of each data synchronization event in a preset time period is greater than the task data of each task queue, each data synchronization event is allocated to each task queue, and the data synchronization data of each data synchronization event in each task queue is synchronized to the receiving end according to the priority of each task queue, realizing configurable data hierarchical synchronization between multiple ends.
[0042] The following is combined Figure 5 For example, the application of the data synchronization method provided by the embodiment in the government data synchronization scene is taken as an example to further illustrate the data synchronization method provided by the embodiment. Refer to Figure 5The data synchronization method applied to the government data synchronization scenario specifically comprises steps S502 to S522.
[0043] In step S502, the service registration module receives a sender registration request of a sender for the data synchronization service and a receiver registration request of a receiver for the data synchronization service.
[0044] In step S504, the sender is registered according to the sender information contained in the sender registration request, and the receiver is registered according to the receiver information contained in the receiver registration request.
[0045] In step S506, the event management module obtains a creation request of each data synchronization event.
[0046] In step S508, the event priority of each data synchronization event is determined according to the event information of each data synchronization event contained in the creation request.
[0047] In step S510, the sender, the receiver and each data synchronization event are associated by the sender-event association module.
[0048] In step S512, the association relationship between the sender, the receiver and each data synchronization event is stored in a database.
[0049] In step S514, the sender sending a data reception request carrying an event identifier is searched in the database according to the event identifier.
[0050] In step S516, a link establishment request is sent to the sender, and a long connection is established after receiving the response of the sender to the link establishment request.
[0051] In step S518, the to-be-synchronized government data of each data synchronization event is obtained based on the long connection established with the sender, and the receiver associated with the event identifier of each data synchronization event is searched in the database.
[0052] In step S520, if it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the data synchronization events with the same event priority are allocated to the same task queue.
[0053] In step S522, the to-be-synchronized government data of each data synchronization event in each task queue is synchronized to the receiver according to the priority of each task queue.
[0054] It should be noted that any one of steps S502 to S522 or a combination of any multiple steps can be selected as any one of steps S102 to S106 or a combination of any multiple steps to form a new implementation mode according to the needs of implementation deployment; and any one or any multiple technical features in the technical solution formed by steps S502 to S522 can also be selected as any one or multiple technical features in the technical solution formed by steps S102 to S106 to form a new implementation mode according to the actual deployment needs, or the technical features in one or more optional implementation modes provided by steps S102 to S106 are combined to form a new implementation mode, which will not be described here.
[0055] Figure 6 A schematic diagram of a data synchronization device provided by an embodiment of the application is shown in FIG. 6, which includes: Figure 6 A to-be-synchronized data acquisition module 602 is configured to acquire to-be-synchronized data of each data synchronization event based on a long connection established with a sending end, and find a receiving end associated with an event identifier of each data synchronization event in a database. If it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, an event deployment module 604 is run, which is configured to deploy each data synchronization event to each task queue. A data synchronization module 606 is configured to synchronize the to-be-synchronized data of each data synchronization event in each task queue to the receiving end according to the priority of each task queue.
[0056] The data synchronization device provided by the embodiment has the characteristics of simplicity, easy use, easy development and maintenance, and realizes the function of real-time data push update. When the sending end has new data, the data can be immediately pushed to the receiving end. In addition, the long connection makes the network overhead and service resource consumption less. The receiving end associated with the event identifier of each data synchronization event is found in the database. By associating the sending end, the receiving end and the data synchronization event in advance, the data synchronization efficiency is improved. If it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the event deployment module 604 is run to deploy each data synchronization event to each task queue. Then, the data synchronization module 606 is run to synchronize the to-be-synchronized data of each data synchronization event in each task queue to the receiving end according to the priority of each task queue, so as to realize the configurable data hierarchical synchronization between multiple ends.
[0057] The data synchronization device provided by the embodiment of the present specification can implement the processes in the foregoing method embodiments and achieve the same functions and effects, which are not repeated here.
[0058] Further, the embodiment of the present specification also provides a data synchronization device, Figure 7 A structural schematic diagram of the data synchronization device provided by the embodiment of the present specification is shown in the figure, which includes a memory 701, a processor 702, a bus 703 and a communication interface 704. The memory 701, the processor 702 and the communication interface 704 communicate through the bus 703. The communication interface 704 can include an input and output interface, which includes but is not limited to a keyboard, a mouse, a display, a microphone, a loudspeaker, etc. Figure 7
[0059] Figure 7 In the embodiment, the memory 701 stores computer executable instructions that can run on the processor 702. When the computer executable instructions are executed by the processor 702, the following processes are implemented: Based on the long connection established with the sending end, the to-be-synchronized data of each data synchronization event is obtained, and the receiving end associated with the event identifier of each data synchronization event is searched in the database; If it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue; According to the priority of the each task queue, the to-be-synchronized data of each data synchronization event in the each task queue is synchronized to the receiving end.
[0060] The data synchronization device provided by the embodiment has the characteristics of simplicity, easy development and maintenance, and realizes the function of real-time data push update. When the sending end has new data, it can be immediately pushed to the receiving end. In addition, the long connection makes the network overhead and service resource consumption less. The receiving end associated with the event identifier of each data synchronization event is searched in the database. By associating the sending end, the receiving end and the data synchronization event in advance, the data synchronization efficiency is improved. If it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue. According to the priority of the each task queue, the to-be-synchronized data of each data synchronization event in the each task queue is synchronized to the receiving end, realizing the configurable data hierarchical synchronization between multiple ends.
[0061] The data synchronization device provided by the embodiment of the present specification can implement the processes in the foregoing method embodiments and achieve the same functions and effects, which are not repeated here.
[0062] Further, another embodiment of the present specification also provides a computer readable storage medium for storing computer executable instructions, which, when executed by a processor, implement the following processes: obtaining the to-be-synchronized data of each data synchronization event based on the long connection established with the sending end, and searching for the receiving end associated with the event identifier of each data synchronization event in a database; if it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue; synchronizing the to-be-synchronized data of each data synchronization event in the each task queue to the receiving end according to the priority of the each task queue.
[0063] The computer readable storage medium provided by the embodiment has the characteristics of being simple and easy to use, easy to develop and maintain, and realizes the function of real-time data push update. When the sending end has new data, the receiving end can be immediately pushed. In addition, the long connection makes the network overhead and service resource consumption less. The receiving end associated with the event identifier of each data synchronization event is searched in the database. By associating the sending end, the receiving end and the data synchronization event in advance, the data synchronization efficiency is improved. If it is detected that the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, each data synchronization event is allocated to each task queue. The to-be-synchronized data of each data synchronization event in each task queue is synchronized to the receiving end according to the priority of each task queue, realizing configurable data hierarchical synchronization between multiple ends.
[0064] The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0065] The computer readable storage medium provided by the embodiment of the present specification can implement the processes in the foregoing method embodiments and achieve the same functions and effects, which are not repeated here.
[0066] Further, another embodiment of the present specification also provides a computer program product, which, when executed by a processor, implements the following processes: The to-be-synchronized data of each data synchronization event is obtained based on a long connection established with the sending end, and the receiving end associated with the event identifier of each data synchronization event is searched in a database; If the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue; The to-be-synchronized data of each data synchronization event in the each task queue is synchronized to the receiving end according to the priority of the each task queue.
[0067] The computer program product provided in the embodiment has the characteristics of simple use, easy development and maintenance, and realizes the function of real-time data push update. When the sending end has new data, the new data can be immediately pushed to the receiving end. In addition, the long connection makes the network overhead and service resource consumption less. The receiving end associated with the event identifier of each data synchronization event is searched in a database. By associating the sending end, the receiving end and the data synchronization event in advance, the data synchronization efficiency is improved. If the number of events of each data synchronization event in a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue. The to-be-synchronized data of each data synchronization event in the each task queue is synchronized to the receiving end according to the priority of the each task queue. The data hierarchical synchronization between multiple ends is realized.
[0068] The computer program product provided in the embodiment can realize each process in the foregoing method embodiment and achieve the same function and effect, which will not be repeated here.
[0069] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable program code.
[0070] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions.
[0071] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions.
[0072] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or blocks of the flowcharts can be implemented by computer program instructions.
[0073] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0074] The memory can include non-persistent memory and / or volatile memory, such as a random access memory (RAM) including a cache area for the temporary storage of data. The memory can also include non-volatile memory, such as a read only memory (ROM) device, a floppy disk, a hard disk, or a flash memory. The memory can store an operating system including procedures and data used to manage the computer's operation, as well as programs for implementing the methods described herein. The memory can also store the data generated by the methods described herein.
[0075] Computer-readable storage media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile discs (DVDs) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable storage media does not include transitory media, such as modulated data signals and carrier waves.
[0076] It should also be noted that the terms "comprising", "containing", or any other similar term are intended to encompass non-exclusive inclusions such that a process, method, article, or apparatus that comprises a list of elements does not include those elements solely, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus.
[0077] Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code.
[0078] The above description is only a summary of the embodiments of the application, and is not intended to limit the application. Those skilled in the art can make various modifications and changes to the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the application shall be included in the scope of the claims of the application.
Claims
1. A method of data synchronization, the method comprising: The method comprises: obtaining the to-be-synchronized data of each data synchronization event based on a long connection established with a sending end, and searching a database for a receiving end associated with an event identifier of each data synchronization event; if it is detected that the number of events of each data synchronization event within a preset time period is greater than the number of tasks of each task queue, the each data synchronization event is allocated to the each task queue; synchronizing the to-be-synchronized data of each data synchronization event in the each task queue to the receiving end according to the priority of the each task queue.
2. The data synchronization method of claim 1, wherein, The long connection is established in the following manner: searching the database for the sending end associated with the event identifier according to a data receiving request sent by the receiving end and carrying the event identifier; sending a link establishment request to the sending end, and establishing the long connection after receiving a response to the link establishment request from the sending end.
3. The data synchronization method of claim 1, wherein, Before the step of obtaining the to-be-synchronized data corresponding to each data synchronization event based on the long connection established with the sending end, the method further comprises: receiving a sending end registration request of a data synchronization service sent by the sending end and a receiving end registration request of the data synchronization service sent by the receiving end through a service registration module; registering the sending end according to the sending end information contained in the sending end registration request, and registering the receiving end according to the receiving end information contained in the receiving end registration request.
4. The data synchronization method of claim 3, wherein, Further comprising: obtaining a creation request of each data synchronization event through an event management module; determining the event priority of each data synchronization event according to the event information of each data synchronization event contained in the creation request.
5. The data synchronization method of claim 4, wherein, The allocation of each data synchronization event to each task queue comprises: determining the event priority of each data synchronization event; allocating data synchronization events with the same event priority to the same task queue.
6. The data synchronization method of claim 4, wherein, Further comprising: associating the sending end, the receiving end, and each data synchronization event through an end and event association module; storing the association relationship between the sending end, the receiving end, and each data synchronization event in the database.
7. A data synchronization apparatus, characterized by comprising: The device comprises: a to-be-synchronized data obtaining module, configured to obtain the to-be-synchronized data of each data synchronization event based on a long connection established with a sending end, and search a database for a receiving end associated with an event identifier of each data synchronization event; if it is detected that the number of events of each data synchronization event within a preset time period is greater than the number of tasks of each task queue, an event allocation module is run, the event allocation module being configured to allocate the each data synchronization event to the each task queue; a data synchronization module, configured to synchronize the to-be-synchronized data of each data synchronization event in the each task queue to the receiving end according to the priority of the each task queue.
8. A data synchronization device, characterized by The device comprises a memory and a processor, and the memory stores computer executable instructions, which, when executed on the processor, can implement the steps of the data synchronization method of any one of claims 1-6.
9. A computer-readable storage medium having stored computer-executable instructions therein, the computer-executable instructions comprising, The computer executable instructions, when executed by the processor, can implement the steps of the data synchronization method of any one of claims 1-6.
10. A computer program product, characterised in that, The computer program product comprises a data synchronization program, which, when executed by a processor, can implement the steps of the data synchronization method of any one of claims 1-6.