Data access method, equipment and network card

By having the network interface card (NIC) manage the cache lock state in a distributed system, the high latency problem of data transmission in the RDMA protocol is solved, a high-performance distributed cache consistency protocol is realized, and system performance is improved.

CN121664883APending Publication Date: 2026-03-13CHENGDU HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In distributed systems, the high latency of RDMA protocol data transmission is mainly due to the long processing path caused by the CPU handling the encryption/unlocking operations and data transfer operations of the coherence protocol.

Method used

The network interface card (NIC) is used to manage the state of cache locks. The NIC queries the cache lock state to determine access permissions, avoiding CPU involvement and speeding up the data access and processing path.

Benefits of technology

Reduce the latency of data transmission in the RDMA protocol, improve system performance, and realize a high-performance distributed cache coherence protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121664883A_ABST
    Figure CN121664883A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data access method and device and a network card, and relates to the technical field of storage. The state of the cache lock is stored in the first service node, in the processing process of the read request, the first network card of the first service node receives the read request of the second service node, and the state of the cache lock is inquired through the first cache included in the read request. And when the state of the cache lock is no lock or read lock, the first network card returns a first confirmation message to the second service node. Compared with a scheme of judging the locking and unlocking of the consistency protocol through a CPU, the embodiment of the invention does not need the participation of the CPU, realizes the recognition of the state of the cache lock through the network card, and further obtains the access authority of the second service node to the cache lock. Therefore, by shortening the length of a processing path in data access and reducing the transmission delay of RDMA protocol data transmission, a high-performance distributed cache consistency protocol is realized, the computing power of a CPU (Central Processing Unit) is liberated, and the overall performance of a system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, specifically to a data access method, device, and network interface card. Background Technology

[0002] In distributed systems, the same data may be replicated multiple times and stored on different nodes. When a user modifies the cache, it is necessary to ensure data consistency between nodes. Currently, cache management is mainly achieved through consistency protocols, and data is transmitted via the Remote Direct Memory Access (RDMA) protocol.

[0003] Because current consensus protocols rely on the Central Processing Unit (CPU) within a node to determine whether a cache can be accessed, perform cache locking / unlocking operations, and handle data transfer, scenarios involving data transfer via RDMA require the CPU to process consensus protocol locking / unlocking and the transfer of cached data to the network interface card (NIC). This long processing path results in high data transmission latency in current distributed systems.

[0004] In distributed systems, reducing the transmission latency of data transmitted via the RDMA protocol has become a pressing technical problem. Summary of the Invention

[0005] This application provides a data access method, device, and network interface card (NIC) to reduce the transmission latency of data transmitted via the RDMA protocol.

[0006] Firstly, this application provides a data access method. The first service node of the method includes a processor, a memory, and a first network interface card (NIC). The first service node is the owner node of a first cache. The memory stores the state of a cache lock for the first cache. This cache lock is used to indicate access permissions to the first cache. The state includes: unlocked, read-locked, or write-locked. During the processing of a read request, when the first NIC of the first service node receives a first read request for the first cache from a second service node, it queries the cache lock state through the first cache. If the cache lock state is unlocked or read-locked, the first NIC returns a first acknowledgment message to the second service node that sent the read request, indicating that the second service node has read permissions to the first cache.

[0007] Based on the first aspect, in the process of handling read requests, compared to the scheme of locking and unlocking through the CPU to determine the consistency protocol, the embodiment of this application does not require the participation of the CPU. The network card realizes the identification of the cache lock status, and then obtains the access rights of the second service node to the cache lock. In this way, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data transmission, a high-performance distributed cache consistency protocol is realized, freeing up CPU computing power and helping to improve the overall performance of the system.

[0008] In one optional implementation, the first cache includes one or more storage units. The state of the cache lock in the first cache includes the state of the cache lock for each storage unit in the first cache. The state of the cache lock is used to indicate the access permissions for each storage unit in the first cache. Optionally, a first read request is used to request read permission for the first storage unit in the first cache. In the implementation where the first network interface card (NIC) queries the cache lock state based on the first read request, the first NIC queries the state of the cache lock for the first storage unit based on the first read request. The first confirmation message is used to indicate that the second service node has read permission for the first storage unit in the first cache.

[0009] In this way, fine-grained management of cache locks is achieved at the storage unit level, ensuring cache consistency across business nodes.

[0010] In one optional implementation, the specific steps are as follows: If the cache lock is in a write lock state, the first network interface card (NIC) determines the node holding the cache lock. If the node holding the cache lock is a third service node, the first NIC sends a first cache reclamation request to the third service node. This first cache reclamation request instructs the third service node to release the cache lock on the first storage unit. The first NIC receives a second acknowledgment message returned by the third service node. If the second acknowledgment message indicates that the cache lock on the first storage unit has been successfully released, the first NIC sends a first acknowledgment message to the second service node.

[0011] Based on this optional implementation, when read-write conflicts occur on the same cache across different service nodes, the first network interface card (NIC) initiates a cache retrieval process. Only after the node holding the cache lock successfully releases it does the first NIC return a first acknowledgment message to the second service node. This ensures data consistency across multiple service nodes. Furthermore, in the event of a read-write conflict, cache retrieval is handled by the first NIC, eliminating the need for processor intervention, reducing the processing path length in read-write conflict scenarios, and improving data transmission efficiency.

[0012] In one optional implementation, the specific implementation is as follows: A first network interface card (NIC) receives a first write request from a second service node, which requests write permission to a second storage unit in a first cache. The first NIC queries the status of the cache lock for the second storage unit based on the first write request. If the cache lock for the second storage unit is in the read lock state, the first NIC determines the node holding the cache lock for the second storage unit. If the node holding the cache lock for the second storage unit includes only the second service node, the first NIC sends a fourth acknowledgment message to the second service node, which indicates that the second service node has write permission to the second storage unit.

[0013] Based on this optional implementation, during the write request processing, when the cache lock is in a read lock state and the node holding the cache is the second service node, the first network interface card (NIC) returns a fourth acknowledgment message to the second service node that sent the write request. Compared to the scheme where the CPU determines cache locking / unlocking, this embodiment does not require CPU involvement. Instead, the first NIC identifies the cache lock state and determines whether to grant cache access permissions to the second service node. Thus, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data, a high-performance distributed cache consistency protocol is achieved, freeing up CPU computing power and improving the overall system performance.

[0014] In one optional implementation, the specific implementation is as follows: if the node holding the cache lock of the second storage unit does not include the second service node, or if the node holding the cache lock of the second storage unit includes both the second and third service nodes, the first network interface card (NIC) sends a fifth acknowledgment message to the second service node. The fifth acknowledgment message is used to indicate that the second service node does not have write permission to the second storage unit.

[0015] In this way, cache consistency between business nodes can be guaranteed even when there are read / write conflicts on the same cache across different business nodes.

[0016] In one optional implementation, the specific steps are as follows: If the cache lock of the second storage unit is in a write lock or read lock state, the first network interface card (NIC) determines the node holding the cache lock of the second storage unit. If the node holding the cache lock of the second storage unit includes a third service node, the first NIC sends a second cache reclamation request to the third service node. The second cache reclamation request instructs the third service node to release the cache lock of the second storage unit. The first NIC receives a third acknowledgment message returned by the third service node. If the third acknowledgment message indicates that the cache lock of the second storage unit has been successfully released, the first NIC sends a fourth acknowledgment message to the second service node.

[0017] Based on this optional implementation, in the event of a read-write conflict in the second storage unit, the first network interface card (NIC) recalls the cache lock for the second storage unit. Based on the cache lock recall result, if the cache lock is successfully released, the first NIC allows the second service node to write data to the second storage unit. This ensures cache consistency across multiple service nodes. Furthermore, when read-write conflicts occur on the same cache across different service nodes, the NIC handles the cache lock recall without processor intervention, reducing the processing path length in read-write conflict scenarios and improving data transmission efficiency.

[0018] In one optional implementation, the specific implementation is as follows: If the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a read lock state, the first network interface card (NIC) receives a first cache lock change request from the second service node. This first cache lock change request is used to request that the second service node's access permission to the first storage unit be modified to write permission. The first NIC determines the node holding the cache lock on the first storage unit. If the node holding the cache lock on the first storage unit includes only the second service node, the first NIC updates the cache lock state of the first storage unit to a write lock and returns a sixth acknowledgment message to the second service node. The sixth acknowledgment message indicates that the second service node's access permission change to the first storage unit was successful.

[0019] Based on this optional implementation, when the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a read lock state, the cache lock state of the first storage unit can be changed to a write lock through a single request. Thus, without the second service node actively returning the cache lock, the first network interface card can achieve cache lock state switching, reducing the number of cache requests transmitted between service nodes.

[0020] In one optional implementation, the specific implementation is as follows: When the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a write lock state, the first network interface card (NIC) receives a second cache lock change request from the second service node. This second cache lock change request is used to request that the second service node's access permission to the first storage unit be modified to read permission. The first NIC updates the cache lock state of the first storage unit to a read lock and returns a seventh acknowledgment message to the second service node. The seventh acknowledgment message indicates that the second service node's access permission change to the first storage unit was successful.

[0021] Based on this optional implementation, when the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a write lock state, the cache lock state of the first storage unit can be changed to a read lock through a single request. Thus, without the second service node actively returning the cache lock, the first network interface card can achieve cache lock state switching, reducing the number of cache requests transmitted between service nodes.

[0022] In one optional implementation, the specific implementation is as follows: when the second service node holds a cache lock on the second storage unit in the first cache, the first network interface card (NIC) receives a cache lock return request from the second service node. This cache lock return request indicates the return of the cache lock on the second storage unit. The first NIC updates the information of the node holding the cache lock on the second storage unit. After the information of the node holding the cache lock on the second storage unit is updated, if the node holding the cache lock on the second storage unit is empty, the first NIC updates the status of the cache lock on the second storage unit to unlocked.

[0023] In this way, when the first network interface card (NIC) receives the first cache lock return request, the first NIC of the first service node updates the cache lock's state and the node holding the cache lock. This ensures cache consistency across multiple service nodes. Furthermore, it eliminates the need for processor (CPU) involvement, reducing the processing path length in cache lock update request scenarios and improving data transmission efficiency.

[0024] In one optional implementation, the specific implementation is as follows: if the first service node does not hold a cache lock on the third storage unit in the second cache, the first network interface card (NIC) sends a second read request to the fourth service node. The fourth service node is the owner node of the second cache. This second read request is used to request read permission from the fourth service node for the third storage unit in the second cache.

[0025] Based on this optional implementation method, business nodes can grant cache to other business nodes or request cache from other business nodes, thereby realizing the function of cache sharing among business nodes and improving the functional diversity of business nodes.

[0026] In one optional implementation, the specific implementation is as follows: the memory stores the cache lock holding state of the first service node for the third storage unit in the second cache. After the first network interface card (NIC) sends a second read request to the fourth service node, the first NIC receives an eighth acknowledgment message returned by the fourth service node. If the eighth acknowledgment message indicates that the first service node has read permission for the third storage unit in the second cache, the first NIC modifies the holding state stored in the memory to hold a read lock.

[0027] In this way, the holding status of the cache lock by the business nodes can be updated in a timely manner.

[0028] In one optional implementation, the specific implementation is as follows: The first network interface card (NIC) receives a third cache reclamation request from the fourth service node. The third cache reclamation request indicates that the cache lock held by the first node for the third storage unit be reclaimed. The first NIC queries the holding status in the memory based on the third cache reclamation request. If the holding status is any of the following, the first NIC returns a ninth acknowledgment message to the fourth service node and updates the holding status in the memory to "not holding a cache lock": requesting a read lock, holding a read lock, requesting a write lock, requesting a cache lock upgrade, requesting a cache lock downgrade, or the cache lock has been released; the ninth acknowledgment message indicates that the first service node has successfully released the cache lock on the third storage unit of the second cache.

[0029] When the cache lock of the third cache unit is in the state of holding a write lock, the first network card returns a tenth acknowledgment message to the fourth service node; the tenth acknowledgment message is used to indicate that the first service node failed to release the cache lock of the third storage unit of the second cache.

[0030] In this way, the first network interface card responds to the third cache eviction request by holding the cache lock and returns the corresponding confirmation message, ensuring cache consistency across multiple service nodes. Furthermore, the cache eviction process does not require the involvement of the processor (CPU), reducing the processing path length of the cache lock update request and improving data transmission efficiency.

[0031] In one alternative implementation, the first read request and the first acknowledgment message are implemented based on the Remote Direct Memory Access (RDMA) protocol; the first address is carried by an extension field of the RDMA protocol.

[0032] The header of the first read request includes a read request opcode and a first extended header field. This first extended header field contains a first protocol primitive field and an identifier field indicating a first address. Optionally, the first protocol primitive field is used to indicate a cache read operation.

[0033] The first confirmation message header includes a read request opcode and a second extended header field. This second extended header field contains: a first protocol primitive field, an identifier field indicating the first address, and a second protocol primitive field. The second protocol primitive field indicates that the cache read operation was successful.

[0034] Based on this optional implementation, by adding extended fields, the cache coherency protocol and the RDMA protocol are integrated. After receiving a packet, the network interface card (NIC) of the service node can identify the operation type of the cache lock and the operation type of the data in the cache based on the first protocol primitive field. Therefore, the NIC can perform cache lock granting and data retrieval with a single request. This reduces the number of requests between service nodes.

[0035] Secondly, this application provides a data access device for managing a first cache. The data access device includes a processor, a memory, and a data processing unit.

[0036] The processor is configured to: acquire the state of the cache lock of the first cache, and write the state of the cache lock of the first cache into memory. The cache lock is used to indicate the access permissions of the first cache. Optionally, the state includes: unlocked, read lock, or write lock.

[0037] The data processing unit is configured to receive a first read request from a second service node requesting read permission for the first cache, query the status of the cache lock in the memory based on the first read request, and if the cache lock status is unlocked or read-locked, send a first confirmation message to the second service node. Optionally, the first confirmation message is used to indicate that the second service node has read permission for the first cache.

[0038] Thirdly, this application provides a network interface card (NIC), comprising: a data processing unit and a communication interface. The communication interface is used to send data sent by the data processing unit, or to receive data sent to the data processing unit by other devices; the data processing unit and the communication interface perform the operational steps of the method in any implementation of the first aspect.

[0039] Fourthly, this application provides a computer-readable storage medium storing a computer program or instructions, which, when executed by a data access device or network card, performs the operational steps of the method described in any implementation of the first aspect.

[0040] Fifthly, a computer program product is provided. When the computer program product is run on a computer, it causes the computer to perform the operational steps of the method described in any implementation of the first aspect. For example, the computer may refer to a data access device, a host, or a network interface card (NIC).

[0041] The beneficial effects of aspects two through five can be referred to the description of any implementation method in aspect one, and will not be repeated here. Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of a distributed caching system architecture;

[0043] Figure 2 This is a diagram illustrating cache operations in a distributed caching system.

[0044] Figure 3 This is a schematic diagram of the structure of a business node in the relevant technology;

[0045] Figure 4 This is a schematic diagram of the structure of the data access system 100 provided in the embodiments of this application;

[0046] Figure 5 This is a schematic diagram of the structure of the service node cluster provided in the embodiments of this application;

[0047] Figure 6 A schematic diagram of the storage mapping provided in the embodiments of this application;

[0048] Figure 7 This is a schematic diagram of the software module structure in the business node provided in the embodiments of this application;

[0049] Figure 8 A schematic diagram of a cache management information list provided in an embodiment of this application;

[0050] Figure 9 Flowchart of the data access method provided in the embodiments of this application Figure 1 ;

[0051] Figure 10 A schematic diagram of the conformance protocol message format provided in the embodiments of this application;

[0052] Figure 11 Flowchart of the data access method provided in the embodiments of this application Figure 2 ;

[0053] Figure 12A Flowchart of the data access method provided in the embodiments of this application Figure 3 ;

[0054] Figure 12B Flowchart of the data access method provided in the embodiments of this application Figure 4 ;

[0055] Figure 13 Flowchart of the data access method provided in the embodiments of this application Figure 5 ;

[0056] Figure 14 A schematic diagram of the data access process under the upgraded cache lock provided in this application embodiment;

[0057] Figure 15A schematic diagram of the data access process in a cache lock downgrade scenario provided in this application embodiment;

[0058] Figure 16 A schematic diagram of the data access process in a cache lock return scenario provided in an embodiment of this application;

[0059] Figure 17 This is a schematic diagram illustrating the state description information of the cache lock provided in an embodiment of this application;

[0060] Figure 18 This is a flowchart illustrating the data access method provided in this application under a read cache request.

[0061] Figure 19 This is a flowchart illustrating the data access method provided in this application embodiment under a write cache request. Detailed Implementation

[0062] Currently, in distributed caching systems, the CPU of the cache's home node handles the business logic of granting a cache lock to the accessing node, and also transmits the cached data to the home node's network interface card (NIC). The home node's NIC then handles the data transmission. This long data transmission path causes latency in cache processing. Furthermore, CPU-managed cache consumes CPU computing power, reducing system performance.

[0063] The technical solution provided in this application includes: implementing cache lock state management by the network interface card (NIC) instead of the CPU, thereby enabling the second service node to obtain access to the cache. In this way, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data, a high-performance distributed cache coherence protocol is achieved, freeing up CPU computing power and improving the overall system performance.

[0064] Specifically, the first service node, as the owner node of the first cache, stores the cache lock status of the first cache. During the processing of a read request, when the first network interface card (NIC) of the first service node receives the first read request for the first cache from the second service node, the first NIC queries the cache lock status of the first cache. If the cache lock status is unlocked or read-locked, the first NIC returns a first confirmation message to the second service node indicating that the second service node has read permission for the first cache.

[0065] The technical solutions involved in this application may be applied not only to current storage technologies or storage systems, but also to future storage technologies or storage systems, or include data access systems for storage systems. The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. A brief introduction to some concepts that may be involved in this application is provided below.

[0066] Distributed caching refers to a caching technology that shares cached data among multiple nodes.

[0067] Nodes are used to store data and provide data access services. Nodes can also be called business nodes or cache nodes.

[0068] Optionally, a node can be a compute node or a storage node.

[0069] In this context, a computing node can refer to a node that has both storage and computing capabilities, such as a server, virtual machine, or other computing device.

[0070] A storage node can refer to a node that stores data, such as a storage server.

[0071] Distributed caching system: can refer to a group of computing clusters that work together to provide distributed caching services to clients.

[0072] The computing cluster consists of multiple nodes, and the distributed caching system distributes data across these nodes, with each node responsible for storing a portion of the data. For example, each node's hard drive stores a corresponding portion of the data.

[0073] In a distributed caching system, to enable fast data retrieval from nodes, each node can load data from disk into its cache upon startup. This allows for efficient data retrieval by reading the corresponding data from the cache.

