Cache replacement method, device and system

In a distributed system with a separate memory architecture, the computing node obtains the access information of the memory node and calculates the popularity of the data object, the problem of inaccurate cache replacement is solved, and the cache hit rate is improved.

CN119536979APending Publication Date: 2025-02-28HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202311196479.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-08-28
Filing Date
2023-09-15
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In a distributed system under a separate memory architecture, the computing node cannot obtain global access information, resulting in the inability to accurately perform cache replacement, which reduces the cache hit rate.

Method used

The computing node obtains access information of multiple data objects by sending a first read operation request to the memory node, and calculates the popularity of the data objects using a cache replacement algorithm. When cache replacement is required, a cache replacement request is sent to the memory node according to the popularity to replace the cold data.

Benefits of technology

By obtaining global access information, the computing node can accurately execute the cache replacement algorithm, which improves the overall cache hit rate of the distributed system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536979A_ABST
    Figure CN119536979A_ABST
Patent Text Reader

Abstract

The invention provides a cache replacement method, device and system, and relates to the field of computers. And the computing node in the distributed system sends a first read operation request to the memory node, wherein the first read operation request is used for indicating to read the access information of the plurality of data objects from the memory node. Then, the computing node uses a first cache replacement algorithm in a plurality of cache replacement algorithms to respectively compute the popularity of the plurality of data objects based on the access information of the plurality of data objects; and finally, when the computing node needs to carry out cache replacement, sending a cache replacement request to the memory node according to the popularity of the plurality of data objects, so as to indicate to replace cold data in the plurality of data objects with the data object to be inserted into the memory node. In this way, the computing node executes the cache replacement algorithm according to the global access information, and accurate cache replacement is achieved in the distributed system of the separated memory architecture.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on August 28, 2023, with application number 202311090908.1 and application name “A method, device and other equipment for cache replacement”, the entire contents of which are incorporated by reference in this application. Technical Field

[0002] The present application relates to the computer field, and in particular to a cache replacement method, device and system. Background Art

[0003] A distributed system usually consists of multiple compute nodes (CN) and multiple memory nodes (MN). Compute nodes are used to access and operate cached data objects in memory nodes. When cache replacement is required for cache data stored in memory nodes, the memory nodes use a cache replacement algorithm to perform cache replacement on the locally stored cache data.

[0004] However, in a distributed system with a disaggregated memory architecture, computing nodes usually directly access cache data stored in memory nodes, and the processor of the memory node cannot obtain the computing node's access information to the cache data. Therefore, the memory node cannot accurately replace the cache data that needs to be replaced without obtaining the global access information of the distributed system. Summary of the invention

[0005] The present application provides a cache replacement method, device and system, thereby improving the overall cache hit rate of a distributed system.

[0006] In a first aspect, the present application provides a cache replacement method, which is applied to a computing node in a distributed system of a separated memory architecture. The distributed system also includes a memory node, and the cache data stored in the memory node includes multiple data objects. The computing node bypasses the processor (central processing unit, CPU) of the memory node when accessing the cache data stored in the memory node. The computing node sends a first read operation request to the memory node, and the first read operation request is used to indicate access information of multiple data objects to be read from the memory node. Then, the computing node uses the first cache replacement algorithm among multiple cache replacement algorithms to calculate the heat of multiple data objects based on the access information of multiple data objects. Finally, when the computing node needs to perform cache replacement on the cache data, it sends a cache replacement request to the memory node according to the heat of the multiple data objects, and the cache replacement request is used to indicate that the cold data in the multiple data objects is replaced with the data object to be inserted into the memory node.

[0007] The cold data may be one or more data objects whose heat is less than a heat threshold among multiple data objects, or may be the first n data objects after sorting multiple data objects from low to high heat, where n is a positive integer.

[0008] Based on the above cache replacement method, the computing node obtains the global access information of the distributed system based on the metadata of multiple candidate data objects in the cache data, so that the first cache replacement algorithm can be selected according to the global access information to perform cache replacement on the cache data stored in the memory node. In this way, the computing node executes the cache replacement algorithm according to the global access information, and accurate cache replacement is achieved in the distributed system of the separated memory architecture.

[0009] As a possible implementation, the memory node stores metadata of cached data. When the cached data includes multiple data objects, the metadata of the cached data includes metadata of each of the multiple data objects. Taking the multiple data objects including the first data object as an example, the metadata of the first data object includes access information of the first data object being accessed. After the computing node accesses the first data object, a metadata update request is sent to the memory node. The metadata update request is used to indicate an update of the access information of the first data object.

[0010] Based on the above implementation method, compared to the memory node being unable to perceive the computing node's access information to the cached data when executing the cache replacement algorithm, the memory node maintains the global access information of the distributed system based on data access, so that the computing node can obtain effective global access information from the memory node to execute the cache replacement algorithm.

[0011] Optionally, the access information includes a last access timestamp and a number of accesses. For example, the access information of the metadata of the first data object includes a last access timestamp and a number of accesses of the first data object. In this way, after obtaining the access information of the data object, the computing node can use a cache replacement algorithm to accurately calculate the cold data that needs to be replaced from the memory node based on the last access timestamp and the number of accesses.

[0012] As a possible implementation, the metadata of cached data stored in the memory node is stored in the format of a hash table. The hash table includes multiple hash slots, each of which is used to store the metadata of a data object, and each hash slot includes a length field, a pointer field, a last access timestamp field, and an access count field.

[0013] The length field is used to indicate the length of the data object to which the metadata belongs. The pointer field is used to indicate the address of the data object to which the metadata belongs in the memory node. The last access timestamp field is used to indicate the time when the data object to which the metadata belongs was last accessed. The access count field is used to indicate the number of times the data object to which the metadata belongs has been accessed.

[0014] Optionally, the hash table includes multiple hash buckets, and each hash bucket includes multiple hash slots.

[0015] Optionally, each hash slot can be divided into an atomic domain and a metadata domain. The atomic domain may include an object identification field, a length field, and a pointer field. The object identification field is used to indicate the identification of the data object to which the metadata belongs. The metadata domain may include an access timestamp field, an access count field, a data content field, and an access count field. The data content field is used to indicate the hash value of the data content of the data object to which the metadata belongs. The access count field is used to indicate the number of times the data object to which the metadata belongs has been accessed.

[0016] Based on the above implementation method, the memory node stores the metadata of the cached data in the format of a hash table. The computing node can quickly query the metadata of the data object based on the hash table, and it is convenient for the computing node to perform subsequent operations on the metadata, thereby improving the overall data access efficiency of the distributed system.

[0017] As a possible implementation, the metadata update request includes a first write operation request and a first atomic count operation request. The first write operation request is used to indicate that the value of the last access timestamp field of the metadata of the second data object is set to the timestamp when the computing node initiates data access. The first atomic count operation request is used to indicate that the value of the access count field is increased by one. In this way, the computing node operates the metadata of the data object through atomic operations, thereby ensuring the overall data consistency in the distributed system.

[0018] As a possible implementation, after replacing the cold data out of the memory node, the computing node may also convert the metadata of the cold data into a historical record item, providing a data basis for the subsequent detection of whether different cache replacement algorithms cause access misses. Taking the cold data including the second data object as an example, after replacing the second data object out of the memory node, the computing node sends a historical record item generation request to the memory node. The historical record item generation request is used to instruct the metadata of the second data object to be converted into a historical record item. The historical record item is used to indicate the second cache replacement algorithm used when the second data object is replaced by the cache.

