Data writing method, data reading method, cache system, terminal device and storage medium

By introducing an acceleration module and persistent memory on the cache server, the problems of high latency and data loss due to power failure in KV caching on the CPU are solved, achieving efficient, low-latency data storage and persistence.

WO2025251765A1PCT designated stage Publication Date: 2025-12-11ZTE CORP
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/086772
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-06-06
Filing Date
2025-04-02
Publication Date
2025-12-11

AI Technical Summary

Technical Problem

In existing technologies, key-value pair caches (KV caches) have high latency when implemented on the central processing unit (CPU), and KV data is easily lost when power is lost when stored in memory.

Method used

The acceleration module includes a cache server consisting of a key-value pair (KV) access unit and a network communication unit. The network communication unit receives and processes KV data, the KV access unit creates an index and stores it in the host memory module, and some data is stored in the storage service server. Persistent memory (PMEM) is used to avoid data loss.

Benefits of technology

It reduces storage latency, improves storage efficiency, and prevents data loss in the event of power failure, achieving high-concurrency, low-latency data persistence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025086772_11122025_PF_FP_ABST
    Figure CN2025086772_11122025_PF_FP_ABST
Patent Text Reader

Abstract

The present application belongs to the field of data processing. Disclosed are a data writing method, a data reading method, a cache system, a terminal device and a storage medium. The data writing method is applied to a cache server. The cache server comprises a host memory module and an acceleration module, wherein the acceleration module comprises a key-value (KV) access unit and a network communication unit. The method comprises: a network communication unit receiving KV data sent by a client, and processing the KV data, wherein the KV data is data in a data format corresponding to the network communication unit; the network communication unit sending processed KV data to a KV access unit; the KV access unit establishing a KV index on the basis of the KV data and storing the KV index in a host memory module; and the KV access unit storing at least part of the KV data in a storage server.
Need to check novelty before this filing date? Find Prior Art

Description

Data writing, reading method, cache system, terminal device and storage medium

[0001] Cross-reference to related applications

[0002] The present application claims priority to the Chinese patent application No. 202410727604.X, filed on June 6, 2024, and entitled "Data writing, reading method, cache system, terminal device and storage medium", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0003] The present application belongs to the field of data processing, and particularly relates to a data writing, reading method, cache system, terminal device and storage medium. BACKGROUND

[0004] The Key-Value (KV) cache in the related technology is usually implemented by software, such as memCache, Dcache, Redis, etc., which are all executed on a Central Processing Unit (CPU) to perform Log-Structured Merge-Tree (LSM-Tree) or Hash algorithm, save KV data in the memory and support fast index reading, which causes the problem of easy loss of data in power failure. Since a large number of clients have to be faced, the performance of the cache server must be strong, but the delay is high when implemented on the CPU.

[0005] Therefore, there is an urgent need for a new cache mode to solve the above problems. SUMMARY

[0006] The present application aims to provide a data writing, reading method, cache system, terminal device and storage medium, which at least solves the problem of high delay when the KV cache in the related technology is implemented on the CPU, and easy loss of data in power failure when the KV data is saved in the memory.

[0007] In a first aspect, the embodiments of the present application propose a data writing method applied to a cache server, wherein the cache server comprises a host memory module and an acceleration module, the acceleration module comprises a Key-Value (KV) access unit and a network communication unit, and the method comprises: receiving, by the network communication unit, KV data sent by a client, and processing the KV data, wherein the data is data in a data format corresponding to the network communication unit; sending, by the network communication unit, the processed KV data to the KV access unit; establishing, by the KV access unit, a KV index based on the KV data and storing the KV index to the host memory module; and storing, by the KV access unit, at least part of the data in the KV data to a storage server.

[0008] In a second aspect, an embodiment of the present application provides a data reading method applied to a cache server, the cache server comprising a host memory module and an acceleration module, the acceleration module comprising a KV access unit and a network communication unit, the method comprising: the network communication unit receiving KV data sent by a client and processing the KV data, the data being data in a data format corresponding to the network communication unit; the network communication unit sending the processed KV data to the KV access unit; the KV access unit searching in the host memory module based on the KV data; in a case where there is a matching item of the KV data in the host memory module, the KV access unit reading corresponding data in the host memory module and returning to the network communication unit; in a case where there is no matching item of the KV data in the host memory module, the KV access unit sending the KV data to a storage server to obtain corresponding data; and the network communication unit encapsulating the corresponding data into data in a data format corresponding to the network communication unit and sending the data to the client.

