Distributed cache system and data caching method

CN116848516BActive Publication Date: 2026-09-22HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180093084.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2026-09-22
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

当需要通知的数据请求节点的数目较多时,会明显降低整个系统的带宽

Benefits of technology

[0007]本申请实施例提供的分布式缓存系统,通过数据请求节点在向数据管理节点请求缓存数据时,二者即完成了在数据请求节点中缓存的数据的失效时间的协商,当失效时间达到时,数据请求节点中缓存的数据自动失效,数据管理节点与存储节点之间无需再针对数据失效进行交互,因此不会降低系统带宽,并且针对一个地址只用记录一个最大失效时间,资源开销较小。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116848516B_ABST
    Figure CN116848516B_ABST
Patent Text Reader

Abstract

The application discloses a kind of distributed cache system and data caching method, it is related to storage field, for improving the bandwidth of distributed cache system.Distributed cache system includes data management node, data request node and memory, data management node is used to carry out cache consistency management to data in memory;Data request node is used to send first request message (S401) to data management node, and first request message includes first time and first address in memory, and first request message is used to request to cache target data in first address;First time is used to indicate the invalid time of target data in data request node cache;Data management node is further used to send first response message to data request node, and update second time according to first time (S402), wherein, first response message includes target data, and second time is used to indicate the latest invalid time of target data cached by other nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage, and more particularly to a distributed caching system and a data caching method. Background Technology

[0002] A distributed caching system includes a data management node and multiple data request nodes. The data management node is responsible for managing the data in the address space (multiple addresses). Multiple data request nodes can request the data management node to cache the data in a certain address, that is, multiple copies of the same data can be cached on multiple data request nodes.

[0003] To ensure consistency between multiple replicas and the original data cache, if data at a given address becomes invalid (e.g., a write operation occurs), the data management node sends a message to the data request nodes that have cached the replicas, notifying them that the data at that address has expired. When the number of data request nodes that need to be notified is large, this significantly reduces the overall system bandwidth. Summary of the Invention

[0004] This application provides a distributed caching system and a data caching method to improve the bandwidth of the distributed caching system.

[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0006] In a first aspect, a distributed caching system is provided, including a data management node, a data request node, and a memory. The data management node is used to manage cache consistency of data in the memory. The data request node is used to send a first request message to the data management node. The first request message includes a first time and a first address in the memory. The first request message is used to request cached target data at the first address. The first time is used to indicate the expiration time of the target data cached in the data request node. The data management node is also used to send a first response message to the data request node and update a second time according to the first time. The first response message includes the target data, and the second time is used to indicate the latest expiration time of the target data cached by other nodes.

[0007] The distributed caching system provided in this application embodiment completes the negotiation of the expiration time of the data cached in the data request node when the data request node requests cached data from the data management node. When the expiration time is reached, the data cached in the data request node automatically expires. The data management node and the storage node no longer need to interact for data expiration, so the system bandwidth is not reduced. Moreover, only one maximum expiration time needs to be recorded for each address, resulting in low resource overhead.

[0008] In one possible implementation, the data management node includes: a time-local agent and a local agent; the local agent is used for cache consistency management of data in memory; the time-local agent is used to receive a first request message, obtain target data from the local agent, send a first response message, and update a second time according to a first time. The local agent is still responsible for cache consistency management, that is, it still uses the MESI protocol for communication to be compatible with existing technology. The newly added time-local agent is responsible for timestamp protocol communication, or time management, and is also responsible for communicating with the local agent according to the MESI protocol.

[0009] In one possible implementation, the first time is a relative time, and the first response message also includes a third time, which is the first time minus the transmission delay between the data management node and the data request node. This facilitates the data request node in determining the absolute time when the cached target data expires.

[0010] In one possible implementation, the first time is absolute time.

[0011] In one possible implementation, the data management node further includes a first cache proxy; the first cache proxy is used to request exclusive read target data from the local proxy before the second time; the local proxy is also used to request invalidation of target data cached by other nodes from the time local proxy; the time local proxy is also used to indicate to the local proxy after the second time that the target data cached by other nodes has become invalid; the local proxy is also used to send the target data to the first cache proxy. That is, when the cache proxy in the data management node requests exclusive read target data, the local proxy must send the target data to the local proxy after all other nodes' cached target data has become invalid.