[0019] Optionally, similar to metadata, the history item is stored in a hash slot of a hash table, and the hash slot includes a type field and an algorithm identification field. The type field is used to indicate that the data object to which the history item belongs has been replaced by the cache. The algorithm identification field is used to indicate the second cache replacement algorithm used when the data object to which the history item belongs is replaced by the cache.

[0020] Optionally, the historical record item is converted from the metadata of the data object. The historical record item generation request includes an atomic exchange operation request and a second write operation request, the atomic exchange operation request is used to indicate that the value of the length field of the metadata of the second data object is modified to the value of the type field, and the second write operation request is used to indicate that the value of a field used to represent access information in the metadata of the second data object is replaced with the value of a second cache replacement algorithm used when the second data object is replaced by the cache. In this way, the computing node can convert the metadata of the object data into historical data items through the historical record item generation request, thereby realizing the reuse of the hash table and reducing the consumption of storage resources of the memory node.

[0021] As a possible implementation, when a computing node misses accessing a second data object stored in a memory node, the computing node determines that the memory node stores a historical record item of the second data object. Then, the computing node sends a second read operation request to the memory node. The second read operation request is used to read the historical record item of the second data object from the memory node, and the value of the algorithm identification field of the historical record item of the second data object indicates a second cache replacement algorithm. Finally, the computing node reduces the weight of the second cache replacement algorithm. In this way, the computing node determines the cache replacement algorithm used to replace the data object according to the historical record item of the data object that was erroneously replaced out of the memory node, thereby dynamically adjusting the weights of multiple cache replacement algorithms according to the data access mode, so that the computing node can select a cache replacement algorithm suitable for the current data access mode according to the weights of multiple cache replacement algorithms, thereby reducing the probability of replacing the cache data that the computing node needs to access out of the memory node, thereby improving the overall cache hit rate of the distributed system.

[0022] Optionally, after reducing the weight of the second cache replacement algorithm, the computing node sends a third write operation request to the memory node. The third write operation request is used to instruct the memory node to write the reduced weight of the second cache replacement algorithm, so that the memory node merges the reduced weight of the second cache replacement algorithm into the global algorithm weight, and returns the merged global algorithm weight to the computing node. In this way, when the memory node cannot perceive the global data access information, the global update of the algorithm weight in the distributed system is realized, and the accuracy of the weights of multiple cache replacement algorithms recorded by the computing node is guaranteed.

[0023] As a possible implementation method, when the remaining storage space of the memory node is less than the size of the data object to be inserted, or when the remaining storage space of the memory node is less than a preset threshold, the computing node determines that cache replacement is required for the cached data and sends a cache replacement request to the memory node.

[0024] In a second aspect, the present application provides a cache replacement method, which is applied to computing nodes and memory nodes in a distributed system of a separated memory architecture. The cache data stored in the memory node includes multiple data objects, and the computing node bypasses the processor of the memory node when accessing the cache data stored in the memory node. The computing node sends a first read operation request to the memory node. The memory node returns access information of multiple data objects to the computing node based on the first read operation request. Then, the computing node uses the first cache replacement algorithm among multiple cache replacement algorithms to calculate the heat of multiple data objects based on the access information of multiple data objects. Finally, when the computing node needs to perform cache replacement on the cache data, it sends a cache replacement request to the memory node according to the heat of the multiple data objects. The cache replacement request is used to indicate that cold data in multiple data objects is replaced with data objects to be inserted into the memory node.

[0025] In a third aspect, the present application provides a cache replacement device, comprising a transceiver module and a processing module. The transceiver module is used to send a first read operation request to a memory node, and the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes multiple data objects. The processing module is used to use a first cache replacement algorithm among multiple cache replacement algorithms to respectively calculate the heat of multiple data objects based on the access information of multiple data objects. The transceiver module is also used to send a cache replacement request to the memory node according to the heat of multiple data objects when cache replacement of cache data is required, and the cache replacement request is used to indicate that cold data in multiple data objects is replaced with data objects to be inserted into the memory node.

[0026] As a possible implementation manner, the cache replacement device may further include other modules that execute the operation steps of the cache replacement method described in the first aspect.

[0027] In a fourth aspect, the present application provides a cache replacement system, including a client and a server. The client is used to send a first read operation request to a memory node, and the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes multiple data objects. The server is used to return access information to the client according to the first read operation request. The client is also used to calculate the heat of multiple data objects respectively based on the access information of multiple data objects using the first cache replacement algorithm among multiple cache replacement algorithms. The client is also used to send a cache replacement request to the memory node according to the heat of multiple data objects when cache replacement of cache data is required, and the cache replacement request is used to indicate that cold data in multiple data objects is replaced with data objects to be inserted into the memory node.

[0028] Regarding the technical principles and beneficial effects of the second, third and fourth aspects, reference may be made to the relevant description of the first aspect, which will not be repeated here.

[0029] In a fifth aspect, the present application provides a computing device cluster, including at least one computing device, each computing device including a processor and a memory. The processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the cache replacement method described in any possible implementation of the first aspect above.

[0030] In a sixth aspect, the present application provides a computing device cluster, including at least one computing device, each computing device including a processor and a memory. The processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the cache replacement method described in any possible implementation of the second aspect above.

[0031] In a seventh aspect, the present application provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed on a computer, the computer executes the cache replacement method described in any possible implementation of the first aspect.

[0032] In an eighth aspect, the present application provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed on a computer, the computer executes the cache replacement method described in any possible implementation of the second aspect.

[0033] In a ninth aspect, the present application provides a computer-readable storage medium, which includes: a computer program or instruction; when the computer program or instruction is executed on a computer, the computer executes the cache replacement method described in any possible implementation of the first aspect.

[0034] In a tenth aspect, the present application provides a computer-readable storage medium. The computer-readable storage medium includes: a computer program or instruction; when the computer program or instruction is executed on a computer, the computer executes the cache replacement method described in any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of the architecture of a distributed system provided for this application;

[0036] Figure 2 A schematic diagram of a cache replacement method provided in this application;

[0037] Figure 3 A schematic diagram of the structure of a hash table provided for this application;

[0038] Figure 4 A flowchart of the access information update steps provided for this application;

[0039] Figure 5 A schematic diagram of the structure of a historical record item provided for this application;

[0040] Figure 6 A flowchart of the conversion steps of a historical record item provided by the present application;

[0041] Figure 7 A schematic diagram of a flow chart of a priority adjustment step of a cache replacement algorithm provided in this application;

[0042] Figure 8 A schematic diagram of the structure of a cache replacement device provided by the present application;

[0043] Fig. 9 A schematic diagram of the structure of another cache replacement device provided by the present application;

[0044] Fig.10 A schematic diagram of the structure of a cache replacement system provided by this application;

[0045] Fig.11 A schematic diagram of the structure of a computing device provided for this application;

[0046] Fig.12 A schematic diagram of the structure of a computing device cluster provided in this application. DETAILED DESCRIPTION

[0047] The cache replacement method, device and system provided in the embodiments of the present application can be applied to cache replacement scenarios in a distributed system with a separated memory architecture. A brief introduction to the technologies that may be involved in the present application is given.

[0048] (1) Distributed Systems