[0074] Cache: can refer to a high-speed memory used to store copies of data that need to be accessed frequently.

[0075] Optionally, the cache can be divided into multiple storage units. A storage unit is the smallest unit for storing data in the cache. This storage unit can be, but is not limited to, the following types: storage block, data page, data segment, persistent log (Plog), or a namespace provided by an SSD that supports zoned namespaces (ZNS). The Plog is a storage space that supports append-only writes. The ZNS SSD divides the logical address space of a namespace into zones. Basic zone operations include read, append write, zone management, and get log page. Optionally, within each zone, data can be written sequentially.

[0076] Different storage units store different data items. Each data item is associated with a storage unit. When a node reads data from the cache, it can either use the storage unit's identifier to retrieve the data from the unit indicated by that identifier, or identify the storage unit associated with that data item based on its identifier and read the data from that unit.

[0077] In a distributed caching system, data can be transferred between nodes. A node can request partial data cached by other nodes, enabling data sharing among nodes. That is, in a distributed caching system, the same data may be replicated to multiple nodes.

[0078] like Figure 1 As shown, Figure 1 This is a schematic diagram of a distributed caching system, which includes storage media, a computing cluster, and clients. Clients are connected to the computing cluster via a network. Nodes in the computing cluster load data from the storage media into their caches. The storage media can refer to memory, storage devices, disks, hard drives, etc.

[0079] like Figure 1 As shown, the computing cluster includes node 1, node 2, and node 3. Clients include terminal 1, terminal 2, and terminal 3. User 1 accesses node 1 in the distributed caching system through terminal 1, user 2 accesses node 2 through terminal 2, and user 3 accesses node 3 through terminal 2. File A is stored in the caches of nodes 1, 2, and 3. That is, nodes 1, 2, and 3 share file A.

[0080] In data sharing, nodes in a distributed caching system can be divided into owner nodes and access nodes.

[0081] The home node can also be called the cache's home node. The home node refers to the node that manages the cache. Optionally, the home node's management of the cache includes one or more of the following: reading data from the disk into the cache, and granting cache access to other nodes. Granting cache access to other nodes can mean allowing other nodes to read data stored in the cache, or allowing other nodes to write data to the cache. For example, using... Figure 1 For example, when node 1 loads file A from the storage medium into node 1's cache, node 1 is the owner node of the file A cache.

[0082] An accessing node can refer to a node that requests access to the cache (i.e., requests access to the cache belonging to another node). For example, with Figure 1For example, when node 1 loads file A from the storage medium into node 1's cache, when node 2 and node 3 request file A from node 1, node 2 and node 3 are the accessing nodes.

[0083] Understandably, "owner node" and "access node" can refer to the same node playing different roles in different situations. For example, taking any node in a distributed cache as an example, when this node receives a data retrieval request, if the data requested by the request is stored in the node's cache, then this node can be called the owner node. If the data requested by the request is not stored in the node's cache, then the node needs to retrieve the data from other nodes, and in this case, the node can be called the access node.

[0084] It is worth noting that in this paper, the home node can manage the cache at the granularity of the cache, or at the granularity of the storage unit in the cache, or at the granularity of the data stored in the cache.

[0085] In the first possible example, managing at the cache granularity means that the cache's owner node manages the entire cache. That is, for an access node, when the owner node grants it cache access, the access node gains access to the entire cache of the owner node (the right to read or write data). In the second possible example, managing at the storage unit granularity means that the cache's owner node manages each storage unit in the cache individually. That is, for an access node, when the owner node grants it cache access, the access node gains access to one or more storage units in the owner node's cache.

[0086] In a third possible example, managing at the data granularity level could mean that the cache's owner node manages access permissions to the cache at the granularity of each data item stored in the cache. That is, for an access node, the owner node can authorize corresponding access permissions to that access node at the granularity of the storage space occupied by one or more data items stored in the cache.

[0087] It should be noted that the above three possible examples are only different implementations of the home node managing the cache at different granularities. In practical applications, other implementations can also be used, and this application does not limit them.

[0088] Data sharing involves cache consistency and data consistency. Distributed caching systems ensure data consistency between nodes through cache consistency among nodes.

[0089] Cache consistency refers to the consistency of data retrieved from the same cache by all nodes in a distributed caching system. Cache consistency prevents conflicts caused by multiple nodes simultaneously modifying data at the same memory location. Here, "memory location" refers to the storage address of the data in the cache.

[0090] Data consistency refers to the fact that the same data is identical across all nodes in a distributed caching system.

[0091] Currently, distributed caching systems address cache consistency issues using cache locks. When a node modifies data within a specific storage unit in the cache, it acquires a cache lock on that unit. This prevents other nodes from reading or writing to that storage unit until the cache lock is released.

[0092] Among them, cache lock: used to indicate the device's access permissions to the cache. Access permissions include read permissions or write permissions.

[0093] In this article, read permission refers to the device's ability to read data from the cache. Write permission refers to the device's ability to write data to the cache.

[0094] Writing data includes, but is not limited to: modifying data, deleting data, and writing data.

[0095] It should be noted that if an access node has read permissions for the cache, it can only read cached data and cannot write data to the cache. If an access node has write permissions for the cache, it can both read and write data to the cache.

[0096] It should be noted that, in addition to satisfying the cache lock's requirement to solve cache consistency, the owner node's management of the cache can also include: adding cache locks to the cache and removing cache locks from the cache.

[0097] For example, taking storage units as the granularity, the cache's owner node adds or removes a cache lock for each storage unit in the cache.

[0098] For example, taking caching as the granularity, the node that owns the cache can add or remove a cache lock on the entire cache.

[0099] For example, taking a data item as an example, the cache owner node adds a cache lock to a data item in the cache or releases a cache lock on a data item.

[0100] In this article, depending on the access permissions, cache locks can include the following states: read lock, write lock, or no lock.

[0101] In this context, "lock-free" can refer to a situation where no node holds a cache lock. In this paper, when a cache lock is in an unlocked state, any node in the distributed caching system can request to read data from the cache or request to write data to the cache.

[0102] A read lock indicates that a node has read access only to data in a cache. In this article, when a cache lock is in the read lock state, a distributed caching system can add multiple read locks to a cache, meaning multiple nodes can read data from the same cache simultaneously.

[0103] It should be noted that in this article, "nodes only have read permissions for data in the cache" means that nodes can only read data in the cache and cannot write data to the cache.

[0104] A write lock refers to a node's write permission to the cache. In this article, when a cache lock is in the write lock state, only the node holding the cache lock can write data to the cache in a distributed caching system. Alternatively, when a cache lock is in the write lock state, only the node holding the cache lock can read data from the cache and write data to the cache in a distributed caching system.

[0105] It is worth noting that in this article, "a node holding a cache lock" means that the node has one or both of the following permissions: read permission or write permission to data in the cache. Here, "node" can also refer to any node in the distributed caching system.

[0106] In the first alternative example, a node holding a cache lock means that the node has read permission for the data in the cache.

[0107] In the second alternative example, a node holding a cache lock means that the node has write permissions to the data in the cache.

[0108] In the third alternative example, a node holding a cache lock means that the node has read and write permissions to the data in the cache.

[0109] It should be noted that in this article, when the cache lock is in a read lock state, a node holding the cache lock indicates that the node has read access to the data in the cache. When the cache lock is in a write lock state, a node holding the cache lock indicates that the node has write access to the data in the cache. Alternatively, a node may have both read and write access to the data in the cache.

[0110] In this article, "adding a cache lock to the cache" means: adding a cache lock to a storage unit in the cache at the granularity of the storage unit in the cache; or adding a cache lock to the cache at the granularity of the cache; or adding a cache lock to the data in the cache at the granularity of the data.

[0111] In this context, adding a cache lock to a storage unit in the cache, with the storage unit in the cache as the granularity, can refer to the cache owner node adding a cache lock to each storage unit in the cache.

[0112] Adding a cache lock to a cache at the granular level can mean that the cache's owner node adds a cache lock to the entire cache.

[0113] Adding a cache lock to data in the cache at the data granularity means that the cache's owner node adds a cache lock to each data item stored in the cache.

[0114] For example, taking the storage unit in the cache as the granularity, we will introduce how to add a cache lock to the storage unit in the cache:

[0115] In the first optional example, adding a cache lock to a storage unit in the cache means that the cache lock state of the storage unit in the cache is changed to a read lock. For example, the cache lock state of the storage unit changes from unlocked to read lock.

[0116] In the second optional example, adding a cache lock to a storage unit in the cache means that the cache lock state of the storage unit in the cache is changed to a write lock. For example, the cache lock state of the storage unit changes from unlocked to write lock. Or the cache lock state of the storage unit changes from read lock to write lock.

[0117] In this article, "releasing cache locks" means: releasing cache locks on cached storage units at the granularity of cache storage units; or releasing cache locks on cached items at the granularity of cached items; or releasing cache locks on data items stored in the cache at the granularity of data items stored in the cache.

[0118] For example, taking the storage unit in the cache as the granularity, we will introduce how to unlock the cache lock of the storage unit in the cache:

[0119] In the first optional example, releasing the cache lock on a storage unit in the cache means that when the cache lock is in the read lock state, the cache lock state of the storage unit in the cache is changed from read lock to unlock.

[0120] In the second optional example, releasing the cache lock on a storage unit in the cache means that when the cache lock is in the state of write lock, the cache lock state of the storage unit in the cache is changed from write lock to unlock.

[0121] Currently, data sharing between nodes is achieved through RDMA protocol and cache coherence protocol in distributed caching systems.

[0122] RDMA, or Relational Data Access Protocol, refers to a data transfer method between nodes. In data access, RDMA can bypass the node's controller (or processor). This means a node doesn't need to wait for the controller of another node to interact with the disk corresponding to the cache before writing data from memory to the cache. This reduces the length of the I / O path for writing data within a node and increases the efficiency of data access between nodes.

[0123] A cache consistency protocol refers to a management scheme for data in the cache. By managing individual storage units in the cache, a cache consistency protocol can be achieved across nodes, as well as the consistency of data within the cache across nodes.

[0124] In data sharing, the home node determines the state of the cache lock through a cache consistency protocol to determine whether the accessing node has cache access permissions. If the accessing node has cache access permissions, the home node transmits the cached data to the accessing node via the RDMA protocol.

[0125] The following is combined Figure 2 and Figure 3 This paper introduces the operational process of cache consistency in related technologies.

[0126] For example, with Figure 1 Taking the distributed caching system shown as an example, such as Figure 2 As shown, Figure 2 This is a schematic diagram of cache operations in a distributed caching system. Node 1 stores file A in cache 1, meaning node 1 is the owner node of cache 1. Nodes 2 and 3 can request to read file A or write data to file A, meaning nodes 2 and 3 are the access nodes of cache 1.

[0127] like Figure 2 As shown in Figure (a), the cache lock of the storage unit containing file A in cache 1 of node 1 is in an unlocked state. When node 2 receives a read request for file A, node 2 requests to read file A from cache 1 of node 1. Node 1 adds a read lock to the storage unit containing file A in cache 1, and the cache lock state of the storage unit containing file A in cache 1 changes from unlocked to read lock.

[0128] Similarly, similar to the handling of read requests, when node 2 receives a write request for file A, node 2 requests node 1 to write data to file A in cache 1. Node 1 adds a write lock to the storage unit where file A is located in cache 1, and the cache lock state of the storage unit where file A is located in cache 1 changes from unlocked to write locked.

[0129] It is worth noting that after node 2 requests to read file A, if node 3 requests to read file A in cache 1 of node 1, then node 1 will acquire a read lock on the storage unit where file A is located in cache 1 again. At this time, both node 2 and node 3 hold the read lock on the storage unit where file A is located in cache 1.

[0130] If node 2 requests to read file A, and node 3 requests to write data to file A in cache 1, then node 2 must first release the read lock on the storage unit containing file A in cache 1. Only then can node 3 write data to file A.

[0131] like Figure 2 As shown in Figure (b), node 2 holds a cache lock on the storage unit containing file A in cache 1, and the cache lock is in a read lock state. When node 3 requests to write data to file A from node 1, since node 2 holds a cache lock on the storage unit containing file A, to ensure the consistency of file A among nodes 1, 2, and 3, node 1 requests to node 2 to release the cache lock on the storage unit containing file A. After node 2 releases the cache lock on the storage unit containing file A, the cache lock state of the storage unit containing file A changes from a read lock to an unlocked state. At this time, node 1 grants write permission to file A to node 2, allowing node 3 to write data to file A, and adds a write lock to the storage unit containing file A. The cache lock state of the storage unit containing file A changes from an unlocked state to a write lock.

[0132] Correspondingly, if node 2 holds a cache lock on the storage unit containing file A in cache 1, and the cache lock is in a write lock state, then if node 3 requests to read file A from node 1, or if node 3 requests to write data to file A from node 1, node 1 can refer to the above... Figure 2 The operation flow is shown in Figure (b) of this application. This will not be elaborated upon further here.

[0133] Depend on Figure 2 It can be seen that in the implementation of data sharing in distributed caching systems, such as... Figure 3 As shown, for the home node of the cache, the business logic of whether to grant a cache lock to the accessing node is handled by the CPU in the home node, as well as the transfer of data in the cache to the network interface card (NIC) of the home node. The data transmission is then carried out by the NIC of the home node. This increases the processing path in the data transmission process, causing latency in cache processing.

[0134] Based on this, this application provides a data access method in which the network interface card (NIC) in the service node handles the cache coherency protocol and the RDMA protocol. The service node stores the state of cache locks, and the NIC determines whether to grant cache access to the accessing node by querying the cache lock state. Compared to schemes that rely on the CPU to determine the encryption and decryption of the coherency protocol, this application does not require CPU involvement, thus shortening the processing path length in data access, reducing the transmission latency of RDMA protocol data, and achieving a high-performance distributed cache coherency protocol.

[0135] The data access method and corresponding data access device provided in this application are described below with reference to the accompanying drawings. First, a brief introduction to the relevant technologies is given.

[0136] The data access method provided in this application can be applied to distributed systems or centralized systems. It achieves data consistency among multiple business nodes in a distributed or centralized system.

[0137] For example, taking a distributed system as an example, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of a data access system 100 provided in an embodiment of this application. The data access system 100 includes a host cluster 10 and a service node cluster 20. The service node cluster 20 is used to provide data access services to the host cluster 10.

[0138] Host cluster 10 includes one or more hosts (such as...) Figure 4 The host shown is host 1, host 2, and host 3. A host is a computer running an application on the user side. For example, if the computer running the application is a physical computing device, it can be a server or a terminal. A terminal can also be called a terminal device, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. A terminal can be a mobile phone, tablet computer, laptop computer, desktop computer, personal communication service (PCS) telephone, desktop computer, wireless terminal in a smart city, wireless terminal in a smart home, etc. The embodiments of this application do not limit the specific technology or device form used by the host. In some optional implementations, Figure 4 The host shown can also refer to the client.

[0139] The business node cluster 20 includes one or more business nodes, which can also be referred to as data access devices. For example... Figure 4 The diagram shows business node 1, business node 2, and business node 3. These business nodes can be interconnected via an Internet Protocol (IP) network or other networks. For example... Figure 4 As shown, business node 1, business node 2 and business node 3 are interconnected through switch 30.

[0140] A service node is a device that possesses both computing and storage capabilities, such as a server or desktop computer. For example, an Advanced Reduced Instruction Set Computer (ARM) server or an x86 server can serve as a service node. In terms of hardware, such as... Figure 4 As shown, taking service node 1 as an example, service node 1 includes at least a processor 112, memory 113, network card 114, and hard disk 105. The processor 112, memory 113, network card 114, and hard disk 105 are connected via a bus. Correspondingly, the hardware implementation of service node 2, service node 3, and service node 4 can refer to the implementation of service node 1.

[0141] The processor 112 and memory 113 of business node 1 are used to provide computing resources. Specifically, the processor 112 of business node 1 is a CPU used to process data access requests (such as write data requests or read data requests) from outside business node 1 (host, application server or other server), and also to process requests generated internally by business node 1.

[0142] For example, taking a write data request sent from host 1 to service node 1 as an example, the processor 112 in service node 1 receives the write data request. If the cache corresponding to the write data request belongs to service node 1, service node 1 performs a data write operation. If the cache corresponding to the write data request belongs to service node 2, service node 1 will send the access address of the cache corresponding to the write data request and the network address of service node 2 to the network card 114 of service node 1. The network card 114 of service node 1 sends a write request to service node 2 using the access address of the cache corresponding to the write data request and the network address of service node 2, thereby enabling service node 1 to write data to the cache corresponding to the write data request.

[0143] In one possible scenario, when the total amount of data in the cache reaches a certain threshold, the processor of the cache's home node will send the data stored in memory to the home node's hard disk for persistent storage. For example, taking business node 1 as the home node of the cache, when the total amount of data in the cache of business node 1 reaches a certain threshold, the processor 112 in business node 1 will send the data stored in the memory 113 of business node 2 to the hard disk 105 of business node 1 for persistent storage.

[0144] In addition, the processor 112 of business node 1 is also used for data calculation or processing. Figure 4 Only one processor 112 is shown in this embodiment. In practical applications, the number of processors 112 in service node 1 is often multiple, and each processor 112 has one or more CPU cores. This embodiment does not limit the number of CPUs or the number of CPU cores.

[0145] The memory 113 of service node 1 refers to the internal memory that directly exchanges data with the processor. It can read and write data at any time at high speed, serving as temporary data storage for the operating system or other running programs. Memory includes at least two types of memory. For example, memory can be random access memory, such as dynamic random access memory (DRAM), or storage class memory (SCM). DRAM is a semiconductor memory, and like most random access memory (RAM), it is a type of volatile memory device. SCM is a composite storage technology that combines the characteristics of traditional storage devices and memory. Storage class memory can provide faster read and write speeds than hard drives, but its access speed is slower than DRAM, and it is also cheaper than DRAM. However, DRAM and SCM are only illustrative examples in this embodiment; memory can also include other random access memories, such as static random access memory (SRAM).

[0146] Additionally, the memory 113 of service node 1 can also be a dual in-line memory module (DIMM), i.e., a module composed of dynamic random access memory (DRAM), or a solid state disk (SSD). In practical applications, service node 1 can be configured with multiple memory modules of different types. This embodiment does not limit the number or type of memory. Furthermore, memory 113 can be configured to have a power-saving function. The power-saving function means that when the system experiences a power outage and then power is restored, the data stored in memory 113 will not be lost. Memory with a power-saving function is called non-volatile memory.

[0147] It should be noted that the memory 113 of business node 1 can be either the memory storing business node 1 itself, or memory allocated from the global memory pool for business node 1's use. This global memory pool is pre-created on each business node, and its storage space is provided by the memory or other storage devices on each business node. Each business node can request a portion of storage space from this global memory pool as its own memory when in use.

