A storage node, distributed storage system and method
Patent Information
- Application Number
- CN202610759542.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-28
- Publication Date
- 2026-10-09
AI Technical Summary
[0003]为了解决上述问题,相关技术还提出了采用分布式索引机制,以使得多节点集群中的每个节点均拥有整个集群的KV索引数据的本地快照,但该方案要求局部节点缓存全局索引,带来了大量的重复缓存,严重消耗了各个节点的缓存资源,造成了较大的资源浪费
[0018]本发明实施例的分布式存储系统包括多个存储节点,多个存储节点包括第一节点和第二节点,其中,第一节点的第一控制器用于确定第一节点中的第一缓存单元中的目标类型数据,并基于目标类型数据的逻辑索引信息获取目标类型数据的地址信息,响应于地址信息对应的存储节点为第二节点,生成存储请求并将存储请求发送至第二节点,存储请求包括所述目标类型数据和地址信息,第二节点中的第二控制器用于将接收到的存储请求中的目标类型数据存储至第二存储单元。由此,本发明实施例可以在实现数据分布式存储的同时,通过构建逻辑索引信息与地址信息之间的映射关系来实现存储节点只需构建本地存储索引,也即无需构建全局存储索引即可实现全局存储共享,并在保证查询效率的同时降低了资源开销。
Smart Images