[0049] A distributed system, also known as a distributed computer system, refers to a system formed by multiple dispersed computing devices connected by communication lines. Different functions of the system (such as processing, control, storage, etc.) are distributed in various computing devices. According to the system function, distributed systems include distributed storage systems, distributed computing systems, distributed message queue systems, distributed machine learning systems, etc.

[0050] Among them, a distributed storage system refers to a system that stores data in multiple independent storage nodes. The distributed network storage system adopts an extensible system structure and uses multiple storage nodes to share the storage load. It not only improves the reliability, availability and access efficiency of the storage system, but also makes it easy to expand.

[0051] (2) Separate Memory Architecture

[0052] Separated memory architecture is an architecture of distributed systems. It physically separates the processor and memory on the same motherboard in the traditional architecture and constructs them into two independent resource pools, namely the computing pool and the memory pool. The computing pool contains multiple computing nodes, each of which contains a large number of computing resources (such as processor (Central Processing Unit, CPU) cores) and a small amount of storage resources (such as dynamic random access memory (Dynamic Random Access Memory, DRAM)). The storage resources in the computing nodes are used as running caches. The memory pool contains a large number of memory nodes, each of which contains a large number of storage resources and a small amount of computing resources. The computing resources of the memory nodes are used for management tasks, such as network connection management and memory space management, and the storage resources are used for data storage.

[0053] The computing pool and the memory pool are interconnected through the network, so that the computing nodes can directly access the data on the memory nodes without going through the processor of the memory pool, effectively improving the resource utilization and elasticity of the cache system. The computing pool and the memory pool can be interconnected through remote direct memory access (RDMA), remote procedure call protocol (RPC), etc.

[0054] (3) Cache Replacement Algorithm

[0055] The cache replacement algorithm is also called a cache algorithm. It is used in cache devices with limited storage space (such as memory nodes in a distributed system under a separated memory architecture). Its goal is to make the limited cache space store hot data with a higher access frequency as much as possible to maximize the cache hit rate. The cache replacement algorithm generally consists of three steps. First, the cache replacement algorithm records all access information to data objects in the cache space, such as access timestamps and access counts. Secondly, the cache replacement algorithm determines the heat of data objects in the cache space based on the access information in the record. Finally, the cache replacement algorithm maintains the heat of data objects in a specific cache data structure to facilitate rapid cache replacement of cold data when the cache space is full.

[0056] Cache replacement algorithms include the least recently used (LRU) algorithm, the least frequently used (LFU) algorithm, the random replacement algorithm, the first in first out (FIFO) algorithm, the size replacement algorithm, etc.

[0057] The present application provides a cache replacement method, in particular, a cache replacement method in which a computing node selects a cache replacement algorithm that conforms to the current data access mode. In a distributed system with a separated memory architecture, a computing node sends a first read operation request to a memory node, and the first read operation request is used to read access information of multiple data objects in cache data from the memory node. Based on the access information of multiple data objects, the computing node uses the first cache replacement algorithm among multiple cache replacement algorithms to respectively calculate the heat of multiple data objects. When the computing node needs to perform cache replacement on the cached data, according to the heat of multiple data objects, the computing node sends a cache replacement request to the memory node, and the cache replacement request is used to indicate that the cold data in the multiple data objects is replaced out of the memory node. In this way, the computing node obtains the global access information of the distributed system based on the metadata of multiple candidate data objects in the cached data, so that the first cache replacement algorithm can be selected according to the global access information to perform cache replacement on the cached data stored in the memory node. The computing node executes the cache replacement algorithm according to the global access information, and accurate cache replacement is achieved in the distributed system with a separated memory architecture.

[0058] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0059] like Figure 1 As shown, the distributed system 100 provided in the present application includes a computing node cluster and a memory node cluster. The computing node cluster constitutes a computing pool, and the memory node cluster constitutes a memory pool.

[0060] The computing node cluster includes one or more computing nodes 110 ( Figure 1 1 shows three computing nodes 110, but is not limited to three computing nodes 110), and each computing node 110 can communicate with each other. The computing node 110 is a computing device, such as a server, a desktop computer, or a controller of a storage array. In terms of hardware, Figure 1 As shown, the computing node 110 includes at least a processor 112, a memory 113 and a network card 114. Among them, the processor 112 is a central processing unit, which is used to process data access requests from outside the computing node 110, or requests generated inside the computing node 110. Exemplarily, when the processor 112 receives a write data request sent by a user, the data in these write data requests will be temporarily stored in the memory 113. When the total amount of data in the memory 113 reaches a certain threshold, the processor 112 sends the data stored in the memory 113 to the memory node 120 for persistent storage. In addition, the processor 112 is also used for data calculation or processing, such as metadata management, deduplication, data compression, virtualized storage space, and address translation. Figure 1 Only one CPU 112 is shown in the figure. In actual applications, there are often multiple CPUs 112, wherein one CPU 112 has one or more CPU cores. This embodiment does not limit the number of CPUs and the number of CPU cores.

[0061] The memory 113 refers to an internal memory that directly exchanges data with the processor. It can read and write data at any time and at a very fast speed, and serves as a temporary data storage for the operating system or other running programs. The memory can include multiple types of memory, for example, the memory can be either a random access memory (RAM) or a read only memory (ROM). For example, the random access memory is a dynamic random access memory or a storage class memory (SCM). However, DRAM and SCM are only exemplary descriptions in this embodiment, and the memory can also include other random access memories, such as static random access memory (SRAM), etc. As for the read-only memory, for example, it can be a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), etc. In addition, the memory 113 can also be a dual in-line memory module or a dual in-line memory module (DIMM), that is, a module composed of a dynamic random access memory. In actual applications, multiple memories 113 and different types of memories 113 may be configured in the computing node 110. In addition, the memory 113 may be configured to have a power-saving function. The power-saving function means that when the system loses power and then powers on again, the data stored in the memory 113 will not be lost. The memory with the power-saving function is called a non-volatile memory.

[0062] The network card 114 is used to communicate with the memory node 120. For example, when the total amount of data in the memory 113 reaches a certain threshold, the computing node 110 can send a request to the memory node 120 through the network card 114 to store the data persistently. In addition, the computing node 110 can also include a bus for communication between the components inside the computing node 110. Figure 1 The main function of the computing node 110 in the system is computing services. When storing data, remote storage can be used to achieve persistent storage. Therefore, it has less local storage than a conventional server, thereby saving costs and space. However, this does not mean that the computing node 110 cannot have local storage. In actual implementation, the computing node 110 can also have a small number of hard disks built in or externally connected.

[0063] Any computing node 110 can access any memory node 120 in the memory node cluster through the network. The memory node cluster includes multiple memory nodes 120 ( Figure 1 Three memory nodes 120 are shown in the figure, but are not limited to three memory nodes 120). A memory node 120 includes one or more processors 121, a network card 124 and multiple memories 125. The network card 124 is used to communicate with the computing node 110. The memory 125 is used to store data, such as cache data of the computing node 110. The memory 125 is similar to the above-mentioned memory 113 and is not repeated here. The processor 121 is used to perform management tasks, such as network connection management and memory space management.