[0009] In a third aspect, an embodiment of the present application provides a cache system, comprising: a client, a cache server and a storage server, the client being configured to collect service requirements of a terminal and convert the service requirements into KV data, encapsulate the KV data into a data format corresponding to a network communication unit in the cache server, and communicate with the cache server; the cache server comprising a host memory module and an acceleration module, the acceleration module comprising a KV access unit and the network communication unit, the network communication unit being configured to communicate with the client and process the KV data; the KV access unit being configured to establish a KV index, save KV data received by the network communication unit to the host memory module, and communicate with the storage server to store at least part of the KV data to the storage server; and the storage server being configured to store data and communicate with the cache server.

[0010] In a fourth aspect, an embodiment of the present application provides a terminal device, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, the program or instruction being executed by the processor to implement the steps of the data writing method according to the first aspect, or to implement the steps of the data reading method according to the second aspect.

[0011] In a fifth aspect, an embodiment of the present application provides a storage medium, the storage medium storing a program or instruction, the program or instruction being executed by a processor to implement the steps of the data writing method according to the first aspect, or to implement the steps of the data reading method according to the second aspect.

[0012] In a sixth aspect, an embodiment of the present application provides a program product stored in a storage medium, and the program product is executed by at least one processor to implement the steps of the data writing method according to the first aspect, or to implement the steps of the data reading method according to the second aspect. BRIEF DESCRIPTION OF DRAWINGS

[0013] The above and / or additional aspects and advantages of the present application will become apparent and more readily appreciated from the following description of embodiments, taken in conjunction with the accompanying drawings, in which:

[0014] FIG. 1 is a flowchart of a data writing method according to an embodiment of the present application;

[0015] FIG. 2 is a schematic diagram of a data writing method according to an embodiment of the present application;

[0016] FIG. 3 is a flowchart of a data reading method according to an embodiment of the present application;

[0017] FIG. 4 is a schematic diagram of a cache system according to an embodiment of the present application;

[0018] FIG. 5 is a schematic diagram of a terminal device according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] Embodiments of the present application will be described in detail below with reference to the drawings, in which the same or similar components have the same reference numbers throughout the several views. The embodiments described below are examples in which the application is applied, and are intended to explain the present application, and should not be understood as limiting the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work under the premise that the scope of the present application.

[0020] The terms "first", "second" in the description and claims of the present application can explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally means that the front and rear associated objects are in an "or" relationship.

[0021] In the description of the present application, it needs to be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application.

[0022] In the description of the present application, it needs to be understood that the terms "mounting", "connection", "connection" should be understood broadly, for example, it can be fixed connection, or detachable connection, or integral connection; it can be mechanical connection, or electrical connection; it can be directly connected, or indirectly connected through intermediate medium, or the communication inside two elements. For those skilled in the art, the meaning of the above terms in the present application can be understood according to the situation.

[0023] In the following, combined with FIG. 1 to FIG. 5, the data writing and reading method, the terminal device and the storage medium provided by the embodiments of the present application are described in detail through embodiments and application scenarios.

[0024] FIG. 1 is a flowchart of a data writing method provided by the embodiments of the present application. As shown in FIG. 1, the data writing method can be applied to a cache server, which includes a host memory module and an acceleration module. The acceleration module includes a key-value pair (KV) access unit and a network communication unit. The data writing method can include the contents shown in steps 101 to 104.

[0025] In S101, the network communication unit receives the KV data sent by the client and processes the KV data.

[0026] Among them, the KV data is data in a data format corresponding to the network communication unit.

[0027] In this embodiment, the client is responsible for collecting the business requirements of the terminal and converting them into KV data, and then sending them to the network communication unit of the cache server. For example, if the network communication unit is a remote direct memory access (RDMA) communication module or a RDMA-like communication module, the client encapsulates the KV data into the data format of RDMA or RDMA-like.

[0028] In S102, the network communication unit sends the processed KV data to the KV access unit.

[0029] That is, the network communication unit can directly pass the KV data to the KV access module without CPU intervention after receiving the KV data, which can improve storage efficiency and reduce latency.

[0030] In S103, the KV access unit establishes a KV index based on the KV data and stores the KV data to the host memory module.

[0031] The host memory module is a memory on the host side, which can be a persistent memory (PMEM) or other non-volatile memory, so that the data stored in the host memory module is not lost when power is off.

[0032] In this embodiment, the KV access unit is used to establish the index of the KV and store the KV data to the host memory module. The KV access unit also needs to cooperate with the software on the host side to perform data migration service to write the data written by the client from the cache server to the storage server in the back end.

[0033] In S104, the KV access unit stores at least part of the KV data to the storage server.

[0034] The KV access unit can store at least part of the KV data to the storage server through the data migration module, or store it through the data line, etc. The actual application is subject to the actual application, and this embodiment does not make any limitation. It is worth noting that this embodiment places the network communication unit and the KV access unit in a separate module for acceleration processing, which can be placed on a field programmable gate array (FPGA) or other hardware for execution, and directly saves the KV data in the PMEM or other non-volatile memory on the host side through the FPGA or other hardware, thereby releasing the dependence of the KV access unit and the network communication unit on the CPU, and making the cache data persistent while maintaining high concurrency and low latency performance.

