Data synchronization method, storage medium, electronic device and program product

Through the RDMA protocol, the data synchronization file is directly transmitted between the master node and the slave node, and the delay and resource consumption problems caused by multiple replications during the data synchronization process in the prior art are solved, and more efficient data transmission and synchronization are achieved.

CN119728719AInactive Publication Date: 2025-03-28INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510223003.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-03-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the process of data synchronization, the data needs to be copied from the user state to the core state, and then from the kernel cache to the network cache, resulting in multiple replications within the node, increasing the delay in data transmission and reducing the data transmission speed.

Method used

The data synchronization file is directly transmitted between the master node and the slave node through the RDMA protocol, avoiding the node kernel participating in data synchronization, and directly writing the synchronized data from the user to the CXL device, and sending the synchronization file to the slave node for memory loading through the RDMA protocol.

Benefits of technology

It reduces multiple replication of data within the node, reduces delay and resource consumption, and improves data transmission speed and synchronization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728719A_ABST
    Figure CN119728719A_ABST
Patent Text Reader

Abstract

The invention discloses a data synchronization method, a storage medium, electronic equipment and a program product, and relates to the technical field of computers.The method comprises the steps that firstly, a master node can receive a data synchronization request sent by a slave node through an RDMA protocol; then acquiring synchronous data corresponding to the data synchronization request, writing the synchronous data into configured first CXL equipment, and generating a synchronous file corresponding to the synchronous data; and the synchronization file is sent to the slave node through an RDMA protocol, so that the slave node carries out memory loading on the synchronization data in the synchronization file through configured second CXL equipment. Compared with the prior art, the method has the advantages that the master node can send the synchronization file to the slave node through the RDMA protocol, a node kernel does not need to participate in data synchronization, time delay and resource consumption caused by multiple times of copying of the synchronization data in the node are reduced, the transmission speed of the synchronization data is increased, and then the data synchronization efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data synchronization method, storage medium, electronic device and program product. Background Art

[0002] Storage systems usually support data synchronization between master and slave nodes, and are used in scenarios such as caching, message queues, session storage, real-time analysis, and geospatial data indexing, meeting the high-performance, publish-subscribe, and high-speed caching requirements of application scenarios such as the Internet and the Internet of Things.

[0003] At present, in the process of data synchronization in related technologies, data needs to be copied from user state to kernel state, and then from kernel cache to network cache. It undergoes multiple copies within the node, which increases the delay of data transmission and reduces the data transmission speed. Summary of the invention

[0004] The present application provides a data synchronization method, storage medium, electronic device and program product. Its main purpose is to solve the problem that in the data synchronization process of the related technology, data needs to be copied from user state to kernel state, and then from kernel cache to network cache, and multiple copies are performed inside the node, which increases the delay of data transmission and reduces the data transmission speed.

[0005] In a first aspect, the present application provides a data synchronization method, which can be applied to a master node for execution, including: Receive data synchronization requests sent by the slave node through the RDMA protocol; Acquire synchronization data corresponding to the data synchronization request, write the synchronization data into the configured first CXL device, and generate a synchronization file corresponding to the synchronization data; The synchronization file is sent to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0006] In a second aspect, the present application provides a data synchronization method, which can be applied to a slave node for execution, including: Sending a data synchronization request to the master node through the RDMA protocol, so that the master node uses a persistence mechanism to write the synchronization data corresponding to the data synchronization request into the configured first CXL device, and generates a synchronization file corresponding to the synchronization data; Receive synchronization files sent by the master node through the RDMA protocol; The synchronization data in the synchronization file is loaded into memory through the configured second CXL device.

[0007] In a third aspect, the present application provides a data synchronization device, which can be applied to a master node, including: A receiving module, configured to receive a data synchronization request sent by a slave node via an RDMA protocol; an acquisition module configured to acquire synchronization data corresponding to the data synchronization request, write the synchronization data into a configured first CXL device, and generate a synchronization file corresponding to the synchronization data; The synchronization module is configured to send the synchronization file to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0008] In a fourth aspect, the present application provides a data synchronization device, which can be applied to a slave node, including: a sending module configured to send a data synchronization request to the master node through the RDMA protocol, so that the master node writes synchronization data corresponding to the data synchronization request into a configured first CXL device, and generates a synchronization file corresponding to the synchronization data; A receiving module, configured to receive a synchronization file sent by the master node through the RDMA protocol; The synchronization module is configured to load the synchronization data in the synchronization file into memory through the configured second CXL device.

[0009] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of the first aspect or the method of the second aspect.

[0010] In a sixth aspect, the present application provides an electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the method of the first aspect or the method of the second aspect when executing the computer program.

[0011] In a seventh aspect, the present application provides a computer program product having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of the first aspect or the method of the second aspect.