[0012] In one possible implementation, the data request node is further configured to request the target data in the cached first address from the data management node after the first cache proxy requests exclusive access to the target data and before the second time period; the data management node is further configured to send the target data to the data request node after the second time period. That is, before the second time period, no new data management nodes are allowed to request the target data in the cached first address. This can be achieved by instructing the data request node to continuously re-request until the second time period ends, or by blocking until after the second time period and returning the target data in the first address to the data management node. This prevents further extension of the second time period and avoids the first cache proxy in the data management node being unable to exclusively access the target data as quickly as possible.

[0013] In one possible implementation, the data request node includes: a time cache agent and a second cache agent; the second cache agent requests cached target data from the time cache agent; the time cache agent sends a first request message to the data management node, receives a first response message, and sends the target data to the second cache agent. The second cache agent is still responsible for cache consistency management, i.e., it still uses the MESI protocol for communication to be compatible with existing technologies. The newly added time cache agent is responsible for timestamp protocol communication, or time management, and is also responsible for communicating with the second cache agent according to the MESI protocol.

[0014] In one possible implementation, the time-based cache proxy is also used to request invalidated cached target data from a second cache proxy after the first time. The cached target data becomes invalid after the data request node reaches the first time.

[0015] Secondly, a data caching method is provided, comprising: a data requesting node sending a first request message to a data management node, the first request message including a first time and a first address in memory, the first request message being used to request cached target data at the first address; the first time being used to indicate the expiration time of the target data cached in the data requesting node; the data management node being used to perform cache consistency management on the data in memory; the data management node sending a first response message to the data requesting node and updating a second time according to the first time, wherein the first response message includes the target data, and the second time is used to indicate the latest expiration time of the target data cached by other nodes.

[0016] In one possible implementation, the data management node sends a first response message to the data requesting node and updates a second time according to a first time, including: the data management node's time local agent obtaining target data from the data management node's local agent, sending the first response message, and updating the second time according to the first time, wherein the local agent is used to perform cache consistency management on the data in the memory.

[0017] In one possible implementation, the first time is a relative time, and the first response message also includes a third time, which is the first time minus the transmission delay between the data management node and the data request node.

[0018] In one possible implementation, the first time is absolute time.

[0019] In one possible implementation, the method further includes: the first cache agent of the data management node requests exclusive access to the target data from the local agent before the second time; the local agent requests the time local agent to invalidate the target data cached by other nodes; the time local agent indicates to the local agent after the second time that the target data cached by other nodes is invalid; and the local agent sends the target data to the first cache agent.

[0020] In one possible implementation, the method further includes: after the first cache proxy requests exclusive access to the target data and before the second time, the data requesting node requests the target data in the cached first address from the data management node; the data management node sends the target data to the data requesting node after the second time.

[0021] In one possible implementation, the data requesting node sends a first request message to the data management node, including: the second cache agent of the data requesting node requests cached target data from the time cache agent of the data requesting node; and the time cache agent sends the first request message to the data management node.

[0022] In one possible implementation, the method further includes: the time cache agent requests the invalid cached target data from the second cache agent after the first time.

[0023] Thirdly, a computer-readable storage medium is provided that stores instructions that run on a distributed caching system to cause the distributed caching system to perform the methods described in the second aspect and any of its embodiments.

[0024] Fourthly, a computer program product comprising instructions that run on a distributed caching system, causing the distributed caching system to perform the methods described in the second aspect and any embodiment thereof.

[0025] The technical effects of the second to fourth aspects are the same as those of the first aspect and any of its embodiments. Attached Figure Description

[0026] Figure 1 A schematic diagram of the structure of a multi-core processor provided in an embodiment of this application;

[0027] Figure 2 This application provides an architectural diagram of a distributed caching system according to an embodiment of the present application.

[0028] Figure 3 This is a schematic diagram of the architecture of another distributed caching system provided in an embodiment of this application;

[0029] Figure 4 A flowchart illustrating a data caching method provided in this application embodiment. Figure 1 ;

[0030] Figure 5 A flowchart illustrating a data caching method provided in this application embodiment. Figure 2 ;

[0031] Figure 6 A flowchart illustrating a data caching method provided in this application embodiment. Figure 3 ;

[0032] Figure 7 A flowchart illustrating a data caching method provided in this application embodiment. Figure 4 . Detailed Implementation

[0033] First, let me describe some of the concepts involved in this application:

[0034] Cache coherence: The processor's operating speed is much faster than the memory's (or main memory) read / write speed. If the processor has to wait for the read / write operation to complete before processing other tasks, the processor's efficiency will decrease. Therefore, a cache (such as a L1 or L2 cache) can be placed between the processor core and memory. The cache's read / write speed is faster than the memory's but slower than the processor's operating speed. When the processor writes data to memory, the data can be written to the cache first, and then other tasks can be processed. Direct memory access (DMA) devices are used to store the data in memory. Similarly, when the processor reads data from memory, a DMA device first writes the data from memory to the cache, and then the processor reads the data from the cache.

[0035] like Figure 1 As shown, for a processor 11 that includes multiple cores, a cache 12 is set up for each core. When different cores of the same processor store copies of data at the same address in memory 13 through their respective caches 12, these copies have a cache consistency problem with the original data. When the original data is modified (or invalidated), these copies also need to be updated again, otherwise the problem of inconsistency between the cached copies and the original data will occur.

[0036] like Figure 2As shown, a distributed caching system includes a data management node 21, a data request node 22, and a memory 23. There can be one or more data request nodes 22, and the data management node 21 and data request node 22 can be processors located on different hosts. Both the data management node 21 and the data request node 22 include a kernel (not shown) and a cache. The data management node 21 is responsible for managing cache consistency of the data in the memory 23. When multiple caches (including the cache in the data management node 21 and the cache in the data request node 22) store copies of data at the same address in the memory 23, these copies also have cache consistency issues with the original data.

[0037] Devices requiring cache consistency can comply with the Modified Exclusive Shared Invalid (MESI) protocol. The MESI protocol specifies four states of a cache line (the smallest unit of cache): exclusive (E), modified (M), shared (S), and invalid (I). In this context, the E-state indicates that the cache line is valid, the data in the cache is consistent with the data in memory, and the data exists only in the local cache. The cached data can be called E-state data, and data management node 21 has the authority to request E-state. The M-state indicates that the cache line is valid, the data has been modified, and the data in the cache is inconsistent with the data in memory. The cached data can be called M-state data, and data management node 21 has the authority to request M-state. The S-state indicates that the cache line is valid, the data in the cache is consistent with the data in memory, and the data exists in multiple caches. The cached data can be called S-state data, and both data management node 21 and data request node 22 have the authority to request S-state. The I-state indicates that the cache line is invalid, meaning the data is not stored in the cache but is used directly. This data can be called I-state data, and both data management node 21 and data request node 22 have the authority to request I-state.

[0038] The processor involved in the embodiments of this application can be a chip. For example, it can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0039] The memory involved in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate (DDR) memory, enhanced synchronous dynamic RAM (ESDRAM), synchronous linked dynamic RAM (SLDRAM), and direct rambus RAM (DR RAM).

[0040] like Figure 2As shown, in a distributed caching system, the module in data management node 11 responsible for managing cache consistency of data in memory is the home agent (HA), and the modules in data management node 21 and data request node 22 responsible for managing the MESI state of the corresponding cache are cache agents (CA). For example, CA0 in processor 0 is responsible for managing the MESI state of cache 0 in processor 0, CA1 in processor 1 is responsible for managing the MESI state of cache 1 in processor 1, CA2 in processor 2 is responsible for managing the MESI state of cache 2 in processor 2, and CA3 in processor 0 is responsible for managing the MESI state of cache 3 in processor 3.

[0041] When data management node 21 or data request node 22 needs to store data from a cache to a memory address, or when data management node 21 or data request node 22 needs to store data from a memory address to the cache, the corresponding CA requests the corresponding permission from HA according to the MESI protocol to ensure cache consistency.

[0042] For example, when processor 0 needs to store data from cache 0 to a certain address in memory 23, CA0 in processor 0 can send a modification message to HA in processor 0 to write the M-state data into memory 23. When processor 1 needs to store data from cache 1 to a certain address in memory 23, CA1 in processor 1 can send a modification message to HA in processor 0 to write the M-state data into memory 23.

[0043] For example, when processor 0 wants to store data from a certain address in memory 23 into cache 0, CA0 in processor 0 can send a read exclusive (RE) message to HA in processor 0 to request to read E-state data, or CA0 in processor 0 can send a read shared (RS) message to HA in processor 0 to request to read S-state data. When processor 1 wants to store data from a certain address in memory 23 into cache 1, CA1 in processor 1 can send a read shared (RS) message to HA in processor 0 to request to read S-state data.