[0035] In the embodiment of the present application, the data writing method is applied to the cache server, the cache server can include a host memory module and an acceleration module, the acceleration module includes a KV access unit and a network communication unit, first, the network communication unit receives the KV data sent by the client, and processes the KV data, the data is data in a data format corresponding to the network communication unit, the network communication unit sends the processed KV data to the KV access unit, then the KV access unit establishes a KV index based on the KV data and stores it to the host memory module, finally, the KV access unit stores at least part of the data in the KV data to the storage server. The embodiment of the present application places the KV access unit and the network communication unit in a separate module for acceleration processing, which can enable faster storage of data in the host memory module or the storage server based on the KV index after receiving the KV data from the client, improving storage efficiency, and storing data in the host memory module or the storage server can avoid data loss due to power failure.

[0036] In one possible implementation of the present application, the network communication unit is a RDMA-like communication unit, the network communication unit receives the KV data sent by the client and processes the KV data, which can include: the RDMA-like communication unit receives the KV data sent by the client; based on the KV data, the data link (Medium Access Control, MAC) layer, the network (Internet Protocol, IP) layer, the user datagram protocol (User Datagram Protocol, UDP) layer, and the message header of the RDMA-like message are parsed to obtain the original KV data packet.

[0037] That is, after the RDMA-like communication unit of the cache server receives the KV data sent by the client, the data is parsed to obtain the MAC layer, IP layer, UDP layer, and message header of the RDMA-like message to restore the original KV data packet, and the KV data is cached in the storage unit of the acceleration module, such as the double data rate synchronous dynamic random access memory (DDR) in FIG. 2.

[0038] In the embodiment of the present application, the received KV data is parsed and processed by the RDMA-like communication unit to obtain the original data to be written.

[0039] In one possible implementation of the present application, before the network communication unit receives the KV data sent by the client, the data writing method can further include: sending a credit quota to the client, the credit quota being used to determine the quota of receivable data packets.

[0040] That is, when the cache server and the client establish a connection, the cache server issues a credit quota to the client, so that the client can send data packets to the cache server based on the credit quota, and the client can improve the priority of sending data packets using the credit quota as needed. When the credit quota is used up, the client stops sending data packets to the cache server and waits for the cache server to update the credit quota.

[0041] The credit quota is issued and updated through the Flow Credit field in the message header of the RDMA-like message. The cache server can allocate credit quotas to the client according to its processing capacity, and can dynamically adjust to reduce or stop allocating credit quotas to the client in the case of network congestion until the network congestion is resolved.

[0042] It is worth noting that the credit quota is delivered by the number of allowed packets or other measurement parameters. The advantage of using the number of packets is that both the sender and the receiver can directly use this parameter without needing to make another conversion. This parameter is defined in the RDMA-like header. The cache server does not need to update this value for each message. If the rate does not need to be adjusted, the number of credit quotas from the last time can be used. If the rate needs to be adjusted, the cache server updates the parameter again. For the client, the parameter needs to be retrieved for each message, and the sending rate is adjusted according to the parameter change. Under normal circumstances, the client will always maintain a certain credit quota as the starting packet.

[0043] In one possible implementation of the present application, the data writing method can further include updating the credit quota according to a total credit quota of the storage server and a quota of data packets that have been received by the storage server, wherein the total credit quota is counted by the storage server according to its processing capacity.

[0044] That is, the cache server can count the total credit quota according to its processing capacity, and update the credit quota according to the quota of data packets that have been received, i.e., the consumption of the credit quota of the client.

[0045] The update of the credit quota is obtained through a specific field Flow Credit field in the RDMA-like message header. The client itself maintains the consumption of the credit quota. For each message sent, the credit quota decreases by one. After the cache server updates the quota, the client updates the quota accordingly. When the quota consumption reaches zero, the client stops sending.

[0046] The present embodiment can significantly reduce the occurrence of network congestion by issuing and updating the credit quota, and can quickly respond and quickly resolve the congestion after the network congestion occurs.

[0047] In a possible implementation of the present application, the RDMA-like communication unit receives the KV data sent by the client, which can include: the RDMA-like communication unit receiving the packet slices of the KV data sent by the client one by one, each packet slice including address information of the packet slice; in the case that all packet slices are received, detecting the addresses of all packet slices; in the case that a packet slice is detected to be missing, notifying the client based on the address information of the missing packet slice, so that the client retransmits the missing packet slice based on the address information.