[0012] The data synchronization method, storage medium, electronic device and program product provided by the present application include: first, the master node can receive a data synchronization request sent by the slave node through the RDMA protocol; then obtain the synchronization data corresponding to the data synchronization request, write the synchronization data into the configured first CXL device, and generate a synchronization file corresponding to the synchronization data; then send the synchronization file to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device. Compared with the current prior art, the present application can use the RDMA protocol to perform synchronous data transmission between the master node and the slave node. After the master node receives the data synchronization request sent by the slave node, it can store the synchronization data in the configured first CXL device, obtain the synchronization file corresponding to the synchronization data, and then send the synchronization file to the slave node through the RDMA protocol. There is no need for the node kernel to participate in data synchronization, which reduces the delay and resource consumption caused by multiple copies of the synchronization data within the node, improves the transmission speed of the synchronization data, and thus improves the data synchronization efficiency.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0015] Figure 1 A schematic diagram of a data synchronization method provided in an embodiment of the present application is shown; Figure 2 A schematic diagram of a process flow of another data synchronization method provided in an embodiment of the present application is shown; Figure 3 A schematic diagram showing a flow chart of another data synchronization method provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of the structure of a data synchronization device provided in an embodiment of the present application is shown; Figure 5 A schematic diagram of the structure of another data synchronization device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0017] It should be noted that, in the description of this application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0018] At present, in order to solve the single point failure of the remote dictionary service (Remote Dictionary Server, Redis) and improve the data availability of the remote dictionary service, Redis supports a master-slave mode distributed architecture mode to achieve high data availability and read-write separation. In the distributed architecture, there can be a master node (Master) and multiple slave nodes (Slaves). A Transmission Control Protocol (TCP) long connection will be maintained between the master node and the slave node. The subsequent master node can synchronize the latest write operation command to the slave node through the TCP long connection to achieve data synchronization between the master node and the slave node. However, in order to prevent the TCP connection from consuming too much, the operating system generally limits the cache capacity to a few hundred KB, resulting in limited TCP network cache capacity.

[0019] Among them, the master node can be a Redis node responsible for processing write operations and responding to client write operations. It can be used to receive write requests from clients and synchronize the data corresponding to the write requests to the slave nodes in the distributed architecture. Correspondingly, the slave node can be used to copy data from the master node to maintain data consistency with the master node and improve the system's disaster redundancy. Specifically, the slave node can be used to handle read requests and provide read services for the corresponding data. The slave node is also used to become the new master node through an election mechanism when the master node fails to ensure the fault tolerance engine of the master node.

[0020] In order to improve the current related technologies, during the data synchronization process, it is necessary to copy the data from the user state to the kernel state, and then from the kernel cache to the network cache. The data undergoes multiple copies within the node, which increases the data transmission delay and reduces the data transmission speed.

[0021] This embodiment provides a data synchronization method, which can be applied to the master node for execution, such as Figure 1 As shown, the method comprises the following steps: Step 101: The master node receives a data synchronization request sent by the slave node through a Remote Direct Memory Access (RDMA) protocol.

[0022] In some embodiments, the RDMA protocol allows computers to directly access and store memory data of other computers without the need for processor processing. Specifically, in terms of technical implementation, RDMA is a remote memory direct high-speed access technology that fully optimizes the intelligent network card and software architecture. It achieves its high-performance remote direct data access goal by solidifying the RDMA protocol on hardware (i.e., network card) and supporting zero-copy and kernel bypass. The RDMA data transmission process does not require central processing unit (CPU) intervention (No CPU involvement), and applications can access the remote host memory without consuming any CPU resources in the remote host.

[0023] In some embodiments, a Redis master node can be used to receive data synchronization requests sent by a slave node, and use the RDMA protocol to transmit data with the slave node. In this way, the synchronization data can be sent directly from the user-state cache to the cache area of ​​the slave node, thereby improving the data transmission rate and thereby improving the data synchronization rate between nodes.

[0024] Step 102: The master node obtains synchronization data corresponding to the data synchronization request, writes the synchronization data into a configured first Compute Express Link (CXL) device, and generates a synchronization file corresponding to the synchronization data.

[0025] In some embodiments, the fast compute link CXL is a cache-coherent open interconnect protocol for processors, memory extensions, and accelerators, wherein the CXL protocol can be used to implement direct memory access between local or proximal nodes, and the CXL protocol includes three sub-protocols, namely: CXL input-output protocol (CXL.io), CXL cache protocol (CXL.cache), and CXL memory protocol (CXL.mem), wherein CXL.io is mainly responsible for device discovery, configuration, and basic input-output (I / O) operations; the CXL.cache protocol allows devices (such as graphics processing units (GPUs) and field-programmable gate arrays (Field-Programmable Gate Arrays) to cache data in the host memory and maintain cache consistency, thereby optimizing data transmission and access performance; CXL.mem is suitable for applications that require large-capacity memory, such as in-memory databases, high-performance computing, etc., so that devices (such as memory extension devices) can expose their memory to the host and access it as part of the host memory, thereby optimizing the memory access path, thereby achieving memory expansion and efficient memory access.

[0026] In some embodiments, CXL can be used to define three types of devices, which may include: Type 1 devices, which are acceleration cards or add-on cards installed through PCIe slots. These cards can be integrated with existing systems and communicate directly with the CPU through the CXL interface to provide faster data transfer speeds. They can be used for cache devices such as network cards; Type 2 devices, which have the functions of all Type 1 devices and are typically used in scenarios with high-density computing, such as GPU accelerators; Type 3 devices, which are dedicated storage devices that communicate directly with the host processor and can use the CXL protocol to achieve low-latency, high-throughput data transfer. They can be used as memory buffers to expand memory bandwidth and memory capacity.

[0027] In some examples, a data synchronization request may be initiated by an application or system, and may include but not be limited to synchronized data identification, meta information (such as timestamp, version number), etc. Accordingly, the first CXL device may be a CXL device configured for the master node, such as a CXL-persistent memory (Pmem) memory device that supports the CXL.Type2 technical protocol. CXL-Pmem may support direct memory access and persistent storage functions, and may be operated through a specific API or library. Exemplarily, the synchronization data to be synchronized to the slave node may be obtained from the memory or local storage according to the synchronization request, and the data may be persistently written to the CXL-Pmem device using the libpmem library, and the synchronization data and meta information may be encapsulated as a synchronization file, without the need for the master node kernel to participate in data synchronization, thus reducing node resource consumption and improving data synchronization transmission efficiency, so as to facilitate subsequent synchronization processing, and through the persistence mechanism, it is possible to ensure that the data will not be lost after a power outage or system crash.

[0028] Step 103: The master node sends the synchronization file to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0029] In some examples, a preset transmission interface can be called to send the synchronization file to the slave node through the RDMA protocol. The RDMA protocol allows remote nodes to directly access the memory, reducing network latency and CPU overhead. After the slave node receives the synchronization data sent by the master node, it can save the synchronization data in the configured second CXL device, parse the synchronization file, obtain the synchronization data, and then use the second CXL device to load the synchronization data into the local memory of the slave node. The master node kernel does not need to participate in data synchronization, which reduces resource consumption caused by multiple data values ​​within the master node, improves data transmission speed, and thus improves data synchronization efficiency.