[0148] In the first scenario, memory 113 in business node 1 can be used as a cache for business node 1. Alternatively, in the second scenario, a portion of storage space can be allocated from memory 113 of business node 1 and used as a cache for business node 1. Or, in the third scenario, business node 1 may further include a cache (…). Figure 4 (Not shown in the image). For the three scenarios described above, the implementation method of loading data into the cache by business node 1 in each scenario will be introduced below.

[0149] In the first example, when memory 113 in business node 1 is used as a cache for business node 1, loading data into the cache of business node 1 can mean that business node 1 reads data from the hard disk 105 of business node 1 into the memory 113 of business node 1.

[0150] In the second example, when a portion of the storage space in the memory 113 of business node 1 is used as a cache for business node 1, loading data into the cache of business node 1 can mean that business node 1 reads data from the hard disk 105 of business node 1 into the storage space where the cache is located in the memory 113 of business node 1.

[0151] In the third example, where business node 1 includes a cache and memory 113, loading data into the cache of business node 1 can mean: business node 1 reads data from the hard disk 105 of business node 1 into the cache of business node 1. Alternatively, business node 1 reads data from the hard disk 105 of business node 1 into the memory 113 of business node 1, and then loads the data in the memory 113 of business node 1 into the cache of business node 1.

[0152] It should be noted that the three examples above are only different implementations of loading data into the cache of business node 1. In practical applications, there can be other implementations. For example, business node 1 can load data from an external storage server. Figure 4 Data is loaded into the cache (not shown in the image), but this application does not limit this process.

[0153] The hard disk 105 of business node 1 is used to provide storage resources, such as storing data and information on the data access status of each business node or host. Data can be stored on the hard disk 105 or in memory 113 of business node 1 in the form of data tables, objects, or files. The hard disk 105 can be a disk or other types of storage media, such as a solid-state drive (SSD) or a shingled magnetic recording hard disk. For example, the hard disk 105 of business node 1 can be a solid-state drive based on the Non-Volatile Memory Express (NVMe) specification, such as an NVMe SSD.

[0154] Network interface card 114 in service node 1 is used to communicate with the host or other service nodes (such as...) Figure 4 The communication between business node 2 and business node 3 is shown.

[0155] In one implementation, the functions of the processor 112 of service node 1 can be offloaded to the network interface card 114 of service node 1. In other words, in this implementation, the processor 112 of service node 1 does not perform service data processing operations, but the network interface card 114 of service node 1 performs service data processing, address translation, adding cache locks to the cache, canceling cache locks, and other computing functions.

[0156] In some application scenarios, the network interface card (NIC) 114 of service node 1 may also have persistent memory media, such as persistent memory (PM), non-volatile random access memory (NVRAM), or phase change memory (PCM). The NIC 114 of service node 1 can also be a programmable electronic component, such as a data processing unit (DPU). A DPU possesses the versatility and programmability of a CPU, but is more specialized, capable of efficiently operating on network packets, storage requests, or analysis requests. The DPU differs from a CPU by its high degree of parallelism (the ability to handle a large number of requests). Optionally, the DPU can be replaced by a GPU, NPU, or other processing chip. There is no ownership relationship between the NIC 114 of service node 1 and the hard disk 105; the NIC 114 of service node 1 can access any hard disk 105 within service node 1, making it convenient to expand the hard disk when storage space is insufficient.

[0157] Figure 4 This is merely one example provided in the embodiments of this application. The service node cluster 20 may also include more service nodes, and more than [a certain number of] service nodes may be deployed in each service node. Figure 4 This application does not limit the number or specific form of service nodes, or the number and specific form of memory and hard disks deployed in service nodes, regarding additional memory or hard disk devices. Furthermore, Figure 4 The naming of business nodes and the grouping of their included modules are exemplary. In practical applications, other naming and grouping methods are also possible. For example, the business node can also be divided into a fault handling unit 701, a view management unit 703, a link management unit 704, a cache management unit 702, a driver unit 705, and a consistency protocol state machine. For another specific example of this division, please refer to the following. Figure 7 In the corresponding example. Furthermore, a business node can also be named a data access device, which can include different... Figure 4 The modules shown, specifically the structure of the data access device, can be referenced as follows: Figure 6 This application is described herein.

[0158] It should be noted that, in Figure 4 In the system architecture shown, the service node cluster 20 is a compute-storage integrated structure. In practical applications, the service node cluster 20 can also have other structures. For example, in another scenario, the service node cluster 20 provided in this embodiment (such as...) Figure 4The business node cluster 20 shown can also be a storage cluster with separate compute and storage. For example... Figure 5 As shown, the service node cluster 20 includes a computing device sub-cluster 201 and a storage node sub-cluster 203.

[0159] The computing device sub-cluster 201 includes one or more computing nodes, which can communicate with each other. For example... Figure 5 As shown, the computing device sub-cluster 201 includes computing node 1, computing node 2, and computing node 3. Each computing node can be a computing device, such as a server, desktop computer, or storage array controller. Hardware-wise, the computing device may include a processor, memory, and network interface card (NIC). The processor, a CPU, is used to process data access requests from outside the computing device or requests generated internally within the computing device. For example, when the processor receives a write request from a user, it temporarily stores the data carried in these write requests in memory. When the total amount of data in memory reaches a certain threshold, the processor sends the data stored in memory to the storage device for persistent storage. In addition, the processor is also used for data computation or processing, such as metadata management, deduplication, data compression, virtualization of storage space, and address translation.

[0160] The data access method provided in this application embodiment can be applied to the computing nodes of the computing device sub-cluster 201.

[0161] Taking compute node 1 as an example, the hardware structure of the compute nodes in the compute device sub-cluster 201 is described below. The hardware structure of compute nodes 2 and 3 can be referenced from that of compute node 1. Figure 5 As shown, computing node 1 includes at least processor 112, memory 113 and network card 1141, and processor 112, memory 113 and network card 1141 are connected by a bus.

[0162] Storage node sub-cluster 203 includes one or more storage nodes, such as Figure 5 The diagram shows storage node 1, storage node 2, and storage node 3. Taking storage node 1 as an example, the hardware structure of the storage nodes in the storage node sub-cluster 203 is described. The corresponding storage nodes 2 and 3 can be referenced from the hardware structure of storage node 1. Figure 5 As shown, storage node 1 may include a network interface card (NIC) 1142 and multiple hard disks 105. Data transmission between storage nodes is achieved through the NIC. Computational nodes in computing device sub-cluster 201 access storage nodes in storage node sub-cluster 203 via a network to access data; this network functionality can be implemented by a switch or router. Figure 5As shown, data access between storage node 1 and compute node 1 is achieved through switch 202. For example, compute node 1 in compute device sub-cluster 201 obtains data stored in storage node 1 from storage node sub-cluster 203, stores the obtained data in memory 113 of compute node 1, and performs corresponding processing. During processing, compute node 2 or compute node 3 can read data or modify data from memory 113 of compute node 1. After processing is completed, compute node 1 writes the cached data in memory 113 back to the memory of the corresponding storage node 1.

[0163] In one alternative implementation, a compute-storage separated storage cluster can be used for training large-scale artificial intelligence (AI) models. Compute nodes 1, 2, and 3 obtain model parameters from storage nodes 1, 2, and 3 during model training. During training, compute nodes 1, 2, and 3 share cached model parameters. After training, compute nodes 1, 2, and 3 write the cached model parameters from memory into the memory of their respective storage nodes 1, 2, and 3. This synchronization of model parameters among multiple storage nodes ensures efficient model training. Thus, during model training, the cache flows between multiple compute nodes, reducing I / O overhead as compute nodes in compute device sub-cluster 201 do not need to frequently access storage nodes in storage node sub-cluster 203.

[0164] In one alternative implementation, the hard drives of different business nodes in the distributed caching system can be used to store different data. When the business node cluster 20 starts, the business nodes map data from their hard drives to their caches. Thus, during the operation of the distributed caching system, business nodes directly retrieve stored data from the cache, reducing I / O interactions with the hard drives and improving the data processing capabilities of the distributed caching system. Furthermore, different business nodes communicate with each other via their network interface cards (NICs) to access data stored in the cache, achieving data sharing.

[0165] by Figure 4 Taking a provided business node as an example, this paper provides an implementation method for business node storage mapping. Figure 6 As shown, Figure 6 This is a schematic diagram of the storage mapping provided in the embodiments of this application. A DPU card is inserted into the motherboard of each service node, such as DPU 1 in the motherboard of service node 1, DPU 2 in the motherboard of service node 2, and DPU 3 in the motherboard of service node 3.

[0166] The following is combined Figure 6A brief description of the hardware implementation of the service node is provided. Taking service node 1 as an example, service node 1 includes a processor 11 and a memory 12. This embodiment does not limit the specific connection medium between the processor 11 and the memory 12 in service node 1. This embodiment... Figure 6 The processor 11 and memory 12 of service node 1 can be connected via a bus. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The bus is represented by only one line, but this does not mean that there is only one bus or one type of bus. Service node 1 may also include a communication interface for communicating with other devices via a transmission medium, so that the devices in service node 1 can communicate with other devices.

[0167] Memory 12 is used to store program instructions and / or data, and processor 11 is coupled to memory 12. In this embodiment, coupling is an indirect coupling or communication connection between devices, units, or modules, and can be electrical, mechanical, or other forms, used for information exchange between devices, units, or modules. Processor 11 may operate in conjunction with memory 12. Processor 11 may execute program instructions stored in memory 12.

[0168] In the embodiments of this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0169] In the embodiments of this application, the memory can be non-volatile memory, such as a hard disk drive (HDD) or SSD, or it can be volatile memory, such as RAM. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. The memory in the embodiments of this application can also be a circuit or any other device capable of implementing storage functions, used to store program instructions and / or data.

[0170] In one alternative implementation, such as Figure 6 As shown, a portion of the storage space of the memory 12 of service node 1 can be used as cache 1 of service node 1. Cache 1 of service node 1 is used to store data loaded by service node 1 from the storage device.

[0171] Among them, the storage device can be Figure 4 The hard disk 105 of business node 1 is shown. Alternatively, the storage device can be an external storage server for business node 1. This storage server is used to store data of each business node in the distributed caching system, as well as data exchanged between each business node and the host.

[0172] The following example illustrates how business node 1 loads data 1 from storage device into its cache. Data 1 is persistently stored in the storage device. For instance, data 1 can be stored in the storage device's memory (such as DRAM or PMEM) or in the global address space provided by the storage device. The distributed system provides a Distributed Physical Address (DPA) space, which is mapped to a Distributed Virtual Address (DVA) through a Distributed Page Table (DPT). Applications in business node 1 can map data 1 to the address space of their local processes using a distributed memory map (distributed mmap). For example, data 1 can be mapped to the storage space where the cache resides in memory 12, and business node 1 can access data 1 stored in the cache via load / store.

[0173] In one possible scenario, data 1 uses page resources for storage, such as... Figure 6 The data page shown. The cache occupied by this data 1 can also be called the data page cache.

[0174] like Figure 6 As shown, data 1 occupies three data pages: P1, P2, and P3. P1, P2, and P3 are distributed across the storage space of the storage device.

[0175] In the implementation of business node 1 loading data 1 from the storage device into business node 1's cache 1, business node 1 retrieves data 1 from the storage device and stores data 1 into business node 1's cache 1.

[0176] As described above, the cache can be divided into multiple storage units. Similarly, cache 1 in business node 1 can also be divided into multiple storage units, each of which is a storage block. Figure 6 As shown, cache 1 in business node 1 can be divided into storage blocks B1 to B6. For example... Figure 6 As shown, data 1 can be stored in one or more storage units of cache 1 of business node 1.

[0177] In the first possible example, if the storage space of a single storage unit in cache 1 is larger than the size of data 1, data 1 can be stored in one storage unit of cache 1. For example, data 1 can be stored in any storage unit in cache 1, such as P1, P2, and P3, other data pages, or storage units of other granularities, such as any one of storage blocks B1 to B6.

[0178] For example, assuming that the storage space of a single storage unit is 4KB and the size of data 1 is 1KB, data 1 can be stored in any storage unit, such as storage block B1.

[0179] In a second possible example, if the storage space of a single storage unit in cache 1 is less than that of data 1, data 1 can be stored in multiple storage units of cache 1. For example, data 1 can be stored in two or more storage units in cache 1.

[0180] For example, assuming a single storage unit has a storage space of 4KB and data 1 has a size of 6KB, data 1 can be stored in two storage units, such as storage blocks B1 and B2.

[0181] It should be noted that the above two examples are only different implementations of cache 1 storing data 1. In practical applications, there may be other implementations, which this application does not limit.

[0182] The following is combined Figure 7 A brief explanation of the software modules in the business node is provided, for example, using... Figure 6 Taking business node 1 as an example, the software implementation of the business node will be introduced. The software implementation methods of business nodes 2 and 3 can be referred to the software implementation method of business node 1. Figure 7 As shown, Figure 7 This is a schematic diagram of the software module structure in a business node provided in an embodiment of this application. Business node 1 includes a fault handling unit 701, a view management unit 703, a link management unit 704, a cache management unit 702, a driver unit 705, and a consistency protocol state machine. The fault handling unit 701, view management unit 703, link management unit 704, and cache management unit 702 are deployed in the processor 11 of business node 1. The consistency protocol state machine is located in the DPU1 of business node 1.

[0183] The fault handling unit 701 is used to perform corresponding processing when a fault occurs in the distributed caching system, ensuring the eventual consistency of the distributed cache throughout the entire system. For example, when a fault is detected in the distributed caching system, the fault handling unit 701 resets the cache lock in business node 1 to unlocked.

[0184] The link management unit 704 is used to control the establishment, reconstruction, and disconnection of connections between business nodes in the distributed caching system.

[0185] The cache management unit 702 is used to manage the distributed cache allocation / release of business node 1.

[0186] The view management unit 703 is used to manage the business nodes to which each cache belongs in the distributed caching system.

[0187] The drive unit 705 is used to link the processor 11 and the DPU1.

[0188] A consistency protocol state machine is used to implement the data access method provided in the embodiments of this application.

[0189] For example, taking a request from business node 1 to read cache 2 as an example, where the node to which cache 2 belongs is business node 2. After receiving the read request for cache 2, the cache management unit 702 in business node 1 sends the read request for cache 2 to the DPU1 of business node 1 through the driver unit 705 in business node 1. The DPU1 of business node 1 then sends the read request for cache 2 to business node 2 through the consistency protocol state machine.

[0190] It should be noted that the above Figure 7 The software modules in the provided business node 1 are for illustrative purposes only. In actual applications, business node 1 may have other grouping methods to achieve the above functions, and this application does not limit this.

[0191] The following is combined Figures 8 to 19 The implementation of the data access method provided in the embodiments of this application will be described.

[0192] This data access method can be applied to Figure 4 or Figure 6 The business nodes shown, or the data access method that can be applied to Figure 5 The computing node is shown. For example, taking an application to a business node as an example, the implementation of the data access method provided in this application embodiment will be described. Correspondingly, the implementation of the data access method applied to a computing node can refer to the implementation applied to a business node.

[0193] For example, with Figure 6Taking business node 1 as an example, business node 1 is the owner node of cache 1. Business node 1 can add a cache lock to cache 1 based on read or write requests from other business nodes (such as business node 2 or business node 3), and determine the state of the cache lock. It also records the node identifier holding the cache lock. Business node 1 stores the state of the cache lock and the node identifier in its memory. When business node 1 receives a request from another business node to acquire cache 1 (e.g., a read or write request), its network interface card (NIC) can read the state of the cache lock and the node identifier from memory. Based on the cache lock state and the node identifier, it determines whether to grant access to cache 1 to other business nodes. In this way, business node 1's NIC can bypass its processor to determine whether to grant access to cache 1 to other business nodes, thus maintaining cache consistency across different business nodes while shortening the data transmission processing path length.

[0194] In one optional implementation, the state of the cache lock of cache 1 and the identifier of the node holding the cache lock of cache 1 are stored in the memory of business node 1. There are several implementation methods, for example:

[0195] The first implementation method uses storage units as the granularity, storing the state of the cache lock of each storage unit in cache 1 and the node identifier holding the cache lock of each storage unit in the memory of business node 1.

[0196] The second implementation method uses the cache as the granularity, storing the state of the cache lock of cache 1 and the node identifier holding the cache lock of cache 1 in the memory of business node 1.

[0197] The third implementation method, using data items as the granularity, stores the state of the cache lock for each data item in cache 1, as well as the node identifier holding the cache lock for each data item in cache 1, in the memory of business node 1.

[0198] The above three implementation methods differ only in the state of the storage cache lock and the identifier of the node holding the cache lock. In practical applications, there may be other implementation methods, which are not limited in this application.

[0199] In one alternative implementation, the state of the cache lock and the information of the node holding the cache lock can be stored in memory as a data table.

[0200] In one example, business node 1 can record the status of cache lock for cache 1 and the node identifier holding cache lock for cache 1 in the form of a cache management information list.

[0201] In the first optional example, when the granularity is based on storage units in the cache, each storage unit in cache 1 corresponds to a cache management information list. The cache management information list for each storage unit includes: the unique index of the storage unit in the distributed caching system, the physical address of the storage unit in the memory of business node 1, the status of the cache lock of the storage unit, and the node identifier holding the cache lock of the storage unit.

[0202] In the second optional example, when the cache is considered as a granular unit, cache 1 corresponds to a cache management information list. The cache management information list includes: the unique index of cache 1 in the distributed caching system, the physical address of cache 1 in the memory of business node 1, the status of the cache lock of cache 1, and the node identifier holding the cache lock of cache 1, etc.

[0203] In the third optional example, when the granularity is the data items in the cache, each data item stored in cache 1 corresponds to a cache management information list. The cache management information list of each data item includes: the unique index of the data item in the distributed cache system, the physical address of the data item in the memory of business node 1, the status of the cache lock of the data item, and the node identifier holding the cache lock of the data item.

[0204] It should be noted that the physical address in the cache management information list above can refer to a range of physical addresses or a starting physical address. Understandably, when the physical address is the starting physical address, the cache management information list may also include the size of the storage unit in bytes, the size of the cache storage space, or the size of the data item in bytes.

[0205] For example, taking a storage unit in the cache as the granularity, business node 1 is the node to which cache 1 belongs. Cache 1 contains storage unit B1, and the cache management information list of storage unit B1 is as follows: Figure 8 As shown in Figure (a), the storage unit identifier in the cache management information list indicates the unique index of storage unit B1 in the distributed cache system. `addr` indicates the physical address of storage unit B1 in the memory of service node 1, and `status` indicates the status of the cache lock for storage unit B1. The node list (client_list) indicates the identifiers of the nodes holding the cache lock for storage unit B1. Figure 8 The cache management information list shown in Figure (a) indicates that: the unique index of storage unit B1 in the distributed cache system is block11; the physical address of storage unit B1 in the memory of business node 1 is XXX1~XXX2; the cache lock status of storage unit B1 is unlocked; and no node currently holds the cache lock of storage unit B1.