[0048] In the present embodiment, when the client sends the KV data, the packet of the entire data is sliced and then sent, and an offset bitmap can be allocated to each slice. When each slice is sent, the address information of the slice is sent in the packet header at the same time. The RDMA-like communication unit marks the item in the local address table based on the address of the current packet when the first packet slice is received. The address detection device detects the addresses of the entire data segment space when the packet of the last address arrives. If all slices are detected to be received, the complete packet is considered to be received. If a slice is missing, the retransmission notification device sends the address of the packet detected to be missing in the last stage to the sender through a format packet for retransmission, so as to achieve the purpose of accurate retransmission and avoid the situation that the network is more congested due to the retransmission of all data in the case of packet loss or error.

[0049] In a possible implementation of the present application, the KV access unit establishes a KV index based on the KV data and stores it to the host memory module, which can include: the KV access unit performing hash calculation on the KV data by using a key as a hash function, establishing a hash index to an index table of storage addresses of the host memory module, and storing the original KV data packet to the address in the host memory module corresponding to the index table.

[0050] That is, the KV access unit can include a HASH function unit and a HASH index unit, and the acceleration module can further include a board PMEM unit and the like. That is, after receiving a complete data write instruction, the KV access unit can perform HASH calculation through the HASH function unit and index the data to an index table of storage addresses such as the board PMEM unit or the host memory module through the HASH index unit.

[0051] In a possible implementation of the present application, the cache server further includes a data migration module, and the KV access unit stores at least part of the KV data to the storage server, which can include: the KV access unit storing at least part of the KV data to the storage server through the data migration module.

[0052] In this embodiment, the data can be stored to the storage server through the data migration module. That is, the data migration module can cooperate with the KV access unit to save the written data to the remote storage server.

[0053] In a possible implementation of the present application, the cache server further includes a hotspot management module, and the KV access unit stores at least part of the KV data to the storage server through the data migration module, which can include: the hotspot management module device identifies the hotspot data and the non-hotspot data in the KV data in the KV access unit; the KV access unit caches the hotspot data to the host memory module or the acceleration module, and stores the non-hotspot data to the storage server through the data migration module.

[0054] In this embodiment, the cache server can further include a hotspot management module, which can identify the hotspot data and form a hotspot cache residing in the local memory, so that the request of the client can be responded more quickly, and the data is avoided to be pulled from the remote end.

[0055] As shown in FIG. 2, it is a schematic diagram of data writing provided by the embodiment of the present application.

[0056] The client sends the KV data to the acceleration module of the cache server, and the RDMA-like communication unit of the acceleration module processes the KV data after receiving the KV data and stores the KV data to the DDR. The write instruction is extracted through the instruction data extraction unit, and after obtaining a complete data write instruction, the HASH function unit of the KV access unit is used for HASH calculation, and the data is indexed to the index table of the storage address such as the PMEM unit on the board or the host memory module through the HASH index unit. The acceleration module can be in the form of a board card and accessed to the host board card through the PCIe / CXL interface. The acceleration module can also be directly integrated on the host board card. The actual application is subject to the actual application, and the embodiment of the present application is not limited.

[0057] In a detailed embodiment of the present application, the overall flow of data writing is as follows: the client is responsible for collecting the business requirements of the terminal, the KV service module of the client converts the data of the business requirements into KV data, the softRoce (Soft RDMA over Converged Ethernet, software-implemented RDMA RoCE protocol stack) module of the client receives the data payload of the KV service module, encapsulates the KV data into a data packet in a data format corresponding to the network communication unit, such as an RDMA or RDMA-like data format, and then sends the data packet of the KV data to the cache server through the normal network card of the client, such as sending to the cache server through the User Datagram Protocol / Internet Protocol (UDP / IP) network.

[0058] The network communication unit in the acceleration module of the cache server, such as the RDMA-like communication unit, is responsible for parsing the KV data message sent by each client, such as the RDMA-like message, and successively parsing the MAC layer, IP layer, UDP layer, and RDMA-like protocol layer message header and restoring the original KV data packet. The data is cached in the storage unit of the acceleration module, that is, the KV message payload is extracted and sent to the KV access unit in the acceleration module. The KV access unit establishes a KV index and saves the KV data received by the network communication unit to the host memory module. The KV access unit can also cooperate with the host side to perform data migration, that is, through the data migration module, the at least part of the KV data is stored to the storage server, and the response of the client that is not on the storage server is sent to the storage server. The response of the storage server is received and returned to the client. The cache server can identify the hot data and non-hot data in the KV data in the KV access unit through the hot spot management module, form a hot cache in the storage unit in the host memory module or the acceleration module, and respond to the request of the client more quickly, avoiding pulling data from a remote end.

[0059] The cache server further includes a KV store (KVS) module, which can cooperate with the Nvme-of (Non-Volatile Memory Express over Fabrics) protocol stack to encapsulate the cached data into a Transmission Control Protocol / Internet Protocol (Tcp / IP) network and deliver it to the storage server, thereby completing the access service to the data of the storage server.