Figure CN122884964A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage technology, and more specifically, to a storage node, a distributed storage system, and a method. Background Technology
[0002] Key-value (KV) storage is an important form of data storage, crucial in modern computer systems. In existing distributed storage schemes, a centralized index approach can be adopted. This involves generating a globally unique logical index before caching all KV data, passing this index to the allocator for address allocation, and establishing the relationship between the logical index and global physical addresses. The allocator manages all global storage space and assigns global physical addresses to all storage spaces. In this scheme, the KV index data of all storage nodes is stored on a unified master node. When other nodes need to perform remote queries, they must access the master node to retrieve the required KV index data. This makes metadata consistency maintenance relatively simple, but query efficiency is relatively slow, and system performance will further degrade under high concurrency, long contexts, and high throughput pressure.
[0003] To address these issues, related technologies have proposed using a distributed indexing mechanism, enabling each node in a multi-node cluster to have a local snapshot of the entire cluster's key-value index data. However, this approach requires local nodes to cache the global index, resulting in a large amount of duplicate caching, severely consuming the cache resources of each node and causing significant resource waste. Furthermore, the generation and deletion of key-value index data caches require periodic, extensive global broadcast communication, which also incurs additional peak network bandwidth overhead. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a storage node, a distributed storage system and a method, which, while realizing distributed data storage, enables global storage sharing by constructing a mapping relationship between logical index information and address information, so that the storage node only needs to construct a local storage index, that is, without constructing a global storage index, and reduces resource overhead while ensuring query efficiency.
[0005] In a first aspect, embodiments of the present invention provide a distributed storage system, the distributed storage system comprising multiple storage nodes, the multiple storage nodes comprising: The first node includes a first cache unit for caching data and a first controller. The first controller is used to determine the target type data in the first cache unit and obtain the address information of the target type data based on the logical index information of the target type data. In response to the storage node corresponding to the address information being a second node, the controller generates a storage request and sends the storage request to the second node. The second node includes a second storage unit and a second controller, the second controller being used to store the target type data in the received storage request into the second storage unit.
[0006] Furthermore, the target type data is cold data, and the first controller is also used to filter the target type data from the first cache unit based on data popularity and / or life cycle.
[0007] Further, the first controller includes: The hash calculation module is used to perform hash mapping on the logical index information of the target type data to obtain the address information of the target type data.
[0008] Furthermore, the second controller is also configured to, in response to the target type data being stored in the second storage unit, establish an index node corresponding to the target type data in the storage index structure corresponding to the second storage unit.
[0009] Furthermore, the second controller is also configured to control the sending of a storage response to the first node, and the first controller is also configured to delete the index node corresponding to the target type data from the cache index structure corresponding to the first cache unit.
[0010] Furthermore, the first controller is also configured to establish a lease for the target type data, and in response to receiving a storage response for the target type data, cancel the lease for the target type data.
[0011] Furthermore, the first node also includes a first storage unit. In response to the storage node corresponding to the address information being the first node, the first controller stores the target type data in the first storage unit, establishes an index node corresponding to the target type data in the storage index structure corresponding to the first storage unit, and deletes the index node corresponding to the target type data from the cache index structure corresponding to the first cache unit.
[0012] Furthermore, the cache index structure corresponding to the first cache unit and the storage index structure corresponding to the second storage unit are Radix Trees.
[0013] Furthermore, the first controller is also configured to receive a data access request, and in response to the data access request not hitting the cache, obtain request address information based on the logical index information in the data access request, and in response to the storage node corresponding to the request address information being the second node, generate a data request and send the data request to the second node, wherein the data request includes the request address information; The second controller is used to read request data from the second storage unit according to the request address information of the received data request, and send the request data to the first node. The first controller is used to cache the received request data in the first cache unit and establish an index node corresponding to the request data in the cache index structure corresponding to the first cache unit.
[0014] Furthermore, the second controller is also configured to establish a lease for the requested data, and cancel the lease for the requested data after sending the requested data to the first node, and delete the index node corresponding to the requested data from the storage index structure of the second storage unit.
[0015] In a second aspect, embodiments of the present invention provide a storage node, the storage node comprising: Cache unit, used to cache data; The controller is configured to obtain target type data from the cache unit and obtain the address information of the target type data based on the logical index information of the target type data. In response to the storage node corresponding to the address information being a second node, the controller generates a first storage request and sends the first storage request to the second node, so that the second node stores the target type data in the local storage unit based on the address information.
[0016] Furthermore, the storage node also includes: Storage unit, used to store the corresponding target type data.
[0017] Thirdly, embodiments of the present invention provide a distributed memory access method applied to a storage node, the method comprising: Retrieve target type data; The address information of the target type data is obtained based on the logical index information of the target type data; In response to the address information corresponding to the storage node being the second node, a storage request is generated and sent to the second node, so that the second node stores the target type data in the local storage unit based on the address information.
[0018] The distributed storage system of this invention includes multiple storage nodes, including a first node and a second node. A first controller of the first node determines the target type data in a first cache unit within the first node and obtains the address information of the target type data based on its logical index information. Responding to the address information corresponding to a second node, the system generates a storage request and sends it to the second node. The storage request includes the target type data and the address information. A second controller in the second node stores the target type data from the received storage request in a second storage unit. Therefore, this invention can achieve distributed data storage while simultaneously enabling global storage sharing by constructing a mapping relationship between logical index information and address information. This allows storage nodes to build only local storage indexes, eliminating the need to build global storage indexes, and reducing resource overhead while maintaining query efficiency. Attached Figure Description
[0019] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which: Figure 1 This is a schematic diagram of the KV caching architecture according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a distributed storage system according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the cache index structure corresponding to the cache unit in an embodiment of the present invention; Figure 4 This is a schematic diagram of the address information determination process according to an embodiment of the present invention; Figure 5 This is a flowchart of a distributed memory access method according to an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the update process of a cache index structure according to an embodiment of the present invention; Figure 7 This is a schematic diagram illustrating the update process of a storage index structure according to an embodiment of the present invention; Figure 8 This is a flowchart of another distributed memory access method according to an embodiment of the present invention; Figure 9 This is a flowchart of another distributed memory access method according to an embodiment of the present invention; Figure 10 This is a schematic diagram illustrating the update process of another cache index structure according to an embodiment of the present invention; Figure 11 This is a schematic diagram illustrating the update process of another storage index structure according to an embodiment of the present invention; Figure 12 This is a flowchart of another distributed memory access method according to an embodiment of the present invention; Detailed Implementation
[0020] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0021] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0022] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".
[0023] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0024] The solutions described in this specification and embodiments, if involving the processing of personal information, will be processed only on the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be processed within the scope stipulated or agreed upon. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.
[0025] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0026] Key-Value Cache (KV Cache) is a common optimization technique used in the inference process of large models, primarily to accelerate computational efficiency in autoregressive generation tasks (such as text generation). It avoids redundant computations by caching intermediate computation results (key and value tensors), thereby reducing computational load and feedback latency during inference.
[0027] SSD (Solid State Drive): A type of hard drive manufactured using NAND Flash memory chips.
[0028] Radix Tree: A high-efficiency data structure primarily used for building inverted indexes in associative arrays, IP routing, and information retrieval. It saves space by sharing a common prefix, resulting in higher storage efficiency compared to traditional prefix trees.
[0029] Hash Algorithm: A hash algorithm transforms an input of arbitrary length (also called a pre-image) into a fixed-length output, which is called the hash value. This transformation is a compression mapping, meaning that the space of hash values is usually much smaller than the space of inputs. Different inputs may hash to the same output, so it is impossible to determine a unique input value from the hash value.
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0031] Based on the above explanation of the nouns and terms involved in the embodiments of this application, the storage node, distributed storage system and method provided in the embodiments of this application are described below.
[0032] Figure 1 This is a schematic diagram of a KV caching architecture according to an embodiment of the present invention. It should be understood that the KV caching architecture shown in this embodiment is merely exemplary and is not limited to this in practical applications. Figure 1 As shown, the KC cache architecture 1 in this embodiment includes an inference engine 11, an allocator 12, multi-level caches (such as L1 cache 13 and L2 cache 14, etc.) and a KV cache service 15.
[0033] The inference engine is responsible for executing the model computation graph and the entire generation process. It is used to execute the model computation graph, schedule the corresponding requests, and manage the KV cache. That is, it issues instructions to allocator 12 to allocate KV cache space for new request sequences and instructs to release space after the requests are completed. Allocator 12 is responsible for efficiently managing the allocation and release of KV cache space.
[0034] Furthermore, the KV cache architecture 1 may also include a KV cache offloading module to offload a portion of the KV cache to a larger storage device when the relevant storage is insufficient to accommodate the entire KV cache.
[0035] The L1 cache is a hot data layer, used to store key-value data blocks that are frequently accessed by active computing cores. The L2 cache is a warm data layer, storing key-value data that may be accessed again.
[0036] KV caching service 15 can be a multi-level cache pool based on various storage devices, such as DRAM (Dynamic RAM), HBM (High Bandwidth Memory), SCM (Storage-Class Memory), SSD, etc. It can be a remote storage service or a KV database used for metadata management and persistent data storage.
[0037] In practical applications, achieving distributed global sharing of key-value (KV) caching services is crucial. Related technologies offer centralized indexing and distributed indexing schemes; however, centralized indexing suffers from slow query efficiency and low system performance, while distributed indexing leads to resource waste due to numerous duplicate caches. Therefore, this invention provides a storage node, a distributed storage system, and a method that, while achieving distributed data storage, establishes a mapping relationship between logical index information and address information. This allows storage nodes to build only local storage indexes, eliminating the need for a global storage index, thus achieving global storage sharing while maintaining query efficiency and reducing resource overhead.
[0038] Figure 2 This is a schematic diagram of a distributed storage system according to an embodiment of the present invention. Figure 2 As shown, the distributed storage system of this embodiment includes multiple storage nodes, such as storage node 21 and storage node 22. In this embodiment, storage node 21 is used as the first node for detailed description. It should be understood that the working methods of each storage node in the distributed storage system are similar.
[0039] In this embodiment, taking storage node 21 as an example, storage node 21 includes at least one cache unit 211 and a controller 212. Optionally, the cache unit 211 is a high-speed cache unit, which can be implemented using memory types such as HBM and / or DRAM. It should be understood that this embodiment does not limit the type of cache unit 211, and the cache unit in storage node 21 can be implemented using one or more types of cache units. This embodiment will not describe these types in detail here.
[0040] In this embodiment, the key-value (KV) data is first stored in the cache unit 211 according to the logical index information, thus constructing the cache index structure corresponding to the KV data. Optionally, in this embodiment, the cache index structure corresponding to the KV data in the cache unit 211 can be a RadixTree (compressed prefix tree), or other structures such as B+Tree, RangeTree, Hash Table, Skip List, vector index, etc. This embodiment does not limit this.
[0041] Furthermore, the controller 212 responds to a query instruction by querying the target type data in the cache unit 211. The target type data is cold data, but it can also be other custom-defined data types. Cold data represents data that has not been accessed for a predetermined period, i.e., data whose value has depreciated due to prolonged inaccessibility. Optionally, the query instruction in this embodiment can be triggered periodically, upon receiving a new data access request, or through other custom methods; this embodiment does not impose any limitations on this.
[0042] In one alternative implementation, controller 212 is used to filter cold data from cache unit 211 based on data popularity and / or lifecycle.
[0043] Furthermore, this embodiment can use access frequency, access interval, and / or access percentage to characterize data popularity. Access frequency characterizes the number of cache hits per unit time, access interval characterizes the time interval between adjacent accesses, and access percentage characterizes the ratio of the corresponding data access volume to the total global cache access volume. Optionally, the controller 212 determines the corresponding data as cold data in response to an access frequency less than a first threshold, an access interval greater than a second threshold, and / or an access percentage less than a third threshold.
[0044] Furthermore, this embodiment can determine the data lifespan, last update time, and / or validity period of the corresponding data based on the data's lifecycle. The data lifespan is the time elapsed since the corresponding data cache was created, the last update time is the most recent modification or refresh time of the corresponding data, and the validity period is the preset expiration time of the corresponding data. Optionally, the controller 212 determines the corresponding data as cold data in response to the data storage duration exceeding a preset lifecycle limit, the last update time being more than a fourth threshold (i.e., no update for a long time), and / or the corresponding data being expired or nearing expiration (i.e., less than a fifth threshold before expiration).
[0045] In another optional implementation, the controller 212 of this embodiment can also determine that the corresponding data is cold data when both the data popularity and lifespan meet the criteria for determining cold data. That is, the controller 212 only determines that the data is cold data when it is identified as cold data in both the data popularity dimension and the lifespan dimension using any of the above methods. It should be understood that the controller 212 can use any dimension of data popularity and lifespan to determine cold data, or it can use both dimensions together to determine cold data. This embodiment does not limit this and can be configured based on actual application conditions.
[0046] Furthermore, the various thresholds for determining cold data can be configured based on actual application conditions. Optionally, the threshold configuration when using both data popularity and lifecycle dimensions for judgment can differ from the threshold configuration when using a single dimension for judgment, but they can also be the same; this embodiment does not impose any restrictions on this.
[0047] Figure 3 This is a schematic diagram of the cache index structure corresponding to the cache unit in an embodiment of the present invention. This embodiment uses RadixTree to construct the cache index structure for the data in the cache unit as an example. Figure 2 and Figure 3 As shown, cache index structure 3 is the RadixTree corresponding to the data index in cache unit 211. Cache index structure 3 includes a root node Node0, child nodes Node11 and Node12, and leaf nodes Node21 and Node22. It should be understood that cache index structure 3 is merely exemplary; the actual structure is determined based on the cached data of the corresponding cache unit. Each node has corresponding data such as creation time, access count, and last access timestamp.
[0048] In this embodiment, based on the characteristic of RadixTree's same prefix merging compression, when a node is determined to be a cold data node, the cached data corresponding to the nodes in the subtree rooted at that node can also be determined to be cold data. For example... Figure 3 As shown, assuming node Node12 is identified as a cold data node, the cached data corresponding to other nodes Node22 in its subtree is also identified as cold data.
[0049] After determining the target type data in the first cache unit, the controller 212 obtains the address information of the target type data based on its logical index information. The logical index information of the target type data is also the specific key value (Index), and the address information includes the physical address information where the target type data is stored. In an optional implementation, the controller 212 uses a hash algorithm to perform a hash mapping on the logical index information of the target type data to obtain its address information.
[0050] Furthermore, the controller 212 includes a hash calculation module to perform hash mapping on the logical index information of the target type data to obtain the address information of the target type data. Optionally, the hash calculation module can employ a HASH ACC (Hash Accelerator). In this embodiment, the hash calculation module can specifically employ hash algorithms such as CRC32 or SHA3-64. It should be understood that this embodiment does not limit the specific hash algorithm used, as long as it can achieve address mapping.
[0051] In one optional implementation, each storage node in the distributed storage system further includes at least one storage unit for storing target type data (e.g., cold data). For example, storage node 21 includes at least one storage unit 213, and storage node 22 includes at least one storage unit 223. Each storage node within the distributed storage system is a globally shared storage space. This embodiment performs a hash operation on the globally shared storage space in the distributed storage system. Further, this embodiment hashes the identifier of each storage node to obtain the hash value of the identifier of each storage node, and maps the hash values of each storage node to a hash ring, so that each storage node is responsible for all hash values from its own hash value to the hash value of the next storage node. Further, the controller 212 performs a hash calculation on the acquired logical index information of the target type data to obtain the key hash, and then determines the position of the key hash on the hash ring, and determines the storage node responsible for the key hash.
[0052] Figure 4 This is a schematic diagram illustrating the address information determination process according to an embodiment of the present invention. Figure 4As shown, assuming the distributed storage system includes storage nodes 21-24, a hash operation is performed on the node identifiers of storage nodes 21-24 to obtain the hash values hash1, hash2, hash3, and hash4 of the node identifiers of storage nodes 21, 22, 23, and 24. Further, in this embodiment, the hash values of storage nodes 21-24 are mapped to a hash ring 4. Storage node 21 is responsible for the hash values between hash1 and hash2 on the hash ring; storage node 22 is responsible for the hash values between hash2 and hash3; storage node 23 is responsible for the hash values between hash3 and hash4; and storage node 24 is responsible for the hash values between hash4 and hash1.
[0053] Furthermore, in this embodiment, a mapping relationship is constructed between the globally shared storage space (e.g., storage unit used to store cold data) in each storage node 21-24 and its corresponding hash value range to obtain the local hash table of each storage node 21-24. For example, a mapping relationship is constructed between the globally shared storage space (e.g., storage unit used to store cold data) in storage node 21 and its corresponding hash value range (hash value hash1-hash value hash2) to obtain the local hash table of storage node 21.
[0054] Furthermore, in this embodiment, the hash calculation module in the controller 212 performs hash mapping on the logical index information (i.e., key value) of the acquired target type data to obtain the target hash value Index_hash, and then determines that the target hash value Index_hash is within the hash value range of the storage node 22. The controller 212 then determines to store the target type data in the storage node 22.
[0055] In one optional implementation, controller 212, in response to the acquired address information corresponding to storage node 22, generates a storage request and sends the storage request to storage node 22. Optionally, the storage request includes target type data and address information. Further, the address information can be logical index information of the target type data, or the hash value of the logical index information. In other optional implementations, storage node 21 can also store hash tables of other storage nodes besides its local hash table; that is, each storage node stores a global hash table (including the hash tables of each storage node). In this case, the address information in the storage request can also include physical address information determined based on the hash table of storage node 22.
[0056] In one optional implementation, after determining the target type data, the controller 212 establishes a lease for that target type data to avoid inaccessibility before the data is flushed to the corresponding storage unit. The lease is essentially a time-limited access authorization and exclusive deletion permission. Further optionally, the controller 212 sends a lease request (including, for example, the logical index information of the target type data and the lease duration) to the corresponding lease manager. After performing conflict detection, the lease manager, in response to no conflict (the data is not in an accessed state and there are no other leases), creates the corresponding lease.
[0057] Furthermore, in this embodiment, the storage node 21 also includes a communication unit ( Figure 2 (Not shown in the diagram) to send a storage request to storage node 22 through this communication unit. Optionally, the communication unit of storage node 21 can transmit data with storage node 22 via RDMA (Remote Direct Memory Access). It should be understood that this embodiment does not limit the data transmission method between storage nodes, as long as it can achieve the corresponding transmission function.
[0058] like Figure 2 As shown, storage node 22 includes at least one cache unit 221, a controller 222, and at least one storage unit 223. It should be understood that the process of determining the target type data and the storage address for storage node 22's cache unit 221 and controller 222 is similar to that of storage node 21, and will not be described in detail here.
[0059] Furthermore, if storage node 22 receives a storage request from storage node 21, the controller 222 in storage node 22 stores the target type data into the corresponding storage unit 223 based on the address information in the storage request.
[0060] In one optional implementation, if the address information in the storage request is the logical index information of the target type data, the controller 222 performs a hash calculation on the logical index information to obtain the corresponding hash value, and determines the physical address information corresponding to the hash value based on the hash table corresponding to the storage unit 223, and stores the target type data in the storage location corresponding to the physical address information. Optionally, the controller 222 includes a hash calculation module (e.g., HASH ACC) to implement the hash calculation.
[0061] In another optional implementation, if the address information in the storage request is a hash value of the logical index information of the target type data, the controller 222 determines the physical address information corresponding to the hash value based on the hash table corresponding to the storage unit 223, and stores the target type data in the storage location corresponding to the physical address information. In other optional implementations, if the address information in the storage request is the physical address information of the target type data, the controller 222 stores the target type data in the storage location corresponding to the physical address information.
[0062] Furthermore, in this embodiment, each storage node stores a storage index structure corresponding to the target type data stored in the local storage unit (e.g., cold data storage space). For example, such as Figure 2 As shown, storage node 21 stores the storage index structure corresponding to the target type data stored in local storage unit 213. Storage node 22 stores the storage index structure corresponding to the target type data stored in local storage unit 223. Optionally, the storage index structure corresponding to the storage unit of each storage node can adopt RadixTree (compressed prefix tree), or other structures, such as B+Tree, RangeTree, Hash Table, Skip List, vector index, etc. This embodiment does not limit this.
[0063] Furthermore, in this embodiment, after storing the target type data into the corresponding storage unit 223, the controller 222 of the storage node 22 establishes an index node corresponding to the target type data in the storage index structure corresponding to the storage unit 223. Taking the RadixTree storage index structure as an example, the controller 222 traverses the RadixTree based on the logical index information (i.e., the key value) of the target type data to construct the leaf node corresponding to the logical index information. Thus, in this embodiment, the storage node can achieve data access by storing only the storage index structure of the local storage unit.
[0064] Furthermore, the controller 222 is also used to control the sending of a storage response to the storage node 21, so that the storage node 21 can update the cache index structure corresponding to the cache unit 211 based on the storage response.
[0065] Optionally, the controller 222 of storage node 22 includes a data detector ( Figure 2 (Not shown in the image), this embodiment uses the data detector (flush monitor) to process target type data, such as the storage of target type data and the creation of corresponding nodes in the storage index structure, and the feedback of storage response.
[0066] Furthermore, in response to receiving the storage response, the controller 212 of storage node 21 deletes the index node corresponding to the target type data from the cache index structure corresponding to cache unit 211.
[0067] Furthermore, the controller 212 of storage node 21 can also cancel the lease of the target type data in response to receiving a storage response for the target type data or the expiration of the lease for the corresponding target type data.
[0068] It should be understood that in this embodiment, storage node 21 is used as the first node for querying target type data and performing data flushing, and storage node 22 is used as the remote storage node (i.e., the second node) for performing data flushing. That is, the controller 212 in storage node 21 is the first controller, the cache unit 211 is the first cache unit, and the storage unit 213 is the first storage unit. The controller 222 in storage node 22 is the second controller, the cache unit 221 is the second cache unit, and the storage unit 223 is the second storage unit.
[0069] Figure 5 This is a flowchart of a distributed memory access method according to an embodiment of the present invention. Figure 6 This is a schematic diagram illustrating the update process of a cache index structure according to an embodiment of the present invention. Figure 7 This is a schematic diagram illustrating the update process of a storage index structure according to an embodiment of the present invention. This embodiment describes the process of flushing acquired target type data to a remote storage node. Figure 6 The cache index structure shown is the index structure corresponding to the data in the cache unit of the local storage node. Figure 7 The storage index structure shown is the index structure corresponding to the data in the storage unit of the remote storage node. For example... Figure 5 As shown, the distributed storage process in this embodiment includes the following steps: Step S110: The first node (i.e., the local storage node) retrieves the target type data from the local cache unit. For example... Figure 6 As shown, the currently determined target type data is the KV data corresponding to node Node22 in the cache index structure. Further, in this embodiment, after determining the target type data, a lease for that target type data is established.
[0070] Step S120: The first node obtains the address information of the target type data based on the logical index information of the target type data.
[0071] In step S130, the first node generates a storage request. The storage request includes target type data and address information. The storage node corresponding to the address information is the second node.
[0072] In step S140, the first node sends a storage request to the second node (i.e., the remote storage node).
[0073] In step S150, after receiving the storage request, the second node stores the target type data into the local storage unit based on the address information in the storage request.
[0074] Step S160: Create an index node corresponding to the target type data in the storage index structure corresponding to the local storage unit of the second node. For example... Figure 7 As shown, the storage index structure corresponding to the local storage unit in the second node includes nodes node1 and node2. An index node node3 corresponding to the target type data is established in it to obtain the updated storage index result.
[0075] In step S170, the second node sends a storage response to the first node.
[0076] In step S180, after receiving the storage response, the first node deletes the index node corresponding to the target type data in the cache index structure corresponding to the local cache unit. For example... Figure 6 As shown, the first node deletes the index node Node22 corresponding to the target type data from the cache index structure corresponding to the local cache unit, and obtains the updated cache index structure.
[0077] Furthermore, after the target type data is flushed, the lease for that target type data is cancelled.
[0078] It should be understood that in this embodiment, the first node can also serve as a remote storage node for other nodes (such as the second node). When the target type data of other nodes needs to be flushed to the first node, that is, when the first node receives a storage request, it performs the corresponding storage operation and updates the storage index structure corresponding to the local storage node of the first node. The specific process is similar to the execution process of the second node described above, and will not be described in detail here.
[0079] Furthermore, the specific implementation methods of each of the above steps are similar to those of the above embodiments, and will not be repeated here.
[0080] Furthermore, in this embodiment, as Figure 4 As shown, assuming that the hash calculation module in controller 212 performs hash mapping on the logical index information (i.e. key value) of the acquired target type data to obtain the target hash value Index_hash', and then determines that the target hash value Index_hash' is within the hash value range of storage node 21, controller 212 determines to store the target type data in storage node 21, that is, in the local storage unit 213.
[0081] Furthermore, controller 212 determines the physical address information corresponding to the target hash value 'Index_hash' based on the local hash table, and stores the target type data in the storage location corresponding to the physical address information. Then, it establishes logical index information for the target type data in the storage index structure corresponding to storage unit 213, and deletes the logical index information for the target type data from the cache index structure corresponding to cache unit 211. Optionally, controller 212 is also used to establish a corresponding lease when initiating data flushing of the target type data, and cancel the lease corresponding to the target type data after the flushing is completed.
[0082] Figure 8 This is a flowchart of another distributed memory access method according to an embodiment of the present invention. This embodiment describes a flowchart of the process of flushing acquired target type data to the local storage node. Figure 8 As shown, the distributed memory access method in this embodiment includes the following steps: Step S210: Obtain target type data. The local storage node obtains the target type data from the local cache unit. Further, in this embodiment, after determining the target type data, a lease for the target type data is established.
[0083] Step S220: Obtain the address information of the target type data based on the logical index information of the target type data.
[0084] In step S230, in response to the address information being a local storage node, the target type data is stored in the local storage unit.
[0085] Step S240: Create an index node corresponding to the target type of data in the storage index structure corresponding to the local storage unit.
[0086] Step S250: Delete the index node corresponding to the target type data from the cache index structure corresponding to the local cache unit.
[0087] It should be understood that the specific implementation methods of the above steps, as well as the update methods of the storage index structure and cache index structure, are similar to those in the above embodiments, and will not be described in detail here.
[0088] In one optional implementation, the hot data in this embodiment can employ a scheme of local node caching of the global index to ensure efficient transmission of hot data. Specifically, each storage node periodically uploads the KV index data cached in its local cache unit's cache index structure to the global index storage unit. That is, the global index storage unit stores the global index structure, which is the KV index data cached by all storage nodes. Further, each storage node periodically retrieves the global index structure from the global index storage unit. Thus, the storage unit can access both local and remote caches based on the global index structure, ensuring efficient access to hot data. Simultaneously, this embodiment of the invention implements distributed storage of cold data in the memory of the storage nodes, reducing cache consumption.
[0089] Furthermore, the data reading method of the distributed storage system in this embodiment includes local cache reading, remote cache reading, local storage unit reading, and remote storage unit reading.
[0090] In this embodiment, as Figure 2 As shown, the controller 212 is also configured to receive data access requests, and in response to a data access request not being hit by the cache unit 211, to obtain request address information based on the logical index information in the data access request, and to implement data access based on the request address information. The data access request includes logical index information (i.e., a key value).
[0091] In one alternative implementation, when the controller 212 receives a data access request, it queries the cache index structure corresponding to the cache unit 211 based on the logical index information corresponding to the data access request. In response to finding the index node corresponding to the logical index information in the cache index structure, the controller 212 retrieves the requested data from the cache unit 211 based on the physical address information in the index node.
[0092] In other optional implementations, if the storage node 21 stores a global index structure, the controller 212 can query the global index structure based on the logical index information corresponding to the data access request. In response to finding the index node corresponding to the logical index information in the global index structure, the controller 212 determines the storage node where the requested data is located and the physical address information in the cache unit of the storage node based on the physical address information in the index node, and obtains the requested data accordingly.
[0093] Furthermore, in response to the fact that the index node corresponding to the logical index information in the data access request is not found in the local cache index structure or the global index structure, that is, the data access request has not hit the cache, the controller 212 enters the storage space of the target type data (e.g., cold data) for querying.
[0094] Furthermore, the controller 212 obtains the request address information based on the logical index information in the data access request. The logical index information in the data access request is also the specific key value (Index). In one optional implementation, the controller 212 uses a hash algorithm to perform a hash mapping on the logical index information in the data access request to obtain the request address information.
[0095] Furthermore, the controller 212 uses its hash calculation module to perform hash mapping on the logical index information in the data access request to obtain the request address information. It should be understood that the calculation process for the request address information is similar to the calculation process for the address information of the target type data during data flushing, and will not be described in detail here.
[0096] Furthermore, in response to the request address information corresponding to a remote storage node (i.e., a storage node other than the local storage node 21, hereinafter taking storage node 22 as an example), controller 212 generates a data request and sends the data request to storage node 22. The data request includes the request address information. Optionally, the request address information can be logical index information, i.e., a key value.
[0097] Furthermore, if this embodiment uses a hash ring to implement address mapping, such as Figure 4 As shown, the hash calculation module in controller 212 performs hash mapping on the logical index information (i.e., key value) in the data access request to obtain the requested hash value Index_hash1, and then determines that the target hash value Index_hash1 is within the hash value range of the storage node 22. Controller 212 then determines that the requested data is located in storage node 22.
[0098] Further, after receiving a data request, storage node 22 reads the requested data from storage unit 223 of storage node 22 based on the requested address information, and sends the requested data to storage node 21. Optionally, in this embodiment, after receiving a data request, storage node 22 queries the storage index structure corresponding to storage unit 223 based on the logical index information in the data request, obtains the index node corresponding to the logical index information in the storage index structure, obtains the physical address of the requested data in storage unit 223, and reads the corresponding requested data from storage unit 223 based on the physical address.
[0099] Alternatively, in this embodiment, the lease of the index node is established before or simultaneously with reading the storage unit 223 based on the physical address in the index node, in order to avoid access conflicts.
[0100] Furthermore, after the storage node 21 receives the request data, the controller 212 caches the received request data in the cache unit 211 and establishes the index node corresponding to the request data in the cache index structure corresponding to the cache unit 211.
[0101] Optionally, after completing the caching of the requested data and the establishment of the index node, the controller 212 can send a processing completion message to the storage node 22. Upon receiving this message, the controller 222 in the storage node 22 deletes the index node corresponding to the requested data from the storage index structure corresponding to the storage unit 223. In other optional implementations, the controller 222 in this embodiment can also delete the index node corresponding to the requested data from the storage index structure corresponding to the storage unit 223 after completing the transmission of the requested data (or after a predetermined time following the transmission of the requested data).
[0102] Optionally, the controller 222 in storage node 22 may invalidate the lease for the requested data in response to receiving the processing completion message or the lease for the requested data expiring. Furthermore, in this embodiment, the controller 222 may also delete the index node corresponding to the requested data from the storage index structure corresponding to the storage unit 223 after the lease for the requested data expires.
[0103] It should be understood that in this embodiment, a local storage node (e.g., storage node 21) is used as the first node and a remote storage node (e.g., storage node 22) is used as the second node. However, it should be understood that each storage node in the storage system is a local node relative to itself and a remote node relative to other storage nodes. That is, each storage node can be used as either the first node or the second node, and the control method is the same.
[0104] Figure 9 This is a flowchart of another distributed memory access method according to an embodiment of the present invention. Figure 10 This is a schematic diagram illustrating the update process of another cache index structure according to an embodiment of the present invention. Figure 11 This is a schematic diagram illustrating the update process of another storage index structure according to an embodiment of the present invention. This embodiment describes the process of obtaining requested data from a remote storage node. Figure 10 The cache index structure shown is the index structure corresponding to the data in the cache unit of the local storage node. Figure 11 The storage index structure shown is the index structure corresponding to the data in the storage units of the remote storage node. For example... Figure 5 As shown, the distributed storage process in this embodiment includes the following steps: In step S310, the first node (i.e., the local storage node) receives a data access request. The data access request includes logical index information.
[0105] In step S320, the first node responds to the data access request not hitting the cache by obtaining the request address information based on the logical index information in the data access request.
[0106] Specifically, such as Figure 10 As shown, after receiving a data access request, the first node queries the cache index structure 10 based on the logical index information in the data access request. If the index node corresponding to the logical index information is not found in the cache index structure 10, it is determined that the data access request has not been hit. The first node performs a hash calculation on the logical index information to obtain the corresponding hash value, and determines the second node for storing the requested data based on the hash value.
[0107] In step S330, the first node responds to the request address information by identifying the storage node corresponding to the second node and generates a data request. The data request includes the corresponding logical index information.
[0108] Step S340: The first node sends a data request to the second node.
[0109] Step S350: After receiving the data request, the second node queries the storage index structure based on the logical index information to obtain the requested physical address. For example... Figure 11 As shown, the second node queries the storage index structure 11 in the second node based on the logical index information in the data request, determines that the index node corresponding to the logical index information is node4, and obtains the request physical address corresponding to the data request from node4.
[0110] In step S360, the second node reads the requested data from the second storage unit based on the requested physical address. Further, while performing this step, the second node establishes a lease for the requested data.
[0111] Step S370: The second node sends request data to the first node.
[0112] In step S380, the first node caches the received request data in the first cache unit. In this embodiment, after receiving the request data, the first node allocates a corresponding cache line for the request data and feeds the request data back to the upstream.
[0113] Step S390: The first node establishes an index node corresponding to the requested data in the cache index structure corresponding to the local cache unit. For example... Figure 10 As shown, the first node establishes a corresponding index node Node23 in the cache index structure 10 based on the logical index information corresponding to the request data, thus obtaining the updated cache index structure 10'.
[0114] In step S3A0, the second node deletes the index node corresponding to the requested data from the storage index structure corresponding to the second storage unit. Specifically, as follows: Figure 11 As shown, after the first node completes the caching of the requested data, the second node deletes the index node node4 corresponding to the requested data in the storage index structure 11 corresponding to the second storage unit, and obtains the updated storage index structure 11'.
[0115] Furthermore, after the first node completes the caching of the requested data, the second node controls the expiration of the lease for the requested data.
[0116] It should be understood that in this embodiment, the first node can also serve as a remote storage node for other nodes (such as the second node). When other nodes receive a data access request, the steps they perform are basically the same as those described above, and will not be described in detail here.
[0117] Furthermore, in response to the request address information corresponding to the storage node being a local storage node, i.e. the request data being located in storage unit 213, the controller 212 queries the storage index structure corresponding to storage unit 213 based on the logical index information in the request address information to obtain the index node corresponding to the request data, so as to obtain the physical address of the request data in storage unit 213 from the index node, and reads the request data from storage unit 213 based on the physical address.
[0118] Furthermore, if this embodiment uses a hash ring to implement address mapping, such as Figure 4 As shown, the hash calculation module in controller 212 performs hash mapping on the logical index information (i.e., key value) in the data access request to obtain the requested hash value Index_hash1', and then determines that the target hash value Index_hash1' is within the hash value range of the storage node 21, and controller 212 determines that the requested data is located in storage node 21.
[0119] Furthermore, after obtaining the request data, the controller 212 caches the request data in the cache unit 211, establishes an index node corresponding to the request data in the cache index structure corresponding to the cache unit 211, and deletes the index node corresponding to the request data from the storage index structure corresponding to the storage unit 213.
[0120] Optionally, the controller 212 establishes a lease for the inode before or simultaneously with reading the storage unit 213 based on the physical address in the inode to avoid access conflicts. Further optionally, the controller 212 cancels the lease for the requested data after completing the caching of the requested data or when the lease corresponding to the requested data expires.
[0121] Figure 12 This is a flowchart of another distributed memory access method according to an embodiment of the present invention. This embodiment describes the process of obtaining requested data from a local storage node, such as... Figure 12 As shown, the distributed memory access method in this embodiment includes the following steps: Step S410: Receive a data access request. The data access request includes logical index information.
[0122] Step S420: In response to the data access request not hitting the cache, obtain the request address information based on the logical index information in the data access request.
[0123] After receiving a data access request, the first node queries the cache index structure based on the logical index information in the data access request. If the index node corresponding to the logical index information is not found in the cache index structure, it is determined that the data access request has not been hit. The first node performs a hash calculation on the logical index information to obtain the corresponding hash value, and determines the local storage node of the requested data storage based on the hash value.
[0124] Step S430: In response to the fact that the storage node corresponding to the requested address information is a local storage node, the local storage index structure is queried to obtain the requested physical address. Specifically, the local storage index structure is queried to obtain the index node corresponding to the requested data, and then the requested physical address in the index node is obtained.
[0125] Step S440: Read the requested data from the local storage unit based on the requested physical address.
[0126] Step S450: Cache the requested data in the local cache unit.
[0127] Step S460: Create an index node corresponding to the requested data in the local cache index structure.
[0128] Step S470: Delete the index node corresponding to the requested data from the local storage index structure.
[0129] It should be understood that the specific implementation methods of the above steps, as well as the update methods of the storage index structure and cache index structure, are similar to those in the above embodiments, and will not be described in detail here.
[0130] The distributed storage system of this invention includes multiple storage nodes, including a first node and a second node. A first controller of the first node determines target type data in a first cache unit within the first node and obtains the address information of the target type data based on its logical index information. Responding to the address information corresponding to a second node, the system generates a storage request and sends it to the second node. The storage request includes the target type data and the address information. A second controller in the second node stores the target type data from the received storage request in a second storage unit. Therefore, this application can achieve distributed data storage without building a global storage index, enabling global storage sharing and reducing resource overhead while maintaining query efficiency.
[0131] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program for use by a computer to execute some or all of the above-described method embodiments.
[0132] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0133] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A distributed storage system, the distributed storage system comprising multiple storage nodes, characterized in that, The plurality of storage nodes include: The first node includes a first cache unit for caching data and a first controller. The first controller is used to determine the target type data in the first cache unit and obtain the address information of the target type data based on the logical index information of the target type data. In response to the storage node corresponding to the address information being a second node, the controller generates a storage request and sends the storage request to the second node. The second node includes a second storage unit and a second controller, the second controller being used to store the target type data in the received storage request into the second storage unit.
2. The distributed storage system according to claim 1, characterized in that, The target type data is cold data, and the first controller is further configured to filter the target type data from the first cache unit based on data popularity and / or lifecycle.
3. The distributed storage system according to claim 1, characterized in that, The first controller includes: The hash calculation module is used to perform hash mapping on the logical index information of the target type data to obtain the address information of the target type data.
4. The distributed storage system according to claim 1, characterized in that, The second controller is further configured to, in response to the target type data being stored in the second storage unit, establish an index node corresponding to the target type data in the storage index structure corresponding to the second storage unit.
5. The distributed storage system according to claim 1, characterized in that, The second controller is further configured to control the sending of a storage response to the first node, and the first controller is further configured to delete the index node corresponding to the target type data from the cache index structure corresponding to the first cache unit.
6. The distributed storage system according to claim 1, characterized in that, The first controller is also configured to establish a lease for the target type data and, in response to receiving a storage response for the target type data, cancel the lease for the target type data.
7. The distributed storage system according to claim 1, characterized in that, The first node further includes a first storage unit. In response to the storage node corresponding to the address information being the first node, the first controller stores the target type data in the first storage unit, establishes an index node corresponding to the target type data in the storage index structure corresponding to the first storage unit, and deletes the index node corresponding to the target type data from the cache index structure corresponding to the first cache unit.
8. The distributed storage system according to claim 1, characterized in that, The cache index structure corresponding to the first cache unit and the storage index structure corresponding to the second storage unit are RadixTree.
9. The distributed storage system according to claim 1, characterized in that, The first controller is further configured to receive a data access request, and in response to the data access request not hitting the cache, obtain request address information based on the logical index information in the data access request, and in response to the storage node corresponding to the request address information being the second node, generate a data request and send the data request to the second node, wherein the data request includes the request address information; The second controller is used to read request data from the second storage unit according to the request address information of the received data request, and send the request data to the first node. The first controller is used to cache the received request data in the first cache unit and establish an index node corresponding to the request data in the cache index structure corresponding to the first cache unit.
10. The distributed storage system according to claim 9, characterized in that, The second controller is also configured to establish a lease for the requested data, and after sending the requested data to the first node, cancel the lease for the requested data and delete the index node corresponding to the requested data from the storage index structure of the second storage unit.
11. A storage node, characterized in that, The storage node includes: Cache unit, used to cache data; The controller is configured to obtain target type data from the cache unit and obtain the address information of the target type data based on the logical index information of the target type data. In response to the storage node corresponding to the address information being a second node, the controller generates a first storage request and sends the first storage request to the second node, so that the second node stores the target type data in the local storage unit based on the address information.
12. The storage node according to claim 11, characterized in that, The storage node also includes: Storage unit, used to store the corresponding target type data.
13. A distributed memory access method, applied to storage nodes, characterized in that, The method includes: Retrieve target type data; The address information of the target type data is obtained based on the logical index information of the target type data; In response to the address information corresponding to the storage node being the second node, a storage request is generated and sent to the second node, so that the second node stores the target type data in the local storage unit based on the address information.