[0206] For example, taking a cache within a cache as the granularity, business node 1 is the node to which cache 1 belongs, and the cache management information list of cache 1 is as follows: Figure 8 As shown in Figure (b), the cache identifier of cache 1 is cache1, the physical address of cache 1 in the memory of service node 1 is XXX1~XX10, the cache lock status of cache 1 is unlocked, and no node currently holds the cache lock of cache 1.

[0207] For example, taking data items in the cache as the granularity, business node 1 is the node to which cache 1 belongs, and storage unit B1 of cache 1 stores data 1. The cache management information list of this data 1 is as follows: Figure 8 As shown in Figure (c), the data identifier of data 1 is data1, the physical address of data 1 in the memory of service node 1 is XXX1~XXX2, the cache lock status of data 1 is unlocked, and no node currently holds the cache lock of data 1.

[0208] In one optional implementation, when business node 1 receives a write request or read request for cache 1 from business node 2 or business node 3, the DPU in business node 1 executes the data access method provided in this embodiment to determine whether to cache the cache lock of cache 1 to business node 2 or business node 3. If the cache lock of cache 1 is cached to business node 2 or business node 3, the cache management information list in the memory is modified.

[0209] The following example uses storage units in the cache as the granularity, combined with... Figures 9 to 19 The implementation methods of the data access method provided in the embodiments of this application are described. Accordingly, the implementation methods of the data access method at the granularity of cache and at the granularity of data items can be implemented at the granularity of storage units.

[0210] For example, taking the first business node as business node 1 in business node cluster 20, the second business node as business node 3 in business node cluster 20, the third business node as business node 3 in business node cluster 20, and the fourth business node as business node 4 in business node cluster 20 as examples, the implementation of the data access method provided in the embodiments of this application will be introduced.

[0211] The following example, a read request, illustrates how data access methods are implemented. Figure 9 As shown, Figure 9 Flowchart of the data access method provided in the embodiments of this application Figure 1 .

[0212] The data access method includes the following steps S210 to S230.

[0213] S210, NIC1 of service node 1 receives the first read request from service node 2.

[0214] Among them, the network interface card 1 of service node 1 can be the above-mentioned Figure 4 The network interface card 114 of service node 1, or the network interface card 1 of service node 1, can be one of the above. Figure 6 DPU1 in service node 1. In some alternative methods, network interface card 1 may also be referred to as the first network interface card, the source network interface card, or other names, etc. This application does not limit this. Correspondingly, similar to network interface card 1 of service node 1, Figure 9 The network interface card 2 of the middle service node 2 can be one of the above. Figure 4 The network card of service node 2 in the above, or the network card of service node 2 in the above. Figure 6 DPU2 of service node 2. In some optional ways, network interface card 2 of service node 2 can be called the second network interface card, the destination network interface card, or other names, etc.

[0215] In one alternative implementation, the first read request is used to request read permission for cache 1 from business node 1.

[0216] In one alternative implementation, the first read request carries an identifier for cache 1. For example, the header of the first read request includes an identifier field for cache 1.

[0217] The identifier field of cache 1 can refer to the identifier of cache 1. Alternatively, the identifier field of cache 1 can also be the identifier of the first storage unit in cache 1. Or, the identifier field of cache 1 can also be the identifier of a data item in cache 1. Figure 9 As shown, the identifier field of cache 1 is the identifier of the first storage unit: block11.

[0218] In one example, the first storage unit could be one or more storage units in cache 1.

[0219] In addition, in some optional cases, the first read request may also carry a read request opcode.

[0220] In some implementations, the opcode is used to indicate the type of data operation for the cache request. This type of data operation includes data read, data write, and data send. Accordingly, the read request opcode is used to indicate that data is being read from cache 1.

[0221] In addition, in some optional cases, the opcode can also be used to indicate the transport protocol followed by the cache request. In this paper, the transport protocol includes a conformance protocol or an RDMA protocol.

[0222] Here, RDMA protocol can refer to the data transmission protocol between nodes in related technologies. Consistency protocol can refer to the transmission protocol between nodes provided in the embodiments of this application.

[0223] In one optional implementation, the consensus protocol provided in this application embodiment is based on the RDMA protocol and is formed by adding extended fields. The consensus protocol is offloaded from the CPU of service node 1 to the network interface card (NIC) of service node 1. Therefore, in the implementation of caching operations, NIC 1 can encapsulate packets according to the packet format of the consensus protocol and perform corresponding caching operations according to the protocol primitive fields specified in the consensus protocol.

[0224] In one example, compared to the RDMA message format, the conformance protocol's message format, in addition to the Ethernet header, Internet Protocol (IP) header, User Datagram Protocol (UDP) header, basic transport header, and actual data included in the RDMA message format, adds an extended header below the basic transport header. Furthermore, the extended header contains a first protocol primitive field (OpCode) and a second protocol primitive field. For example... Figure 10 As shown, the message format of this consensus protocol includes: Ethernet header, IP header, UDP header, basic transport header, extended header, and actual data.

[0225] like Figure 10 As shown, the extended header contains extended header fields. These extended header fields include: a first protocol primitive field (OpCode), a second protocol primitive field (ResCode), an identifier field for cache 1 (DataID), a node identifier field for the business node 1 where cache 1 resides (ClientID), and so on. In an optional implementation, these extended header fields can be referred to as extended fields.

[0226] The first protocol primitive field is used to indicate the type of operation on the cache lock.

[0227] In some implementations, the types of operations on cache locks include, but are not limited to: requesting a read from the cache, requesting a write to the cache, requesting a cache upgrade, requesting a cache downgrade, requesting a write to the cache recall, requesting a read from the cache invalidation, actively returning the cache lock, and actively flushing back cached data. The protocol primitive fields are shown in Table 1 below.

[0228] The second protocol primitive fields are used to indicate the operation result of the cache request. As shown in Table 1, the second protocol primitive fields include successful / failed read cache request, successful / failed write cache request, successful / failed cache upgrade request, successful / failed cache downgrade request, and successful / failed write cache recall request.

[0229] The following sections will introduce the first protocol primitive fields mentioned above, specifically regarding request read cache, request write cache, request cache upgrade, request cache downgrade, request write cache recall, request read cache invalidation, proactive cache lock return, and proactive write cache data flushing.

[0230] In this article, "request to read cache" can refer to an accessing node requesting to read data from its home node's cache. For example, business node 2 requests to read data from the first storage unit of cache 1 from business node 1.

[0231] "Request to write to cache" refers to an accessing node requesting a write operation to the cache from the owner node. For example, business node 2 requests business node 1 to write data to the first storage unit in cache 1. The specific processing flow of the owner node under "Request to write to cache" can be found below. Figure 12A The embodiments provided in 12B are described herein.

[0232] "Request Cache Upgrade" instructs the node holding the cache lock to request the owner node to change the cache lock's state from a read lock to a write lock. For example, business node 2 requests business node 1 to change the cache lock state of the first storage unit in cache 1 from a read lock to a write lock. Specifically, the processing flow of the owner node under "Request Cache Upgrade" can be found below. Figure 14 The provided embodiments are not described in detail herein.

[0233] "Request cache degradation" instructs the node holding the cache lock to request the home node to change the cache lock's state from a write lock to a read lock. For example, business node 2 requests business node 1 to change the cache lock state of the first storage unit in cache 1 from a write lock to a read lock. Specifically, the processing flow of the home node under "Request cache degradation" can be found below. Figure 15 The provided embodiments are not described in detail herein.

[0234] "Request Write Cache Recall" is used to instruct the home node to request the release of the cache lock from the node holding the cache lock when the cache lock is in a write lock state. For example, if business node 2 holds a cache lock on the first storage unit of cache 1 in business node 1, and the cache lock is in a write lock state, business node 1 requests business node 2 to release the cache lock on cache 1. Specifically, the processing flow of the home node under "Request Write Cache Recall" can be referred to as follows. Figure 13 The provided embodiments are not described in detail herein.

[0235] "Request Read Cache Invalidation" indicates that when a cache lock is in a read lock state, the home node requests the node holding the cache lock to release the cache lock. For example, if business node 2 holds a cache lock on the first storage unit of cache 1 in business node 1, and the cache lock is in a read lock state, business node 1 requests business node 2 to release the cache lock on cache 1. Specifically, the processing flow for the home node under "Request Read Cache Invalidation" can be found below. Figure 11 The provided embodiments are not described in detail herein.

[0236] "Actively return cache lock" is used to instruct the node holding the cache lock to actively return the cache lock to the node that owns the cache. The cache lock's state changes from read lock or write lock to unlocked.

[0237] In one example, "actively returning cache locks" includes actively returning write locks and actively returning read locks.

[0238] Among them, actively returning the write lock can refer to the node holding the cache lock actively returning the cache lock to the cache's owner node when the cache lock is in the state of a write lock, and the cache lock's state changes from a write lock to an unlocked state.

[0239] Actively returning a read lock can refer to the node holding the cache lock actively returning the cache lock to the node that owns the cache when the cache lock is in the read lock state, thus changing the cache lock state from read lock to unlock.

[0240] It should be noted that in this article, "releasing the cache lock" can mean that the node holding the cache lock returns the cache lock to the owner node, and the state of the cache lock changes from read lock or write lock to unlock.

[0241] "Returning the cache lock" and "Actively returning the cache lock" are two different caching operations. "Returning the cache lock" requires the node holding the cache lock to return the cache lock to the owner node after receiving a request from the owner node. "Actively returning the cache lock" means that the node holding the cache lock returns the cache lock to the owner node after completing data reading or data writing.

[0242] "Actively flushing cached data" refers to the process where, when the cache lock is in a write lock state, the node holding the cache lock synchronizes the modified data to the cache's owner node, enabling the owner node to update the data in its cache. For example, business node 2 holds a cache lock on the first storage unit of cache 1 in business node 1, and the cache lock is in a write lock state. Business node 2 stores a copy of the data in the first storage unit. When business node 2 requests "actively flushing cached data" from business node 1, business node 2 sends the updated data copy to business node 1.

[0243] Table 1

[0244]

[0245] It should be noted that in the cache request, the second protocol primitive field in the extended fields is empty. In the cache request's return message, neither the first protocol primitive field nor the second protocol primitive field in the extended fields is empty.

[0246] In the first example, taking the network interface card 1 receiving the first read request from service node 2 to obtain the first storage unit cache1 as an example, the extended header fields in the first read request are: OpCode: CC_READ; ResCode:; Reserved:; ClientID: Node 1; DataID: cache1. Among them, Node 1 is used to indicate the node identifier of service node 1.

[0247] In the second example, when network interface card 1 determines to grant cache 1 to service node 2, the extended header fields in the message returned by network interface card 1 to service node 2 are: OpCode: CC_READ; ResCode: CC_READ_ACK; Reserved:; ClientID: node 1; DataID: cache1.

[0248] The following is combined Figure 10 This paper provides a brief description of the message format of the conformance protocol provided in the embodiments of this application, excluding the extended header field.

[0249] The Ethernet header contains the destination Media Access Control (MAC) address and the source MAC address. For example, when service node 2 sends a first read request to network interface card 1 of service node 1, the destination MAC address is the MAC address of service node 1, and the source MAC address is the MAC address of service node 2.

[0250] The IP header contains the source IP address and the destination IP address. For example, when service node 2 sends a first read request to network interface card 1 of service node 1, the destination IP address is the IP address of service node 1, and the source IP address is the IP address of service node 2.

[0251] The UDP header includes the source port, destination port, and length. The length refers to the word length of the UDP header and the data. In the case where service node 2 sends its first read request to service node 1's network interface card 1, the destination port is service node 1's port, for example, 4791. The source port is service node 2's port, for example, 4791.

[0252] The basic transport header includes an opcode, message type (MTYPE), error detection field (SE), fragmentation field (M), reserved bits field (Pad), and transport layer version field (TV). The contents of the fields in the message type (MTYPE), error detection field (SE), fragmentation field (M), reserved bits field (Pad), and transport layer version field (TV) can be found in existing RDMA protocol implementations and will not be described in detail here.

[0253] The opcode is used to indicate the type of data operation requested by the cache request and the transport protocol that the cache request follows.

[0254] In one optional implementation, since the consistency protocol provided in this application embodiment is based on the RDMA protocol, in order to distinguish between the consistency protocol and the RDMA protocol, the transport protocol followed by the cache request can be distinguished by whether the opcode carries a preset string.

[0255] For example, network interface card 1 in service node 1 can parse cache requests and identify the read request opcode field within the cache request. If the opcode field carries a preset string, it is determined that the cache request conforms to the consistency protocol. If the opcode does not carry a preset string, it is determined that the cache request conforms to the RDMA protocol.

[0256] The preset string can be "CC_". For example, when the opcode is "CC_**", the cache request conforms to the consistency protocol provided in the embodiments of this application. When the opcode is "**", the cache request conforms to the RDMA protocol. Here, "**" indicates the type of cache request. It is understood that the preset string can also be other content or form, and this application does not limit it.

[0257] For example, taking the example of business node 2 sending a read request for the first storage unit to business node 1, the implementation methods of cache request conforming to the RDMA protocol and cache request conforming to the consistency protocol will be introduced.

[0258] In the first alternative example, if the opcode in the basic transport header of the read request is "READ", the read request conforms to the RDMA protocol. The header of the read request does not contain any extended header fields. After receiving the read request, network interface card 1 reads the data from the first storage unit in cache 1 of service node 1 and sends the read data to the network interface card of service node 2.

[0259] When cache 1 on business node 1 needs to perform cache consistency checks, business node 2 needs to send an additional cache lock acquisition request for the first storage unit to business node 1. At this time, the processor of business node 1 needs to refer to the above... Figure 2The provided process determines whether to grant a cache lock on the first storage unit to service node 2. Only if it is determined that a cache lock on the first storage unit will be granted to service node 2 will network interface card 1 send the data of the first storage unit to service node 2.

[0260] In the second alternative example, when the opcode in the basic transport header of the read request is "CC_READ", the read request conforms to the consistency protocol. The read request header includes an extension header field. After receiving the read request, NIC 1 determines the operation type of the cache lock on the first storage unit by service node 2 through the first protocol primitive field in the extension header field. NIC 1 executes... Figure 9 The provided data access method determines whether to grant a cache lock to the first storage unit to service node 2. Furthermore, network interface card 1 sends the data from the first storage unit to service node 2.

[0261] From the two examples above, it can be seen that when business node 1 receives a message based on the RDMA protocol, it cannot identify the specific operation type of the cache lock. Business node 2 needs to send an additional cache lock acquisition request to acquire the cache lock and retrieve the data from the cache. This increases the number of requests. Figure 10 The provided consistency protocol message format incorporates an extended header that integrates the cache consistency protocol and the RDMA protocol. Upon receiving the message, network interface card 1 (NIC 1) of service node 1 can identify the operation type of service node 2's cache lock and the operation type of the data in the cache based on the first protocol primitive field. Therefore, service node 2 can achieve cache lock granting and data retrieval with a single request. This reduces the number of request transmissions between service nodes.

[0262] S220, NIC1 queries the cache lock status based on the first read request.

[0263] In the first optional implementation, there are several ways to implement the query of the cache lock status based on the first read request, for example:

[0264] In the first implementation, if the first read request carries the identifier of cache 1, the network card 1 queries the memory for the cache lock status of cache 1.

[0265] For example, if the memory of service node 1 stores the state of the cache lock of cache 1, the state of the cache lock of cache X1, and the state of the cache lock of cache X2, and the first read request carries the state of cache 1, then network card 1 queries the state of the cache lock of cache 1.

[0266] In the second implementation, if the first read request carries the identifier of the first storage unit in cache 1, the network card 1 queries the memory for the cache lock status of the first storage unit of cache 1.

[0267] For example, if cache 1 in service node 1 includes storage units B1 to B6, the memory of service node 1 stores the status of the cache lock corresponding to each of storage units B1 to B6. When the first read request carries the identifier of storage unit B3, network card 1 queries the memory of service node 1 for the status of the cache lock of storage unit B3.

[0268] In the third implementation, if the first read request carries the identifier of the data item in cache 1, the network card 1 determines the storage unit in cache 1 that stores the data item and queries the memory for the status of the cache lock of the storage unit that stores the data item.

[0269] For example, if cache 1 in service node 1 includes storage units B1 to B6, and each of storage units B1 to B6 stores data items D1 to D6 respectively, the memory of service node 1 stores the status of the cache lock corresponding to each of storage units B1 to B6. If the first read request carries the identifier of data item D3, network interface card 1 determines that the storage unit storing data item D3 is B3, and network interface card 1 queries the memory of service node 1 for the status of the cache lock of storage unit B3.

[0270] It should be noted that the above three implementation methods are merely different ways of querying the state of the cache lock. In practical applications, other implementation methods can also be used. For example, if the first read request carries the identifier of a data item, the network card 1 of service node 1 determines the data item in service node 1's cache 1 that matches the identifier of the data item, and queries the state of the cache lock of that data item in service node 1's memory. This application does not limit this.

[0271] In one optional implementation, the network interface card 1 of service node 1 can obtain a cache management information list from the memory of service node 1 and query the status of the cache lock in the cache management information list.

[0272] S230, if the cache lock is in an unlocked or read-locked state, NIC1 sends the first acknowledgment message to service node2.

[0273] The first confirmation message is used to indicate that business node 2 has read permission to cache 1.

[0274] In the first example, if the first read request carries the identifier of cache 1, then the read permission of business node 2 to cache 1 can mean that business node 2 has read permission to all storage units in cache 1.

[0275] In the second example, if the first read request carries the identifier of the first storage unit in cache 1, then the read permission of business node 2 to cache 1 can mean that business node 2 has read permission to the first storage unit in cache 1.

[0276] In the third example, if the first read request carries the identifier of the data item in cache 1, then the read permission of business node 2 to cache 1 can mean that business node 2 has read permission to the storage unit in cache 1 that stores the data item.

[0277] It should be noted that the above three examples are merely different implementations of read permissions for cache 1. In practical applications, there can be other implementations. For example, if the first read request carries an identifier for a data item, then business node 2 having read permissions for cache 1 could mean that business node 2 has read permissions for the data item in cache 1 that matches the identifier of the data item. This application does not limit this.