[0030] Compared with the current existing technology, the embodiment of the present application can use the RDMA protocol to perform synchronous data transmission between the master node and the slave node. After the master node receives the data synchronization request sent by the slave node, it can store the synchronized data to the configured first CXL device, obtain the synchronization file corresponding to the synchronized data, and then send the synchronization file to the slave node through the RDMA protocol. There is no need for the node kernel to participate in data synchronization, which reduces the delay and resource consumption caused by multiple replications of synchronized data within the node, improves the transmission speed of synchronized data, and thus improves data synchronization efficiency.

[0031] In order to further illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 2 The specific method shown can be applied to the master node, and the method includes: Step 201: The master node receives a data synchronization request sent by the slave node through the RDMA protocol.

[0032] In some embodiments, the Redis master and slave nodes may be configured with a network card supporting the RDMA protocol and a CXL device, respectively, and receive data synchronization requests sent by the slave node or remote requests from other remote devices through the network card supporting the RDMA protocol, wherein the data synchronization request may support the remote direct memory access protocol and the high-speed computing link protocol, thereby improving the efficiency of receiving data synchronization requests. Exemplarily, a data synchronization command supporting the RDMA-CXL protocol is developed, such as the cxlpsync command, and then the master and slave nodes are triggered to synchronize data through the cxlpsync command, thereby improving the data synchronization efficiency between nodes.

[0033] Step 202: The master node obtains synchronization data corresponding to the data synchronization request, writes the synchronization data into a configured first CXL device, and generates a synchronization file corresponding to the synchronization data. The synchronization file may include an RDB file.

[0034] Optionally, step 202 may specifically include: generating a persistence command supporting the CXL protocol, converting the synchronization data into RDB data according to the persistence command; calling a preset memory interface, applying for a first storage space in the first CXL device, and writing the RDB data into the first storage space, generating an RDB file corresponding to the RDB data.

[0035] Among them, RDB (Redis Database File) is a persistence method of Redis, which can be used to periodically save the data in the memory to the disk file. In the process of generating the RDB file, Redis will scan the data in the memory and serialize it into a file format. Correspondingly, the preset memory interface can be an interface that supports the CXL memory protocol. In some embodiments, after receiving a data synchronization request, the master node can execute a persistence command that supports the CXL protocol, such as cxlbgsave. After cxlbgsave is started, the synchronized data in the Redis memory can be persisted as RDB data, and then the cxlmemDriver interface is called to apply for storage space in the first CXL device to generate an RDB file to facilitate the transmission of synchronized data.

[0036] In some embodiments, an RCXL (RDMA+CXL) ConnDriver object can be developed to implement the CXL.mem registered area storage (Memory Region, MR) function. As the first storage space, MR is an area divided by the RDMA driver in the CXL.mem memory, which can be used to store the sent and received data. Specifically, in this process, the RDMA driver will create and fill in a mapping table from a virtual address (VA) to a CXL.mem logical location (CXL.LA) in the memory. The RDMA network card can convert VA to CXL.LA by looking up the table when necessary to facilitate data reading and writing.

[0037] Optionally, before step 202, the method of this embodiment may further specifically include: configuring a CXL root port through a system bus, and connecting a first CXL device using the CXL root port; calling a memory driver module to obtain scan information of the first CXL device, registering the first CXL device in a system memory according to the scan information, and saving the configuration information of the first CXL device through a configuration file.

[0038] In some embodiments, multiple CXL root ports can be configured through the system bus to connect corresponding devices, such as CXL devices. After the CXL devices are configured, the CXL devices can be scanned through the memory driver module, the scanned information obtained can be registered in the memory, and the configuration information can be saved in the configuration file to facilitate data transmission with the CXL devices. The configuration information can include but is not limited to CXL device information, address space, page configuration, page count, etc.

[0039] Optionally, the method of this embodiment may further include: accessing the first CXL device according to the configuration information, and sending a data synchronization request to a CXL root port corresponding to the first CXL device; obtaining a CXL link control unit packet corresponding to the data synchronization request by using the CXL root port, and sending the CXL link control unit packet to the first CXL device corresponding to the CXL root port.