[0064] The distributed system 100 of the present application adopts a separated memory architecture, and the computing node 110 bypasses the processor of the memory node 120 when accessing the cache data stored in the memory node 120. For example, the computing node 110 directly accesses the data on the memory node 120 through remote direct data access, remote procedure call protocol, Compute Express Link (CXL), etc. without passing through the processor 121 of the memory node 120. Therefore, compared with the memory node 120, the computing node 110 of the distributed system 100 can include a large number of CPU cores and a small number of DRAMs, and the memory node 120 can include a large number of DRAMs and a small number of CPU cores.

[0065] When the computing node 110 directly accesses the data on the memory node 120 through remote direct data access, remote procedure call protocol, etc., compared with the traditional access control method by the processor of the memory node 120, the function of the processor is offloaded to the network card 114. The network card 124 completes data reading and writing, address conversion and other computing functions. At this time, the network card 124 is an intelligent network card, and the corresponding network card 114 is also an intelligent network card, such as an intelligent network card that supports RDMA. The network card 124 can include a processor, such as a CPU. The CPU is used to perform operations such as address conversion and reading and writing data. The processor of the network card 124 can also be a programmable electronic component, such as a data processing unit (DPU).

[0066] The computing nodes, memory nodes, etc. in the above-mentioned distributed system 100 provided in the present application can be hardware devices such as computing servers and storage servers, and can also be nodes in a cloud platform. For example, the distributed system 100 implements the functions of computing nodes, memory nodes, etc. based on infrastructure such as computing server clusters and storage server clusters, based on infrastructure as a service, platform as a service, and software as a service, and provides services (such as computing services, storage services, and network services, etc.) through virtualized cloud nodes.

[0067] Next, the cache replacement method provided by the present application is described in detail with reference to the accompanying drawings.

[0068] The steps of the cache replacement method provided in the present application are performed by the computing node 110 and the memory node 120 in the distributed system 100. Figure 2 Steps 210 to 230 of the cache replacement method are described.

[0069] Step 210 : The computing node 110 sends a first read operation request to the memory node 120 .

[0070] As a possible example, the computing node 110 sends a first read operation request to the memory node 120. The first read operation request is used to read access information of multiple data objects from the memory node 120. For example, the first read operation request is an RDMA read operation request. The multiple data objects may be randomly sampled.

[0071] Optionally, the access information includes a last access timestamp and a number of accesses. The last access timestamp is used to indicate the time when the data object to which the access information belongs was last accessed. The number of accesses is used to indicate the number of times the data object to which the access information belongs has been accessed.

[0072] The present application limits the type of data included in the access information. Depending on the type of data required by the cache replacement algorithm, the access information may also include any type of data. For example, the access information may also include insertion timestamp, object size, access interval duration, access overhead, etc.

[0073] In the embodiment of the present application, the access information is stored in the form of metadata in the memory node 120. In order to ensure the operation efficiency of the access information and reduce the space occupied by the access information, the format of the metadata can be a hash table.

[0074] like Figure 3 As shown, the hash table 300 includes a plurality of hash buckets 301, each of which includes a plurality of hash slots 302 ( Figure 3 Only 4 are shown, but not limited to 4). Each hash slot 302 includes an atomic field and a metadata field. The atomic field includes an object identification field 303, a length field 304, and a pointer field 305. The metadata field includes a last access timestamp field 306 and an access count field 307.

[0075] Among them, a hash slot 302 is used to store metadata of an object data. The value stored in the object identification field 303 is used to indicate the data object to which the metadata belongs, which is called the object identification. For example, the data object is a key-value pair, and the object identification field 303 is used to store the key.

[0076] The value stored in the length field 304 is used to indicate the length of the data object to which the metadata belongs. The length of the data object may also be a type of access information, namely the above-mentioned object size.

[0077] The value stored in the pointer field 305 is used to indicate the address of the data object to which the metadata belongs in the memory node 120 .

[0078] The value stored in the last access timestamp field 306 is used to indicate the timestamp when the data object to which the metadata belongs was last accessed.

[0079] The value stored in the access count field 307 is used to indicate the number of times the data object to which the metadata belongs has been accessed.

[0080] The present application does not limit the field types included in the hash slot 302. Depending on the type of data included in the access information, the hash slot 302 may also add or delete fields. For example, the metadata field may also include a hash value field 308 and an insertion timestamp field 309.

[0081] The value stored in the hash value field 308 is the hash value of the data object to which the metadata belongs.

[0082] The value stored in the insertion timestamp field 309 is used to indicate the timestamp when the data object to which the metadata belongs is inserted into the memory node 120 .

[0083] Based on the above-mentioned hash table 300, the computing node 110 sends a first read operation request to the memory node 120, which may carry an object identifier, and is used to query the value of the object identifier field 303 in the hash table 300 based on the object identifier, which is the hash slot 302 of the carried object identifier, and read the values ​​of the last access timestamp field 306 and the access count field 307 in the hash slot 302.

[0084] This application does not limit the length of each field in the hash table 300. For example, the length of the object identification field 303 is 1 bit, the length of the length field 304 is 1 bit, the length of the pointer field 305 is 6 bits, and the length of the last access timestamp field 306, the access count field 307, the hash value field 308 and the insertion timestamp field 309 are all 8 bits.

[0085] In a possible embodiment of the present application, the access information is instantaneous, that is, the computing node 110 needs to update the access information of the data object according to the access to the data object. Please refer to the following steps for the computing node 110 to update the access information. Figure 4 Steps 410 to 430 are shown and will not be described in detail here.

[0086] Step 220 : The computing node 110 respectively calculates the heat of the multiple data objects using a first cache replacement algorithm among multiple cache replacement algorithms based on the access information of the multiple data objects.

[0087] As a possible example, the computing node 110 respectively substitutes the access information of the multiple data objects into the first cache replacement algorithm to respectively calculate the heat of the multiple data objects.

[0088] As a possible implementation, the computing node 110 locally maintains multiple cache replacement algorithms and priorities of multiple cache replacement algorithms, and the computing node 110 selects the cache replacement algorithm with the highest priority from the multiple cache replacement algorithms as the first cache replacement algorithm. The higher the priority of the cache replacement algorithm, the more suitable the cache replacement algorithm is for the current data access mode, and the lower the probability that the data object replaced by the first cache replacement algorithm is frequently accessed, that is, the probability of causing a subsequent data object access miss is lower.

[0089] The priority of the cache replacement algorithm is adjusted in real time based on data access during the operation of the distributed system 100. For example, the priority of the cache replacement algorithm is adjusted in real time based on the historical record of access misses for the replaced data object when the data object is incorrectly replaced using the cache replacement algorithm. The historical record item in the embodiment of the present application can be obtained by metadata conversion, and is used to indicate the cache replacement algorithm used when the data object is replaced by the cache. For the specific data structure of the historical record item, please refer to the following text Figure 5 And related descriptions, please refer to the following text for the conversion steps of historical records Figure 6 Steps 610 to 620 are shown and will not be described in detail here.

[0090] Optionally, the multiple cache replacement algorithms maintained by the computing node 110 may include a least recently used algorithm, a least frequently used algorithm, a random replacement algorithm, a first-in-first-out algorithm, a length replacement algorithm, and the like.

[0091] In this embodiment, the computing node 110 adjusts the priority of the cache replacement algorithm based on the above historical record items. Figure 7 Steps 710 to 750 are shown and will not be described in detail here.