[0278] In one optional implementation, taking the first read request carrying the identifier of the first storage unit in cache 1 as an example, if the cache lock of the first storage unit is in an unlocked or read-locked state, the network interface card 1 of service node 1 sends a copy of the data in the first storage unit to service node 2. Furthermore, network interface card 1 modifies the cache management information list of the first storage unit in the memory.

[0279] like Figure 9 As shown, the network card 1 of service node 1 moves copies of data items P1 to P6 in the storage unit identified as block11 to service node 2, and service node 2 stores copies of data items P1 to P6 in the memory of service node 2.

[0280] The following section describes how the network interface card 1 modifies the cache management information list of the first memory unit, taking the cache lock states of read lock and unlocked as examples respectively.

[0281] In the first optional implementation, when the cache lock of the first storage unit is unlocked, network interface card 1 adds a cache lock to the data corresponding to the first storage unit. Furthermore, network interface card 1 modifies the cache lock status in the cache management information list, changing the cache lock status from unlocked to read lock. Network interface card 1 then writes the node identifier of service node 2 into the node list of the cache management information list.

[0282] For example, as described above Figure 8Taking the cache management information list shown in Figure (a) as an example, when the network card 1 determines that the service node 2 has the right to read the first storage unit block 11 in the cache 1, the network card 1 changes the cache lock status of the first storage unit block 11 from unlocked to read lock, and writes the node identifier of the service node 2: node 2 into the node list in the cache management information list.

[0283] In the second optional implementation, when the cache lock of the first storage unit is in the read lock state, network interface card 1 writes the node identifier of service node 2 into the node list of the cache management information list. Based on Figure 9 The provided embodiment, compared to the scheme of locking and unlocking the consensus protocol through the CPU, does not require the participation of the CPU. The network card realizes the recognition of the cache lock state, thereby obtaining the access rights of service node 2 to the cache. In this way, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data transmission, a high-performance distributed cache consensus protocol is realized, freeing up CPU computing power and improving the overall performance of the system.

[0284] In one optional implementation, taking the protocol primitive fields shown in Table 1 above as an example, when the network interface card 1 (NIC 1) of service node 1 receives a request carrying different first protocol primitive fields, NIC 1 can determine the corresponding second protocol primitive field based on the state of the cache lock of cache 1, and reply with the corresponding acknowledgment message and modify the state of the cache lock. As shown in Table 2, Table 2 illustrates the second protocol primitive fields replied by NIC 1 of service node 1 under different first protocol primitive fields.

[0285] Table 2

[0286]

[0287] In Table 2, the vertical axis represents the cache lock status of any storage unit in cache 1 of service node 1, and the horizontal axis represents different first protocol primitive fields. The table shows how network interface card 1 (NIC 1) of service node 1 modifies the cache lock status under different first protocol primitive fields and the corresponding second protocol primitive fields. "NAK" indicates a cache request failure, and "ACK" indicates a successful cache request. For example, if the cache lock status of the first storage unit is unlocked, and the received first protocol primitive field is CC_READ, then NIC 1 of service node 1 will change the cache lock status of the first storage unit from "I (unlocked)" to "S (read lock)," and "ACK" indicates a response using the second protocol primitive field CC_READ_ACK. "OK" indicates no processing of the first protocol primitive field.

[0288] In Table 2, "write replica" refers to a replica that has both data write and data read permissions. A business node holding a read replica can refer to a business node that has read permissions for the storage unit. A business node holding a write replica can refer to a business node that has write permissions for the storage unit.

[0289] The following will combine Figures 11 to 16 This section describes the different processing methods of network card 1 of service node 1 under requests carrying different first protocol primitive fields as shown in Table 2 above.

[0290] First, taking the state of the cache lock of the first storage unit as a write lock and the first protocol primitive field CC_READ as an example, the implementation method of the data access method will be introduced.

[0291] In one alternative implementation, after step S220 above, if the cache lock of the first storage unit of cache 1 is in the state of a write lock, the network card 1 of service node 1 can acquire the node holding the cache lock of the first storage unit, and then determine whether to grant read permission to the first storage unit to service node 2.

[0292] In a first optional implementation, if the cache lock of the first storage unit is in a write lock state, and the node holding the cache lock of the first storage unit is service node 3, then network interface card 1 of service node 1 requests service node 3 to release the cache lock of the first storage unit. If service node 3 successfully releases the cache lock, network interface card 1 sends a first confirmation message to service node 2.

[0293] In the second optional implementation, if the cache lock of the first storage unit is in the state of a write lock and service node 2 holds the cache lock of the first storage unit, and service node 2 loses its access to the first storage unit after a power outage and restart or after the distributed caching system is reset, but since service node 2 does not actively return the cache lock of the first storage unit to service node 1's network card, the state of the cache lock of the first storage unit recorded in service node 1's memory is still a write lock, and the node holding the cache lock is still service node 2. Therefore, service node 2 can request to read the data of the first storage unit again.

[0294] The two possible implementations described above are merely different ways in which the network interface card 1 (NIC 1) of service node 1 handles the first read request when the cache lock is in a write lock state. In practical applications, the NIC 1 of service node 1 can also have other implementations. For example, if the node holding the cache lock is service node 3, the NIC 1 of service node 1 can send an acknowledgment message to service node 2 indicating that service node 2 does not have read permission for the first storage unit. This application embodiment does not limit this.

[0295] Regarding the second optional implementation method mentioned above, two feasible examples are provided below for illustration.

[0296] For example, after step S220, if the cache lock of the first storage unit is in a write lock state, the network interface card 1 of service node 1 determines the node holding the cache lock. If service node 1 is the node holding the cache lock, its network interface card 1 sends a first acknowledgment message to the second service node. It is understandable that when the cache lock is in a write lock state, only one node holds the cache lock. The service node holding the cache lock has both read and write permissions for the data corresponding to the first storage unit.

[0297] For example, after step S220, if the cache lock is in the write lock state, the network interface card 1 of service node 1 determines the node holding the cache lock. If the node holding the cache lock is service node 2, the network interface card 1 of service node 1 sends an acknowledgment message to the second service node indicating that the second service node has write permission to the first storage unit.

[0298] Regarding the first optional implementation method mentioned above, the following example illustrates the process of requesting to release the cache lock, assuming the cache lock of the first storage unit is in the state of a write lock and the node holding the cache lock of the first storage unit is business node 3. Figure 11 As shown, Figure 11 Flowchart of the data access method provided in the embodiments of this application Figure 2 .like Figure 11 As shown, network interface card 3 (NIC 3) is configured in service node 3. Similar to service node 1, NIC 3 in service node 3 can be... Figure 4 The network interface card (NIC) in service node 3 can also be one of the above. Figure 6 The DPU3 in service node 3. Furthermore, in some optional implementations, the network interface card 3 (NIC 3) of service node 3 may also be referred to as a third NIC or other names; this application will not elaborate on this.

[0299] Figure 11 The data access method shown is relative to Figure 9 The provided data access method includes steps S240 to S270 after step S220.

[0300] S240, if the cache lock is in the write lock state, the network card 1 of service node 1 determines the node holding the cache lock.

[0301] S250, if the node holding the cache lock is service node 3, network card 1 sends the first cache reclamation request to service node 3.

[0302] In one alternative implementation, when the node holding the cache lock is business node 3, business node 3 stores a copy of the first storage unit, and business node 3 can write or modify data on the copy.

[0303] In one optional implementation, network interface card 1 can compare the node identifier in the node list with the node identifier of service node 2. If the node identifier in the node list does not match the node identifier of service node 2, the node holding the cache lock is determined to be service node 3.

[0304] The first cache reclamation request is used to instruct business node 3 to release the cache lock of the first storage unit.

[0305] In one optional implementation, the network card 1 of service node 1 can obtain the network address of service node 3 and send a first cache reclamation request to service node 3 based on the network address of service node 3 and the identifier of the first storage unit.

[0306] In one optional example, the memory of service node 1 stores the node's network address data. This network address data includes the node identifiers and corresponding network addresses of all service nodes in the distributed caching system. Service node 1's network interface card 1 can obtain the network address of service node 3 from the node's network address data. For example, taking a distributed caching system including service node 1, service node 2, and service node 3 as an example, the network addresses corresponding to service node 1, service node 2, and service node 3 are IP1, IP2, and IP3, respectively.

[0307] In one alternative example, the first cache eviction request carries the first protocol primitive field "CC_RECALL" from Table 1 above. The specific operation type of this first cache eviction request is write cache recall.

[0308] S260, NIC1 of service node 1 receives the second acknowledgment message returned by service node 3.

[0309] The second confirmation message is used to indicate that the cache lock of the first storage address was successfully released, or to indicate that the cache lock of the first storage unit failed to be released.

[0310] In one alternative implementation, the network interface card 3 in the service node 3 can respond to the first cache reclamation request and return a second confirmation message, as provided in Table 5 below, which will not be described in detail here.

[0311] S270, if the second confirmation message indicates that the cache lock of the first storage unit has been successfully released, the network card 1 of service node 1 sends the first confirmation message to service node 2.

[0312] In one alternative implementation, when the second confirmation message indicates that the cache lock of the first storage unit has been successfully released, the network card 1 of service node 1 modifies the status of the cache lock and the node list in the cache management information list of the first storage unit in the memory.

[0313] For example, if the second confirmation message indicates that the cache lock of the first storage unit has been successfully released, the network card 1 of service node 1 will change the status of the cache lock from write lock to unlocked, and delete the node identifier of service node 3 from the node list.

[0314] In one example, if the cache lock on the first storage unit is successfully released, service node 3 returns a copy to service node 1. Service node 1's network interface card 1 receives the copy returned by service node 3 and updates the data stored in the first storage unit based on the returned copy. After the update is complete, service node 1's network interface card 1 sends a first acknowledgment message to service node 2.

[0315] Among them, returning the copy can refer to business node 3 returning the copy of the data that has been written or modified to business node 1, and removing the copy from the memory of business node 3.

[0316] In one alternative implementation, if the second confirmation indicates that the cache lock of the first storage address fails to be released, the network card 1 of service node 1 sends an confirmation message to service node 2 indicating that service node 2 does not have read permission to the first storage unit.

[0317] based on Figure 11 In the provided embodiment, when a read / write conflict occurs between service node 2 and service node 3 regarding the first storage unit, the network interface card 1 (NIC 1) of service node 1 initiates a cache recall process. Only after the node holding the cache lock successfully releases the cache lock does NIC 1 of service node 1 return a first acknowledgment message to service node 2. This ensures data consistency across multiple service nodes. Furthermore, in the event of a read / write conflict, cache recall is performed by NIC 1 of service node 1, eliminating the need for processor intervention, thus reducing the processing path length in read / write conflict scenarios and improving data transmission efficiency.

[0318] Next, taking the first protocol primitive field CC_WRIT as an example, we will introduce the implementation of the data access method of network card 1 of service node 1 under different cache lock states.

[0319] For example, taking the cache lock being in an unlocked state as an example, the implementation method of the data access method will be introduced. Figure 12A As shown, Figure 12A Flowchart of the data access method provided in the embodiments of this application Figure 3 The data access method shown includes steps S310 to S330.

[0320] S310, NIC1 of service node 1 receives the first write request from service node 2.

[0321] The first write request is used to request write permission for the second storage unit in cache 1 of business node 1.

[0322] In some examples, the second storage unit may be a storage unit other than the first storage unit in the cache 1 of service node 1.

[0323] In one alternative implementation, similar to the first read request, the first write request also carries an identifier field for cache 1. For example... Figure 12A As shown, the identifier field of cache 1 carried in the first write request is the identifier of the second storage unit: block12.

[0324] In addition, in other cases, the first write request may carry data to be written to the second storage unit, provided that it carries the identifier field of cache 1.

[0325] S320, the network card 1 of service node 1 queries the status of the cache lock based on the first write request.

[0326] In one alternative implementation, the network card 1 of service node 1 queries the cache lock status of the second storage unit with reference to the above S220, which will not be elaborated here.

[0327] S330, if the cache lock is unlocked, the network card 1 of service node 1 sends a fourth acknowledgment message to service node 2.

[0328] The fourth confirmation message is used to indicate that service node 2 has write permission to the second storage unit.

[0329] In the first optional implementation, when the cache lock is unlocked, network interface card 1 (NIC 1) of service node 1 sends a copy of the data in the second storage unit to service node 2. NIC 1 also modifies the cache lock status and node list in the cache management information list of the second storage unit. Service node 2 then modifies the data copy in the second storage unit. Figure 12A As shown, network interface card 1 (NIC 1) of service node 1 transfers a data copy from the second storage unit to NIC 2 of service node 2. NIC 2 of service node 2 stores the data copy in the memory of service node 2 as a write copy and modifies the data copy.

[0330] In the second optional implementation, when the cache lock is unlocked, network interface card 1 (NIC 1) of service node 1 writes the data carried in the first write request to the second storage unit. Furthermore, NIC 1 modifies the cache lock status and node list in the cache management information list of the second storage unit.

[0331] The implementation method of NIC1 modifying the cache lock status and node list in the cache management information list of the second storage unit includes: NIC1 changes the cache lock status of the second storage unit from unlocked to write lock, and writes the node identifier of service node 2 into the node list.

[0332] based on Figure 12A In this embodiment, during the write request processing, when the network interface card 1 (NIC 1) of service node 1 receives the write request from service node 2, it queries the status of the cache lock using the identifier of cache 1 carried by the write request lock. If the cache lock is unlocked, it returns a fourth acknowledgment message to service node 2 that sent the write request. Compared to the scheme where the CPU determines cache locking / unlocking, this embodiment does not require CPU involvement; the NIC identifies the cache lock status and thus obtains the service node 2's access rights to the cache. In this way, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data, a high-performance distributed cache consistency protocol is achieved, freeing up CPU computing power and improving the overall system performance.

[0333] Next, in conjunction with the above Figure 12A The provided embodiment describes the implementation method of data access when the cache lock is in a read lock state. For example... Figure 12B As shown, Figure 12B Flowchart of the data access method provided in the embodiments of this application Figure 4 . Figure 12B The data access methods shown are Figure 12A Compared to the data access method shown, steps S340 and S350 are included after step S320 above.

[0334] S340, if the cache lock is in the read lock state, the network card 1 of service node 1 determines the node holding the cache lock.

[0335] In one alternative implementation, the network interface card 1 of service node 1 can determine the node holding the cache lock by referring to S240 above. This will not be elaborated further in this application.

[0336] In the case where the only node holding the cache lock is service node 2, network card 1 of service node 1 sends a fourth acknowledgment message to the second service node.

[0337] In one alternative implementation, when only business node 2 holds the cache lock for the second storage unit and the cache lock is in the read lock state, business node 2's request for write permission for the second storage unit from business node 1 will not cause cache inconsistency between business nodes. Therefore, when the cache lock is in the read lock state and only business node 2 holds the cache lock for the second storage unit, the state of business node 2's cache lock for the second storage unit can be changed to write lock.

[0338] In one possible implementation, if only service node 2 holds the cache lock, service node 1's network interface card 1 modifies the cache lock status in the cache management information list of the second storage unit, changing the cache lock status from read lock to write lock.

[0339] based on Figure 12B In the provided embodiment, during the write request processing, when the network interface card 1 (NIC 1) of service node 1 receives a write request from service node 2, it queries the status of the cache lock using the identifier of cache 1 carried by the write request lock. If the cache lock is in the read lock state and the node holding the cache is service node 2, NIC 1 returns a fourth acknowledgment message to service node 2 that sent the write request. Compared to the scheme that uses the CPU to determine cache locking and unlocking, this embodiment does not require CPU participation; the NIC identifies the cache lock status and thus obtains the service node 2's access rights to the cache. In this way, by shortening the processing path length in data access and reducing the transmission latency of RDMA protocol data, a high-performance distributed cache consistency protocol is achieved, freeing up CPU computing power and improving the overall system performance.

[0340] The above Figure 12A and Figure 12B This paper primarily describes the write request processing process using the example of no read-write conflict or write-write conflict in the second storage unit. In other embodiments, different service nodes may experience read-write conflicts or write-write conflicts with the second storage unit. To better describe the data access method provided in this application, the following description uses the example of read-write conflicts or write-write conflicts between different service nodes with the second storage unit to illustrate the write request processing process.

[0341] Read-write conflicts can include the following two scenarios: First, if the cache lock in the second storage unit is in a read lock state, the node holding the cache lock does not include service node 2. Second, if the cache lock in the second storage unit is in a read lock state, the nodes holding the cache lock include both service node 2 and service node 3.

[0342] Specifically, a write-write conflict can refer to a situation where, when the cache lock in the second storage unit is in a write lock state, the node holding the cache lock does not include business node 2. That is, the node holding the cache lock is business node 3.

[0343] In the first optional implementation, in the event of read-write conflicts or write-write conflicts between different service nodes regarding the second storage unit, to ensure cache consistency among service nodes, the network interface card 1 of service node 1 can return a fifth acknowledgment message to service node 2. This fifth acknowledgment message indicates that service node 2 does not have write permissions to the second storage unit.

[0344] For example, taking a read-write conflict as an example, in the first example, if the node holding the cache lock does not include business node 2, the network card 1 of business node 1 returns a fifth acknowledgment message to business node 2.

[0345] In the second example, if the nodes holding the cache lock include both service node 2 and service node 3, then network interface card 1 of service node 1 returns a fifth acknowledgment message to service node 2.

[0346] It should be noted that the above two examples are only different implementation methods under the condition that the second storage unit has read and write conflicts. In practical applications, there may be other implementation methods, which are not limited in this application.

[0347] For example, taking the case of a write-write conflict in the second storage unit, in one example, when the node holding the cache lock is the service node 3, the network card 1 of the service node 1 returns a fifth acknowledgment message to the service node 2.

[0348] In the second possible implementation, in the event of read-write conflicts or write-write conflicts in the second storage unit, to ensure cache consistency among service nodes, network interface card 1 (NIC 1) of service node 1 can request the release of the cache lock on the second storage unit from the third service node. If the cache lock on the second storage unit is successfully released, NIC 1 of service node 1 returns a fourth acknowledgment message to service node 2. If the cache lock on the second storage unit fails to be released, NIC 1 of service node 1 returns a fifth acknowledgment message to service node 2.

[0349] It should be noted that the two possible implementations described above are only different ways to handle write requests when there are read-write conflicts or write-write conflicts in the second storage unit. In practical applications, there may be other implementations. This application does not limit these implementations.

[0350] Regarding the second optional implementation method mentioned above, the following will combine... Figure 13 This paper introduces the implementation methods of data access under read-write conflicts.

[0351] like Figure 13 As shown, Figure 13 Flowchart of the data access method provided in the embodiments of this application Figure 5 . Figure 13The data access methods shown are Figure 12B Compared to the data access method shown, steps S360 to S380 are included after step S340 above.

[0352] S360, if the node holding the cache lock includes service node 3, the network card 1 of service node 1 sends a second cache reclamation request to service node 3.