[0040] In some embodiments, a memory driver module that supports the reading and writing of data of Type2 memory devices of CXL.cache and CXL.mem can be developed for Redis nodes. CXL devices and RDMA network cards are configured in the nodes, and driver software such as cxlmemDriver can be developed to implement functions such as registration, memory space allocation, and read and write operations of CXL.mem memory devices. In some examples, a synchronization data request is first sent to the Redis master node through the RDMA network card. The master node can write the synchronization data to the Type2 type device and manage it through the CXL controller. The slave node can also transmit data through the RDMA network card to ensure data consistency and reliability. Among them, the Redis master node can be used for writing and reading data, and the Redis slave node can be used as a backup node to synchronize the data of the master node. The CXL controller can be used to manage CXL memory (CXLmem) and other related components. Persistent Memory (PMEM) can be used to provide high-speed storage. The RDMA network card can be used for remote direct memory access to improve network transmission efficiency.

[0041] Exemplarily, the steps may include: 1) One or more CXL root ports (RPs) are configured on the system bus of the Redis node CPU, and the CXL device endpoint (EP) is connected through the RPs. Here, the device endpoint type can be a CXL Type2 memory device endpoint; cxlmemDriver can call the operating system (OS) kernel driver to start PCIe transactions to scan CXL devices; Type-2 memory is accessed by the host through CXL.mem as a storage medium, and the persistent memory Pmem can be used as the storage medium CXL-Pmem of CXL.mem. At the same time, computing resources that support Type-2 use the CXL.mem protocol to buffer application data into the CXL-Pmem cache, and the device (cache) memory consistency engine (Device Coherency Engine, DCOH) tracks the cache line status between CXL and CXL devices to ensure cache consistency with other CXL devices; 2) Register the CXL.mem device CXL-Pmem to the system memory in the node according to the scan information, and initialize, paging configure and address space allocate the CXL-Pmem device memory; 3) Then the CXL logical address space data is synchronously mapped with the physical address space in the CXL device; 4) Write CXL device information, address space, page configuration, page count, etc. into the node operating system configuration file; 5) When the node restarts, it reads the CXL device configuration information of the OS. When receiving a data read / write operation request, it accesses the CXL device memory through the load / store instruction. The request is passed to the corresponding root port, which converts the request into a CXL link control unit packet (CXL flit) and calls the CXL protocol to send it to the CXL-Pmem device. After that, the CXL controller in the CXL device can be used to parse the CXL flit, convert the incoming address, and send the converted request to the underlying memory controller to realize the reading and writing of the CXL device memory resources.

[0042] Specifically, a logic check can be performed through the check logic unit, and the corresponding address can be obtained by using the address calculation logic unit. The system bus can connect to PMEM through MC. Conventional memory may include address space, operating system address space, CXL base address register BAR, CXL internal memory HDM, and data Buffer. Bufferke can be used to obtain the MR mapping table from VA to CXLLA. The Redis master node and the slave node can communicate through the RDMA network card RNIC. The master node can use the network card to read data and request memory. It can also obtain WQE1, WQE1, WQE2 corresponding to SQ and WQE0 and WQE1 corresponding to RQ through WR.

[0043] Optionally, the method of this embodiment may further specifically include: calling a memory driver module to determine a first storage space in the first CXL device, and configuring operation permissions and operation keys for the first storage space; receiving a remote request sent by a remote host, the remote request is used to request operation permissions and operation keys, and remotely accessing the first storage space according to the operation permissions and operation keys.

[0044] For example, during the MR registration process, the MR's permissions and operation keys (Key) can be set to ensure data integrity. MR permissions can be mainly used to meet the read / write requirements of the local / remote nodes. The local key (LocalKey, L_Key) and remote key (Remote Key, R_Key) can be designed separately to determine the key mechanism for accessing the MR, that is, when the MR is registered, L_Key and / or R_Key are created at the same time according to the program requirements. Only requests holding L_Key and / or R_Key keys can operate the MR.

[0045] As a possible implementation, remote operation of CXL-Pmem through RDMA mainly supports remote memory operation and remote message operation, and its functions can be implemented through RCXLConnDriver object. Remote memory operations may include read operations, write operations, etc. Before performing remote read and write operations, the user of the remote host can obtain CXL-Pmem permissions by remotely requesting RCXLConnDriver, that is, obtain the L_Key / R_Key key of MR to access CXL memory, and the operating system will hand over CXL-Pmem to RCXLConnDriver for control. Exemplarily, RCXLConnDriver can use SHA-256 to encrypt and decrypt data to ensure data security.

[0046] Optionally, the method of this embodiment may further include: in response to receiving a data loading completion message sent by the slave node, clearing the first storage space, and storing an address corresponding to the first storage space in a free address list of the first CXL device.

[0047] In some embodiments, after the slave node loads the synchronized data into the local memory, it may send a data loading completion message to the master node to inform the master node that the synchronization is completed. The master node may then clear the synchronized data in the first storage space to reduce memory usage, and store the address of the space in a free address list to provide more storage space for the next data synchronization, thereby improving data synchronization efficiency and optimizing system performance.

[0048] Optionally, the method of this embodiment may further include: in the process of generating the RDB file, obtaining page access data of the cache page of the first CXL device; and determining a target page to be released in the cache page according to the page access data and a preset page heat threshold.