[0060] The client network card and the softRoce module send the KV write response message to the KV service module, and the write instruction of the client is completed.

[0061] FIG. 3 is a flowchart of a data reading method provided by an embodiment of the present application. As shown in FIG. 3, the data reading method can be applied to a cache server, and the cache server includes a host memory module and an acceleration module. The acceleration module includes a key-value pair (KV) access unit and a network communication unit. The data reading method can include the contents shown in steps 301 to 306.

[0062] In S301, the network communication unit receives KV data sent by a client and processes the KV data.

[0063] The KV data is data in a data format corresponding to the network communication unit.

[0064] In this embodiment, the client is responsible for collecting the service requirements of the terminal, and converting the service requirements into KV data, and then sending the KV data to the network communication unit of the cache server. For example, if the network communication unit is an RDMA communication module or a similar RDMA communication module, the client encapsulates the KV data into an RDMA or similar RDMA data format.

[0065] In S302, the network communication unit sends the processed KV data to the KV access unit.

[0066] That is, after receiving the KV data, the network communication unit does not need CPU intervention, and can directly pass the KV data to the KV access module, which can improve storage efficiency and reduce latency.

[0067] In S303, the KV access unit searches in the host memory module based on the KV data.

[0068] The host memory module is a memory on the host side, which can be a PMEM or other non-volatile memory, so that the data stored in the host memory module is not lost during power failure.

[0069] That is, the KV storage unit parses the KV read instruction in the KV data, and searches for the corresponding data in the host memory module based on the instruction.

[0070] In S304, in the case where there is a matching item of the KV data in the host memory module, the KV access unit reads the corresponding data in the host memory module and returns it to the network communication unit.

[0071] In this embodiment, if the corresponding matching item is found in the host memory module, it means that the KV data is saved in the memory on the host side, such as PMEM, and the data is directly read based on the address and returned to the network communication unit.

[0072] In S305, in the case where there is no matching item of the KV data in the host memory module, the KV access unit sends the KV data to the storage server to obtain the corresponding data.

[0073] In this embodiment, if the corresponding matching item is not found in the host memory module, the KV data is sent to the cache server, and the data is pulled from the cache server and returned.

[0074] In S306, the network communication unit encapsulates the corresponding data into a data format corresponding to the network communication unit, and sends the data to the client.

[0075] In this embodiment, whether the data obtained from the host memory module or the data pulled from the cache server, is encapsulated into a corresponding data format in the network communication unit and sent to the client, such as RDMA-like data format, and sent to the client through the UDP / IP network.

[0076] In the embodiment of the application, the data reading method can be applied to the cache server, which includes a host memory module and an acceleration module. The acceleration module includes a KV access unit and a network communication unit. First, the network communication unit receives the KV data sent by the client and processes the KV data. The KV data is data in a data format corresponding to the network communication unit. The network communication unit sends the processed KV data to the KV access unit. The KV access unit searches in the host memory module based on the KV data. Then, in the case that there is a matching item of the KV data in the host memory module, the KV access unit reads the corresponding data in the host memory module and returns it to the network communication unit. In the case that there is no matching item of the KV data in the host memory module, the KV access unit sends the KV data to the storage server to obtain the corresponding data. Finally, the network communication unit encapsulates the corresponding data into data in a data format corresponding to the network communication unit and sends it to the client. In the embodiment of the application, the KV access unit and the network communication unit are placed in separate modules for acceleration processing, which can enable the corresponding data to be found faster in the host memory module or the storage server based on the KV index in the case of receiving the KV data from the client, improve the data reading efficiency, and store the data in the host memory module or the storage server, which can avoid data loss due to power failure.

[0077] In one detailed embodiment of the application, the overall flow of data reading is as follows: the KV service module of the client encapsulates the key value and the read request instruction into a KV read instruction, the softRoce module of the client encapsulates the KV read instruction into a data packet in a data format corresponding to the network communication unit, such as RDMA or RDMA-like data format, and then sends the data packet of the KV data to the cache server through the normal network card of the client, such as through the UDP / IP network to the cache server.

[0078] The network communication unit in the acceleration module of the cache service end, such as the RDMA-like communication unit, is responsible for parsing the KV data message sent by each client, such as the RDMA-like message, and successively parses the MAC layer, IP layer, UDP layer, and RDMA-like protocol layer message header and restores the original KV read instruction, and caches the data in the storage unit DDR of the acceleration module; after receiving a complete KV read instruction, the KV access unit calculates the key by using a hash function, queries whether a matching item can be found in the index table, if the matching item can be found in the index table, it is indicated that the KV data is saved in the PMEM cache, the KV takes the address of the corresponding item in the index table and reads the data to return, if the corresponding matching item cannot be found in the index table, the KV control module sends the read instruction to the cold and hot data migration unit, the latter pulls the data from the remote storage service end through the KVS service and returns; the data returned by the read instruction is re-encapsulated into a UDP / IP message in the RDMA-like module of the service end and sent to the client.