[0353] The second cache reclamation request is used to instruct business node 3 to release the cache lock of the second storage unit.

[0354] In one alternative implementation, the second cache eviction request carries the first protocol primitive field "CC_INV" from Table 1 above. The specific operation type of this second cache eviction request is a request to read cache invalidation.

[0355] In one alternative implementation, after receiving the second cache reclamation request, business node 3 can refer to the following... Figure 19 The provided embodiment returns a third confirmation message to service node 1, which will not be described in detail here.

[0356] In one optional implementation, the node holding the cache lock includes business node 3, which includes any of the following cases: the node holding the cache lock includes only business node 3, or the node holding the cache lock includes both business node 3 and business node 2.

[0357] S370, NIC1 of service node 1 receives the third acknowledgment message returned by service node 3.

[0358] In one alternative implementation, the third acknowledgment message carries either the second protocol primitive field "CC_INV_ACK" or "CC_INV_NAK" from Table 1 above.

[0359] In the case where the second protocol primitive field carried in the third confirmation message is “CC_INV_ACK”, it is determined that the third confirmation message indicates that the cache lock of the second storage unit has been successfully released.

[0360] If the second protocol primitive field carried in the third confirmation message is “CC_INV_NAK”, it is determined that the third confirmation message indicates that the cache lock release of the second storage unit has failed.

[0361] In an optional example, if the third acknowledgment message indicates that the cache lock of the second storage unit was successfully released, the network interface card 1 of service node 1 executes the following S380. If the third acknowledgment message indicates that the cache lock of the second storage unit was not released, the network interface card 1 of service node 1 returns a fifth acknowledgment message to service node 2.

[0362] S380, if the third confirmation message indicates that the cache lock of the second storage unit has been successfully released, the network card 1 of service node 1 sends a fourth confirmation message to service node 2.

[0363] In one alternative implementation, in step S380, the network card 1 of service node 1 can send a fourth confirmation message to service node 2 as described in step S330 above, and transfer the data copy in the second storage unit to service node 2.

[0364] In one optional implementation, in step S380, the network interface card 1 of service node 1 can modify the state of the cache lock and the node list in the cache management information list of the second storage unit. The state of the cache lock is changed from a read lock to a write lock, and the node identifier of service node 3 in the node list is changed to the node identifier of service node 2.

[0365] based on Figure 13 In the provided embodiment, when a read / write conflict exists between service node 2 and service node 3 regarding the second storage unit, the network interface card 1 (NIC 1) of service node 1 recalls the cache lock for the second storage unit. Based on the recall result of the cache lock, it is determined whether service node 2 is allowed to write data to the second storage unit. This ensures cache consistency across multiple service nodes. Furthermore, in the event of a read / write conflict, the NIC handles the cache lock recall without the need for processor involvement, reducing the processing path length in read / write conflict scenarios and improving data transmission efficiency.

[0366] Regarding the second optional implementation method mentioned above, the implementation method for data access under write-write conflicts will be introduced below. Compared to... Figure 13 The implementation methods shown in the figure for read-write conflicts and the implementation methods for data access under write-write conflicts mainly differ in the following ways:

[0367] (1) In the case of a write-write conflict, the first protocol primitive field carried in the cache eviction request is “CC_RECALL”, and the specific operation type of the cache eviction request is to request write cache recall.

[0368] (2) In the event of a write-write conflict, the confirmation message returned by business node 3 carries the second protocol primitive field “CC_RECALL_ACK” or “CC_RECALL_NAK”.

[0369] If the second protocol primitive field is "CC_RECALL_ACK", the cache lock release of the second storage unit is determined to be successful. If the second protocol primitive field is "CC_RECALL_NAK", the cache lock release of the second storage unit is determined to be unsuccessful.

[0370] (3) In the event of a write-write conflict, if the cache lock of the second storage unit is successfully released, the network interface card 1 of service node 1 modifies the node list in the cache management information list of the second storage unit. The node identifier of service node 3 in the node list is changed to the node identifier of service node 2.

[0371] The above primarily uses read and write requests as examples to introduce the data access method provided in this application. Understandably, during data access, if business node 2 holds a cache lock on cache 1 in business node 1, business node 2 can request cache upgrades or downgrades from business node 1. It can also proactively return the cache lock to business node 1.

[0372] In this context, "request cache upgrade" can refer to a cache request where the first protocol primitive field is "CC_UPGRADE".

[0373] Request cache degradation can refer to a cache request where the first protocol primitive field is "CC_DOWNGRADE".

[0374] Actively returning a cache lock can mean that the first protocol primitive field carried by the cache request is "CC_S_FLUSH" or "CC_E_FLUSH".

[0375] It should be noted that, in this embodiment of the application, when the first protocol primitive field carried in the cache request is "CC_UPGRADE" or "CC_DOWNGRADE", the cache request can be called a cache lock change request. This cache lock change request is used to request a change in access permissions to the cache to write permissions or read permissions.

[0376] If the first protocol primitive field carried in the cache request is "CC_S_FLUSH" or "CC_E_FLUSH", the cache request can be called a cache lock return request. This cache lock change request is used to indicate the return of the cache lock.

[0377] The following sections will introduce the implementation methods of data access methods, taking cache upgrade requests, cache downgrade requests, and cache requests that actively return cache locks as examples.

[0378] First, taking request cache upgrade as an example, we will introduce the implementation of data access methods.

[0379] In the first optional implementation, business node 2 holds a cache lock on the first storage unit in the cache 1 of business node 1, and the cache lock is in the state of read lock.

[0380] Service Node 2 sends a first cache lock change request to Service Node 1. This request changes Service Node 2's access permission to the first storage unit from read to write. Upon receiving the first cache lock change request, Service Node 1's network interface card 1 (NIC 1) determines the node holding the cache lock for the first storage unit. If the node holding the cache lock for the first storage unit is only Node 2, Service Node 1's NIC 1 updates the cache lock status of the first storage unit from read lock to write lock. If the node holding the cache lock for the first storage unit includes both a second and a third service node, Service Node 1's NIC 1 can refer to the above. Figure 13 The provided embodiment initiates a cache lock recall process. If the cache lock recall for the first storage unit is successful, the network interface card 1 (NIC 1) of service node 1 updates the state of the cache lock for the first storage unit from a read lock to a write lock. If the cache lock recall for the first storage unit fails, the NIC 1 of service node 1 does not modify the state of the cache lock for the first storage unit; that is, the state of the cache lock for the first storage unit remains a read lock.

[0381] The first cache lock change request is used to request business node 1 to change business node 2's access permission to the first storage unit from read permission to write permission. This first cache lock change request carries the first protocol primitive field "CC_UPGRADE".

[0382] In addition, similar to the first read request mentioned above, the first cache lock change request carries the identifier of the first storage unit.

[0383] In the second optional implementation, business node 2 does not hold the cache lock of the first storage unit in the cache 1 of business node 1.

[0384] Service Node 2 sends a first cache lock change request to Service Node 1. This request changes Service Node 2's access permission to the first storage unit from read permission to write permission. Upon receiving the first cache lock change request, Service Node 1's network interface card 1 returns an acknowledgment message to Service Node 2 indicating that Service Node 2's access permission to the corresponding data in the first storage unit has not changed. Alternatively, Service Node 1's network interface card 1 may not respond to the first cache lock change request.

[0385] The confirmation message indicating that the access permissions of service node 2 to the data corresponding to the first storage unit have not changed carries the second protocol primitive field "CC_UPGRADE_NAK".

[0386] It should be noted that the two possible implementations described above represent different ways in which the network interface card (NIC) 1 of service node 1 handles cache lock change requests under different cache lock states. In practical applications, other implementations exist, which this application does not limit. For example, if service node 2 holds a write lock on the first storage unit in cache 1, and service node 2 experiences a power outage and restart, or an instruction error, service node 2 sends a first cache lock change request to NIC 1 of service node 1. NIC 1 of service node 1 returns an acknowledgment message to service node 2 indicating that service node 2's access permissions to the corresponding data in the first storage unit have not changed. Alternatively, NIC 1 of service node 1 may not respond to the first cache lock change request. Or, if the number of times service node 2 sends the first cache lock change request to NIC 1 of service node 1 is greater than or equal to a threshold, NIC 1 of service node 1 returns an acknowledgment message to service node 2 indicating that the access permissions to the corresponding data in the first storage unit have been successfully changed. The threshold can be a positive integer greater than 1, such as 3, 5, 8, 10, etc. This application does not limit the specific value of the threshold.

[0387] The following example uses the first optional implementation method mentioned above, combined with... Figure 14 The implementation methods of the data access methods are introduced.

[0388] like Figure 14 As shown, Figure 14 This is a schematic diagram of the data access process under the upgraded cache lock provided in the embodiments of this application. The data access process shown includes steps S141 to S143.

[0389] S141, NIC1 of service node 1 receives the first cache lock change request from service node 2.

[0390] S142, the network card 1 of service node 1 determines the node holding the cache lock of the first storage unit.

[0391] In one alternative implementation, the first network interface card (NIC) can determine the node holding the cache lock by referring to step S240 above. This will not be elaborated upon further in this application.

[0392] S143, if the only node holding the cache lock of the first storage unit is service node 2, the network card 1 of service node 1 updates the status of the cache lock of the first storage unit to write lock and returns the sixth confirmation message to service node 2.

[0393] The sixth confirmation message is used to indicate that the access rights of service node 2 to the first storage unit have been successfully changed.

[0394] In one alternative implementation, the second protocol primitive field carried in the sixth acknowledgment message is “CC_UPGRADE_ACK”.

[0395] In one alternative implementation, if the node holding the cache lock includes business node 3, a read / write conflict may occur between business node 2 and business node 3 after adjusting the permissions of business node 2 for the data corresponding to the first storage unit. Therefore, to ensure the consistency of the data in the first storage unit among the business nodes, the network interface card 1 of business node 1 can return an acknowledgment message to business node 2 indicating that the access permissions of business node 2 for the data corresponding to the first storage unit have not changed.

[0396] In an optional implementation, if the node holding the cache lock includes service node 3, the network interface card 1 of service node 1 can perform the above-described operation. Figure 13 The provided embodiment initiates a cache lock recall process. If service node 3 successfully releases the cache lock of the first storage unit, the cache lock recall for the first storage unit is determined to be successful. The network interface card 1 (NIC 1) of service node 1 then executes step S143 to modify the state of the cache lock for the first storage unit. If service node 3 fails to release the cache lock of the first storage unit, the cache lock recall for the first storage unit is determined to be unsuccessful. The NIC 1 of service node 1 returns an acknowledgment message to service node 2 indicating that the access permissions of service node 2 to the corresponding data in the first storage unit have not changed.

[0397] based on Figure 14 In the provided embodiment, when network interface card 1 of service node 1 receives a first cache lock update request, it determines whether to update the cache lock state based on the cache lock's state and the node holding the cache lock. This ensures cache consistency across multiple service nodes. Furthermore, it eliminates the need for processor intervention, reducing the processing path length in cache lock update request scenarios and improving data transmission efficiency.

[0398] Next, taking request caching degradation as an example, we will introduce the implementation of data access methods.

[0399] In the first optional implementation, business node 2 holds a cache lock on the first storage unit in cache 1 of business node 1, and the cache lock is in the state of a write lock.

[0400] Since only one node holds the cache lock for the first storage unit in cache 1 when the cache lock is in a write lock state, changing the cache lock state of the first storage unit to a read lock on network interface card 1 (NIC 1) of service node 1 will not cause cache inconsistency issues for the first storage unit across different service nodes. Therefore, when service node 2 holds the cache lock for the first storage unit in cache 1 of service node 1, and the cache lock state is a write lock, upon receiving a second cache lock change request, NIC 1 of service node 1 will update the cache lock state of the first storage unit from a write lock to a read lock.

[0401] The second cache lock change request is used to request business node 1 to change business node 2's access permission to the first storage unit from write permission to read permission. This first cache lock change request carries the first protocol primitive field "CC_DOWNGRADE".

[0402] In addition, similar to the first cache lock change request, the second cache lock change request also carries the identifier of the first storage unit.

[0403] In an alternative implementation, network interface card 1 may also return a seventh acknowledgment message to service node 2.

[0404] The seventh acknowledgment message is used to indicate that the access rights change for the first storage unit by service node 2 was successful. In an optional implementation, the seventh acknowledgment message carries the second protocol primitive field "CC_DOWNGRADE_ACK".

[0405] like Figure 15 As shown, the service node holds a cache lock on the first storage unit in cache 1 of service node 1, and the cache lock is in a write lock state. A write copy of data 1 in the first storage unit is stored in the memory of service node 2. Service node 2 sends a second cache lock change request to service node 1, and the network interface card 1 of service node 1 receives the second cache lock change request from service node 2 (S151). Service node 1 updates the cache lock state of the first storage unit from a write lock to a read lock (S152). The network interface card 1 of service node 1 sends a seventh acknowledgment message to service node 2 (S153).

[0406] based on Figure 15 In the provided embodiment, when business node 2 holds a cache lock on the first storage unit in cache 1 of business node 1, and the cache lock is in a write lock state, business node 2 updates the cache lock state of the first storage unit from a write lock to a read lock through a single cache request. In this way, the cache lock state switching can be achieved without business node 2 actively returning the cache lock, reducing the number of cache requests between business nodes.

[0407] In the second optional implementation, service node 2 does not hold a cache lock on the first storage unit in service node 1's cache 1. When service node 1's network interface card 1 receives a second cache lock change request, service node 1's network interface card 1 returns an acknowledgment message to service node 2 indicating that service node 2's access permissions to the corresponding data in the first storage unit have not changed. Alternatively, service node 1's network interface card 1 does not respond to the second cache lock change request. Or, service node 1's network interface card 1 returns a message indicating an incorrect instruction to service node 2. This application does not limit this.

[0408] The confirmation message used to indicate that the access rights of service node 2 to the data corresponding to the first storage unit have not changed carries the second protocol primitive field "CC_DOWNGRADE_NAK".

[0409] In the third optional implementation, service node 2 holds a cache lock on the first storage unit in cache 1 of service node 1, and the cache lock is read-locked. Due to a power outage and restart of service node 2, or an instruction error, service node 2 sends a second cache lock change request to service node 1. Upon receiving the second cache lock change request, service node 1's network interface card 1, similar to the second optional implementation, returns an acknowledgment message to service node 2 indicating that service node 2's access permissions to the corresponding data in the first storage unit have not changed. Alternatively, service node 1's network interface card 1 does not respond to the second cache lock change request. Or, service node 1's network interface card 1 returns a message indicating an instruction error to service node 2. This application does not limit this.

[0410] It should be noted that the two implementation methods described above represent different ways in which network interface card 1 of service node 1 handles the second cache lock change request under different cache lock states. In practical applications, other implementation methods exist, which this application does not limit.

[0411] Finally, taking the example of business node 2 actively returning the cache lock to business node 1, we will introduce the implementation of the data access method.

[0412] In the first optional implementation, business node 2 holds a cache lock on the second storage unit in cache 1 of business node 1, and the cache lock is in a read lock state. Business node 2 sends a first cache lock return request to business node 1. After receiving the first cache lock return request, network interface card 1 of business node 1 modifies the node list in the cache management information list of the second storage unit.

[0413] The first protocol primitive field carried in the first cache lock return request is “CC_S_FLUSH”. This first cache lock return request is used to instruct business node 1 to release business node 2’s read permission for the data corresponding to the first storage unit.

[0414] In addition, similar to the first write request, the first cache lock return request may carry the identifier of the second storage unit.

[0415] In one alternative implementation, modifying the node list in the cache management information list of the second storage unit includes: deleting the node identifier of business node 2 from the node list in the cache management information list of the second storage unit.

[0416] In addition, in other cases, after the node identifier of service node 2 is removed from the node list of the cache management information list of the second storage unit, if the node list of the cache management information list of the second storage unit is empty, then the network card 1 of service node 1 will change the state of the cache lock of the second storage unit from read lock to unlock.

[0417] The updated statement that "the node holding the cache lock is empty" can mean that no node currently holds the cache lock for the second storage unit.

[0418] like Figure 16 , Figure 16 This application provides a schematic diagram of the data access process in a cache lock return scenario. Figure 1 Business node 2 holds a cache lock on the second storage unit in cache 1 of business node 1, and the cache lock is in a read lock state. A read copy of data 1 in the second storage unit is stored in the memory of business node 2.

[0419] The data access process in the cache lock return scenario includes steps S161 to S162.

[0420] S161, NIC1 of service node 1 receives the first cache lock return request from service node 2.

[0421] In the first optional implementation, when business node 2 sends a first cache lock return request to business node 1, business node 2 can return the read copy of data 1 in the second storage unit to business node 1.

[0422] In the second optional implementation, when business node 2 sends a first cache lock return request to business node 1, business node 2 can delete the read copy of data 1 in the second storage unit, or mark the read copy of data 1 in the second storage unit as an invalid read copy.

[0423] Invalid read copy is used to indicate that there is no read permission for the read copy.

[0424] If the read replica of data 1 is marked as invalid in business node 2, business node 2 needs to send a read request to business node 1 if it needs to read data from the read replica of data 1. Conversely, if business node 2 needs to modify the data content of data 1, it needs to send a write request to business node 1.

[0425] S162, Service Node 1's network interface card 1 updates the node holding the cache lock for the second storage unit.

[0426] like Figure 16As shown, before step S161, the node list in the cache management information list of the second storage unit only contains the node identifier "Node 2" of service node 2. After step S161, the network card 1 of service node 1 removes the node identifier "Node 2" of service node 2 from the node list of the cache management information list of the second storage unit. Since the node holding the cache lock is empty after the update, the network card of service node 1 updates the state of the cache lock of the second storage unit from read lock to unlocked.

[0427] based on Figure 16 In the provided embodiment, when the network interface card (NIC) receives a first cache lock return request, the NIC of the service node updates the state of the cache lock and the node holding the cache lock. This ensures cache consistency across multiple service nodes. Furthermore, it eliminates the need for processor intervention, reducing the processing path length in cache lock update request scenarios and improving data transmission efficiency.

[0428] In the second optional implementation, business node 2 holds a cache lock on the second storage unit in cache 1 of business node 1, and the cache lock is in a write lock state. Business node 2 sends a second cache lock return request to business node 1. After receiving the second cache lock return request, network interface card 1 of business node 1 modifies the node list and cache lock state in the cache management information list of the second storage unit.

[0429] The first protocol primitive field carried in the second cache lock return request is “CC_E_FLUSH”. This second cache lock return request is used to instruct business node 1 to release business node 2’s write permission to the data corresponding to the first storage unit.

[0430] In addition, similar to the first cache lock return request, the second cache lock return request may carry the identifier of the second storage unit.