[0049] As a possible implementation method, in the process of applying for memory space for RDB files by the CXL-Pmem device, the access data of each page can be detected, and it can be determined whether there are pages that need to be released based on the page access data, thereby reducing the consumption of storage space and improving system performance. Specifically, the access frequency and last access time of each cache page can be recorded, and the page ID and its corresponding meta information can be stored using a data structure. For example, each time a cache page is accessed, its access frequency and timestamp can be updated, or all cache pages can be scanned regularly to collect its access data. Accordingly, the preset page heat threshold can be a heat threshold set according to system requirements, which can be used to distinguish hot pages (for example, pages above the threshold) and cold pages (for example, pages below the threshold). Cold pages can be determined as target pages that need to be released. Page access data can include but is not limited to page access frequency, read access times, write access times, last access time and other information, which can be used to evaluate the heat of the page.

[0050] Optionally, the target page to be released in the cache page is determined based on the page access data and a preset page heat threshold, which may specifically include: obtaining the page heat corresponding to the cache page using a preset heat calculation formula based on the page access data; comparing the page heat corresponding to the cache page with the preset page heat threshold to determine the target page.

[0051] In specific application scenarios, based on the CXL-Pmem page heat algorithm, the page heat counter WR parameter can be added to the page configuration. In the process of generating RDB files, the CXL-Pmem page heat algorithm is called to calculate the page temperature and recycle pages with low temperatures. The heat of the CXL-Pmem page can be measured by its access frequency and the time period since the last access. It can include three variables, namely the number of read accesses rnum, the number of write accesses wnum and the most recent access time ltime of the page. The preset heat calculation formula is as follows: WR= (rnum+wnum ) / Δt+1 Wherein, WR represents the page heat, which can be calculated while accessing the page. First, subtract ltime from the current time to get Δt. If Δt is greater than the heat threshold Tl (Tl is a configurable parameter stored in the system configuration file), WR, rnum, and wnum can be cleared.

[0052] Exemplarily, all cache pages can be traversed, their heat values ​​can be calculated according to a preset heat calculation formula, and pages with heat values ​​below a threshold can be marked as target pages. In this way, the target page in the device can be determined and removed from the cache to provide space for other data to optimize cache utilization.

[0053] Further optionally, step 202 may specifically include: starting a subprocess to call a preset memory interface to apply for a first cache partition in the first CXL device, where the first cache partition is used to store cache data.

[0054] Exemplarily, during the RDB generation process, the master node may simultaneously start a child process, such as cxlfork, and may call the cxlmemDriver interface through cxlfork to create a first cache partition in CXL-Pmem, such as a temporary replication partition (cxl-replication buffer), and store the latest received write Redis data in the temporary replication partition of CXL-Pmem.

[0055] Optionally, the method of this embodiment may further specifically include: sending a cache data synchronization message to the slave node, the cache data synchronization message is used to instruct the slave node to apply for a second cache partition for storing cache data in the second CXL device, and integrate the cache data and RDB data in the local memory; maintaining an RDMA connection with the slave node, the RDMA connection is used to send the latest synchronization data to the slave node.

[0056] In some embodiments, cached data may be synchronized to a slave node during the data synchronization process. A cached data synchronization message may be used to instruct the slave node to synchronize cached data. The slave node may apply for a partition in its configured second CXL device for storing cached data according to the cached data synchronization message. After receiving the RDB data and cached data sent by the master node, the slave node merges the cached data with the RDB data in the local memory to obtain complete synchronized data, so as to ensure data consistency between the master and slave nodes.

[0057] In this way, the RDMA protocol can be used to establish and maintain an efficient communication connection between the master node and the slave node, which improves the efficiency of data transmission. By maintaining the RDMA connection between the master and slave nodes and sending the latest synchronization data, the latest synchronization data can be sent regularly through the connection to ensure the consistency of the master and slave node data.

[0058] Step 203: The master node obtains the target synchronization mode corresponding to the data synchronization request.

[0059] In some embodiments, after the master node checks the slave node application, the master node may determine the target synchronization mode based on the cxlpsync command received from the slave node. The target synchronization mode may include but is not limited to full synchronization, incremental synchronization, etc.

[0060] Step 204: The master node sends the synchronization parameters and replication progress corresponding to the target synchronization mode and the RDB file to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0061] The second CXL device may be a CXL device configured for the slave node. For example, a preset transmission interface, such as the RCXLConnDriver data transmission interface, may be called to send synchronization data and related parameters to the slave node through the RDMA protocol and the CXL protocol to ensure data consistency between the master and slave nodes. As a possible implementation, the data synchronization function of the Redis node based on RCXL (RDMA+CXL) is as follows: a. The Redis slave node initiates cxlpsync to the master node on the left, triggering data synchronization between the master and slave nodes, that is, starting the process of copying the RDB file from the Redis master node to the slave node; b. After the master node checks and approves the slave node's application, the master node receives the cxlpsync command from the slave node and finds that runid has no value. It determines that it is a full synchronization and returns cxlfullresync with the runid and current replication progress of the master server. The slave node receives and stores these two values.

[0062] c. The master node executes cxlbgsave to generate an RDB file. After cxlbgsave is started, the data in the Redis memory is persisted as an RDB, and the cxlmemDriver interface is called to apply for space in the CXL-Pmem device. During this process, the CXL-Pmem page heat algorithm is called to calculate the page temperature and recycle pages with low temperatures. Then the RDB data is written to the CXL-Pmem device to generate an RDB file. During the RDB generation process, the master node also starts a child process cxlfork. cxlfork calls the cxlmemDriver interface to create a temporary replication partition (cxl-replication buffer) in CXL-Pmem. The newly received Redis write data will be stored in the temporary replication partition in CXL-Pmem.