[0079] The client network card and the softRoce module cooperate to extract the KV response data, send the KV response data to the KV service module, and complete the KV read instruction.

[0080] As shown in FIG. 4, the application embodiment further provides a cache system. As shown in FIG. 4, the cache system can include a client, a cache service end, and a storage service end.

[0081] The client is configured to collect the service demand of a terminal and convert the service demand into KV data, encapsulate the KV data into a data format corresponding to the network communication unit in the cache service end, and communicate with the cache service end. The cache service end includes a host memory module and an acceleration module. The acceleration module includes a KV access unit and a network communication unit. The network communication unit is configured to communicate with the client and process the KV data. The KV access unit is configured to establish a KV index, save the KV data received by the network communication unit to the host memory module, and communicate with the storage service end, store at least part of the KV data to the storage service end, or read data from the host memory module or the storage service end based on the KV data. The storage service end is configured to store data and communicate with the cache service end.

[0082] In the embodiment of the present application, the cache system comprises a client, a cache server and a storage server. The client is configured to collect service requirements of a terminal and convert the service requirements into KV data, encapsulate the KV data into a data format corresponding to a network communication unit in the cache server, and communicate with the cache server. The cache server comprises a host memory module and an acceleration module. The acceleration module comprises a KV access unit and a network communication unit. The network communication unit is configured to communicate with the client and process the KV data. The KV access unit is configured to establish a KV index, save the KV data received by the network communication unit to the host memory module, and communicate with the storage server, store at least part of the KV data to the storage server, or read data from the host memory module or the storage server based on the KV data. The storage server is configured to store data and communicate with the cache server. In the embodiment of the present application, the KV access unit and the network communication unit are placed in a separate module for acceleration processing. In the case of receiving KV data from the client, the data can be stored in the host memory module or the storage server based on the KV index, the storage efficiency is improved, or the corresponding data is found in the host memory module or the storage server, the data reading efficiency is improved, and the data is stored in the host memory module or the storage server, which can avoid data loss due to power failure.

[0083] For communication between the cache server and the client, on the one hand, low delay and large bandwidth transmission are required, and on the other hand, data flow is optimized. After the network communication unit of the cache server receives the KV packet, the processor does not need to intervene, and the packet is directly transmitted to the KV access module. Therefore, the network communication unit in the embodiment of the present application can be a RDMA communication unit, as shown below.

[0084] In the embodiment of the present application, the protocol is simplified by using the asymmetric characteristics of the KV service. The KV service network access is initiated by the client and responded by the cache server, regardless of KV read or KV write. Therefore, the embodiment of the present application only supports SEND, Write (first / middle / last) and Ack / Nack (Acknowledgement / Negative Acknowledgement) operation codes in RC (Radio Configuration) mode.

[0085] According to the characteristics of the KV service, the number of clients is large, and the access request of each client is not high. Therefore, a general network card is used in the client to support RDMA access through softRoce, and the cache server is accelerated by using heterogeneous logic, which reduces the deployment cost of the client and ensures the high IOPS (Input / Output Operations Per Second) requirement of the server.

[0086] The RDMA-like logic of the cache server in the embodiment is compatible with the standard RDMA and RDMA-like protocol, and the actual application is subject to verification.

[0087] The message of the RDMA-like communication unit improves the problem of congestion and packet loss requiring retransmission of the entire data packet. The flow control credit (Flow Credit) field and the slice packet address offset (Offset Bitmap) field are added in the custom part of the original RDMA message header. The sending and receiving ends can solve the congestion and flow control problem by exchanging the Flow Credit and Offset Bitmap information.

[0088] In one possible implementation of the present application, the network communication unit is an RDMA-like communication unit, and the transmission layer message of the RDMA-like communication unit is a message in which a flow control credit field and a slice packet address offset field are added in the custom part of the message header of the RDMA message. The flow control credit field is used to store the credit quota allocated by the cache server to the client, so that the client sends data packets to the cache server based on the credit quota. The slice packet address offset field is used to store the address allocated to each slice in the message, so as to determine the address of the lost packet in the case of slice loss, and perform retransmission based on the address of the lost packet.

[0089] That is, the RDMA-like communication unit in the embodiment of the present application adds a flow control credit field and a slice packet address offset field in the custom part of the message header of the RDMA message to solve the problem of network congestion and flow control. That is, by issuing credit flow control, the link traffic is planned, which can significantly reduce the occurrence of congestion, and quickly respond to congestion to quickly eliminate congestion. By allocating Offset Bitmap to each slice in the message, the position information of each slice is sent in the packet header when each slice is sent. If there is slice loss, the retransmission notification device sends the address of the lost packet detected in the previous stage to the sender through the format message of the retransmission notification to achieve accurate retransmission. The custom transmission layer message header (Header) of the RDMA-like communication unit is shown in Table 1.