[0044] For example, when processor 0 needs to directly use data at a certain address in memory 23 without storing it in cache 0, CA0 in processor 0 can send a read invalid (RI) message to HA in processor 0 to request to read the I-state data. When processor 1 needs to directly use data at a certain address in memory 23 without storing it in cache 1, CA1 in processor 1 can send a read invalid (RI) message to HA in processor 0 to request to read the I-state data.

[0045] For High Availability (HA), in order to ensure cache consistency across multiple replicas, HA maintains a directory to record the MESI status of data at a specific address. This directory can use either an exact recording method or a fuzzy recording method.

[0046] For precise recording, if a CA requests caching of data at a specific address from the HA, the HA creates a vector in the directory that indicates the MESI status of the data at that address and the identifier of the CA requesting the caching. If multiple CAs request caching of data at the same address, the HA will create multiple vectors for that address.

[0047] For the fuzzy recording method, HA assigns a vector in the directory for each address of requested cached data. This vector indicates the MESI status of the data at that address. That is, if multiple CAs request to cache data at the same address, HA will create a vector for that address.

[0048] The data request node does not have permission to request to read E-state data from the data management node, but the data request node has permission to request to read I-state data or S-state data from the data management node.

[0049] If a data requesting node requests to read I-state data from a data management node, meaning the data requesting node directly uses data at a certain address in memory without caching, in these scenarios, if the data at that address becomes invalid (e.g., a write operation occurs), the HA does not need to notify the data requesting node that the data at that address has become invalid.

[0050] If a data requesting node requests to read S-state data from the data management node, that is, the data requesting node caches the data at a certain address in the memory, and if the data at that address becomes invalid (for example, a write operation has occurred), the HA sends an invalid listen request message to the CA that cached the data at that address according to the directory, so as to notify each CA that the data at that address has become invalid.

[0051] For precise recording methods, when the scale of the entire distributed caching system is large, the number of vectors that HA needs to record is very large, resulting in a very large directory resource overhead. In addition, once the directory structure managed by HA is determined, it limits the number of data request nodes that can be accessed, so the scalability is very limited.

[0052] For fuzzy recording, HA needs to broadcast or multicast invalid listener request messages to all CAs or to a subset of CAs. This means a large number of CAs need to be notified, many of which do not cache data at that address. Therefore, many invalid listener request messages are invalid, leading to long-distance, long-duration transmission in large-scale distributed caching systems, significantly reducing overall system bandwidth. Furthermore, to avoid conflicts, HA and CAs may need to perform multiple handshakes or network ordering restrictions. Although this reduces directory resources compared to precise recording, the overhead of directory resources is still very significant for large-scale distributed caching systems. Additionally, similar to precise recording, once the directory structure managed by HA is determined, it limits the number of data request nodes that can access it, thus severely limiting scalability.

[0053] To address this, this application provides a distributed caching system and data caching method, applicable to the scenario described above where a data requesting node requests to read S-state data from a data management node. The CAs in each data requesting node notify the HA in the data management node of the expiration time of the cached data at the same address. When the expiration time of a data requesting node's cached data is reached, the cached data automatically expires. When the latest expiration time for the cached data at the same address is reached, the HA of the data management node can determine that all cached copies of the data at that address have expired. In other words, automatic data expiration is achieved through the expiration time of the data cached on the data requesting node side and the latest expiration time of the data on the data management node side. No interaction is required between the data management node and the storage node, thus not reducing system bandwidth. Furthermore, only one maximum expiration time needs to be recorded for each address, resulting in low resource overhead.

[0054] like Figure 3 As shown, a time home agent (THA) (e.g., the THA in CPU0) can be added to data management node 21, and a time cache agent (TCA) (e.g., TCA1 in CPU1, TCA2 in CPU2) can be added to data request node 22. The cache consistency management function of HA and the MESI state management function of CA are described in detail below. Figure 2 Description, and Figure 2The difference is that direct communication between HA and CA is changed to indirect communication through THA and TCA. The newly added THA and TCA are responsible for communication of the timestamp protocol or time management. THA is also responsible for communicating with HA according to the MESI protocol, and TCA is also responsible for communicating with CA according to the MESI protocol.

[0055] Specifically, the data management node and the data request node execute as follows: Figure 4 One data caching method shown:

[0056] S401, The data request node sends the first request message to the data management node.