[0063] d. After the RDB file is generated, the master node will call the RCXLConnDriver data transmission interface, and the main parameters include cxlfullresync, runid, offset, etc., and send it to the slave node. After receiving the cxlfullresync and other data returned by the master node, the slave node clears the local old data and creates a receiving partition in CXL-Pmem locally; after the slave node Redis receives the RDB data, it loads the RDB data into the Redis local regular memory; after the slave node loads the RDB into the local memory, it clears the RDB storage space in CXL-Pmem at the same time, reclaims the CXL storage, and puts the address in the free address list.

[0064] e. After the RDB file is loaded in the slave node, the slave node returns a message to the master node, indicating that the RDB data loading is complete. The master node clears the RDB storage space in the local CXL-Pmem, reclaims the CXL storage, and puts the address in the free address list.

[0065] f. The master node sends a message to the slave node "send temporary copied partition data to the slave node". After receiving the message, the slave node applies for cache space in the local CXL-Pmem of the slave node, and receives the temporary copied partition data of the master node to cache in the local CXL-Pmem. After the slave node completes the reception, it loads the temporary copied partition data into the Redis memory and integrates it with the RDB data in d into the complete Redis data. Then it deletes the cached data in the local CXL-Pmem and puts the address space back to the free address.

[0066] g. After the synchronization is completed, the master and slave nodes will maintain an RDMA connection. The master node will pass the subsequent newly written data to the slave node through this connection to ensure the consistency of the data between the master node and the slave node.

[0067] In this way, the present embodiment can develop and implement the function of supporting CXL.Type2 technology protocol memory devices in the node of the remote dictionary service Redis, and support the integration of persistent storage Pmem and CXL, so as to realize the writing and reading of data of CXL-Pmem devices by Redis nodes; develop and design the CXL-Pmem page heat algorithm, increase the page heat counter WR parameter through page configuration, and realize the rapid allocation and recovery of cache pages; combine RDMA with CXL protocol to realize the remote computing link data transmission protocol RCXL, realize the registration and mapping of the local RDMA network card cache address of Redis node and the physical address of CXL-Pmem memory; and realize the direct transmission between CXL-Pmem memory on different nodes based on RDMA between Redis nodes.

[0068] Compared with the prior art, this embodiment can use the RDMA protocol to establish and maintain an efficient communication connection between the master node and the slave node, and the page temperature corresponding to the cache page is compared with the preset page temperature threshold to determine the page that needs to be released, thereby realizing rapid allocation and recovery of cache pages. In addition, the cache data can be synchronized to the slave node during the data synchronization process to achieve complete data synchronization, so as to ensure data consistency between the master and slave nodes.

[0069] Furthermore, this embodiment provides a data synchronization method, which can be applied to a slave node for execution, such as Figure 3 As shown, the method includes: Step 301: The slave node sends a data synchronization request to the master node through the RDMA protocol, so that the master node writes synchronization data corresponding to the data synchronization request into a configured first CXL device and generates a synchronization file corresponding to the synchronization data.

[0070] Exemplarily, the slave node may include a Redis slave node, which may directly send a data synchronization request to the master node through the RDMA protocol. After receiving the data synchronization request, the master node may use a persistence mechanism to persistently write the data to be synchronized into the configured first CXL device, and then send the synchronization data to the slave node through the CXL device, thereby reducing the resource consumption of data replication within the master node.

[0071] Step 302: The slave node receives the synchronization file sent by the master node through the RDMA protocol.

[0072] Correspondingly, the slave node can receive the synchronization files sent by the master node through the RDMA protocol, and can also receive the target synchronization method sent by the master node, as well as the synchronization parameters and replication progress corresponding to the target synchronization method, so as to monitor the synchronization progress in real time, ensure data consistency, and improve the system's disaster redundancy capability.

[0073] Step 303: The slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0074] In some embodiments, a second CXL device may be configured for the slave node to receive the synchronization file sent by the master node. The synchronization data may be parsed by the second CXL device and loaded into the local memory to achieve data synchronization with the master node. The slave node kernel does not need to participate in data synchronization, which reduces resource consumption caused by multiple data values ​​within the slave node, improves data transmission speed, and thereby improves data synchronization efficiency.

[0075] Optionally, step 301 may specifically include: applying for a second storage space for storing the RDB file in the second CXL device; when detecting that the RDB data corresponding to the RDB file is loaded into the local memory, clearing the second storage space, and storing the address corresponding to the second storage space in a free address list of the second CXL device.

[0076] The second storage space may be a storage space in a second CXL device configured from the node for storing synchronization data. After the synchronization is completed, the space may be cleared to provide free storage space for the next data synchronization.

[0077] Compared with the prior art, in this embodiment, the slave node can receive the synchronization file sent by the master node through the RDMA protocol, and load the data corresponding to the synchronization file into memory through the second CXL device. There is no need for the slave node kernel to participate in data synchronization, which reduces the resource consumption caused by multiple data values ​​inside the slave node, improves the data transmission speed, and thus improves the data synchronization efficiency.

[0078] The embodiment of the present application also provides a data synchronization device, as Figure 1 and Figure 2The specific implementation of the method shown can be applied to the master node, such as Figure 4 As shown, the device includes: a receiving module 41, an acquiring module 42, and a synchronization module 43.