[0092] Compared with the cache replacement algorithm executed by the memory node 120, the cache replacement algorithm executed by the computing node 110 avoids occupying the computing resources of the memory node 120, thereby avoiding the impact of insufficient computing power of the memory node 120 on data access throughput and data access latency. In addition, the computing node can perceive the global access information, select the cache replacement algorithm suitable for the current data access mode, and use the global access information for cache replacement, which reduces the probability of replacing the cache data that the computing node needs to access out of the memory node, thereby improving the overall cache hit rate of the distributed system.

[0093] Step 230 : When the computing node 110 needs to perform cache replacement on cached data, it sends a cache replacement request to the memory node according to the heat of multiple data objects.

[0094] As a possible example, after computing the heat of multiple data objects using the first cache replacement algorithm, the computing node 110 determines the cold data in the multiple data objects according to the heat of the multiple data objects, and sends a cache replacement request based on the cold data to the memory node 120. The cache replacement request is used to indicate that the cold data in the multiple data objects is replaced with the data object to be inserted into the memory node 120.

[0095] As a first possible implementation method, when the computing node 110 inserts a data object to be inserted into the memory node 120, if it is determined that the remaining storage space of the memory node 120 is smaller than the size of the data object to be inserted, it is determined that the cache data stored in the memory node 120 needs to be cached. Replacement.

[0096] As a second possible implementation, when the time elapsed after the last cache replacement of the cache data stored in the memory node 120 reaches a threshold, the computing node 110 determines that the cache replacement of the cache data stored in the memory node 120 needs to be performed.

[0097] As a third possible implementation manner, when the remaining space of the memory node 120 is less than a threshold, the computing node 110 determines that cache replacement is required for the cache data stored in the memory node 120 .

[0098] Optionally, the cold data is the data object with the lowest heat among the multiple data objects.

[0099] Optionally, the cold data is n data objects ranked first among multiple data objects in order of popularity from low to high, where n is a positive integer.

[0100] In the above two cold data determination methods, the step of the computing device 110 determining the cold data according to the heat of multiple data objects may be integrated into the cache replacement algorithm.

[0101] Optionally, the cache replacement request is an RDMA write operation request.

[0102] In the embodiment of the present application, the computing node 110 bypasses the processor 121 of the memory node 120 when accessing the cache data stored in the memory node 120. The processor 121 of the memory node 120 does not perform operations related to data access, but only provides data storage functions, such as returning access information of multiple data objects to the memory node 120 according to the first read operation request. Therefore, Figure 2 The operations performed by the memory node 120 are not shown separately. In other possible embodiments, the operations performed by the memory node 120 can be presented as interactive operations with the computing node 110. For example, between step 210 and step 220, the step is also included: the memory node 120 returns access information of multiple data objects to the computing node 110 according to the first read operation request.

[0103] Based on the above steps 210 to 230, the computing node obtains the global access information of the distributed system based on the metadata of the candidate multiple data objects in the cache data, so that the first cache replacement algorithm can be selected according to the global access information to perform cache replacement on the cache data stored in the memory node. In this way, the computing node executes the cache replacement algorithm according to the global access information, and accurate cache replacement is achieved in the distributed system of the separated memory architecture.

[0104] The above is based on Figure 2 and Figure 3 The cache replacement algorithm provided in this application is generally described below. Figure 4 The steps for computing node 110 to update access information are described in detail. Figure 4 As shown, the step of the computing node 110 updating the access information may include the following steps 410 to 430.

[0105] Step 410 : The computing node 110 sends a third read operation request to the memory node 120 .

[0106] As a possible example, when accessing data, the computing node 110 sends a third read operation request to the memory node 120 , which is used to instruct to read the address of the first data object in the memory node 120 from the memory node 120 .

[0107] As a possible implementation, the metadata of the first data object is stored in the memory node 120 in the form of a hash table, and the third read operation request is used to indicate reading the value of the pointer field in the hash slot indicated by the object identifier from the memory node 120.

[0108] Optionally, when accessing data, the computing node 110 calculates a hash value according to the object identifier of the data object to be accessed, locates the hash bucket according to the hash value, and the third read operation request is used to read the value of the located hash bucket. For example, the third read operation request is an RDMA read operation request.

[0109] After reading the value of the located hash bucket, the computing node 110 traverses and queries the value of the pointer field of the first data object in the hash bucket according to the object identifier of the first data object.

[0110] Step 420 : The computing node 110 sends a fourth read operation request to the memory node 120 .

[0111] As a possible example, the computing node 110 sends a fourth read operation request to the memory node 120 according to the address of the first data object in the memory node 120. The fourth read operation request carries the address of the first data object in the memory node 120, and is used to indicate reading the data object from the memory node 120 based on the address of the first data object in the memory node 120.

[0112] As a possible implementation, the metadata of the first data object is stored in the memory node 120 in the form of a hash table, and the address of the first data object in the memory node 120 carried by the fourth read operation request is the value of the pointer field of the metadata of the first data object.

[0113] Optionally, the fourth read operation request is an RDMA read operation request.

[0114] Step 430 : After accessing the first data object, the computing node 110 sends a metadata update request to the memory node 120 .

[0115] As a possible example, after accessing data of the first data object, the computing node 110 sends a metadata update request to the memory node 120 to instruct to update the access information of the first data object.

[0116] As a possible implementation, the metadata update request includes a first write operation request and a first atomic count operation request. Optionally, the first write operation request is an RDMA write operation request, and the first atomic count operation request is an RDMA fetch_and_add operation request.

[0117] Taking the example of metadata being stored in the form of a hash table in memory node 120, the first write operation request is used to instruct that the value of the last access timestamp field in the metadata of the first data object be set to the timestamp of the data access initiated by computing node 110, i.e., the timestamp of the third read operation request sent by computing node 110. The first atomic count operation request is used to instruct that the value of the access count field in the metadata of the first data object be increased by one.

[0118] The above steps 410 to 430 are based on an example in which the computing node 110 performs a read operation on the memory node 120. In other possible embodiments, the computing node 110 may access the data object through a set operation, etc., which will not be described in detail here.

[0119] Based on the above steps 410 to 430 , the computing node 110 realizes global perception of access to the data object and global update of access information, which provides a data basis for subsequent calculation of the popularity of the data object based on the access information of the data object.

[0120] In an embodiment of the present application, in addition to updating the metadata of the data object based on access to the data object, the computing node 110 may also transform the metadata of the data object replaced out of the memory node 120 after the data object is replaced out of the memory node 120 to obtain a historical record item to record the cache replacement algorithm used when the data object is replaced out of the memory node 120.

[0121] In the embodiment of the present application, in order to reduce the space occupied by the historical record items in the memory node 120 and the index overhead, the historical record items can be stored in a multiplexed hash table. Figure 5 , describes the structure of a history item.

[0122] like Figure 5 As shown, when a hash slot for storing metadata is used to store a historical record item, the hash slot includes an atomic domain and a metadata domain. The atomic domain includes an object identification field 501, a type field 502, and a historical record item identification field 503. The metadata domain includes a hash value field 504, an algorithm identification field 505, a last access timestamp field 506, and an access count field 507.

[0123] Among them, a hash slot is used to store a historical data item of object data. The value stored in the object identification field 501 is used to indicate the data object to which the historical data item belongs, which is called the object identification. For example, the data object is a key-value pair, and the object identification field 501 is used to store the key.

[0124] The value stored in the type field 502 is used to indicate that the hash slot stores a historical record item. For example, the value of the type field 502 is 0xFF.