[0431] In one optional implementation, modifying the node list and cache lock status in the cache management information list of the second storage unit includes: the network card 1 of service node 1 removes the node identifier of service node 2 from the node list, and changes the cache lock status of the second storage unit from write lock to unlock.

[0432] In the third optional implementation, service node 2 does not hold the cache lock for the second storage unit in service node 1's cache 1. If service node 1 receives a first cache lock return request or a second cache lock return request from service node 2, service node 1's network interface card 1 will not process the first or second cache lock return request, or will return an error message to service node 2.

[0433] It should be noted that the above three optional implementation methods are only different ways of implementing data access methods for cache locks in different states. In practical applications, there may be other implementation methods, which are not limited in this application.

[0434] The above Figures 9 to 16 This document provides an embodiment, primarily focusing on the perspective of business node 1 as the owner node of cache 1, to describe the data access method provided in this application. In other embodiments, business node 1 may also act as an access node, sending cache requests to the owner node of the cache or responding to cache eviction requests sent by the owner node of the cache.

[0435] For example, if business node 1 does not hold the cache lock, business node 1 sends a read request or a write request to the cache's owner node.

[0436] For example, if business node 1 holds a cache lock for the cache, business node 1 can send cache lock update requests and cache lock return requests to the cache's owner node.

[0437] The following section uses business node 1 as an example to introduce how business node 1 sends a cache request to the cache's owner node.

[0438] In one alternative implementation, with Figure 4 Taking business node cluster 20 as an example, business node 4 in business node cluster 20 is the owner node of cache 2. Similar to cache 1, cache 2 also includes multiple storage units.

[0439] First, taking the example of business node 1 sending a read request or a write request to business node 4, we will introduce how business node 1 sends a cache request to the cache's owner node.

[0440] In one optional implementation, the user sends a service request to service node 1 via a client. Service node 1 receives the service request from the client. Based on the service request, service node 1 sends a cache operation request to its network interface card (NIC 1). Based on the cache operation request, NIC 1 sends a second read request or a second write request to service node 4.

[0441] Similar to the first read request described above, the second read request carries the first protocol primitive field "CC_READ" and a cached identifier field. Similarly, similar to the first write request described above, the second write request carries the first protocol primitive field "CC_WRITE" and a cached identifier field.

[0442] Among them, business requests are used to request data reading or data writing from business node 1. For example, data query requests, data modification requests, and data write requests.

[0443] For example, taking a distributed caching system providing video playback services as an example, a business request can be a video playback request or a video update request. For instance, a request to play video A, or to replace audio data 1 in video A with audio data 2. Understandably, when a client sends a video playback request, business node 1 needs to read the video data from the distributed caching system's cache. When a client sends a video update request, business node 1 needs to write the video data to the cache.

[0444] The cache operation request carries the following information: the first protocol primitive field, the identifier of the third storage unit in cache 2, and the network address and node identifier of business node 4.

[0445] In one alternative example, a cache operation request can be a cache read request or a cache write request.

[0446] In the first example, if the first protocol primitive field carried in the cache operation request is "CC_READ", the cache operation request is a cache read request. Network interface 1 sends a second read request to service node 4 based on the cache read request.

[0447] In the second example, if the first protocol primitive field carried in the cache operation request is "CC_WRITE", the cache operation request is a cache write request. Network interface 1 sends a second write request to service node 4 based on the cache write request.

[0448] Next, we will use a cache read request as an example to explain how to implement a cache read request. The implementation method for a corresponding cache write request can be found by referring to the implementation method for a cache read request.

[0449] In the first optional implementation, after receiving a service request from a client, the processor of service node 1 can determine the storage unit of the data requested in cache 2 and the owning node of cache 2 based on the data requested in the service request. If the owning node of cache 2 is not service node 1, the processor of service node 1 sends a cache read request to the network card of service node 1 based on the identifier of the storage unit, the node identifier of the owning node of cache 2, the network address, and the operation type of the cache lock.

[0450] Understandably, when the node to which cache 2 belongs is business node 1, the processor of business node 1 reads the data requested by the business request from the memory and returns the data to the client.

[0451] In one alternative implementation, in a distributed caching system, each business node stores different data in its cache. When the number of business nodes in the distributed caching system is large, or when a large amount of data is stored, a hash algorithm can be used to quickly determine the storage unit of the data in the cache and the node to which the cache belongs.

[0452] For example, taking data 2 requested by the business request as an example, the processor of business node 1 calculates the hash value X1 of data 2 based on the identifier of data 2. It locates the position of hash value X1 in the hash ring of the distributed caching system, and starts from this position, performing a node query in a clockwise direction. The first business node found is determined as the owner node of cache 2 storing data 2. This owner node is business node 4. Based on the hash value X1 of data 2, it queries the mapping relationship between storage units and data in business node 4, determining that the storage unit of data 2 in cache 2 is the third storage unit.

[0453] The mapping relationship between storage units and data in business node 4 is used to indicate the correspondence between each storage unit in the cache of business node 4 and the hash value of the data stored on the storage unit.

[0454] In one optional implementation, in the process of the processor of service node 1 sending a cache read request to the network interface card (NIC) of service node 1, the processor can call the NIC driver interface in service node 1 to send the cache read request to the NIC. The NIC driver interface is used to link the processor of service node 1 with the NIC.

[0455] Furthermore, in the implementation where the processor of service node 1 sends a cache read request to the network interface card (NIC) of service node 1, to facilitate the identification and management of the cache lock holding state of service node 1, the processor of service node 1 can record the cache lock holding state of service node 1 for the third storage unit and store the cache lock holding state in the memory of service node 1. After the NIC of service node 1 receives the message returned by service node 4, it modifies the cache lock holding state of the third storage unit.

[0456] The holding status of the cache lock is used to indicate the state of the cache lock held by the accessing node.

[0457] In one example, as shown in Table 3, Table 3 illustrates the holding states of the cache lock provided in this application embodiment. The holding states of the cache lock include, but are not limited to: not holding a cache lock, requesting a read lock, holding a read lock, requesting a write lock, requesting a cache lock upgrade, holding a write lock, requesting a cache lock downgrade, having released a read lock, and having released a write lock.

[0458] In this context, "not holding a cache lock" can mean that the accessing node does not have access to the cache. For example, taking business node 1 as an example, if the cache lock of the third storage unit is in the state of "not holding a cache lock," then business node 1 does not have access to the third storage unit.

[0459] "Requesting a read lock" can mean that the accessing node is requesting read permission from the cache's owner node. For example, taking business node 1 as an example, if the cache lock of the third storage unit is in the state of "Requesting a read lock," business node 1 is requesting read permission from business node 4 to obtain read permission for the data in the third storage unit.

[0460] Holding a read lock means that the accessing node has read access to the cache. For example, taking business node 1 as an example, if the cache lock of the third storage unit is in the state of holding a read lock, business node 1 has read access to the data in the third storage unit of business node 4.

[0461] "Requesting a write lock" can mean that the accessing node is requesting write permission from the cache's owner node. For example, taking business node 1 as an example, if the cache lock of the third storage unit is in the state of "Requesting a write lock," business node 1 is requesting write permission to the third storage unit from business node 4.

[0462] "Requesting a cache lock upgrade" can mean that the accessing node is requesting the cache's owner node to change its read permission to write permission. For example, taking business node 1 as an example, if the cache lock status of the third storage unit is "Requesting a cache lock upgrade," business node 1 is requesting business node 4 to change its read permission to write permission for the third storage unit.

[0463] Holding a write lock means that the accessing node has write access to the cache. For example, taking business node 1 as an example, if the cache lock of the third storage unit is in the state of holding a write lock, business node 1 has write access to the third storage unit in business node 4.

[0464] "Requesting cache lock downgrade" can mean that the accessing node is requesting the cache's owner node to change its write permission to read permission. For example, taking business node 1 as an example, if the cache lock status of the third storage unit is "Requesting cache lock downgrade," business node 1 is requesting business node 4 to change its write permission to read permission for the third storage unit.

[0465] A released read lock means that the accessing node has released its read permission to the cache, and the accessing node no longer has read permission to the cache. Taking business node 1 as an example, if the cache lock of the third storage unit is in the state of a released read lock, business node 1 has released its read permission to the third storage unit in business node 4.

[0466] A released write lock means that the accessing node has released its write permission to the cache. The accessing node does not have write permission to the cache. Taking business node 1 as an example, if the cache lock of the third storage unit is in the state of a released write lock, business node 1 has released its write permission to the third storage unit in business node 4.

[0467] Table 3

[0468]

[0469]

[0470] It should be noted that when the cache lock is in a state of "released read lock" or "released read lock", the network interface card 1 of service node 1 can send a cache lock return request to service node 4, or request a read lock or write lock from service node 4 again. This application embodiment does not limit this.

[0471] In one example, the processor of business node 1 stores the holding state of the cache lock in the implementation of the memory of business node 1. The processor of business node 1 can store the holding state of the cache lock in the memory in the form of a data table, data segment, field or linked list.

[0472] For example, taking a data table as an example, the processor of business node 1 can record the cache identifier field, the cache lock holding status, and the number of cache locks in the form of a data table.

[0473] For example, taking the cache lock holding state of business node 1 on the third storage unit as an example, such as Figure 17 As shown in Figure (a), the storage unit identifier in the data table indicates the identifier of the third storage unit, the "holding status" indicates the holding status of the cache lock on the third storage unit, and the "cache lock count (lock_count)" indicates the number of cache locks held by business node 1 on the third storage unit. Figure 17 The data table shown in Figure (a) indicates that: the identifier of the third storage unit is bloc21, the holding status of the cache lock of the third storage unit by business node 1 is "requesting read lock" and the "cache lock count" is 0.

[0474] Next, we will take the example of NIC1 of business node 1 sending a second read request to business node 4 to introduce the implementation method of data access.

[0475] In one optional implementation, after receiving a cache read request, the network interface card 1 of service node 1, based on the first protocol primitive field, the identifier of the third storage unit, the node identifier of service node 4, and the network address, ... Figure 10The message format of the consistency protocol shown is used to encapsulate the message, and the encapsulated second read request is sent to business node 4.

[0476] In an optional example, after network interface card 1 (NIC 1) of service node 1 sends a second read request to service node 4, service node 4 responds to the second read request according to the processing flow of the first read request described above, and returns the corresponding eighth acknowledgment message to service node 1. Based on the eighth acknowledgment message, the NIC of service node 1 modifies the cache lock holding state of service node 1 on the third storage unit of cache 2.

[0477] The eighth acknowledgment message carries either the second protocol primitive field "CC_READ_ACK" or "CC_READ_NAK". If the second protocol primitive field is "CC_READ_ACK", the eighth acknowledgment message indicates that service node 1 has read permission to the third storage unit. If the second protocol primitive field is "CC_READ_NAK", the eighth acknowledgment message indicates that service node 1 does not have read permission to the third storage unit.

[0478] In the first example, with Figure 17 Taking the data table shown in Figure (a) as an example, if the eighth confirmation message indicates that service node 1 has read permission for the third storage unit, the network card 1 of service node 1 will change the holding status of the cache lock of the third storage unit from "Requesting read lock" to "Holding read lock", and modify the "Cache Lock Count" in the data table to 1. This forms the following... Figure 17 The data table shown in Figure (b) is shown in the figure.

[0479] In the second example, with Figure 17 Taking the data table shown in Figure (a) as an example, if the eighth confirmation message indicates that service node 1 does not have read permission for the third storage unit, the network card 1 of service node 1 will change the holding status of the cache lock of the third storage unit from "requesting read lock" to "not holding cache lock". This forms a structure as follows: Figure 17 The data table shown in Figure (c) is shown in the figure.

[0480] Next, we will take the example of NIC1 of business node 1 sending a second write request to business node 4 to introduce the implementation method of data access.

[0481] Similar to how network interface card 1 of service node 1 sends a second read request to service node 4, network interface card 1 of service node 1 follows the above procedure. Figure 10 The provided message format is used to send a second write request to service node 4.

[0482] In an optional implementation, after network interface card 1 (NIC 1) of service node 1 sends a second write request to service node 4, service node 4 responds to the second write request according to the processing flow of the first write request described above, and returns a corresponding acknowledgment message to service node 1. Based on the acknowledgment message, the NIC of service node 1 modifies the cache lock holding state of service node 1 on the third storage unit of cache 2.

[0483] The confirmation message carries either the second protocol primitive field "CC_WRITE_ACK" or "CC_WRITE_NAK". If the second protocol primitive field is "CC_WRITE_ACK", it is determined that service node 1 has write permission to the third storage unit. If the second protocol primitive field is "CC_WRITE_NAK", it is determined that service node 1 does not have write permission to the third storage unit.

[0484] In the first example, if business node 1 has write permission to the third storage unit, the network card 1 of business node 1 will change the holding status of the cache lock of the third storage unit from "requesting write lock" to "holding write lock" and change the "cache lock count" to 1.

[0485] In the second example, if business node 1 does not have write permission to the third storage unit, the network card 1 of business node 1 will change the holding status of the cache lock of the third storage unit from "requesting write lock" to "not holding cache lock".

[0486] It should be noted that the above mainly describes the modification of the cache lock holding state using the example of the access node sending read and write requests to the cache's owner node. In practical applications, the access node can also send a cache lock return request or a cache lock update request to the cache's owner node. The access node receives an acknowledgment message returned by the owner node and modifies the cache lock holding state according to the second protocol primitive field carried in the acknowledgment message. For example, as shown in Table 4, Table 4 illustrates the modification of the cache lock holding state under different second protocol primitive fields provided in the embodiments of this application.

[0487] Table 4

[0488]

[0489] In Table 4, the vertical axis represents the holding status of the cache lock in the third storage unit, and the horizontal axis represents different second protocol primitive fields. The table shows how the holding status of the cache lock is modified by the network interface card 1 (NIC 1) of service node 1 under different second protocol primitive fields. For example, if the access permission status of the third storage unit is "Upgrading write lock (UPGRAD_ING)", and the received second protocol primitive field is CC_UPGRADE_NAK, then NIC 1 of service node 1 will change the holding status of the cache lock from "Upgrading write lock (UPGRAD_ING)" to "Holding read lock (SHARED)" or "Released read lock (S_FLUSHED)".

[0490] Next, taking the example of the cache owner node sending a cache recycling request to business node 1, we will introduce how business node 1 responds to the cache owner node's cache recycling request.

[0491] In one alternative implementation, business node 1 holds a cache lock on the third storage unit in cache 3.

[0492] The node to which cache 3 belongs is business node 4. Business node 4 can be referenced as described above. Figure 11 or Figure 13 The embodiment shown sends a third cache reclamation request to business node 1.

[0493] The third cache lock release request is used to request service node 1 to release the cache lock of the third storage unit. Similar to the first and second cache lock release requests, the third cache lock release request carries the first protocol primitive field "CC_RECALL" or "CC_INV" and the identifier of the third storage unit.

[0494] In the implementation of the network interface card 1 of service node 1 responding to the third cache lock release request, the network interface card 1 of service node 1 replies to the service node 4 with the corresponding confirmation message according to the holding status of the cache lock of the third storage unit.

[0495] For example, taking the third cache lock release request carrying the first protocol primitive field "CC_RECALL" as an example, we will introduce the confirmation message replied by network card 1 to service node 4.

[0496] In the first example, when the cache lock holding state of the third storage unit is any of the following states, the network card 1 of service node 1 replies to the ninth confirmation message to service node 4: not holding cache lock, requesting read lock, holding read lock, requesting write lock, requesting cache lock upgrade, requesting cache lock downgrade, read lock released, and write lock released.

[0497] The ninth confirmation message is used to indicate that the cache lock of the third storage unit of cache 1 by service node 1 has been successfully released.

[0498] In the second example, when the cache lock of the third storage unit is in the state of holding a write lock, the network card 1 of service node 1 returns a tenth acknowledgment message to service node 4, or the network card 1 of service node 1 does not reply to service node 4.

[0499] The tenth confirmation message is used to indicate that the business node 1 failed to release the cache lock on the third storage unit of cache 1.

[0500] For example, taking the third cache lock release request carrying the first protocol primitive field "CC_INV" as an example, the acknowledgment message replied by network card 1 to service node 4 will be introduced.

[0501] In the first example, if the cache lock holding state of the third storage unit is any of the following states, the network card 1 of service node 1 replies to service node 4 with the ninth confirmation message: no cache lock held, requesting read lock, requesting write lock, requesting cache lock upgrade, requesting cache lock downgrade, and read lock released.

[0502] In the second example, when the cache lock of the third storage unit is in the state of holding a write lock, holding a read lock, or having released a write lock, the network card 1 of service node 1 returns a tenth acknowledgment message to service node 4, or the network card 1 of service node 1 does not reply to service node 4.

[0503] In addition, in other cases, in the implementation of responding to the release request of the third cache lock, in addition to replying to the corresponding confirmation message to the business node 4 according to the holding status of the cache lock of the third storage unit, business node 1 will also modify the holding status of the cache lock of the third storage unit.

[0504] As shown in Table 5, Table 5 illustrates the response methods of network card 1 of service node 1 under different holding states of the cache lock.

[0505] In the first example, when business node 1 replies to business node 4 with the ninth message, the holding status of the cache lock of the third storage unit is changed to "not holding cache lock".

[0506] For example, if the holding status of the cache lock of the third storage unit is "holding a read lock", and if business node 1 responds to the third cache lock release request and replies with the ninth message to business node 4, then the holding status of the cache lock of the third storage unit will be changed from "holding a read lock" to "not holding a cache lock".

[0507] It should be noted that when the cache lock holding status of the third storage unit is "not holding cache lock", after business node 1 replies to business node 4 with the ninth message, it does not modify the holding status of the cache lock of the third storage unit.

[0508] In the second example, if business node 1 replies to business node 4 with the tenth message or does not reply with the message, the holding state of the cache lock of the third storage unit is not modified.

[0509] Table 5

[0510]

[0511] In Table 5, the horizontal axis represents the different holding states of the cache lock in the third storage unit. The vertical axis represents the release requests of the third cache lock carrying different first protocol primitive fields.

[0512] To better illustrate the data access method provided in the embodiments of this application, in Figure 7 Based on the provided software module structure of the business nodes, this application embodiment takes business node 1 as the access node and business node 2 as the home node as an example to introduce the implementation method of business node 1 requesting the read cache of storage unit 1 from business node 2. Figure 18 As shown, Figure 18 This is a schematic diagram illustrating the data access method provided in this application under a read cache request. The data access method shown under a read cache request includes stages ① to ⑦:

[0513] ① Business node 1 receives a read request from storage unit 1. The cache management unit 702 in business node 1 creates the holding state of the cache lock corresponding to storage unit 1, and changes the holding state of the cache lock from "INV" (never held cache lock) to "S_ING" (requesting read lock).