[0090] Table 1

[0091] Wherein, the first 0-11 bits are the same as the original RDMA message header, and the last 0-15 bits are the custom part in the original RDMA message header. In the embodiment of the present application, the Flow Credit field and the Offset Bitmap field (bold part in Table 1) are defined in this part.

[0092] In a possible implementation of the present application, the cache server comprises a board card connected with the host server through an interface, and the acceleration module is arranged on the board card, and the host memory module is arranged on the host server.

[0093] That is, the acceleration module can be made in the form of a board card, which is connected to the host board card, i.e., the host server, through a PCIe / CXL interface. The dependence of the KV access module and the network communication module on the CPU can be released, and the cache data can be persisted while maintaining high concurrency and low latency performance.

[0094] In a possible implementation of the present application, the client comprises a KV service module and a softRoce module, the KV service module is configured to convert service requirements of a terminal collected by the client into KV data and store the KV data, the service requirements include data writing and data reading, and the softRoce module is configured to encapsulate the KV data in the KV service module into a data format corresponding to the network communication unit, and send the KV data to the cache server through a protocol.

[0095] In a possible implementation of the present application, the cache server further comprises a data migration module, and the KV access unit stores at least part of the KV data to the storage server through the data migration module.

[0096] In a possible implementation of the present application, the cache server further comprises a hotspot management module, and the hotspot management module is configured to identify hotspot data in the KV data, so that the KV access unit caches the hotspot data to the host memory module or the acceleration module.

[0097] In this embodiment, the hotspot data can be identified by the hotspot management module, and the hotspot cache can be formed and resided in the local memory, so that the request of the client can be responded more quickly, and the data can be avoided to be pulled from a remote end.

[0098] As shown in FIG. 5, the present application also provides a terminal device 500, which comprises a processor 501, a memory 502, a program or instructions stored in the memory 502 and executable on the processor 501, the program or instructions are executed by the processor 501 to implement each process of the above-mentioned data writing method or data reading method embodiment, and the same technical effects can be achieved. To avoid repetition, details are not described here.

[0099] The present application also provides a storage medium, which stores a program or instructions, the program or instructions are executed by a processor to implement each process of the data writing method or data reading method embodiment provided in any of the above-mentioned embodiments. And the same technical effects can be achieved. To avoid repetition, details are not described here.

[0100] The processor is the processor in the terminal device in the above-mentioned embodiments. The storage medium includes a computer storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0101] The chip provided in the embodiments of the present application includes a processor and a communication interface, the communication interface is coupled with the processor, the processor is used to run programs or instructions, realizes each process of the above-mentioned data writing method or data reading method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described here.

[0102] It should be understood that the chip mentioned in the embodiments of the present application can also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.

[0103] The computer program / program product provided in the embodiments of the present application is stored in a storage medium, and is executed by at least one processor to realize each process of the above-mentioned data writing method or data reading method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described here.

[0104] The processing device provided in the embodiments of the present application is configured to execute each process of the above-mentioned data writing method or data reading method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described here.

[0105] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such a process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to the order of performing the functions shown or discussed, but can also include performing the functions in a substantially simultaneous manner or in a reverse order, for example, the described method can be performed in an order different from that described, and various steps can also be added, omitted, or combined. In addition, the features described with reference to certain examples can be combined in other examples.