[0057] The first request message includes a first time and a first address in memory. The first request message is used to request the target data in the cache at the first address. In other words, the first request message is used to request the reading of S-state data from the first address. The first request message can be a read S-state data (RS) message.

[0058] The first time interval is used to indicate the expiration time of the target data cached in the data request node. That is, after the first time interval, the target data cached by the data request node becomes invalid. The first time interval can be a relative time (e.g., X milliseconds after the current time) or an absolute time (e.g., X o'clock X minutes X seconds X microseconds).

[0059] Specifically, the CA of the data request node requests the TCA to cache the target data in the first address. The TCA sends a first request message to the THA of the data management node. After receiving the first request message, the THA of the data management node requests the HA of the data management node to cache the target data in the first address.

[0060] For example, such as Figure 5 As shown, when CPU1 requests to read S-state data from CPU0, CA1 in CPU1 sends an RS1 message to TCA1 in CPU1. This RS1 message includes a first address. TCA1 establishes a first mapping table (referred to as "Table 1" in the diagram) and sends an RS2 message to THA in CPU0. This first mapping table indicates the mapping relationship between the CA1 identifier and the THA identifier, facilitating the determination of which response message should be forwarded to CA1 when receiving a response message from THA. The RS2 message includes the first address and a first time 1; for example, the first time 1 can be time T1. After receiving the RS2 message, THA in CPU0 establishes a second mapping table (referred to as "Table 2" in the diagram) and sends an RS3 message to HA in CPU0. This second mapping table indicates the mapping relationship between the HA identifier and the TCA1 identifier, facilitating the determination of which response message should be forwarded to TCA1 when receiving a response message from HA. The RS3 message includes the first address.

[0061] Similarly, such as Figure 5 As shown, when CPU2 requests to read S-state data from CPU0, CA2 in CPU2 sends an RS4 message to TCA2 in CPU2. This RS4 message includes a first address. TCA2 establishes a third mapping table (referred to as "Table 3" in the diagram) and sends an RS5 message to THA in CPU0. This third mapping table indicates the mapping relationship between the CA2 identifier and the THA identifier, so that when a response message is received from THA later, it can be determined according to the third mapping table to forward the response message to CA2. The RS5 message includes the first address and the first time 2. For example, the first time 2 can be time T2. After receiving the RS5 message, THA in CPU0 establishes a fourth mapping table (referred to as "Table 4" in the diagram) and sends an RS6 message to HA in CPU0. This fourth mapping table indicates the mapping relationship between the HA identifier and the TCA2 identifier, so that when a response message is received from HA later, it can be determined according to the fourth mapping table to forward the response message to TCA2. The RS6 message includes the first address.

[0062] S402, the data management node sends a first response message to the data request node and updates the second time according to the first time.

[0063] The second time indicates the latest expiration time when the target data is cached by other nodes (i.e., the data request nodes that have cached the target data). If multiple data request nodes request to cache the target data at the same address, each data request node will send its own first time. The data management node then selects the latest first time to update the second time. After the second time, the data management node can determine that the target data cached by each data request node has expired. Figure 5 In the example, the second time is time T2. It should be noted that the data management node can update the second time based on the first time in either step S401 or step S402, and this application does not limit it.

[0064] The first response message includes the target data. Optionally, when the first time is a relative time, the first response message may also include a third time, which is the first time minus the transmission delay between the data management node and the data request node. This allows the data request node to determine the absolute time when the cached target data expires, and this absolute time is consistent with that of the data management node.

[0065] Specifically, the HA of the data management node sends the target data to the THA of the data management node, the THA of the data management node sends a first response message to the TCA of the data request node, and updates the second time according to the first time. The TCA of the data request node then sends the target data to the CA of the data request node.

[0066] For example, such as Figure 5 As shown, when CPU1 requests to read S-state data from CPU0, the HA in CPU0 sends a D1 message to the THA in CPU0, which includes the target data. The THA in CPU0 sends a D2 message (i.e., the first response message) to the TCA1 in CPU1, which also includes the target data. Optionally, it may include a third time 1. The TCA1 in CPU1 sends a D3 message to the CA1 in CPU1, which also includes the target data.

[0067] Similarly, such as Figure 5 As shown, when CPU2 requests to read S-state data from CPU0, the HA in CPU0 sends a D4 message to the THA in CPU0, which includes the target data. The THA in CPU0 sends a D5 message (i.e., the first response message) to the TCA2 in CPU2, which also includes the target data. Optionally, it may include a third time 2. The TCA2 in CPU2 sends a D6 message to the CA2 in CPU2, which also includes the target data.

[0068] After the first time, the data requesting node can invalidate the cached target data. Specifically, the TCA of the data requesting node requests the CA of the data requesting node to invalidate the cached target data.

[0069] For example, such as Figure 5 As shown, for CPU1 to request to read S-state data from CPU0, after time T1, TCA1 in CPU1 sends an invalid listen request message (Snp1) to CA1 in CPU1 to request invalid cached target data. After clearing the target data stored in the cache, CA1 in CPU1 sends an invalid listen response message (Rsp1) to TCA1 in CPU1. TCA1 in CPU1 deletes the first mapping table (referred to as "delete table 1" in the figure).

[0070] Similarly, such as Figure 5 As shown, for CPU2 to request to read S-state data from CPU0, after time T2, TCA2 in CPU2 sends an invalid listen request message (Snp2) to CA2 in CPU2 to request invalid cached target data. After clearing the target data stored in the cache, CA2 in CPU2 sends an invalid listen response message (Rsp2) to TCA2 in CPU2. TCA2 in CPU2 deletes the third mapping table (referred to as "delete table 3" in the figure).

[0071] After the second time, the data management node determines that the target data cached by all data request nodes has expired. At this point, the data management node can delete the mapping table related to the target address.

[0072] For example, such as Figure 5 As shown, CPU0 can delete the second mapping table (referred to as "delete table 2" in the figure) and the fourth mapping table (referred to as "delete table 4" in the figure) after time T2.

[0073] In addition, if the CA in the data management node requests exclusive access to the target data from the HA in the data management node before the second time, that is, requests to read E-state data (RE), then the HA requests invalid target data cached by other nodes from the THA in the data management node. After the second time, the THA indicates to the HA that the target data cached by other nodes is invalid, and the HA sends the target data to the CA in the data management node, thus realizing that the CA in the data management node has exclusive access to the target data.

[0074] For example, such as Figure 6 As shown, before time T2, CA0 in CPU0 sends a RE1 message to HA in CPU0 to request exclusive access to the target data. HA in CPU0 sends an invalid listen request message (Snp3) to THA in CPU0 to request invalidation of the target data cached by other nodes. After time T2, THA in CPU0 sends an invalid listen response message (Rsp3) to HA in CPU0. HA in CPU0 then sends a D7 message to CA0 in CPU0, which includes the target data.

[0075] Furthermore, if the CA in the data management node requests exclusive access to the target data from the HA in the data management node before the second timeout, then the requesting nodes' requests for the target data in the cached first address will be blocked until the second timeout. That is, no new data management nodes are allowed to request the target data in the cached first address before the second timeout. This can be achieved by instructing the data requesting nodes to continuously re-request until the second timeout ends, or by blocking them until after the second timeout and returning the target data in the first address to the data management node. This prevents the second timeout from being extended further, ensuring that the CA in the data management node can quickly and exclusively access the target data.

[0076] For example, such as Figure 7As shown, suppose that CA0 in CPU0 requests exclusive access to read target data from HA in CPU0 before time T2, and HA in CPU0 sends an invalid listen request message (Snp3) to THA in CPU0 before the second time. Then, CPU1 requests to read S-state data from CPU0. CA1 in CPU1 sends RS1 message to TCA1 in CPU1, and TCA1 sends RS2 message to THA in CPU0. Then, THA in CPU0 sends RS3 message to HA in CPU0 after the second time. HA in CPU0 sends D1 message to THA in CPU0. THA in CPU0 sends D2 message to TCA1 in CPU1. TCA1 in CPU1 sends D3 message to CA1 in CPU1.

[0077] The distributed caching system and data caching method provided in this application complete the negotiation of the expiration time of the data cached in the data request node when the data request node requests cached data from the data management node. When the expiration time is reached, the data cached in the data request node automatically expires. The data management node and the storage node no longer need to interact for data expiration, so the system bandwidth is not reduced. Moreover, only one maximum expiration time needs to be recorded for each address, resulting in low resource overhead.

[0078] This application also provides a computer-readable storage medium storing instructions that run on a distributed caching system, causing the distributed caching system to perform... Figure 4 The method in the middle.

[0079] This application also provides a computer program product containing instructions that run on a distributed caching system, causing the distributed caching system to execute... Figure 4 The method in the middle.

[0080] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0081] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0082] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0083] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0084] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0085] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0086] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[0087] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included 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 distributed caching system, characterized in that, It includes a data management node, a data request node, and a storage, wherein the data management node is used to perform cache consistency management on the data in the storage; The data request node is used to send a first request message to the data management node. The first request message includes a first time and a first address in the memory. The first request message is used to request the caching of target data in the first address. The first time is used to indicate the expiration time of the cached target data in the data request node. The data management node is also used to send a first response message to the data request node and update a second time according to the first time, wherein the first response message includes the target data and the second time is used to indicate the latest expiration time of the target data being cached by other nodes.