[0125] The value stored in the history record item identification field 503 is used to indicate the position of the history record item in the logical first-in-first-out queue.

[0126] The value stored in the algorithm identification field 505 is used to indicate the cache replacement algorithm used when the data object to which the historical record item belongs is cache replaced. For example, the value stored in the algorithm identification field 505 is a bitmap, and different bits of the bitmap correspond to different cache replacement algorithms. When the bit corresponding to the second cache replacement algorithm in the bitmap is a preset value, the value of the algorithm identification field 505 indicates the second cache replacement algorithm.

[0127] Hash value field 504, last access timestamp field 506 and access count field 507 are Figure 3 The corresponding fields in the metadata shown are the same and will not be repeated here.

[0128] Next, combine Figure 6 The steps of converting metadata and historical records are described. The computing node 110 sends a historical record item generation request to the memory node 120 to perform the steps of converting metadata and historical records. Based on the data format of the historical records, the historical record item generation request sent by the computing node 110 to the memory node 120 may include an atomic swap operation request and a second write operation request. The second write operation request may be an RDMA write operation request, and the atomic swap operation request may be an RDMA compare_and_swap operation request. Figure 6 As shown, the step of converting metadata and history items may include the following steps 610 to 620.

[0129] Step 610 : The computing node 110 sends an atomic swap operation request to the memory node 120 .

[0130] As a possible example, after completing cache replacement of the second data object, the computing node 110 sends an atomic exchange operation request to the memory node 120. The atomic exchange operation request is used to indicate that the value of the length field of the metadata of the second data object is modified to the value of the type field, such as 0xFF.

[0131] Step 620 : The computing node 110 sends a second write operation request to the memory node 120 .

[0132] As a possible example, the computing node 110 sends a second write operation request to the memory node 120, and the second write operation request is used to indicate that the value of a field used to represent access information in the metadata of the second data object is replaced with a value, such as a bitmap, used to represent the cache replacement algorithm used when the second data object is replaced by the cache, and the replaced field is called the algorithm identification field 505.

[0133] As a possible embodiment, the field in the metadata to be replaced by the second write operation request may be any one of the last access timestamp field 306 , the access count field 307 , and the insertion timestamp field 309 .

[0134] In a possible embodiment of the present application, when the historical record item includes the historical record item identification field 503 , the above-mentioned step of converting metadata and historical record items also requires converting the pointer field 305 of the metadata into the historical record item identification field 503 .

[0135] As a possible implementation, computing node 110 sends a second atomic counting operation request to memory node 120 before step 610, where the second atomic counting operation request is used to indicate that the number of global history items is increased by one, and to return the value before the number of global history items is increased by one as the value of history item identification field 503.

[0136] In this way, the computing node 110 sends the atomic swap operation request to the memory node 120 in step 610 and is also used to modify the value of the pointer field of the metadata of the second data object to the value of the historical record item identification field 503.

[0137] The function of the history record item identification field 503 is described below.

[0138] The value stored in the history record item identifier field 503 is called a history record item identifier, and the history record item identifier is used to indicate the position of the corresponding history record item in the logical first-in-first-out queue.

[0139] Assuming that the value of the history item identifier is u, the number of global history items is v, and the length of the logical FIFO queue is s, the position of the history item in the logical FIFO queue can be expressed as follows: Formula (1).

[0140]

[0141] Among them, if k>s, it means that the historical record item to which the historical record item identifier belongs exceeds the range of the logical first-in-first-out queue, and the computing node 110 can convert the historical record item back to metadata. The conversion method is the inverse step of the step of converting metadata to historical record items, which will not be repeated here.

[0142] Based on the fact that the algorithm identification field 505 of the historical record item indicates the cache replacement algorithm used when the data object is replaced out of the memory node 120, the computing node 110 can dynamically adjust the priorities of multiple cache replacement algorithms based on the historical data item. Figure 7 , taking the priority of multiple cache replacement algorithms as weight as an example, the cache replacement algorithm with higher weight has higher priority, and the priority adjustment steps of the cache replacement algorithm are described. Figure 7 As shown, the priority adjustment step of the cache replacement algorithm may include the following steps 710 to 750.

[0143] Step 710: When the computing node 110 misses accessing the second data object stored in the memory node 120, it is determined that the memory node 120 stores a history record item of the second data object.

[0144] As a possible example, when the computing node 110 fails to access the second data object stored in the memory node 120, the computing node 110 sends a query operation request to the memory node 120 to query the history item of the second data object from the memory node 120. If the history item of the second data object is found, the computing node 110 determines that the memory node 120 stores the history item of the second data object. If the history item of the second data object is not found, the computing node 110 determines that the history item of the second data object does not exist in the memory node 120.

[0145] Step 720 : The computing node 110 sends a second read operation request to the memory node 120 .

[0146] As a possible example, the computing node 110 sends a second read operation request to the memory node 120 , where the second read operation request is used to read a history record item of a second data object from the memory node 120 .

[0147] As a possible implementation, the history record item of the second data object includes an algorithm identification field. For example, the value of the algorithm identification field is used to indicate a second cache replacement algorithm among multiple cache replacement algorithms.

[0148] Step 730: The computing node 110 reduces the weight of the second cache replacement algorithm.

[0149] As a possible example, computing node 110 determines that the value of the algorithm identification field of the history record item of the second data object indicates the second cache replacement algorithm, that is, the second cache replacement algorithm performs an incorrect data replacement, and updates the weight of the second cache replacement algorithm based on the following formula (2).

[0150]

[0151] Among them, w represents weight, e represents natural constant, λ represents learning rate, d t represents the penalty value used to reduce the weight, and d is set to a constant value to reduce the impact of older errors in historical records.

[0152] Step 740 : The computing node 110 sends a third write operation request to the memory node 120 .

[0153] As a possible example, after reducing the weight of the second cache replacement algorithm stored locally, the computing node 110 sends a third write operation request to the memory node 120. The third write operation request is used to instruct the memory node 120 to write the reduced weight of the second cache replacement algorithm, so that the memory node 120 merges the reduced weight of the second cache replacement algorithm into the global algorithm weight of multiple cache replacement algorithms maintained by the memory node 120, and returns the merged global algorithm weight to the computing node 110.

[0154] Step 750 , the computing node 110 and the memory node 120 synchronize the global algorithm weights.

[0155] In this way, based on the above steps 710 to 750, in the distributed system 100, the computing node 110 maintains the weight of the locally maintained cache replacement algorithm based on the historical record items, and communicates with the memory node 120 to synchronize the global algorithm weights of multiple cache replacement algorithms in the entire distributed system 100, thereby ensuring the accuracy of the algorithm weights, and enabling the computing node 110 to accurately select the cache replacement algorithm suitable for the current data access mode according to the weights of multiple cache replacement algorithms, thereby achieving accurate cache replacement in the distributed system 100 with a memory separation architecture.

[0156] In order to cooperate with the above Figure 2 The present application also provides a cache replacement device 800, which can be used to implement the cache replacement method shown above. Figure 2 The function of computing node 110 in the cache replacement method shown in FIG. Figure 8 As shown, the cache replacement device 800 includes a transceiver module 810 and a processing module 820 .

[0157] The transceiver module 810 is used to send a first read operation request to the memory node, where the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes multiple data objects.