[0079] A receiving module 41 is configured to receive a data synchronization request sent by a slave node via an RDMA protocol; An acquisition module 42 is configured to acquire synchronization data corresponding to the data synchronization request, write the synchronization data into a configured first CXL device, and generate a synchronization file corresponding to the synchronization data; The synchronization module 43 is configured to send the synchronization file to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

[0080] In some examples of this embodiment, the synchronization file includes an RDB file, and the acquisition module 42 is specifically configured to convert the synchronization data into remote dictionary RDB data according to a persistence command supporting the CXL protocol; apply for a first storage space in the first CXL device, write the RDB data into the first storage space, and generate an RDB file corresponding to the RDB data.

[0081] In some examples of this embodiment, the synchronization module 43 is specifically configured to obtain a target synchronization mode corresponding to a data synchronization request; and send synchronization parameters and replication progress corresponding to the target synchronization mode, as well as an RDB file to the slave node through the RDMA protocol.

[0082] In some examples of this embodiment, the receiving module 41 is further configured to configure a CXL root port through a system bus, and connect a first CXL device using the CXL root port; call a memory driver module to obtain scanning information of the first CXL device, register the first CXL device to the system memory according to the scanning information, and save the configuration information of the first CXL device through a configuration file.

[0083] In some examples of this embodiment, the receiving module 41 is specifically configured to access the first CXL device according to the configuration information, send the data synchronization request to the CXL root port corresponding to the first CXL device; obtain the CXL link control unit packet corresponding to the data synchronization request by using the CXL root port, and send the CXL link control unit packet to the first CXL device corresponding to the CXL root port.

[0084] In some examples of this embodiment, the receiving module 41 is further configured to call the memory driver module to determine the first storage space in the first CXL device, and configure the operation permission and operation key of the first storage space.

[0085] In some examples of this embodiment, the receiving module 41 is further configured to receive a remote request sent by a remote host, where the remote request is used to request an operation permission and an operation key, and remotely access the first storage space based on the operation permission and the operation key.

[0086] In some examples of this embodiment, the receiving module 41 is further configured to, in response to receiving a data loading completion message sent by the slave node, clear the first storage space and store the address corresponding to the first storage space into a free address list of the first CXL device.

[0087] In some examples of this embodiment, the acquisition module 42 is further configured to acquire page access data of cache pages of the first CXL device during the process of generating the RDB file; and determine the target page to be released in the cache pages according to the page access data and a preset page heat threshold.

[0088] In some examples of this embodiment, the acquisition module 42 is further configured to obtain the page heat corresponding to the cached page according to the page access data using a preset heat calculation formula; compare the page heat corresponding to the cached page with the preset page heat threshold to determine the target page.

[0089] In some examples of this embodiment, the acquisition module 42 is further configured to apply for a first cache partition in the first CXL device, where the first cache partition is used to store cache data.

[0090] In some examples of this embodiment, the synchronization module 43 is specifically configured to send a cache data synchronization message to the slave node, where the cache data synchronization message is used to instruct the slave node to apply for a second cache partition for storing cache data in the second CXL device, and integrate the cache data with the RDB data in the local memory; maintain an RDMA connection with the slave node, where the RDMA connection is used to send the latest synchronization data to the slave node.

[0091] It should be noted that for other corresponding descriptions of the functional units involved in the data synchronization device provided in this embodiment, reference can be made to Figure 1 and Figure 2 The corresponding description in will not be repeated here.

[0092] This embodiment provides a data synchronization device, which can be applied to a slave node as Figure 3 The specific implementation of the method shown is as follows Figure 5 As shown, the device includes: a sending module 51, a receiving module 52, and a synchronization module 53.

[0093] The sending module 51 is configured to send a data synchronization request to the master node through the RDMA protocol, so that the master node writes the synchronization data corresponding to the data synchronization request into the configured first CXL device and generates a synchronization file corresponding to the synchronization data; The receiving module 52 is configured to receive the synchronization file sent by the master node through the RDMA protocol; The synchronization module 53 is configured to load the synchronization data in the synchronization file into memory through the configured second CXL device.

[0094] In some examples of this embodiment, the synchronization module 53 is specifically configured to apply for a second storage space for storing the RDB file in the second CXL device; when it is detected that the RDB data corresponding to the RDB file is loaded into the local memory, clear the second storage space, and store the address corresponding to the second storage space in the free address list of the second CXL device.

[0095] Based on the above Figure 1 or Figure 2 or Figure 3 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figure 1 or Figure 2 or Figure 3 The method shown.

[0096] Based on the above Figure 1 or Figure 2 or Figure 3 The method shown in the embodiment also provides a computer program product, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figure 1 or Figure 2 or Figure 3 The method shown.

[0097] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.

[0098] Based on the above Figure 1 or Figure 2 or Figure 3 The method shown, and Figure 4 or Figure 5In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an electronic device, such as a personal computer, a server, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 or Figure 2 or Figure 3 The method shown.

[0099] In some embodiments, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may include a standard wired interface, a wireless interface (such as a WI-FI interface), etc. in some embodiments.

[0100] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.

[0101] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.

[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the solution of this embodiment, compared with the current prior art, the slave node in this embodiment can receive the synchronization file sent by the master node through the RDMA protocol, and load the data corresponding to the synchronization file into memory through the second CXL device, without the need for the slave node kernel to participate in data synchronization, reducing the resource consumption caused by multiple data values ​​inside the slave node, improving the data transmission speed, and thus improving the data synchronization efficiency.

[0103] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0104] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.