2. The distributed caching system according to claim 1, characterized in that, The data management node includes: a time-local agent and a local agent; The local agent is used for cache consistency management of data in the memory; The time-local agent is used to receive the first request message, obtain the target data from the local agent, send the first response message, and update the second time according to the first time.

3. The distributed caching system according to any one of claims 1-2, characterized in that, The first time is a relative time, and the first response message also includes a third time, which is the first time minus the transmission delay between the data management node and the data request node.

4. The distributed caching system according to any one of claims 1-2, characterized in that, The first time is an absolute time.

5. The distributed caching system according to claim 2, characterized in that, The data management node also includes a first cache proxy; The first cache proxy is used to request exclusive access to the target data from the local proxy of the data management node before the second time. The local agent is also used to request invalid target data that is cached by other nodes from the time local agent of the data management node; The time-local agent is also used to indicate to the local agent after the second time that the target data cached by other nodes is invalid; The local proxy is also used to send the target data to the first cache proxy.

6. The distributed caching system according to claim 5, characterized in that, The data request node is further configured to request the data management node to cache the target data in the first address after the first cache proxy requests exclusive access to the target data and before the second time. The data management node is also configured to send the target data to the data request node after the second time period.

7. The distributed caching system according to any one of claims 1-2, characterized in that, The data request node includes: a time cache proxy and a second cache proxy; The second cache proxy is used to request the target data to be cached from the time cache proxy; The time cache proxy is used to send the first request message to the data management node, receive the first response message, and send the target data to the second cache proxy.

