Data synchronization method and apparatus
By generating sub-data transmission links and using hash algorithm allocation devices, pipelined data flow technology is implemented, which solves the problem of severe network bandwidth resource consumption in multi-data center distributed storage systems and improves data synchronization efficiency and flexibility.
Patent Information
- Application Number
- CN202210022083.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-10
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-01-10
AI Technical Summary
In multi-datacenter distributed storage systems, existing technologies distribute data copies from the primary datacenter to the secondary datacenters one by one, resulting in significant network bandwidth resource consumption and impacting the efficiency of business request response.
By generating a transmission link for each sub-data item and using a hash algorithm to allocate different devices for synchronization, it ensures that each sub-data item travels through a different transmission path. Each device, except the last one, forwards the sub-data item to the next device, thus achieving data synchronization in pipeline data stream technology.
This reduces the bandwidth pressure on the main server room's network egress, making the bandwidth consumption of the network entry and exit points of each slave server room more balanced, and improving the efficiency and flexibility of data synchronization.
Smart Images

Figure CN116450732B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to the field of computer technology, specifically to the field of data processing technology, and in particular to data synchronization methods and apparatus. Background Technology
[0002] In multi-datacenter distributed storage systems, a redundancy configuration of one master and multiple slave datacenters is typically used, with the same data distributed in replicas across different datacenters. When a new data file is written, it is usually written only to the master datacenter, which then distributes the data replicas to the slave datacenters via a backend mechanism. Current technologies mostly employ a traversal distribution method for synchronizing data replicas from the master datacenter to the slave datacenters. This means the master datacenter distributes the data replicas one by one to all slave datacenters. During this distribution process, the master datacenter needs to send all data replicas to all slave datacenters. The outbound traffic for the same data across each slave datacenter is duplicated. When handling the distribution of a large number of data replicas, this leads to significant network bandwidth overhead in the master datacenter, resulting in substantial packet loss under limited network bandwidth conditions and impacting the efficiency of business request response. Summary of the Invention
[0003] This application provides a data synchronization method, apparatus, device, and storage medium.
[0004] According to a first aspect of this application, a data synchronization method is provided, the method comprising: in response to receiving a data synchronization request, acquiring data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized, wherein the data to be synchronized includes at least two sub-data to be synchronized; generating a transmission link for each sub-data, the transmission link being used to characterize the order of the devices that need to be synchronized for each sub-data; and synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data, wherein the transmission rules are used to characterize each device in each transmission link, except for the last device, to forward the sub-data to the next device after receiving the sub-data.
[0005] In some embodiments, the number of sub-data is not greater than the number of devices; generating a transmission link for each sub-data includes generating a transmission link for each sub-data, wherein the first device in the transmission link of each sub-data is different from the others.
[0006] In some embodiments, generating a transmission link for each sub-data includes: determining the order of each sub-data, the order of each device, and the number of devices in the acquired data to be synchronized and each device; generating the corresponding number of each device to be synchronized for each sub-data using a hash algorithm based on the order of each sub-data, the order of each device, and the number of devices; and generating a transmission link for each sub-data based on the corresponding number of each device, wherein the order of each device in the transmission link of each sub-data is different from each other.
[0007] In some embodiments, each sub-data is synchronized to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data, including: synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data, wherein the transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device traverses and distributes the received sub-data to other devices in the corresponding transmission link.
[0008] In some embodiments, synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data includes: synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data, wherein the transmission rules are used to characterize that after each device in each transmission link (excluding the last device) receives the sub-data, it forwards the sub-data to the next device, and after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device distributes the received sub-data to other devices in the corresponding transmission link in a traversal manner to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy.
[0009] According to a second aspect of this application, a data synchronization apparatus is provided, comprising: an acquisition unit configured to, in response to receiving a data synchronization request, acquire data to be synchronized corresponding to the data synchronization request and at least two devices to be synchronized for the data to be synchronized, wherein the data to be synchronized includes at least two sub-data to be synchronized; a generation unit configured to generate a transmission link for each sub-data, the transmission link being used to characterize the order of the devices to be synchronized for each sub-data; and a synchronization unit configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data, wherein the transmission rules are used to characterize each device in each transmission link, except for the last device, to forward the sub-data to the next device after receiving the sub-data.
[0010] In some embodiments, the number of sub-data is no greater than the number of devices; the generation unit is further configured to generate a transmission link for each sub-data, wherein the first device in the transmission link of each sub-data is different from the others.
[0011] In some embodiments, the generation unit includes: a determining module configured to determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices based on the acquired data to be synchronized and each device; a first generation module configured to generate the corresponding number of each device to be synchronized for each sub-data using a hash algorithm based on the order of each sub-data, the order of each device, and the number of devices; and a second generation module configured to generate the transmission link for each sub-data based on the corresponding number of each device, wherein the order of each device in the transmission link of each sub-data is different.
[0012] In some embodiments, the synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data. The transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device will distribute the received sub-data to the other devices in the corresponding transmission link.
[0013] In some embodiments, the synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data. The transmission rules are used to characterize that after each device in each transmission link (excluding the last device) receives the sub-data, it forwards the sub-data to the next device, and after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device distributes the received sub-data to the other devices in the corresponding transmission link in a traversal manner to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy.
[0014] According to a third aspect of this application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method as described in any implementation of the first aspect.
[0015] According to a fourth aspect of this application, this application provides a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to cause a computer to perform a method as described in any implementation of the first aspect.
[0016] According to the technology of this application, in response to receiving a data synchronization request, the system acquires the data to be synchronized and at least two devices required to synchronize the data to be synchronized, wherein the data to be synchronized includes at least two sub-data items. A transmission link is generated for each sub-data item, and the transmission link is used to characterize the order of the devices required to synchronize each sub-data item. Based on the transmission link and transmission rules for each sub-data item, each sub-data item is synchronized to each device in the corresponding transmission link. The transmission rules characterize that each device in each transmission link, except for the last device, forwards the sub-data to the next device after receiving it. This implements a data synchronization method using pipelined data flow technology, transforming data synchronization from transmission by a single device to transmission by multiple different devices. This reduces the network egress bandwidth pressure on the main device's data center (i.e., the primary data center) and makes the network egress bandwidth overhead more balanced in the data centers of the slave devices (i.e., the secondary data centers).
[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0018] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this application.
[0019] Figure 1 This is a schematic diagram of a first embodiment of the data synchronization method according to this application;
[0020] Figure 2 This is a scenario diagram illustrating the data synchronization method implemented in the embodiments of this application.
[0021] Figure 3 This is a schematic diagram of a second embodiment of the data synchronization method according to this application;
[0022] Figure 4 This is a schematic diagram of a structure of an embodiment of the data synchronization device according to this application;
[0023] Figure 5 This is a block diagram of an electronic device used to implement the data synchronization method of the embodiments of this application. Detailed Implementation
[0024] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] Figure 1 A schematic diagram 100 is shown according to a first embodiment of the data synchronization method of this application. The data synchronization method includes the following steps:
[0027] Step 101: In response to receiving a data synchronization request, obtain the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized.
[0028] In this embodiment, when the executing entity (e.g., a data processing server) receives a data synchronization request, it can obtain the data to be synchronized and at least two devices required to synchronize the data from a local or remote location via a wired or wireless connection. The data to be synchronized includes at least two sub-data items, which can be sub-data packets, sub-data blocks, or sub-data tables, etc., and the representation of the sub-data is not limited. Devices can represent machines, instruments, equipment, storage media, and complex objects with a specific function located in different locations. The data to be synchronized represents various types of data awaiting system synchronization, such as code, tables, graphics, and text. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G, 4G, 5G, WiFi, Bluetooth, WiMAX, Zigbee, UWB (ultra-wideband), and other currently known or future wireless connection methods.
[0029] Step 102: Generate the transmission link for each sub-data.
[0030] In this embodiment, the executing entity can generate the transmission links for each sub-data randomly or sequentially. The transmission links are used to characterize the order of the various devices that need to be synchronized for each sub-data, for example, the transmission links are [device 1, device 2, device 3].
[0031] In some optional implementations of this embodiment, the number of sub-data items is no greater than the number of devices; generating a transmission link for each sub-data item includes: generating a transmission link for each sub-data item, wherein the first device in the transmission link of each sub-data item is different from the others. By setting different first devices for each sub-data item to be synchronized, each sub-data item to be synchronized is distributed in different transmission devices, and by utilizing transmission rules, the bandwidth pressure on the main server room network egress is effectively reduced, and the bandwidth consumption of the network egress and egress of each slave server room is more balanced.
[0032] Step 103: Based on the transmission link and transmission rules of each sub-data, synchronize each sub-data to each device in the corresponding transmission link.
[0033] In this embodiment, the executing entity can synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules generated in step 102. The transmission rules characterize how each device in each transmission link, except the last one, forwards the sub-data to the next device after receiving it. This is equivalent to transmitting the data in series, with each device except the last one acting as the receiver of the previous device and the sender of the next device.
[0034] See also Figure 2 The data synchronization method 200 in this embodiment operates in the electronic device 201. First, the electronic device 201 receives a data synchronization request and obtains the data to be synchronized and at least two devices 202 that need to be synchronized for the data to be synchronized, corresponding to the data synchronization request. The data to be synchronized includes at least two sub-data. Then, the electronic device 201 generates a transmission link 203 for each sub-data. Next, based on the transmission link and transmission rules for each sub-data, the electronic device 201 synchronizes each sub-data to each device 204 in the corresponding transmission link. The transmission rules are used to characterize that each device in each transmission link, except for the last device, forwards the sub-data to the next device after receiving the sub-data, so as to complete the data synchronization of all devices for each sub-data.
[0035] The data synchronization method provided in the above embodiments of this application employs the following steps in response to receiving a data synchronization request: First, it acquires the data to be synchronized corresponding to the data synchronization request and at least two devices required to synchronize the data to be synchronized. The data to be synchronized includes at least two sub-data items. A transmission link is generated for each sub-data item, and the transmission link characterizes the order of the devices required to synchronize each sub-data item. Based on the transmission link and transmission rules for each sub-data item, each sub-data item is synchronized to the devices in the corresponding transmission link. The transmission rules characterize that each device in each transmission link, except the last device, forwards the sub-data to the next device after receiving it. This implements a data synchronization method utilizing pipelined data flow technology, transforming data synchronization from transmission by a single device to transmission by multiple different devices, reducing the bandwidth pressure on the main server room's network egress and making the bandwidth overhead at the network ingress and egress points of each slave server room more balanced.
[0036] Further reference Figure 3 The diagram 300 illustrates a second embodiment of the data synchronization method. The method includes the following steps:
[0037] Step 301: In response to receiving a data synchronization request, obtain the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized.
[0038] In this embodiment, after receiving a data synchronization request, the executing entity can obtain the data to be synchronized and at least two devices required to synchronize the data from a local or remote location via a wired or wireless connection. The data to be synchronized includes at least two sub-data sets, the number of which is no greater than the number of devices.
[0039] Step 302: Based on the acquired data to be synchronized and each device, determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices.
[0040] In this embodiment, the executing entity, based on the acquired data to be synchronized and each device, sorts the sub-data in the data to be synchronized by number, sorts the devices by number, and determines the order of the sub-data in the data to be synchronized, the order of the devices, and the number of devices.
[0041] Step 303: Based on the sorting of each sub-data, the sorting of each device, and the number of devices, a hash algorithm is used to generate the corresponding number of each device that needs to be synchronized for each sub-data.
[0042] In this embodiment, the executing entity can generate the corresponding device number for each device that needs to be synchronized for each sub-data based on the sorting of each sub-data, the sorting of each device, and the number of devices, using a hash algorithm. The hash algorithm is constructed based on the sequence number of each sub-data, the sequence number of each device, and the number of devices. The number is used to characterize the position of the device during the data synchronization process of the corresponding sub-data.
[0043] To further explain, the hash algorithm formula can be expressed as: k = ((i+p)%N)+1, where i represents the data sequence number of the sub-data, p represents the current device sequence number, N represents the number of devices in the current sub-data, and k represents the number corresponding to the generated device. For example, assuming there are 3 devices in total, for the sub-data with data sequence number 1, the number corresponding to the upstream device (device with device sequence number 1) is ((1+1)%3)+1 = 3, the number corresponding to the middle device (device with device sequence number 2) is ((1+2)%3)+1 = 1, and the number corresponding to the downstream device (device with device sequence number 3) is ((1+3)%3)+1 = 2.
[0044] In some optional implementations of this embodiment, based on the sorting of each sub-data, the sorting of each device, and the number of devices, a hash algorithm is used to generate the corresponding number for each device that needs to be synchronized for each sub-data. This includes: based on the sorting of each sub-data, the sorting of each device, and the number of devices, using a number generation model to generate the corresponding number for each device that needs to be synchronized for each sub-data. The number generation model can be pre-trained based on historical data. The number generation model is used to represent the numbering of each device corresponding to each sub-data based on a mapping table. This provides a simple, convenient, and efficient method for obtaining device numbers.
[0045] Step 304: Based on the corresponding number of each device, generate the transmission link for each sub-data.
[0046] In this embodiment, the executing entity can generate a transmission link for each sub-data according to the numbering order of each device. The transmission link is used to represent the order of the devices that need to be synchronized for each sub-data. The order of the devices in the transmission link of each sub-data is different. For example, using the hash algorithm formula above, the transmission link of sub-data 1 is [device 3, device 1, device 2], the transmission link of sub-data 2 is [device 1, device 2, device 3], and the transmission link of sub-data 3 is [device 2, device 3, device 1].
[0047] Step 305: Based on the transmission link and transmission rules of each sub-data, synchronize each sub-data to each device in the corresponding transmission link.
[0048] In some optional implementations of this embodiment, each sub-data is synchronized to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data. This includes: synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data. The transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link, the first device distributes the received sub-data to other devices in the corresponding transmission link. By distributing the data synchronization task to various devices, the inbound and outbound traffic of each sub-data transmission process is not repeated in the main device, eliminating duplicate traffic generated by synchronizing the same sub-data to different devices, reducing the network egress bandwidth pressure on the main device, and simultaneously realizing multiple data synchronization methods, making data synchronization more flexible and diverse.
[0049] In some optional implementations of this embodiment, each sub-data is synchronized to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data. This includes: synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data. The transmission rules characterize how each device in each transmission link (excluding the last device) forwards the sub-data to the next device after receiving it, and how the first device distributes the received sub-data to the other devices in the corresponding transmission link after sending each sub-data to the first device in the corresponding transmission link, cooperating with each other to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy. This improves the efficiency and flexibility of data synchronization.
[0050] It should be noted that the hash algorithm mentioned above is a well-known technology that is widely researched and applied, and will not be elaborated on here.
[0051] In this embodiment, the specific operations of steps 301 and 305 are the same as... Figure 1 The operations of steps 101 and 103 in the illustrated embodiments are basically the same, and will not be described again here.
[0052] from Figure 3 It can be seen from this that, with Figure 1Compared to the corresponding embodiments, the data synchronization method in this embodiment, as illustrated in diagram 300, uses the acquired data to be synchronized and each device to determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices. Based on the order of each sub-data, the order of each device, and the number of devices, a hash algorithm is used to generate the corresponding number of each device that needs to be synchronized for each sub-data. Based on the corresponding number of each device, a transmission link for each sub-data is generated. The order of each device in the transmission link of each sub-data is different. The hash algorithm is used to allocate and construct the sub-data synchronization path, and then the transmission rules are used to make the synchronization path of each sub-data different. That is, the inbound and outbound traffic of each sub-data transmission process in the main computer room and each slave computer room is not repeated, eliminating the duplicate traffic generated by the same sub-data for synchronization in different computer rooms, effectively reducing the network egress bandwidth pressure of the main computer room, and making the network egress bandwidth overhead of each slave computer room more balanced and efficient.
[0053] Further reference Figure 4 As a response to the above Figures 1-3 To implement the method shown, this application provides an embodiment of a data synchronization device, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0054] like Figure 4 As shown, the data synchronization device 400 of this embodiment includes: an acquisition unit 401, a generation unit 402, and a synchronization unit 403. The acquisition unit is configured to, in response to receiving a data synchronization request, acquire the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized, wherein the data to be synchronized includes at least two sub-data. The generation unit is configured to generate a transmission link for each sub-data, the transmission link being used to characterize the order of the devices that need to be synchronized for each sub-data. The synchronization unit is configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data, wherein the transmission rules are used to characterize each device in each transmission link, except for the last device, to forward the sub-data to the next device after receiving the sub-data.
[0055] In this embodiment, the specific processing of the acquisition unit 401, generation unit 402, and synchronization unit 403 of the data synchronization device 400 and the resulting technical effects can be referred to respectively. Figure 1 The relevant descriptions of steps 101 to 103 in the corresponding embodiments will not be repeated here.
[0056] In some optional implementations of this embodiment, the number of sub-data is no greater than the number of devices; the generation unit is further configured to generate a transmission link for each sub-data, and the first device in the transmission link of each sub-data is different from each other.
[0057] In some optional implementations of this embodiment, the generation unit includes: a determining module, configured to determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices based on the acquired data to be synchronized and each device; a first generation module, configured to generate the corresponding number of each device to be synchronized for each sub-data using a hash algorithm based on the order of each sub-data, the order of each device, and the number of devices; and a second generation module, configured to generate the transmission link for each sub-data based on the corresponding number of each device, wherein the order of each device in the transmission link of each sub-data is different.
[0058] In some optional implementations of this embodiment, the synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data. The transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device will distribute the received sub-data to other devices in the corresponding transmission link.
[0059] In some optional implementations of this embodiment, the synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules for each sub-data. The transmission rules are used to characterize that after each device in each transmission link (except the last device) receives the sub-data, it forwards the sub-data to the next device, and after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device distributes the received sub-data to other devices in the corresponding transmission link in a traversal manner to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy.
[0060] According to embodiments of this application, this application also provides an electronic device and a readable storage medium.
[0061] like Figure 5 The diagram shown is a block diagram of an electronic device for a data synchronization method according to an embodiment of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present application described and / or claimed herein.
[0062] like Figure 5As shown, the electronic device includes one or more processors 501, a memory 502, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components are interconnected via different buses and can be mounted on a common motherboard or otherwise as required. The processors can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 5 Take a processor 501 as an example.
[0063] The memory 502 is the non-transitory computer-readable storage medium provided in this application. The memory stores instructions executable by at least one processor to cause at least one processor to perform the data synchronization method provided in this application. The non-transitory computer-readable storage medium of this application stores computer instructions for causing a computer to perform the data synchronization method provided in this application.
[0064] Memory 502, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the data synchronization method in the embodiments of this application (e.g., attached...). Figure 4 The acquisition unit 401, generation unit 402, and synchronization unit 403 are shown. The processor 501 executes various functional applications and data processing of the server by running non-transient software programs, instructions, and modules stored in the memory 502, thereby implementing the data synchronization method in the above method embodiments.
[0065] Memory 502 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the data synchronization electronics. Furthermore, memory 502 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 502 may optionally include memory remotely located relative to processor 501, and these remote memories can be connected to the data synchronization electronics via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0066] The electronic device for the data synchronization method may further include an input device 503 and an output device 504. The processor 501, memory 502, input device 503, and output device 504 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0067] Input device 503 can receive input digital or character information, as well as generate key signal inputs related to user settings and function control of data-synchronized electronic devices, such as touch screens, keypads, mice, trackpads, touchpads, joysticks, one or more mouse buttons, trackballs, joysticks, etc. Output device 504 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The display device may include, but is not limited to, liquid crystal displays (LCDs), light-emitting diode (LED) displays, and plasma displays. In some embodiments, the display device may be a touch screen.
[0068] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application-specific integrated circuits (ASICs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.
[0069] These computational programs (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms “machine-readable medium” and “computer-readable medium” refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) used to provide machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term “machine-readable signal” refers to any signal used to provide machine instructions and / or data to a programmable processor.
[0070] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0071] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0072] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0073] The technical solution according to the embodiments of this application adopts a method that, in response to receiving a data synchronization request, acquires the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized. The data to be synchronized includes at least two sub-data items. A transmission link is generated for each sub-data item, and the transmission link is used to characterize the order of the devices that need to be synchronized for each sub-data item. Based on the transmission link and transmission rules for each sub-data item, each sub-data item is synchronized to each device in the corresponding transmission link. The transmission rules characterize each device in each transmission link, except for the last device, to forward the sub-data to the next device after receiving it. This implements a data synchronization method using pipelined data flow technology, transforming data synchronization from transmission by a single device to transmission by multiple different devices, reducing the bandwidth pressure on the main data center's network egress and making the bandwidth overhead of the network egress points of each slave data center more balanced.
[0074] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0075] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A data synchronization method, comprising: In response to receiving a data synchronization request, the system acquires the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized, wherein the data to be synchronized includes at least two sub-data to be synchronized; Generate a transmission link for each sub-data, wherein the transmission link is used to characterize the order of the devices that need to be synchronized for each sub-data; Based on the transmission link and transmission rules of each sub-data, each sub-data is synchronized to each device in the corresponding transmission link, wherein the transmission rules are used to characterize each device in each transmission link, except the last device, to forward the sub-data to the next device after receiving the sub-data; The transmission link for generating each sub-data item includes: Based on the acquired data to be synchronized and each device, determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices; Based on the sorting of each sub-data, the sorting of each device, and the number of devices, a hash algorithm is used to generate the corresponding number of each device that needs to be synchronized for each sub-data. Based on the corresponding numbers of each device, the devices of each sub-data are sorted to generate the transmission link of each sub-data. The sorting of each device in the transmission link of each sub-data is different.
2. The method according to claim 1, wherein, The number of sub-data items is no greater than the number of devices; The transmission link that generates each sub-data includes: The transmission link for each sub-data is generated, and the first device in the transmission link of each sub-data is different from the others.
3. The method according to claim 1, wherein, The method of synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data includes: Based on the transmission link and transmission rules of each sub-data, each sub-data is synchronized to each device in the corresponding transmission link. The transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link, the first device will distribute the received sub-data to the other devices in the corresponding transmission link.
4. The method according to claim 1, wherein, The method of synchronizing each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data includes: Based on the transmission link and transmission rules of each sub-data, each sub-data is synchronized to each device in the corresponding transmission link. The transmission rules are used to characterize that after each device in each transmission link (except the last device) receives the sub-data, it forwards the sub-data to the next device, and after each sub-data is sent to the first device in the corresponding transmission link, the first device distributes the received sub-data to other devices in the corresponding transmission link in a traversal manner to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy.
5. A data synchronization device, comprising: The acquisition unit is configured to, in response to receiving a data synchronization request, acquire the data to be synchronized corresponding to the data synchronization request and at least two devices that need to be synchronized for the data to be synchronized, wherein the data to be synchronized includes at least two sub-data to be synchronized; The generation unit is configured to generate a transmission link for each sub-data, the transmission link being used to characterize the order of the devices that need to be synchronized for each sub-data; A synchronization unit is configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data, wherein the transmission rules are used to characterize each device in each transmission link, except the last device, to forward the sub-data to the next device after receiving the sub-data; The generation unit includes: The determination module is configured to determine the order of each sub-data in the data to be synchronized, the order of each device, and the number of devices based on the acquired data to be synchronized and each device; The first generation module is configured to generate the corresponding number of each device that needs to be synchronized for each sub-data based on the sorting of each sub-data, the sorting of each device, and the number of devices, using a hash algorithm. The second generation module is configured to sort the devices of each sub-data based on the corresponding numbers of each device, and generate the transmission link of each sub-data, wherein the order of each device in the transmission link of each sub-data is different.
6. The apparatus according to claim 5, wherein, The number of sub-data is no greater than the number of devices; the generation unit is further configured to generate a transmission link for each sub-data, wherein the first device in the transmission link of each sub-data is different from the others.
7. The apparatus according to claim 5, wherein, The synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data. The transmission rules are used to characterize that after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device will distribute the received sub-data to the other devices in the corresponding transmission link.
8. The apparatus according to claim 5, wherein, The synchronization unit is further configured to synchronize each sub-data to each device in the corresponding transmission link based on the transmission link and transmission rules of each sub-data. The transmission rules are used to characterize that after each device in each transmission link (except the last device) receives the sub-data, it forwards the sub-data to the next device, and after each sub-data is sent to the first device in the corresponding transmission link based on each transmission link, the first device distributes the received sub-data to other devices in the corresponding transmission link in a traversal manner to ensure that the sub-data is synchronized to each device in the corresponding transmission link with the least amount of time and the highest accuracy.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.
Citation Information
Patent Citations
Data transmission method and system between nodes in content distribution network and node equipment
CN113301096A