[0158] The processing module 820 is used to calculate the heat of the multiple data objects respectively by using a first cache replacement algorithm among multiple cache replacement algorithms based on the access information of the multiple data objects.

[0159] The transceiver module 810 is also used to send a cache replacement request to the memory node according to the heat of multiple data objects when cache replacement is required for cache data. The cache replacement request is used to indicate that cold data in multiple data objects is replaced with the data object to be inserted into the memory node 120.

[0160] Among them, the transceiver module 810 and the processing module 820 can be implemented by software or by hardware. Exemplarily, the implementation of the transceiver module 810 is introduced below by taking the transceiver module 810 as an example. Similarly, the implementation of the processing module 820 can refer to the implementation of the transceiver module 810.

[0161] As an example of a software functional unit, the transceiver module 810 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the transceiver module 810 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.

[0162] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0163] As an example of a hardware functional unit, the transceiver module 810 may include at least one computing device, such as a server, etc. Alternatively, the transceiver module 810 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0164] The multiple computing devices included in the transceiver module 810 can be distributed in the same region or in different regions. The multiple computing devices included in the transceiver module 810 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the transceiver module 810 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0165] It should be noted that, in other embodiments, any module in the transceiver module 810 and the processing module 820 can be used to execute any step in the cache replacement method, and the steps that the transceiver module 810 and the processing module 820 are responsible for implementing can be specified as needed. The full functions of the cache replacement device 800 are realized by respectively implementing different steps in the cache replacement method through the transceiver module 810 and the processing module 820.

[0166] If the memory node 120 returning data to the computing node 110 is regarded as an operation performed by the memory node 120, the cache replacement method also includes the steps performed by the memory node 120. In order to cooperate with the cache replacement method for demonstrating the interaction between the computing node 110 and the memory node 120, the present application also provides a cache replacement device 900, which can be used to implement the cache replacement method for demonstrating the interaction between the computing node 110 and the memory node 120. Fig. 9 As shown, the cache replacement device 900 includes a transceiver module 910 .

[0167] The transceiver module 910 is used to return a response to the computing node 110 according to the request of the computing node 110. For example, the transceiver module 910 is used to return access information of multiple data objects to the computing node 110 according to the first read operation request of the computing node 110.

[0168] The transceiver module 910 may be implemented by software or hardware. Figure 8 The example of the transceiver module 810 is not described in detail here.

[0169] Since the cache replacement method provided by this application is Figure 2 In the steps shown, all of them require the computing node 110 and the memory node 120 to interact with each other. The computing node 110 usually uses a client to communicate with the server of the memory node 120. Therefore, the present application also provides a cache replacement system 1000, such as Fig.10 As shown, the cache replacement system 1000 includes a client 1010 and a server 1020 .

[0170] The client 1010 is used to send a first read operation request to the memory node, where the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes multiple data objects.

[0171] The server 1020 is used to return access information to the client according to the first read operation request.

[0172] The client 1010 is further configured to respectively calculate the heat of the multiple data objects using a first cache replacement algorithm among the multiple cache replacement algorithms based on the access information of the multiple data objects.

[0173] The client 1010 is also used to send a cache replacement request to the memory node according to the heat of multiple data objects when cache replacement is needed for cached data. The cache replacement request is used to indicate that cold data in multiple data objects is replaced with the data object to be inserted into the memory node.

[0174] The client 1010 and the server 1020 can be implemented by software or hardware. As an example, the implementation of the client 1010 is introduced below. Similarly, the implementation of the server 1020 can refer to the implementation of the client 1010.

[0175] As an example of a software functional unit, the client 1010 may include code running on a computing instance. The computing instance may be at least one of a physical host (computing device), a virtual machine, a container, and other computing devices. Furthermore, the computing device may be one or more. For example, the client 1010 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the application may be distributed in the same region or in different regions. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same AZ or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Typically, a region may include multiple AZs.

[0176] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same VPC or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway must be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0177] In the embodiment of the present application, the client 1010 may be used to execute Figure 2The software module of the steps executed by the computing node 110 in the cache replacement method shown in FIG. 1 may also be as follows: Figure 8 The cache replacement device 800 shown. The server 1200 is used to execute Figure 2 The software module of the steps performed by the memory node 1020 in the cache replacement method shown in FIG. 1 may also be as follows: Fig. 9 A cache replacement device 900 is shown.

[0178] As an example of a hardware functional unit, the client 1010 may include at least one computing device, such as a server, etc. Alternatively, the client 1010 may also be a device implemented using ASIC or PLD, etc. The PLD may be implemented using CPLD, FPGA, GAL or any combination thereof.

[0179] The multiple computing devices included in the client 1010 can be distributed in the same region or in different regions. The multiple computing devices included in the client 1010 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the client 1010 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0180] The present application also provides a computing device 1100. Fig.11 As shown, the computing device 1100 includes: a bus 1102, a processor 1104, a memory 1106, and a communication interface 1108. The processor 1104, the memory 1106, and the communication interface 1108 communicate through the bus 1102. The computing device 1100 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1100.

[0181] The bus 1102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 1102 may include a path for transmitting information between various components of the computing device 1100 (eg, the memory 1106, the processor 1104, and the communication interface 1108).

[0182] The processor 1104 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0183] The memory 1106 may include a volatile memory, such as a random access memory (RAM). The processor 1104 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0184] The memory 1106 stores executable program codes, and the processor 1104 executes the executable program codes to respectively implement the functions of the modules included in the cache replacement device 800 or the cache replacement device 900, thereby implementing the cache replacement method. That is, the memory 1106 stores instructions for executing the cache replacement method.

[0185] Alternatively, the memory 1106 stores executable codes, and the processor 1104 executes the executable codes to respectively implement the functions of the client 1010 or the server 1020, thereby implementing the cache replacement method. That is, the memory 1106 stores instructions for executing the cache replacement method.

[0186] The communication interface 1108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1100 and other devices or a communication network.

[0187] Considering that the cache replacement method provided in the present application is applied to the distributed system 100, the respective infrastructures of the computing nodes 110 and the memory nodes 120 of the distributed system 100 usually include multiple computing devices. Therefore, the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop, a laptop, or a smart phone.

[0188] like Fig.12As shown, the computing device cluster includes at least one computing device 1100. The memory 1106 in one or more computing devices 1100 in the computing device cluster may store the same instructions for executing the cache replacement method.

[0189] In some possible implementations, the memory 1106 of one or more computing devices 1100 in the computing device cluster may also store partial instructions for executing the cache replacement method. In other words, the combination of one or more computing devices 1100 may jointly execute instructions for executing the cache replacement method.

[0190] It should be noted that the memory 1106 in different computing devices 1100 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the cache replacement apparatus 800 or the cache replacement 900. That is, the instructions stored in the memory 1106 in different computing devices 1100 may implement the functions of one or more modules included in the cache replacement 800 or the cache replacement 900.

[0191] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 8 A possible implementation is shown. Fig.12 As shown, two computing devices 1100A and 1100B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 1106 in the computing device 1100A stores instructions for executing the functions of one or more modules in the transceiver module 810 and the processing module 820. Fig.12 In the example, the memory 1106 in the computing device 1100A stores instructions for executing the functions of the transceiver module 810. Meanwhile, the memory 1106 in the computing device 1100B stores instructions for the functions of one or more modules in the transceiver module 810 and the processing module 820. Figure 8 In the example, the memory 1106 in the computing device 1100B stores instructions for executing the functions of the processing module 820.