8. The distributed caching system according to claim 7, characterized in that, The time cache proxy is also used to request the target data with invalid cache from the second cache proxy after the first time.

9. A data caching method, characterized in that, include: The data request node sends a first request message to the data management node. The first request message includes a first time and a first address in memory. The first request message is used to request the cached target data in the first address. The first time is used to indicate the expiration time of the target data cached in the data request node; The data management node is used to perform cache consistency management on the data in the memory; The data management node sends a first response message to the data request node and updates a second time according to the first time, wherein the first response message includes the target data, and the second time is used to indicate the latest expiration time of the target data being cached by other nodes.

10. The method according to claim 9, characterized in that, The data management node sends a first response message to the data request node and updates a second time according to the first time, including: The time-local agent of the data management node obtains the target data from the local agent of the data management node, sends the first response message, and updates the second time according to the first time, wherein the local agent is used to perform cache consistency management on the data in the memory.

11. The method according to any one of claims 9-10, characterized in that, The first time is a relative time, and the first response message also includes a third time, which is the first time minus the transmission delay between the data management node and the data request node.

12. The method according to any one of claims 9-10, characterized in that, The first time is an absolute time.

13. The method according to claim 10, characterized in that, Also includes: The first cache proxy of the data management node requests exclusive access to the target data from the local proxy of the data management node before the second time. The local agent requests invalid target data that has been cached by other nodes from the time local agent of the data management node; The time-local agent indicates to the local agent after the second time that the target data cached by other nodes is invalid; The local agent sends the target data to the first cache agent.

14. The method according to claim 13, characterized in that, Also includes: After the first cache proxy requests exclusive access to the target data and before the second time, the data request node requests the data management node to cache the target data in the first address; The data management node sends the target data to the data request node after the second time period.

15. The method according to any one of claims 9-10, characterized in that, The data request node sends a first request message to the data management node, including: The second cache proxy of the data request node requests the time cache proxy of the data request node to cache the target data; The time cache agent sends the first request message to the data management node.

16. The method according to claim 15, characterized in that, Also includes: The time cache proxy requests the invalid cached target data from the second cache proxy after the first time.

Citation Information

Patent Citations

  • Cache data management method and related device

    CN111259034A

  • Method and apparatus for memory consistency using cache coherency protocols

    US20180165213A1