[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned example methods can be realized by means of software and a necessary general hardware platform, and of course, can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a computer software product in essence or in the form of a part that contributes to the prior art, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application.

[0107] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative and not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. A data writing method applied to a cache server, the cache server comprising a host memory module and an acceleration module, the acceleration module comprising a key-value (KV) access unit and a network communication unit, the method comprising: receiving, by the network communication unit, KV data sent by a client, and processing the KV data, the KV data being in a data format corresponding to the network communication unit; sending, by the network communication unit, the processed KV data to the KV access unit; establishing, by the KV access unit, a KV index based on the KV data, and storing the KV index to the host memory module; storing, by the KV access unit, at least part of the KV data to a storage server.

2. The method of claim 1, wherein, The network communication unit is a RDMA-like communication unit, and the network communication unit receives KV data sent by a client and processes the KV data, comprising: receiving, by the RDMA-like communication unit, KV data sent by a client; based on the KV data, parsing the MAC layer, IP layer, UDP layer, and RDMA-like packet header to obtain the original KV data packet.

3. The method of claim 2, wherein, Before the network communication unit receives KV data sent by a client, the method further comprises: sending a credit quota to the client, the credit quota being used to determine the quota of receivable data packets.

4. The method of claim 3, wherein, The method further comprises: updating the credit quota according to the total credit quota of the storage server and the quota of data packets received by the storage server, wherein the total credit quota is calculated by the storage server according to its processing capacity.

5. The method of claim 2, wherein, The RDMA-like communication unit receives KV data sent by a client, comprising: The RDMA-like communication unit receives KV data sent by a client, comprising: The RDMA-like communication unit receives KV data sent by a client, comprising: The RDMA-like communication unit receives KV data sent by a client, comprising:

6. The method of claim 2, wherein, The cache server further comprises a data migration module, and the KV access unit stores at least part of the KV data to the storage server through the data migration module. The cache server further comprises a hotspot management module, and the KV access unit stores at least part of the KV data to the storage server through the data migration module. ​ 7. The method of claim 6, wherein, ​ ​ 8. The method of claim 7, wherein, ​ The hotspot management module device identifies hotspot data and non-hotspot data in the KV data in the KV access unit; The KV access unit caches the hotspot data to the host memory module or the acceleration module, and stores the non-hotspot data to a storage service end through the data migration module.

9. A data reading method applied to a cache service end, the cache service end comprising a host memory module and an acceleration module, the acceleration module comprising a KV access unit and a network communication unit, the method comprising: The network communication unit receives KV data sent by a client and processes the KV data, the KV data being data in a data format corresponding to the network communication unit; The network communication unit sends the processed KV data to the KV access unit; The KV access unit searches in the host memory module based on the KV data; In the case that there is a matching item of the KV data in the host memory module, the KV access unit reads corresponding data in the host memory module and returns to the network communication unit; In the case that there is no matching item of the KV data in the host memory module, the KV access unit sends the KV data to the storage service end to obtain corresponding data; The network communication unit encapsulates corresponding data into data in a data format corresponding to the network communication unit and sends to the client.

10. A cache system comprising: Client, cache service end and storage service end, The client is configured to collect service demands of a terminal and convert the service demands into KV data, encapsulate the KV data into a data format corresponding to a network communication unit in the cache service end, and communicate with the cache service end. The cache service end comprises a host memory module and an acceleration module, the acceleration module comprising a KV access unit and the network communication unit, the network communication unit being configured to communicate with the client and process the KV data; the KV access unit is configured to establish a KV index, save KV data received by the network communication unit to the host memory module, and communicate with the storage service end to store at least part of the KV data to the storage service end or read data from the host memory module or the storage service end based on the KV data. The storage service end is configured to store data and communicate with the cache service end.

11. The system of claim 10, wherein, The network communication unit is a RDMA-like communication unit, a transmission layer packet of the RDMA-like communication unit comprises a flow control credit field and a slice packet address offset field added in a custom part of a packet header of an RDMA packet, the flow control credit field is configured to store a credit quota allocated to the client by the cache service end, so that the client sends a data packet to the cache service end based on the credit quota; the slice packet address offset field is configured to store an address allocated to each slice in a packet, so as to determine a packet loss address in the case of slice loss, and perform retransmission based on the packet loss address.

12. The system of claim 10, wherein, The cache server includes a board card connected with a host server through an interface, and the acceleration module is arranged on the board card, and the host memory module is arranged on the host server.

13. The system of claim 10, wherein, The client includes a KV service module and a softRoce module, The KV service module is configured to convert service requirements of a terminal collected by the client into KV data and store the KV data, and the service requirements include data writing and data reading. The softRoce module encapsulates the KV data in the KV service module into a data format corresponding to the network communication unit, and sends the KV data to the cache server through a protocol.

14. The system of claim 10, wherein, The cache server further includes a data migration module, The KV access unit stores at least part of the KV data to a storage server through the data migration module.

15. The system of claim 10, wherein, The cache server further includes a hotspot management module, The hotspot management module is configured to identify hotspot data in the KV data, so that the KV access unit caches the hotspot data to the host memory module or the acceleration module. 16.A terminal device, comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, wherein the program or instructions are executed by the processor to implement the steps of the data writing method according to any one of claims 1 to 8, or to implement the steps of the data reading method according to claim 9. 17.A storage medium, wherein a program or instructions are stored on the storage medium, and the program or instructions are executed by a processor to implement the steps of the data writing method according to any one of claims 1 to 8, or to implement the steps of the data reading method according to claim 9. 18.A program product stored in a storage medium, wherein the program product is executed by at least one processor to implement the steps of the data writing method according to any one of claims 1 to 8, or to implement the steps of the data reading method according to claim 9.

Citation Information

Patent Citations

  • Data interaction method and device

    CN114020753A

  • Distributed key value storage method and device based on isomorphic adaptive learning index

    CN114138780A

  • Metadata acquisition method, network equipment and system

    CN114625762A

  • Data storage management method and device and electronic equipment

    CN116048879A

  • KV storage method based on FPGA

    CN116257521A