Claims

1. A data synchronization method, characterized in that: include: Receive data synchronization requests sent by slave nodes through remote direct memory access (RDMA) protocol; Acquire synchronization data corresponding to the data synchronization request, write the synchronization data into a configured first fast computing link CXL device, and generate a synchronization file corresponding to the synchronization data; The synchronization file is sent to the slave node through the RDMA protocol, so that the slave node loads the synchronization data in the synchronization file into memory through the configured second CXL device.

2. The data synchronization method according to claim 1, characterized in that: The step of writing the synchronization data into the configured first CXL device and generating a synchronization file corresponding to the synchronization data includes: Converting the synchronization data into remote dictionary RDB data according to a persistence command supporting the CXL protocol; Apply for a first storage space in the first CXL device, write the RDB data into the first storage space, and generate an RDB file corresponding to the RDB data.

3. The data synchronization method according to claim 2, characterized in that: The sending the synchronization file to the slave node through the RDMA protocol includes: Obtaining a target synchronization mode corresponding to the data synchronization request; The synchronization parameters and replication progress corresponding to the target synchronization mode and the RDB file are sent to the slave node through the RDMA protocol.

4. The data synchronization method according to claim 2, characterized in that: The method further comprises: Obtaining page access data of cache pages of the first CXL device; According to the page access data and a preset page heat threshold, a target page that needs to be released in the cache page is determined.

5. The data synchronization method according to claim 4, characterized in that: The step of determining a target page to be released in the cache page according to the page access data and a preset page heat threshold comprises: According to the page access data, a page heat corresponding to the cache page is obtained using a preset heat calculation formula; The target page is determined by comparing the page heat corresponding to the cache page with the preset page heat threshold.

6. The data synchronization method according to claim 1, characterized in that: Before acquiring synchronization data corresponding to the data synchronization request, writing the synchronization data into the configured first CXL device, and generating a synchronization file corresponding to the synchronization data, the method further includes: configuring a CXL root port via a system bus, and connecting the first CXL device using the CXL root port; The memory driver module is called to obtain the scanning information of the first CXL device, the first CXL device is registered in the system memory according to the scanning information, and the configuration information of the first CXL device is saved through the configuration file.

7. The data synchronization method according to claim 6, characterized in that: The method further comprises: accessing the first CXL device according to the configuration information, and sending the data synchronization request to a CXL root port corresponding to the first CXL device; A CXL link control unit packet corresponding to the data synchronization request is acquired by using a CXL root port corresponding to the first CXL device, and the CXL link control unit packet is sent to the first CXL device.

8. The data synchronization method according to claim 6, characterized in that: The method further comprises: The memory driver module is called to determine a first storage space in the first CXL device, and to configure operation permissions and an operation key for the first storage space.

9. The data synchronization method according to claim 8, characterized in that: The method further comprises: A remote request sent by a remote host is received, wherein the remote request is used to request the operation permission and the operation key, and the first storage space is remotely accessed according to the operation permission and the operation key.

10. The data synchronization method according to claim 8, characterized in that: The method further comprises: In response to receiving the data loading completion message sent by the slave node, the first storage space is cleared, and the address corresponding to the first storage space is stored in a free address list of the first CXL device.

11. The data synchronization method according to claim 2, characterized in that: The method further comprises: A first cache partition is applied for in the first CXL device, where the first cache partition is used to store cache data.

12. The data synchronization method according to claim 11, characterized in that: The method further comprises: Sending a cache data synchronization message to the slave node, wherein the cache data synchronization message is used to instruct the slave node to apply for a second cache partition for storing the cache data in a second CXL device, and to integrate the cache data with the RDB data in a local memory; An RDMA connection with the slave node is maintained, where the RDMA connection is used to send the latest synchronization data to the slave node.

13. A data synchronization method, characterized in that: include: Sending a data synchronization request to the master node through a remote direct memory access (RDMA) protocol, so that the master node writes synchronization data corresponding to the data synchronization request into a configured first fast computing link (CXL) device, and generates a synchronization file corresponding to the synchronization data; Receiving the synchronization file sent by the master node through the RDMA protocol; The synchronization data in the synchronization file is loaded into memory through the configured second CXL device.

14. The data synchronization method according to claim 13, characterized in that: The step of loading the synchronization data in the synchronization file into memory through the configured second CXL device includes: Applying for a second storage space for storing the RDB file in the second CXL device; When it is detected that the RDB data corresponding to the RDB file is loaded into the local memory, the second storage space is cleared, and the address corresponding to the second storage space is stored in the free address list of the second CXL device.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data synchronization method according to any one of claims 1 to 14 is implemented.

16. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the data synchronization method according to any one of claims 1 to 14 is implemented.

17. A computer program product having a computer program stored thereon, characterized in that: When the computer program product is executed by a processor, the data synchronization method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Cluster data synchronization method, apparatus and device, and computer readable storage medium

    CN115550384A

  • Data processing method and device of distributed storage system, equipment and medium

    CN117255101A

  • Data writing method and device, equipment, medium and distributed file system

    CN117687984A

  • Metadata management method and device, electronic equipment and readable storage medium

    CN118626008A

Cited By

  • Data processing system, method, device, medium and program product

    CN120492370A