[0514] ② Business node 1 queries the view management unit 703 to obtain the node ID of storage unit 1: node 2, and obtains the node connection through the connection management unit, and sends a CC_READ request to business node 2 to the driver.

[0515] ③ The driver interacts with the network card, and the network card sends a CC_READ request for storage unit 1 to service node 2.

[0516] ④ After receiving the CC_READ request, the network card of service node 2 queries the cache management information list of storage unit 1.

[0517] Since the cache lock status in the cache management information list is unlocked, business node 2 can grant business node 1 a cache lock on storage unit 1.

[0518] ⑤ The network card of service node 2 changes the "status" field in the cache management information list of storage unit 1 to the read lock "SHARED", and records the node number of service node 1: node 1 in the "client_list" field.

[0519] ⑥ The network card of service node 2 returns an acknowledgment message to service node 1, carrying CC_READ_ACK and the data in storage unit 1.

[0520] ⑦ Upon receiving the confirmation message, business node 1 changes the holding status of the cache lock on cache unit 1 to holding the read lock "SHARED".

[0521] exist Figure 18 In the provided embodiments, stages ④ to ⑦ of the read request processing are all implemented by the network card, without the need for the processor in the service node, thus shortening the processing path length in the read request processing and improving the system data throughput.

[0522] To better illustrate the data access method provided in the embodiments of this application, in Figure 7 Based on the structure of the software modules of the provided business nodes, this application embodiment uses the example of read-write conflicts in storage unit 1 to introduce another application scenario of the data access method. Compared to Figure 18 In the provided process for read-cached requests, if a read-write conflict exists, business node 2 also needs to initiate a recall process, such as... Figure 19 As shown, Figure 19 This is a flowchart illustrating the data access method provided in this application embodiment under a write cache request. Figure 18 Compared to the process shown, Figure 19 The data access method shown also includes the following stages ① to ⑦ in the write cache request process.

[0523] ① The network card of service node 2 queries the cache management information list of storage unit 1 to determine that service node 3 holds a read copy of the data in storage unit 1.

[0524] ② The network card of service node 2 finds the node IP of service node 3 according to the connection management unit and initiates the CC_INV primitive to service node 3.

[0525] ③ The network card of service node 3 receives a CC_INV request and queries the holding status of the cache lock of storage unit 1.

[0526] ④ Business node 3 queries the holding status of the cache lock in storage unit 1.

[0527] ⑤ When the cache lock holding state of storage unit 1 is "S_FLUSHED" (read lock released), the network card of service node 3 will change the cache lock holding state to "INV" (no cache lock held).

[0528] ⑥ The network card of service node 3 replies CC_INV_ACK to service node 2.

[0529] ⑦ After receiving CC_INV_ACK, the network card of service node 2 modifies the status of the cache lock in the cache management information list of storage unit 11 to unlocked, and the cache is reclaimed.

[0530] based on Figure 19 In the provided embodiment, in the event of a read-write conflict, the network card of the service node initiates the cache recall process without the need for the processor in the service node, thereby shortening the processing path length in the read request processing and improving the system data throughput.

[0531] The above text combines Figures 4 to 19 This document describes in detail the data access method and data access device provided according to this embodiment. However, the data access device provided in this application embodiment can also be implemented by software units. For example, this data access device can be applied to the aforementioned data access device. The data access device may include: a communication module, a query module, and a lock module. The communication module is used to receive a first read request from a second service node. The query module is used to query the status of the cache lock based on the first read request. The lock module is used to send a first confirmation message to the second service node through the communication module if the cache lock status is unlocked or read-locked. The first confirmation message indicates that the second service node has read permission for the first address.

[0532] It should be understood that the data access device in the embodiments of this application can be implemented by a DPU. The data access device according to the embodiments of this application can correspond to the execution of the methods described in the embodiments of this application, and the above and other operations and / or functions of each unit and module in the data access device are respectively to implement the corresponding processes of the various methods in the foregoing figures. For the sake of brevity, they will not be described again here.

[0533] For example, a DPU includes control circuitry and interface circuitry. The interface circuitry receives data from other devices outside the DPU and transmits it to the control circuitry, or sends data from the control circuitry to other devices outside the DPU. The control circuitry, through logic circuitry or executed code instructions, along with the interface circuitry, performs the functions of the DPU in the aforementioned data access method.

[0534] This application also provides a network interface card (NIC), including a Data Processing Unit (DPU) and a communication interface as described in the previous embodiments. The communication interface may be used to send data sent by the DPU, or to receive data sent to the DPU by other devices. Thus, the DPU implements the operational steps of the data access method provided in this application.

[0535] The method steps in this embodiment can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a computing device. Of course, the processor and storage medium can also exist as discrete components in a network device or terminal device.

[0536] This application also provides a chip system including a processor for implementing the functions of the data processing unit in the above-described method. In one possible design, the chip system further includes a memory for storing program instructions and / or data. This chip system can be composed of chips or may include chips and other discrete devices.

[0537] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. A computer program product includes one or more computer programs or instructions. When a computer program or instruction is loaded and executed on a computer, the processes or functions of the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, a computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).

[0538] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data access method, characterized in that, It is applied to a first service node, which includes a processor, a memory, and a first network interface card; the first service node is the owner node of the first cache; the memory stores the state of the cache lock of the first cache, and the state of the cache lock is used to indicate the access permissions of the first cache; The states include: unlocked, read-locked, or write-locked; the method is executed by the first network interface card, and the method includes: Receive the first read request from the second business node, the first read request being used to request read permission from the first cache; Query the status of the cache lock according to the first read request; If the cache lock is in an unlocked or read-locked state, a first confirmation message is sent to the second service node. The first confirmation message is used to indicate that the second service node has read permission for the first cache.

2. The method according to claim 1, characterized in that, The first cache includes one or more storage units, and the state of the cache lock of the first cache includes the state of the cache lock of each storage unit in the first cache. The state of the cache lock is used to indicate the access permissions of each storage unit in the first cache. The first read request is used to request read permission for the first storage unit in the first cache; The step of querying the status of the cache lock according to the first read request includes: The status of the cache lock of the first storage unit is queried according to the first read request; wherein, the first confirmation message is used to indicate that the second service node has read permission to the first storage unit in the first cache.

3. The method according to claim 2, characterized in that, The method further includes: If the cache lock is in the state of a write lock, determine the node holding the cache lock; If the node holding the cache lock is a third service node, a first cache reclamation request is sent to the third service node; the first cache reclamation request is used to instruct the third service node to release the cache lock of the first storage unit; Receive the second confirmation message returned by the third service node; If the second confirmation message indicates that the cache lock of the first storage unit has been successfully released, the first confirmation message is sent to the second service node.

4. The method according to claim 2 or 3, characterized in that, The method further includes: Receive the first write request from the second service node; the first write request is used to request write permission for the second storage unit in the first cache; The status of the cache lock of the second storage unit is queried according to the first write request; If the cache lock of the second storage unit is in the state of a read lock, determine the node holding the cache lock of the second storage unit; If the node holding the cache lock of the second storage unit includes only the second service node, a fourth confirmation message is sent to the second service node, the fourth confirmation message being used to indicate that the second service node has write permission to the second storage unit.

5. The method according to claim 4, characterized in that, The method further includes: If the node holding the cache lock for the second storage unit does not include the second service node, or if the node holding the cache lock for the second storage unit includes both the second service node and the third service node, A fifth confirmation message is sent to the second service node, the fifth confirmation message being used to indicate that the second service node does not have write permission to the second storage unit.

6. The method according to claim 4, characterized in that, The method further includes: If the cache lock of the second storage unit is in the state of a write lock or a read lock, determine the node holding the cache lock of the second storage unit; If the node holding the cache lock of the second storage unit includes a third service node, a second cache reclamation request is sent to the third service node; the second cache reclamation request is used to instruct the third service node to release the cache lock of the second storage unit; Receive the third confirmation message returned by the third service node; If the third confirmation message indicates that the cache lock of the second storage unit has been successfully released, the fourth confirmation message is sent to the second service node.

7. The method according to any one of claims 2 to 6, characterized in that, When the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in the read lock state, the method further includes: Receive a first cache lock change request from the second service node; the first cache lock change request is used to request that the access permission of the second service node to the first storage unit be modified to write permission; Identify the node holding the cache lock for the first storage unit; If the only node holding the cache lock of the first storage unit is the second service node, the status of the cache lock of the first storage unit is updated to write lock, and a sixth confirmation message is returned to the second service node; the sixth confirmation message is used to indicate that the access permission of the second service node to the first storage unit has been successfully changed.

8. The method according to any one of claims 2 to 6, characterized in that, When the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a write lock state, the method further includes: Receive a second cache lock change request from the second service node; the second cache lock change request is used to request that the access permission of the second service node to the first storage unit be modified to read permission; The cache lock status of the first storage unit is updated to read lock, and a seventh confirmation message is returned to the second service node; the seventh confirmation message is used to indicate that the access permission of the second service node to the first storage unit has been successfully changed.

9. The method according to any one of claims 2 to 8, characterized in that, When the second service node holds a cache lock on the second storage unit in the first cache, the method further includes: Receive a cache lock return request from the second service node; the cache lock return request is used to instruct the return of the cache lock of the second storage unit; Update the information of the node holding the cache lock for the second storage unit; After the information of the node holding the cache lock of the second storage unit is updated, if the node holding the cache lock of the second storage unit is empty, the status of the cache lock of the second storage unit is updated to unlocked.

10. The method according to any one of claims 1 to 9, characterized in that, If the first service node does not hold a cache lock on the third storage unit in the second cache, the method further includes: A second read request is sent to the fourth service node; the fourth service node is the owner node of the second cache; the second read request is used to request the fourth service node to read the third storage unit in the second cache.

11. The method according to claim 10, characterized in that, The memory stores the holding status of the cache lock of the first service node on the third storage unit in the second cache; After sending the second read request to the fourth service node, the method further includes: Receive the eighth confirmation message returned by the fourth service node; If the eighth confirmation message indicates that the first service node has read permission to the third storage unit in the second cache, the holding state stored in the memory is modified to holding a read lock.

12. The method according to claim 11, characterized in that, The method further includes: Receive the third cache reclamation request from the fourth service node; the third cache reclamation request is used to instruct the reclamation of the cache lock of the third storage unit held by the first node; Based on the third cache reclamation request, query the holding status in the memory; If the holding status is any of the following, a ninth confirmation message is returned to the fourth service node, and the holding status in the memory is updated to "not holding cache lock": requesting read lock, holding read lock, requesting write lock, requesting cache lock upgrade, requesting cache lock downgrade, or cache lock released; the ninth confirmation message is used to indicate that the first service node has successfully released the cache lock on the third storage unit of the second cache. If the cache lock holding state of the third cache unit is a write lock, a tenth acknowledgment message is returned to the fourth service node; the tenth acknowledgment message is used to indicate that the first service node failed to release the cache lock of the third storage unit of the second cache.

13. The method according to any one of claims 1 to 12, characterized in that, The first read request and the first acknowledgment message are implemented based on the Remote Direct Memory Access (RDMA) protocol; the first address is carried by an extension field of the RDMA protocol. The header of the first read request includes a read request opcode and a first extended header field. The first extended header field includes a first protocol primitive field and an identifier field for indicating the first address. The first protocol primitive field is used to indicate a cache read operation. The header of the first confirmation message includes the read request opcode and a second extended header field. The second extended header field includes: a first protocol primitive field, an identifier field for indicating the first address, and a second protocol primitive field. The second protocol primitive field is used to indicate that the cache read operation was successful.

14. A data access device, characterized in that, The data access device includes: a processor, a memory, and a data processing unit; the data access device is used to manage a first cache. The processor is configured to: obtain the state of the cache lock of the first cache, and write the state of the cache lock of the first cache into the memory; the cache lock is used to indicate the access permissions of the first cache; the state includes: no lock, read lock, or write lock; The data processing unit is configured to receive a first read request from the second service node, query the status of the cache lock of the first cache in the memory according to the first read request, and if the status of the cache lock of the first cache is unlocked or read-locked, send a first confirmation message to the second service node; the first read request is used to request read permission for the first storage unit in the first cache; the first confirmation message is used to indicate that the second service node has read permission for the first storage unit.

15. The device according to claim 14, characterized in that, The first cache includes one or more storage units, and the state of the cache lock of the first storage unit includes the state of the cache lock of each storage unit in the first cache. The state of the cache lock is used to indicate the access permissions of each storage unit in the first cache; the first read request is used to request read permission for the first storage unit in the first cache. The data processing unit is configured to query the status of the cache lock of the first storage unit according to the first read request; wherein the first confirmation message is used to indicate that the second service node has read permission to the first storage unit in the first cache.

16. The device according to claim 15, characterized in that, The data processing unit is used for: If the cache lock is in the state of a write lock, determine the node holding the cache lock; If the node holding the cache lock is a third service node, a first cache reclamation request is sent to the third service node; the first cache reclamation request is used to instruct the third service node to release the cache lock of the first storage unit; Receive the second confirmation message returned by the third service node; If the second confirmation message indicates that the cache lock of the first storage unit has been successfully released, the first confirmation message is sent to the second service node.

17. The device according to claim 15 or 16, characterized in that, The data processing unit is used for: Receive the first write request from the second service node; the first write request is used to request write permission for the second storage unit in the first cache; The status of the cache lock of the second storage unit is queried according to the first write request; If the cache lock of the second storage unit is in the state of a read lock, determine the node holding the cache lock of the second storage unit; If the node holding the cache lock of the second storage unit includes only the second service node, a fourth confirmation message is sent to the second service node, the fourth confirmation message being used to indicate that the second service node has write permission to the second storage unit.

18. The device according to claim 17, characterized in that, The data processing unit is used for: If the node holding the cache lock for the second storage unit does not include the second service node, or if the node holding the cache lock for the second storage unit includes both the second service node and the third service node, A fifth confirmation message is sent to the second service node, the fifth confirmation message being used to indicate that the second service node does not have write permission to the second storage unit.

19. The device according to claim 17, characterized in that, The data processing unit is used for: If the cache lock of the second storage unit is in the state of a write lock or a read lock, determine the node holding the cache lock of the second storage unit; If the node holding the cache lock of the second storage unit includes a third service node, a second cache reclamation request is sent to the third service node; the second cache reclamation request is used to instruct the third service node to release the cache lock of the second storage unit; Receive the third confirmation message returned by the third service node; If the third confirmation message indicates that the cache lock of the second storage unit has been successfully released, the fourth confirmation message is sent to the second service node.

20. The device according to any one of claims 15 to 19, characterized in that, When the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a read lock state, the data processing unit is configured to: Receive a first cache lock change request from the second service node; the first cache lock change request is used to request that the access permission of the second service node to the first storage unit be modified to write permission; Identify the node holding the cache lock for the first storage unit; If the node holding the cache lock of the first storage unit is only the second service node, the status of the cache lock of the first storage unit is updated to write lock, and a sixth confirmation message is returned to the second service node; The sixth confirmation message is used to indicate that the second service node's access permission to the first storage unit has been successfully changed.

21. The device according to any one of claims 15 to 19, characterized in that, When the second service node holds a cache lock on the first storage unit in the first cache, and the cache lock on the first storage unit is in a write lock state, the data processing unit is configured to: Receive a second cache lock change request from the second service node; the second cache lock change request is used to request that the access permission of the second service node to the first storage unit be modified to read permission; Update the status of the cache lock of the first storage unit to a read lock and return a seventh confirmation message to the second service node; The seventh confirmation message is used to indicate that the second service node's access permission to the first storage unit has been successfully changed.

22. The device according to any one of claims 15 to 21, characterized in that, When the second service node holds a cache lock on the second storage unit in the first cache, the data processing unit is configured to: Receive a cache lock return request from the second service node; the cache lock return request is used to instruct the return of the cache lock of the second storage unit; Update the information of the node holding the cache lock for the second storage unit; After the information of the node holding the cache lock of the second storage unit is updated, if the node holding the cache lock of the second storage unit is empty, the status of the cache lock of the second storage unit is updated to unlocked.

23. The device according to any one of claims 14 to 22, characterized in that, In the event that the data access device does not hold a storage lock on the third storage unit in the second cache, the data access unit is configured to: A second read request is sent to the fourth service node; the fourth service node is the owner node of the second cache; the second read request is used to request the fourth service node to read the third storage unit in the second cache.

24. The device according to claim 23, characterized in that, The memory is used to store the holding state of the cache lock of the data access device on the third storage unit in the second cache; The data access unit is used for: After sending the second read request to the fourth service node, the device receives the eighth confirmation message returned by the fourth service node; if the eighth confirmation message indicates that the data access device has read permission to the third storage unit in the second cache, the holding state stored in the memory is modified to holding a read lock.

25. The device according to claim 24, characterized in that, The data access unit is used for: The third cache reclamation request is received from the fourth service node; the third cache reclamation request is used to instruct the reclamation of the cache lock of the third storage unit held by the data access device; Based on the third cache reclamation request, query the holding status in the memory; If the holding status is in any of the following situations, a ninth confirmation message is returned to the fourth service node, and the holding status in the memory is updated to "not holding cache lock": requesting read lock, holding read lock, requesting write lock, requesting cache lock upgrade, requesting cache lock downgrade, or cache lock has been released. The ninth confirmation message is used to indicate that the data access device has successfully released the cache lock on the third storage unit of the second cache; If the cache lock of the third cache unit is in the state of holding a write lock, a tenth acknowledgment message is returned to the fourth service node; The tenth confirmation message is used to indicate that the data access device failed to release the cache lock on the third storage unit of the second cache.

26. The device according to any one of claims 14 to 25, characterized in that, The first read request and the first acknowledgment message are implemented based on the Remote Direct Memory Access (RDMA) protocol; the first address is carried by an extension field of the RDMA protocol. The header of the first read request includes a read request opcode and a first extended header field. The first extended header field includes a first protocol primitive field and an identifier field for indicating the first address. The first protocol primitive field is used to indicate a cache read operation. The header of the first confirmation message includes the read request opcode and a second extended header field. The second extended header field includes: a first protocol primitive field, an identifier field for indicating the first address, and a second protocol primitive field. The second protocol primitive field is used to indicate that the cache read operation was successful.

27. A network interface card (NIC), characterized in that, include: Data processing unit and communication interface; The communication interface is used to send data sent by the data processing unit, or the communication interface is used to receive data sent to the data processing unit by other devices; The data processing unit and the communication interface perform the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Resource lock management method and device

    CN112148695A

  • Index access method and computer cluster

    CN115599532A

  • Lock management method and device, computing equipment and distributed system

    CN115878514A

  • Lock management method, device and system

    CN116257366A

  • Accelerating and offloading lock access over a network

    US20160043965A1