[0192] It should be understood that Fig.12 The functions of the computing device 1100A shown in FIG. 1100A may also be completed by multiple computing devices 1100. Similarly, the functions of the computing device 1100B may also be completed by multiple computing devices 1100.

[0193] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the following steps: Figure 2 , or the cache replacement method shown in Figure 2 Steps performed by the computing node 110 or the memory node 120 in the cache replacement method shown.

[0194] The present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to store data such as Figure 2 , or the cache replacement method shown in Figure 2 The steps performed by the computing node 110 or the memory node 120 in the cache replacement method shown.

[0195] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). 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 contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0196] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0197] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0198] In the several embodiments provided in the present 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 only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0200] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0201] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.

[0202] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b and c can be single or multiple.

[0203] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0204] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cache replacement method, characterized in that: A computing node in a distributed system of a separated memory architecture, the distributed system further comprising a memory node, the computing node bypassing a processor of the memory node when accessing cache data stored in the memory node, the method comprising: Sending a first read operation request to the memory node, where the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes the multiple data objects; Based on the access information of the multiple data objects, using a first cache replacement algorithm among multiple cache replacement algorithms to respectively calculate the heat of the multiple data objects; When the cache data needs to be replaced, a cache replacement request is sent to the memory node according to the heat of the multiple data objects, and the cache replacement request is used to instruct to replace the cold data in the multiple data objects with the data objects to be inserted into the memory node.

2. The method according to claim 1, characterized in that The memory node stores metadata of the cache data, the multiple data objects include a first data object, the metadata includes the access information, and the method further includes: After the computing node performs data access to the first data object, a metadata update request is sent to the memory node, where the metadata update request is used to indicate updating access information of the first data object.

3. The method according to claim 1 or 2, characterized in that: The access information includes a last access timestamp and a number of accesses.

4. The method according to claim 3, characterized in that The metadata is stored in a hash table, the hash table includes a plurality of hash slots, each hash slot is used to store metadata of a data object, and each hash slot includes a length field, a pointer field, a last access timestamp field, and an access count field; The length field is used to indicate the length of the data object to which the metadata belongs, the pointer field is used to indicate the address of the data object to which the metadata belongs in the memory node, the last access timestamp field is used to indicate the time when the data object to which the metadata belongs was last accessed, and the access count field is used to indicate the number of times the data object to which the metadata belongs is accessed.

5. The method according to claim 4, characterized in that The metadata update request includes a first write operation request and a first atomic counting operation request; The first write operation request is used to instruct to set the value of the last access timestamp field of the metadata of the first data object to the timestamp when the computing node initiates the data access; The first atomic counting operation request is used to instruct to increase the value of the access count field of the metadata of the first data object by one.

6. The method according to any one of claims 1 to 5, characterized in that The cold data includes a second data object. After sending a cache replacement request to the memory node according to the heat of the multiple data objects, the method further includes: A history item generation request is sent to the memory node, where the history item generation request is used to instruct the metadata of the second data object to be converted into a history item, where the history item is used to indicate a second cache replacement algorithm used when the second data object is replaced by cache.

7. The method according to claim 6, characterized in that The historical record item is stored in a hash slot of a hash table, and the hash slot includes a type field and an algorithm identification field; The type field is used to indicate that the data object to which the historical record item belongs has been replaced by the cache, and the algorithm identification field is used to indicate a second cache replacement algorithm used when the data object to which the historical record item belongs is replaced by the cache.

8. The method according to claim 7, characterized in that The history entry generation request includes an atomic swap operation request and a second write operation request, the atomic swap operation request is used to indicate that the value of the length field of the metadata of the second data object is modified to the value of the type field, and the second write operation request is used to indicate that the value of a field in the metadata of the second data object used to represent access information is replaced with a value used to represent a second cache replacement algorithm used when the second data object is replaced by the cache.

9. The method according to claim 8, characterized in that The method further comprises: When a second data object stored in the memory node is accessed without a hit, determining that the memory node stores a history record item of the second data object; Sending a second read operation request to the memory node, where the second read operation request is used to read a history record item of the second data object from the memory node, and a value of an algorithm identification field of the history record item of the second data object indicates the second cache replacement algorithm; The weight of the second cache replacement algorithm is reduced.

10. The method according to claim 9, characterized in that The method further comprises: A third write operation request is sent to the memory node, wherein the third write operation request is used to instruct the reduced weight of the second cache replacement algorithm to be written to the memory node, so that the memory node merges the reduced weight of the second cache replacement algorithm into the global algorithm weight, and returns the merged global algorithm weight to the computing node.

11. The method according to any one of claims 1 to 10, characterized in that The sending a cache replacement request to the memory node according to the heat of the multiple data objects includes: When the remaining storage space of the memory node is smaller than the size of the data object to be inserted, or when the remaining storage space of the memory node is smaller than a preset threshold, a cache replacement request is sent to the memory node according to the heat of the multiple data objects.

12. A cache replacement method, characterized in that: The computing node and the memory node in the distributed system of the separated memory architecture are applied, and the computing node bypasses the processor of the memory node when accessing the cache data stored in the memory node. The method includes: The computing node sends a first read operation request to the memory node, where the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes the multiple data objects; The memory node returns the access information to the computing node according to the first read operation request; The computing node calculates the heat of the multiple data objects respectively using a first cache replacement algorithm among multiple cache replacement algorithms based on the access information of the multiple data objects; When the computing node needs to perform cache replacement on cached data, it sends a cache replacement request to the memory node according to the heat of the multiple data objects, wherein the cache replacement request is used to instruct to replace the cold data in the multiple data objects with the data objects to be inserted into the memory node.

13. A cache replacement device, characterized in that: include: A transceiver module, configured to send a first read operation request to a memory node, wherein the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes the multiple data objects; A processing module, configured to respectively calculate the heat of the plurality of data objects using a first cache replacement algorithm among a plurality of cache replacement algorithms based on the access information of the plurality of data objects; The transceiver module is also used to send a cache replacement request to the memory node when cache replacement is required for the cached data, according to the heat of the multiple data objects, and the cache replacement request is used to indicate that the cold data in the multiple data objects is replaced with the data object to be inserted into the memory node.

14. A cache replacement system, characterized in that: include: A client is used to send a first read operation request to a memory node, wherein the first read operation request is used to read access information of multiple data objects from the memory node, and the cache data stored in the memory node includes the multiple data objects; The server is configured to return the access information to the client according to the first read operation request; The client is further configured to respectively calculate the heat of the multiple data objects using a first cache replacement algorithm among multiple cache replacement algorithms based on the access information of the multiple data objects; The client is also used to send a cache replacement request to the memory node when cache replacement is required for cached data, according to the heat of the multiple data objects, and the cache replacement request is used to indicate that cold data in the multiple data objects is replaced with the data object to be inserted into the memory node.

15. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 11.

16. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to claim 12 .

17. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 11.

18. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method of claim 12 .

19. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 11.

20. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, which, when executed by a computing device cluster, perform the method of claim 12 .

Citation Information

Cited By

  • Memory access method and device, storage medium and computer equipment

    CN120929407A

  • Data processing method and device and electronic equipment

    CN121166694A

  • Cache replacement method and device, and system

    EP4749453A1

  • Cache replacement method and device, and system

    WO2025044128A1