Memory access method and device, computing equipment, memory equipment and system

By setting up hash buckets and slicing node units for the tree index of the separated memory system, the problems of I/O amplification and network bandwidth occupation are solved, and access efficiency is improved.

CN120295758APending Publication Date: 2025-07-11TSINGHUA UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510287441.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In a separate memory system, computing devices need to read the entire tree node into local memory, resulting in I/O amplification problems, excessive network bandwidth usage, and inefficient access.

Method used

In a separate memory system, multiple hash buckets are set up for the leaf nodes of the tree-shaped index. The computing device determines the target hash bucket according to the target key and reads it from the leaf node to reduce the access granularity; for the internal node, it is divided into multiple slicing node units, and the computing device determines the target slicing node unit according to the target key and reads it to reduce the access granularity.

Benefits of technology

Reduces I/O amplification problem, reduces network bandwidth usage, improves access efficiency, and does not change the tree size or increases the number of network round trips.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295758A_ABST
    Figure CN120295758A_ABST
Patent Text Reader

Abstract

One or more embodiments of the invention provide a memory access method and apparatus, a computing device, a memory device and a system. The separated memory system comprises a memory device, a tree index is deployed, the tree index comprises a plurality of leaf nodes, one or more key value entries are stored in each leaf node, each leaf node comprises a plurality of hash buckets, one or more key value entries can be stored in each hash bucket, and the access method is applied to the computing device. Comprising the following steps: when a to-be-accessed tree node is a target leaf node, determining a target hash bucket according to a target key accessed this time; reading the target hash bucket from the target leaf node to the local; under the condition that the current access is the write access, storing the target key and the target value corresponding to the target key into a target hash bucket, and writing the target hash bucket into a target leaf node after the storage is completed; and searching a target value corresponding to the target key based on the key value entry stored in the target hash bucket under the condition that the access is read access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of storage technology, and in particular, to a memory access method, apparatus, computing device, memory device, and system. Background Art

[0002] Disaggregated Memory is a technology that separates memory resources from traditional computing devices and connects them to dedicated memory devices through high-speed networks. It breaks the tight coupling relationship between the CPU and memory in the traditional architecture, pools memory resources, and thus enables more flexible resource allocation and management.

[0003] In a disaggregated memory system, the memory device usually has only a small amount of computing resources and mainly relies on the computing device to access the memory through network primitives (such as RDMA unilateral primitives). This is very different from local memory access. The local memory access granularity is usually the cache line granularity (64 bytes), while the disaggregated memory access granularity is the tree node size, and the computing device needs to read the entire tree node into the local memory, which will cause the I / O (Input / Output) amplification problem. At the same time, due to the network bandwidth being much lower than the local memory access bandwidth, it will also cause problems such as excessive network bandwidth occupancy and low access efficiency. Summary of the Invention

[0004] In view of this, one or more embodiments of this specification provide the following technical solutions:

[0005] According to a first aspect of one or more embodiments of this specification, a memory access method is proposed, which is applied to a computing device in a disaggregated memory system. The disaggregated memory system further includes a memory device, and a tree-like index is deployed in the memory device. The tree-like index includes a plurality of leaf nodes, and one or more key-value entries are stored in the leaf nodes. Each leaf node includes a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. The method includes:

[0006] When the tree node to be accessed is the target leaf node in the tree-like index, determine the target hash bucket according to the target key of this access;

[0007] Read the target hash bucket from the target leaf node to the local;

[0008] In the case where this access is a write access, store the target key and its corresponding target value into the target hash bucket, and after the storage is completed, write the target hash bucket into the target leaf node;

[0009] In the case where the current access is a read access, the target value corresponding to the target key is found based on the key-value entry stored in the target hash bucket.

[0010] Optionally, the process of determining the target hash bucket according to the target key of the current access includes:

[0011] Calculate the hash value of the target key;

[0012] Obtain the number of buckets in the hash buckets of the leaf node;

[0013] Determine the target hash bucket according to the hash value and the number of buckets.

[0014] Optionally, each hash bucket in the leaf node is bound to an overflow bucket, and one or more key-value entries can be stored in the overflow bucket. The process of reading the target hash bucket from the target leaf node to the local includes:

[0015] Read the target hash bucket and its bound target overflow bucket from the target leaf node to the local;

[0016] The process of finding the target value corresponding to the target key based on the key-value entry stored in the target hash bucket includes:

[0017] Find the target value corresponding to the target key based on the key-value entries stored in the target hash bucket and the target overflow bucket;

[0018] The process of storing the target key and its corresponding target value into the target hash bucket includes:

[0019] In the case where the target key is not stored in both the target hash bucket and its bound target overflow bucket, if the target hash bucket is not full, store the target key and its corresponding target value into the target hash bucket.

[0020] Optionally, it further includes:

[0021] In the case where the target key is not stored in both the target hash bucket and its bound target overflow bucket, if the target hash bucket is full, store the target key and its corresponding target value into the target overflow bucket, and write the target overflow bucket into the target leaf node after the storage is completed.

[0022] Optionally, it further includes:

[0023] In the case where the target key is stored in the target hash bucket or the target overflow bucket bound to it, the current value corresponding to the target key stored in the bucket is updated to the target value, and the target hash bucket or the target overflow bucket storing the target key is written into the target leaf node.

[0024] Optionally, the number of the overflow buckets in the leaf node is less than the number of the hash buckets.

[0025] Optionally, the tree index further includes a plurality of internal nodes, each of which corresponds to a complete key value interval, in which keys belonging to the complete key value interval and their corresponding pointers are stored; the internal nodes include a plurality of ordered split node units, each of which corresponds to a sub-key value interval in the complete key value interval, in which keys belonging to the sub-key value interval and their corresponding pointers are stored, and sub-key value intervals corresponding to adjacent split node units are continuous, and the method further includes:

[0026] When the tree node to be accessed is a target internal node in the tree index, determining a target segmentation node unit according to the target key of this access;

[0027] The target segmentation node unit is read from the target internal node to the local, and a pointer pointing to a lower-level child node is searched in the target segmentation node unit, where the lower-level child node is the tree node to be visited during the next visit.

[0028] Optionally, the process of determining the target segmentation node unit according to the target key of the current access includes:

[0029] Obtaining the segmentation granularity of the target internal node;

[0030] Determine the sub-key value interval corresponding to each segmentation node unit in the target internal node according to the complete key value interval corresponding to the target internal node and the segmentation granularity;

[0031] The split node unit corresponding to the target sub-key value interval to which the target key belongs is determined as the target split node unit.

[0032] Optionally, the process of searching for a pointer to a lower-level child node in the target segmentation node unit includes:

[0033] Searching for a minimum key greater than the target key in the target split node unit;

[0034] The pointer corresponding to the minimum key is determined as a pointer pointing to the lower-level child node.

[0035] Optionally, also include:

[0036] Read the left split node unit of the target split node unit from the target internal node to the local;

[0037] Find the first type of maximum key less than or equal to the target key in the target split node unit and the left split node unit;

[0038] Determine the complete key value range corresponding to the lower-level sub-node based on the minimum key and the first type of maximum key.

[0039] Optionally, the second type of maximum key in each split node unit is stored in the rightmost slot of the split node unit. The process of reading the left split node unit from the target internal node to the local includes:

[0040] Read the second type of maximum key stored in the rightmost slot of the left split node unit from the target internal node to the local;

[0041] The process of finding the first type of maximum key less than or equal to the target key in the target split node unit and the left split node unit includes:

[0042] Find the first type of maximum key less than or equal to the target key in the target split node unit and the second type of maximum key.

[0043] Optionally, it further includes:

[0044] When adding a new key to the target internal node, determine the sub-key value range to which the new key belongs. When there is an empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, insert the new key and its corresponding pointer into the empty slot.

[0045] Optionally, it further includes:

[0046] When there is no empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, merge the split node unit and the adjacent split node unit, and perform a merge process on the remaining unmerged split node units so that the size of the sub-key value range corresponding to each merged node unit after merging is the same, and update the split granularity of the target internal node.

[0047] Optionally, the process of inserting the new key and its corresponding pointer into the empty slot includes:

[0048] Compare the size of the new key and the current second type of maximum key stored in the rightmost slot of the split node unit corresponding to the sub-key value range to which the new key belongs;

[0049] In the case where the new key is less than the current second type of maximum key, insert the new key and its corresponding pointer into the empty slot.

[0050] Optionally, it further includes:

[0051] In the case where the new key is greater than the current second-largest key, move the current second-largest key and its corresponding pointer to the empty slot, and insert the new key and its corresponding pointer into the rightmost slot.

[0052] According to a second aspect of one or more embodiments of this specification, a memory access device is proposed, which is applied to a computing device in a disaggregated memory system. The disaggregated memory system further includes a memory device, in which a tree index is deployed. The tree index includes a plurality of leaf nodes, and one or more key-value entries are stored in the leaf nodes. The leaf nodes include a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. The device includes:

[0053] A hash bucket determination unit, when the tree node to be accessed is the target leaf node in the tree index, determines the target hash bucket according to the target key of this access;

[0054] A hash bucket reading unit, reads the target hash bucket from the target leaf node to the local;

[0055] A write access unit, in the case where this access is a write access, stores the target key and its corresponding target value into the target hash bucket, and after the storage is completed, writes the target hash bucket into the target leaf node;

[0056] A read access unit, in the case where this access is a read access, searches for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

[0057] According to a third aspect of one or more embodiments of this specification, a computing device is proposed, including: a processor; a memory for storing processor-executable instructions; wherein, the processor runs the executable instructions to implement the steps of the foregoing method.

[0058] According to a fourth aspect of one or more embodiments of this specification, a memory device is proposed. A tree index is deployed in the memory device. The tree index includes a plurality of leaf nodes, and one or more key-value entries are stored in the leaf nodes. The leaf nodes include a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. When accessing the memory device, the computing device executes the steps of the foregoing method.

[0059] According to a fifth aspect of one or more embodiments of this specification, a disaggregated memory system is proposed. The disaggregated memory system includes a computing device and a memory device. A tree index is deployed in the memory device. The tree index includes a number of leaf nodes. One or more key-value entries are stored in the leaf nodes. Each leaf node includes a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. When the computing device accesses the memory device, the following steps are performed:

[0060] When the tree node to be accessed is the target leaf node in the tree index, determine the target hash bucket according to the target key of this access;

[0061] Read the target hash bucket from the target leaf node to the local;

[0062] In the case where this access is a write access, store the target key and its corresponding target value in the target hash bucket, and after the storage is completed, write the target hash bucket to the target leaf node;

[0063] In the case where this access is a read access, search for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

[0064] According to a sixth aspect of one or more embodiments of this specification, a computer-readable storage medium is proposed, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the foregoing method are implemented.

[0065] According to a seventh aspect of one or more embodiments of this specification, a computer program product is proposed, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the foregoing method are implemented.

[0066] As can be seen from the above description, this specification sets a plurality of hash buckets that can store key-value entries in the leaf nodes of the tree index of the memory device, so that the key-value entries in the leaf nodes are stored in the hash buckets. When the computing device accesses the leaf node, it can determine the target hash bucket according to the target key, and read the target hash bucket from the target leaf node to the local, so as to replace the reading of all key-value entries in the target leaf node, reduce the access granularity, thereby reducing the I / O amplification problem, and at the same time reducing the occupancy of network bandwidth and improving the access efficiency. Moreover, the method of setting hash buckets in the leaf nodes to store key-value entries does not change the size of the tree and does not increase the number of network round-trips during memory access. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 is a schematic diagram of the architecture of a disaggregated memory system provided by an exemplary embodiment.

[0068] Figure 2 It is a flowchart of a memory access method provided by an exemplary embodiment.

[0069] Figure 3 It is a schematic diagram of a leaf node provided by an exemplary embodiment.

[0070] Figure 4 It is a flowchart of another memory access method provided by an exemplary embodiment.

[0071] Figure 5 It is a flowchart of another memory access method provided by an exemplary embodiment.

[0072] Figure 6 It is a schematic diagram of an internal node provided by an exemplary embodiment.

[0073] Figure 7 It is a flowchart of another memory access method provided by an exemplary embodiment.

[0074] Figure 8 It is a flowchart of adding a new key to an internal node provided by an exemplary embodiment.

[0075] Figure 9 It is a schematic diagram of the structure of a computing device provided by an exemplary embodiment.

[0076] Figure 10 It is a block diagram of a memory access device provided by an exemplary embodiment. Detailed implementation

[0077] Disaggregated Memory is a technology that separates memory resources from traditional computing devices and connects them to dedicated memory devices through high-speed networks. It breaks the tight coupling relationship between the CPU and memory in the traditional architecture, pools memory resources, and thus realizes more flexible resource allocation and management.

[0078] In a disaggregated memory system, memory devices are usually equipped with only a small amount of computing resources and mainly rely on computing devices to access memory through network primitives (such as RDMA unilateral primitives). This is very different from local memory access. The local memory access granularity is usually cache line granularity (64 bytes), while the disaggregated memory access granularity is the tree node size. Moreover, the computing device needs to read the entire tree node into local memory, which will cause the I / O amplification problem. At the same time, due to the network bandwidth being much lower than the local memory access bandwidth, it will also cause problems such as excessive network bandwidth occupation and low access efficiency.

[0079] In related technologies, the tree height is reduced by increasing the tree node fan-out, thereby reducing the number of network round-trips during memory access, but this will exacerbate the I / O amplification problem.

[0080] In the related art, the I / O amplification problem is also balanced by adjusting the size of tree nodes and the fan-out of tree nodes. However, this will increase the height of the tree, thereby increasing the number of network round-trips during memory access and resulting in low access efficiency.

[0081] This specification provides a memory access scheme that can be applied to a disaggregated memory system. Without increasing the fan-out of the tree in the memory device and without increasing the height of the tree, it can reduce the access granularity of the computing device, thereby reducing the I / O amplification problem, while reducing the occupancy of network bandwidth and improving the access efficiency.

[0082] In this specification, the disaggregated memory system is a distributed system adopting a disaggregated memory architecture. The disaggregated memory system may include several computing devices and several memory devices. The computing devices include computing resources such as CPUs and may be nodes in servers, computers, cloud platforms, etc. The memory devices include memory resources such as DRMA (Dynamic Random Access Memory) and may be nodes in servers, memories, cloud platforms, etc. The memory devices may store a tree-shaped index structure (such as B-tree, B+-tree, etc.), thereby supporting fast memory access.

[0083] Figure 1 It is a schematic diagram of the architecture of a disaggregated memory system provided by an exemplary embodiment.

[0084] Please refer to Figure 1 , Figure 1 The disaggregated memory system shown includes 3 computing devices 110 and 3 memory devices 120. Among them, the computing device 110 communicates with the memory device 120 through a network. For example, the computing device 110 uses the RDMA (Remote Direct Memory Access) unilateral primitive to access the memory device 120.

[0085] Before introducing the implementation process of this specification, some technical concepts are first explained.

[0086] Tree-shaped index: A tree-shaped index is an index method based on a tree-shaped data structure and can be used to efficiently store and retrieve data. It organizes data into a tree-shaped structure and supports fast access (operations such as searching, inserting, and deleting). A tree-shaped index may include multiple leaf nodes and multiple internal nodes.

[0087] Leaf Node: A leaf node refers to a node in a tree that has no child nodes. They are located at the bottommost layer of the tree and are typically used to store key-value entries. The key-value entry includes a key and its corresponding value, which can be actual data or a pointer to the actual data.

[0088] Internal Node: An internal node refers to a node that has at least one child node. They are located between the root node and the leaf nodes of the tree and are mainly used to organize and manage the hierarchical structure of the tree. The internal node stores a key and its corresponding pointer, which is used to point to the child node of the internal node. In the internal node, the pointer P1 corresponding to the key K1 points to the child node where all keys less than K1 are located, and the pointer P i corresponding to the key K i points to the child node where all keys greater than or equal to K i-1 and less than K i are located, where 1 < i ≤ n.

[0089] When performing memory access, starting from the root node, query layer by layer according to the target key until the leaf node where the target data is located is located.

[0090] The memory access method provided in this specification can improve the access mode of leaf nodes and / or internal nodes in a tree-shaped index, enabling the computing device to access by reading partial contents of the tree nodes, thereby reducing the access granularity.

[0091] The implementation process of this specification will be described below with reference to the accompanying drawings from two types of tree nodes: leaf nodes and internal nodes.

[0092] I. Leaf Nodes

[0093] In this embodiment, for the leaf nodes in the memory device tree-shaped index, the key-value entries stored in them can be divided into multiple hash buckets, and each hash bucket can store one or more key-value entries. When the computing device performs memory access, the target key used for memory access can be mapped to the hash bucket in the leaf node, enabling the computing device to read key-value entries from the leaf node at the granularity of the hash bucket, avoiding reading the complete key-value entries in the leaf node, and achieving a reduction in access granularity.

[0094] Figure 2 is a flowchart of a memory access method provided by an exemplary embodiment.

[0095] Please refer to Figure 2 , the memory access method may include the following steps:

[0096] Step 202, when the tree node to be accessed is the target leaf node in the tree-shaped index, determine the target hash bucket according to the target key of this access.

[0097] In this embodiment, during the process of querying layer by layer from the root node downward when accessing memory, the computing device can determine the type of the tree node to be accessed next (hereinafter referred to as the tree node to be accessed) according to the metadata of the tree-like index, that is, determine whether the tree node to be accessed is a leaf node or an internal node.

[0098] In this embodiment, when the tree node to be accessed is a leaf node in the tree-like index (hereinafter referred to as the target leaf node), the target hash bucket can be determined according to the target key of this access.

[0099] Wherein, the target key is the key value of this memory access. The target hash bucket is a hash bucket in the target leaf node.

[0100] In this embodiment, the sizes of the leaf nodes in the same tree-like index are usually the same, that is, the maximum number of key-value entries that can be stored in each leaf node is the same. Furthermore, the hash buckets can be set in advance according to the leaf node size, and the maximum number of key-value entries that can be stored in each hash bucket is also the same.

[0101] For example, assume that the size of the leaf node is 64, that is, at most 64 key-value entries can be stored in this leaf node. Assume that the number of hash buckets in each leaf node is set to 8 in advance, then at most 8 key-value entries can be stored in each hash bucket.

[0102] In this embodiment, when determining the target hash bucket, the hash value of the target key can be calculated first, then the number of hash buckets in the leaf node (hereinafter referred to as the bucket number) can be obtained, and then the target hash bucket of this access can be determined through modulo operation.

[0103] Exemplarily, the remainder obtained by dividing the hash value of the target key by the bucket number can be calculated, and then the target hash bucket can be determined based on the obtained remainder. Still taking the bucket number being 8 as an example, assume that the remainder obtained by dividing the hash value of the target key by 8 is 2, then the 2nd hash bucket can be determined as the target hash bucket.

[0104] Of course, in other examples, other algorithms can also be used to determine the target hash bucket. For example, bitwise operations on the target key, etc. This specification does not make special restrictions on this.

[0105] Step 204, read the target hash bucket from the target leaf node to the local.

[0106] Based on the foregoing step 202, after determining the target hash bucket, the computing device can read the key-value entries stored in the target hash bucket from the target leaf node to the local, thereby eliminating the need to read all the key-value entries in the target leaf node and reducing the access granularity.

[0107] Step 206: When the current access is a write access, store the target key and its corresponding target value into the target hash bucket, and after the storage is completed, write the target hash bucket into the target leaf node.

[0108] In this embodiment, when the current access is a write access, after the computing device reads the target hash bucket locally, it can store the target key and its corresponding target value of the current write access into the target hash bucket, that is, write the target key and its corresponding target value into the target hash bucket, and after the writing is completed, write the target hash bucket into the target leaf node, thereby realizing the writing of the target key and its target value.

[0109] Step 208: When the current access is a read access, search for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

[0110] In this embodiment, when the current access is a read access, after the computing device reads the target hash bucket locally, it searches for the target value corresponding to the target key in the key-value entries stored in the target hash bucket. If found, it can return the target value; otherwise, it can return a result indicating not found.

[0111] As can be seen from the above description, this specification sets multiple hash buckets capable of storing key-value entries for the leaf nodes in the tree-like index of the memory device, such that the key-value entries in the leaf nodes are stored in the hash buckets. When the computing device accesses a leaf node, it can determine the target hash bucket according to the target key, and read the target hash bucket from the target leaf node locally to replace the reading of all key-value entries in the target leaf node, reducing the access granularity, thereby reducing the I / O amplification problem, and at the same time reducing the occupation of network bandwidth and improving the access efficiency. Moreover, the method of setting hash buckets for leaf nodes to store key-value entries does not change the size of the tree and does not increase the number of network round-trips during memory access.

[0112] In another embodiment of this specification, the method of determining the target hash bucket based on the target key may cause an imbalance in the number of key-value entries stored in each hash bucket in the leaf node. For example, there are more key-value entries stored in hash bucket 1, while hash bucket 2 is empty and has not stored any key-value entries, etc. This will cause a decrease in memory utilization.

[0113] In this embodiment, when setting up hash buckets, an overflow bucket can be set for each hash bucket. One or more key-value entries can also be stored in the overflow bucket. The overflow bucket is bound to the hash bucket so that the overflow bucket can store the key-value entries that should be stored in the hash bucket when the bound hash bucket is full. To solve the problem of imbalance of key-value entries among hash buckets, the number of overflow buckets can be less than the number of hash buckets. In other words, the relationship between hash buckets and overflow buckets is one-to-many, and multiple hash buckets can be bound to the same overflow bucket.

[0114] Exemplarily, the size of the overflow bucket and the size of the hash bucket can be the same, that is, the maximum number of key-value entries that can be stored in the overflow bucket and the hash bucket is the same. In practical applications, the number of buckets can be determined according to the size of the leaf node (the maximum number of key-value entries that can be stored) and the bucket size, and then the hash buckets and overflow buckets can be set. For example, if the size of the leaf node is 64 and the preset bucket size is 8, then 8 buckets can be set in each leaf node, and then it can be determined whether each bucket is a hash bucket or an overflow bucket.

[0115] Relatively simply, an overflow bucket can be set between two hash buckets, and the adjacent hash bucket and the overflow bucket between them can be bound, that is, two hash buckets share one overflow bucket. Please refer to Figure 3 the example of the leaf node in Figure 3 wherein the KV stored in the bucket refers to the key-value entry.

[0116] Of course, in other examples, the size of the overflow bucket and the size of the hash bucket may not be the same, or the number of hash buckets bound to different overflow buckets in the same leaf node may also be different. For example, assuming there are 8 buckets in the leaf node, then 5 hash buckets and 3 overflow buckets can be set. Among them, 4 hash buckets and 2 overflow buckets can be bound in the aforementioned one-to-two manner, and the remaining 1 hash bucket and 1 overflow bucket are bound, etc. This specification does not make special restrictions on this.

[0117] In this embodiment, when binding an overflow bucket to a hash bucket, please refer to Figure 4 , the memory access method for read access may include the following steps:

[0118] Step 402, when the tree node to be accessed is the target leaf node in the tree-like index, determine the target hash bucket according to the target key of this access.

[0119] In this embodiment, the implementation process of step 402 can refer to the foregoing Figure 2The implementation process of step 202 in the illustrated embodiment will not be elaborated herein.

[0120] Step 404: Read the target hash bucket and its bound target overflow bucket from the target leaf node to the local.

[0121] In this embodiment, since the hash bucket of the leaf node is bound to an overflow bucket, when reading the target hash bucket, the target hash bucket and its bound overflow bucket (hereinafter referred to as the target overflow bucket) can be read to the local of the computing device together.

[0122] Among them, the description in this specification of reading the hash bucket or the overflow bucket to the local means reading the key-value entries stored in the hash bucket or the overflow bucket to the local of the computing device.

[0123] Step 406: Search for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket and the target overflow bucket.

[0124] In this embodiment, the target value corresponding to the target key can be searched for in the key-value entries stored in the target hash bucket and the target overflow bucket.

[0125] Please refer to Figure 5 , the memory access method for write access may include the following steps:

[0126] Step 502: When the tree node to be accessed is the target leaf node in the tree-shaped index, determine the target hash bucket according to the target key of this access.

[0127] In this embodiment, the implementation process of step 502 can refer to the implementation process of step 202 in the foregoing Figure 2 illustrated embodiment and will not be elaborated herein.

[0128] Step 504: Read the target hash bucket and its bound target overflow bucket from the target leaf node to the local.

[0129] In this embodiment, the implementation process of step 504 can refer to the implementation process of step 404 in the foregoing Figure 4 illustrated embodiment and will not be elaborated herein.

[0130] Step 506: Determine whether the target key is stored in the target hash bucket and its bound target overflow bucket. If not, execute step 508 or 510; if so, execute step 512.

[0131] In this embodiment, after the computing device reads the target hash bucket and the target overflow bucket to the local, it can search for the target key in the target hash bucket and the target overflow bucket. If the target key is not found, it can indicate that neither the target hash bucket nor the target overflow bucket stores the target key and its corresponding value, and step 508 or step 510 can be executed to insert the target key and its corresponding target value of the current write access into the bucket. If the target key is found, it can indicate that the target hash bucket or the target overflow bucket stores the target key and its corresponding value (hereinafter referred to as the current value). At this time, the current value needs to be updated, and then step 512 is executed.

[0132] Step 508, if the target hash bucket is not full, store the target key and its corresponding target value into the target hash bucket, and after the storage is completed, write the target hash bucket to the target leaf node.

[0133] Based on the judgment result of the foregoing step 506, when neither the target hash bucket nor the target overflow bucket stores the target key, it indicates that the current write access needs to insert the target key and its corresponding target value into the leaf node.

[0134] In this embodiment, the target key and its corresponding target value are preferentially inserted into the target hash bucket. Specifically, when the target hash bucket is not full, the target key and its corresponding target value can be stored into the target hash bucket. For example, assume that the size of the hash bucket is 8, and the number of key-value entries stored in the target hash bucket has not reached 8, which indicates that the target hash bucket is not full. Then, the target key and its corresponding target value can be stored into the target hash bucket. Next, after the storage is completed, the target hash bucket can be written to the target leaf node, thereby completing the write access of the target key and its corresponding target value.

[0135] Step 510, if the target hash bucket is full, store the target key and its corresponding target value into the target overflow bucket, and after the storage is completed, write the target overflow bucket to the target leaf node.

[0136] In this embodiment, although the target key and its corresponding target value are preferentially inserted into the target hash bucket, if the target hash bucket is full, the target key and its corresponding target value can be stored into the overflow bucket, and after the storage is completed, the target overflow bucket can be written to the target leaf node, thereby completing the write access of the target key and its corresponding target value.

[0137] For example, assume that the size of the hash bucket is 8 and the number of key-value entries already stored in the target hash bucket is 8, which indicates that the target hash bucket is full and cannot store any more key-value entries. Consequently, the target key and its corresponding target value can be stored in the target overflow bucket to which it is bound.

[0138] Step 512: Update the current value corresponding to the target key stored in the bucket to the target value, and write the target hash bucket or the target overflow bucket storing the target key to the target leaf node.

[0139] Based on the judgment result of the foregoing step 506, when the target key is stored in the target hash bucket or the target overflow bucket, it indicates that the current value corresponding to the target key already stored needs to be updated to the target value during this write access. Therefore, after finding the target key, its corresponding current value is updated to the target value. Subsequently, after the update is completed, the target hash bucket or the target overflow bucket storing the target key can be written to the target leaf node, thereby completing the write access to the target key and its corresponding target value.

[0140] As can be seen from the above description, this specification sets multiple hash buckets capable of storing key-value entries for the leaf nodes in the tree-like index of the memory device, enabling the key-value entries in the leaf nodes to be stored in the hash buckets. When the computing device accesses a leaf node, it can determine the target hash bucket based on the target key and read the target hash bucket from the target leaf node to the local, instead of reading all the key-value entries in the target leaf node, reducing the access granularity, thereby reducing the I / O amplification problem and simultaneously reducing the occupation of network bandwidth and improving the access efficiency. Moreover, the method of setting hash buckets for leaf nodes to store key-value entries does not change the size of the tree and does not increase the number of network round-trips during memory access.

[0141] II. Internal Node

[0142] In this embodiment, for the internal nodes in the tree-like index of the memory device, each internal node corresponds to a complete key-value interval and can store the keys within this complete key-value interval and their corresponding pointers. In the related art, the internal node stores a key-value sequence and a pointer sequence. This embodiment improves the storage method of key-values and pointers in the internal node. Instead of storing them separately in the form of sequences, it adopts a storage method similar to that of the key-value entries in the leaf nodes, storing them in the form of key-value pointer pairs, that is, in the form of (key value K, pointer P).

[0143] On this basis, the complete key-value range corresponding to the internal node can be split, and the complete key-value range is split into multiple consecutive sub-key-value ranges. Correspondingly, the internal node is divided into multiple ordered split node units, each split node unit corresponds to a sub-key-value range, and the keys in the corresponding sub-key-value range and their corresponding pointers can be stored, and the sub-key-value ranges corresponding to adjacent split node units are consecutive. In implementation, the splitting granularity of the internal node can be preset, that is, the number of split node units in the internal node, and then each sub-key-value range is determined according to the size of the internal node and the splitting granularity, and further the sub-key-value range corresponding to each split node unit is determined. Adopting such a division method, the computing device can read the keys and their corresponding pointers from the internal node with the split node unit as the granularity, avoiding reading all the keys and their pointers in the internal node, and realizing the reduction of the access granularity.

[0144] Please refer to Figure 6 For the example of, assume that the complete key-value range corresponding to a certain internal node is [100, 500), and the preset splitting granularity is 4, that is, the internal node is split into 4 split node units, namely split node unit 1 to split node unit 4. The split sub-key-value ranges are [100, 200), [200, 300), [300, 400) and [400, 500) respectively. Among them, split node unit 1 corresponds to the sub-key-value range [100, 200), split node unit 2 corresponds to the sub-key-value range [200, 300), and so on.

[0145] In this embodiment, the keys in the corresponding sub-key-value range and their corresponding pointers are stored in the split node unit. For the inside of the split node unit, the storage of each key can be unordered. Please continue to refer to Figure 6 , taking split node unit 2 as an example, which stores keys such as 230, 250, 210, 280, etc. These keys do not need to be sorted in order of size, avoiding a large number of moving operations during the new key insertion operation. It should be noted that, for the sake of clearly showing the keys stored in the split node unit, Figure 6 the pointers corresponding to each key are not shown.

[0146] Figure 7 is a flowchart of another memory access method provided by an exemplary embodiment.

[0147] Please refer to Figure 7 , the memory access method may include the following steps:

[0148] Step 702, when the tree node to be accessed is the target internal node in the tree index, determine the target split node unit according to the target key of this access.

[0149] In this embodiment, when the tree node to be accessed is an internal node (subsequently referred to as the target internal node), before accessing the target internal node, the target split node unit can be determined according to the target key first.

[0150] In this embodiment, when determining the target split node unit of the target internal node, the split granularity of the target internal node can be obtained, and then according to the complete key value range corresponding to the target internal node and the split granularity, the sub-key value ranges corresponding to each split node unit in the target internal node can be determined, and the split node unit corresponding to the target sub-key value range to which the target key belongs can be determined as the target split node unit.

[0151] Among them, the complete key value range corresponding to the target internal node can be determined after reading the split node unit in the parent node of the target internal node and determining the pointer of the target internal node. The split granularity can be stored in the pointer pointing to the target internal node in the parent node of the target internal node, or can be stored in the head of the target internal node.

[0152] Suppose the complete key value range corresponding to the target internal node is [100, 500), and its split granularity is 4, then the split node units in the target internal node are as Figure 6 shown. Also suppose the target key is 205, and it is in the target sub-key value range corresponding to split node unit 2, then split node unit 2 can be determined as the target split node unit.

[0153] Step 704, read the target split node unit from the target internal node to the local, and find the pointer pointing to the lower-level child node in the target split node unit. The lower-level child node is the tree node to be accessed during the next access.

[0154] In this embodiment, regardless of whether the current access is a read access or a write access, the pointer to the lower-level child node of the target internal node needs to be found according to the target key, and then continue to search in this lower-level child node. The lower-level child node is the tree node to be accessed when the computing device accesses the tree index next time, and it may be an internal node or a leaf node.

[0155] In this embodiment, in an internal node, each pointer points to a lower-level child node that also corresponds to a key value range. For example, pointer P i points to all lower-level child nodes where the key values are greater than or equal to K i-1 and less than K i Therefore, when searching for the pointer to the lower-level child node, the smallest key greater than the target key can be searched in the target split node unit, and the pointer corresponding to the smallest key can be determined as the pointer to the lower-level child node.

[0156] Taking the target key as 205 as an example, please continue to refer to Figure 6 , it can be determined that the smallest key greater than the target key stored in the target split node unit is 210. Then, the pointer corresponding to the smallest key 210 can be determined as the pointer to the lower-level child node, that is, the right endpoint of the complete key-value range corresponding to the lower-level child node is 210.

[0157] In this embodiment, the computing device can continue to search in the lower-level child node until the leaf node where the target key belongs is found, and then perform a write access or a read access.

[0158] As can be seen from the above description, in this specification, the internal nodes in the tree-like index of the memory device are split into multiple split node units. Each split node unit corresponds to a partial sub-key-value range of the complete key-value range corresponding to the internal node, and stores the keys belonging to the corresponding sub-key-value range and their corresponding pointers. When the computing device accesses an internal node, it can determine the target split node unit according to the target key, and read the target split node unit to the local from the target internal node to replace the reading of all keys and their corresponding pointers in the target internal node, reducing the access granularity, thereby reducing the I / O amplification problem, while reducing the occupation of network bandwidth and improving the access efficiency. Moreover, the method of splitting the internal node into split node units does not reduce the size of the internal node, so it will not increase the height of the tree, will not change the size of the tree, and will not increase the number of network round trips during memory access.

[0159] In another embodiment of this specification, after finding the pointer to the lower-level child node, if the lower-level child node is still an internal node, before accessing the lower-level child node, the split granularity of the lower-level child node and its corresponding complete key-value range can be determined first, and then the target split node unit in the lower-level child node can be determined according to the target key, so that when the computing device accesses the lower-level child node, it can read the target split node unit to the local.

[0160] Among them, the split granularity of the lower-level child node can be stored in the pointer to the lower-level child node.

[0161] The complete key value range corresponding to the subordinate child node includes two endpoints, where the right endpoint is the smallest key greater than the target key, and the left endpoint is the largest key less than or equal to the target key. The largest key may be located in the target split node unit or in the split node unit to the left of the target split node unit (subsequently referred to as the left split node unit). Therefore, when the computing device reads the target split node unit to the local from the target internal node, it can also read its left split node unit to the local at the same time, that is, read the target split node unit and its left split node unit to the local through one read operation.

[0162] Next, the largest key less than or equal to the target key (referred to as the first type of largest key) can be found in the target split node unit and the left split node unit as the left endpoint. Based on the smallest key and the first type of largest key, the complete key value range corresponding to the subordinate child node can be determined.

[0163] Still taking the target key as 205 as an example, please continue to refer to Figure 6 , it can be determined that the smallest key stored in the target split node unit and the left split node unit is 210. Suppose the first type of largest key is 190 and is stored in the left split node unit, then the complete key value range corresponding to the subordinate child node can be determined as [190, 210). Suppose again that the split granularity of the subordinate child node is also 4, then it can be determined that there are also 4 split node units in the subordinate child node, corresponding to the sub-key value ranges [190, 195), [195, 200), [200, 205), and [205, 210) in sequence. Since the target key 205 belongs to the sub-key value range [205, 210), when the computing device accesses the subordinate child node, it can read its third and fourth split node units from it.

[0164] In this way, by determining the complete key value range corresponding to the subordinate child node to determine the target split node unit in the subordinate child node, there is no need to record a separate pointer for the split node unit.

[0165] In another embodiment of the present specification, since the purpose of reading the left split node unit is to find the first type of maximum value less than or equal to the target key, based on the orderliness among the split node units, if the first type of maximum value is located in the left split node unit, it must be the maximum key in the left split node unit. To further reduce the access granularity, for each split node unit, the maximum key therein (for the sake of distinction, the maximum key in each split node unit is called the second type of maximum key) can be stored in the rightmost slot. In this way, when reading, for the left split node unit, only the second type of maximum key stored in the rightmost slot therein needs to be read, without reading the entire left split node unit. The computing device can then find the first type of maximum value less than or equal to the target key among the read target split node and the second type of maximum key.

[0166] In another embodiment of the present specification, when an internal node in the tree-like index needs to add a new key during an insertion operation, please refer to Figure 8 , and the process of adding a new key may include the following steps:

[0167] Step 802, when adding a new key to the target internal node, determine the sub-key value interval to which the new key belongs.

[0168] In this embodiment, for the target internal node, when a new key needs to be added, the sub-key value interval to which the new key belongs can be determined first. The determination method can refer to the process of determining the target sub-key value interval to which the target key belongs as described above, and will not be elaborated here.

[0169] Step 804, when there is an empty slot in the split node unit corresponding to the sub-key value interval, insert the new key and its corresponding pointer into the empty slot.

[0170] Based on the foregoing step 802, after determining the sub-key value interval to which the new key belongs, it can be determined whether the split node unit corresponding to the sub-key value interval is full, that is, whether there is an empty slot in the split node unit. If there is, it means that the split node unit is not full, and the new key and its corresponding pointer can be inserted into the empty slot to achieve the addition of the new key.

[0171] Step 806, when there is no empty slot in the split node unit corresponding to the sub-key value interval, merge the split node unit and the adjacent split node unit, and perform a merge process on the remaining unmerged split node units so that the size of the sub-key value interval corresponding to each merged node unit after merging is the same, and update the split granularity of the target internal node.

[0172] In this embodiment, when the split node unit corresponding to the sub-key value range to which the new key belongs is full, that is, there is no remaining empty slot in this split node unit, the split node unit and the adjacent split node unit can be merged to obtain a merged node unit, and the corresponding merging process is also performed on the remaining unmerged split node units. In this way, multiple merged node units are obtained, and the sizes of these merged node units are the same, which is convenient for subsequent calculation of the sub-key value range to which the target key belongs.

[0173] Among them, when merging, the adjacent split node unit to be merged with it can be determined according to the position of the split node unit corresponding to the sub-key value range to which the new key belongs. For example, assume that there are 4 split node units in the target internal node. If the split node unit corresponding to the new key is split node unit 2 and split node unit 2 is full, then split node unit 2 and the left split node unit 1 can be merged to obtain merged node unit 1. And, the remaining split node unit 3 and split node unit 4 are merged to obtain merged node unit 2. If the split node unit corresponding to the new key is split node unit 3 and split node unit 3 is full, then split node unit 3 and its right split node unit 4 can be merged to obtain a merged node unit, and the remaining split node unit 1 and split node unit 2 are merged. This can make the sizes of the merged node units the same.

[0174] In this embodiment, after the split node units are merged, the splitting granularity of the target internal node where it is located can be updated. Still taking the above-mentioned merging as an example, the splitting granularity of the target internal node before merging is 4, and the splitting granularity of the target internal node after merging is 2.

[0175] In this embodiment, since the merging operation in the internal node is not frequent, this merging overhead can be ignored.

[0176] Optionally, in another embodiment, if the second largest key in each split node unit is stored in the rightmost slot in the split node unit, when there is an empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, the size of the new key and the current second largest key stored in the rightmost slot in this split node unit can be compared first.

[0177] If the new key is less than the current second largest key, it can be shown that the second largest key in this split node unit is still the current second largest key originally stored in the rightmost slot, then the new key and its corresponding pointer can be inserted into the empty slot in this split node unit.

[0178] If the new key is greater than the current second-largest key of the second type, it can be shown that the second-largest key of the second type in the split node unit is the new key to be inserted. Then, the current second-largest key of the second type and its pointer in the rightmost slot can be moved to the empty slot, and the new key and its corresponding pointer can be inserted into the rightmost operation, thereby ensuring that the second-largest key of the second type in the split node unit is always stored in the rightmost slot.

[0179] This specification also provides a disaggregated memory system, which includes a computing device and a memory device. A tree index is deployed in the memory device. The tree index includes several leaf nodes, and one or more key-value entries are stored in the leaf nodes. Each leaf node includes multiple hash buckets, and one or more key-value entries can be stored in each hash bucket. When the computing device accesses the memory device, when the tree node to be accessed is the target leaf node in the tree index, the target hash bucket can be determined according to the target key of this access; read the target hash bucket from the target leaf node to the local; in the case of a write access for this access, store the target key and its corresponding target value into the target hash bucket, and after the storage is completed, write the target hash bucket into the target leaf node; in the case of a read access for this access, search for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

[0180] This specification also provides a memory device of a disaggregated memory system. A tree index is deployed in the memory device. The tree index includes several leaf nodes, and one or more key-value entries are stored in the leaf nodes. Each leaf node includes multiple hash buckets, and one or more key-value entries can be stored in each hash bucket. The computing device in the disaggregated memory system can access the memory device by using the method provided in this specification.

[0181] Figure 9 It is a schematic structural diagram of a computing device provided by an exemplary embodiment. Please refer to Figure 9 , at the hardware level, the device includes a processor 902, an internal bus 904, a network interface 906, a memory 908, and a non-volatile memory 910. Of course, there may also be other hardware required for other functions. One or more embodiments of this specification can be implemented in a software manner. For example, the processor 902 reads the corresponding computer program from the non-volatile memory 910 into the memory 908 and then runs it. Of course, in addition to the software implementation manner, one or more embodiments of this specification do not exclude other implementation manners, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or a logic device.

[0182] Please refer to Figure 10, the memory access device 1000 can be applied to a computing device as shown in Figure 9 to implement the technical solutions of this specification. Among them, the memory access device 1000 may include:

[0183] When the tree node to be accessed is the target leaf node in the tree-like index, the hash bucket determination unit 1001 determines the target hash bucket according to the target key of this access;

[0184] The hash bucket reading unit 1002 reads the target hash bucket from the target leaf node to the local;

[0185] The write access unit 1003, when this access is a write access, stores the target key and its corresponding target value into the target hash bucket, and writes the target hash bucket into the target leaf node after the storage is completed;

[0186] The read access unit 1004, when this access is a read access, searches for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

[0187] Optionally, the process of determining the target hash bucket according to the target key of this access includes:

[0188] Calculating the hash value of the target key;

[0189] Obtaining the number of buckets in the hash bucket of the leaf node;

[0190] Determining the target hash bucket according to the hash value and the number of buckets.

[0191] Optionally, each hash bucket in the leaf node is bound to an overflow bucket, and one or more key-value entries can be stored in the overflow bucket. The process of reading the target hash bucket from the target leaf node to the local includes:

[0192] Reading the target hash bucket and its bound target overflow bucket from the target leaf node to the local;

[0193] The process of searching for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket includes:

[0194] Searching for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket and the target overflow bucket;

[0195] The process of storing the target key and its corresponding target value into the target hash bucket includes:

[0196] In the case that the target key is not stored in either the target hash bucket or its bound target overflow bucket, if the target hash bucket is not full, store the target key and its corresponding target value in the target hash bucket.

[0197] Optionally, in the case that the target key is not stored in either the target hash bucket or its bound target overflow bucket, if the target hash bucket is full, store the target key and its corresponding target value in the target overflow bucket, and write the target overflow bucket to the target leaf node after storage.

[0198] Optionally, in the case that the target key is stored in the target hash bucket or its bound target overflow bucket, update the current value corresponding to the target key stored in the bucket to the target value, and write the target hash bucket or the target overflow bucket storing the target key to the target leaf node.

[0199] Optionally, the number of overflow buckets in the leaf node is less than the number of hash buckets.

[0200] Optionally, the tree index further includes a number of internal nodes. Each internal node corresponds to a complete key-value range, and stores keys belonging to the complete key-value range and their corresponding pointers therein. Each internal node includes a number of ordered split node units. Each split node unit corresponds to a sub key-value range in the complete key-value range, and stores keys belonging to the sub key-value range and their corresponding pointers therein. The sub key-value ranges corresponding to adjacent split node units are continuous. The device further includes:

[0201] A split determination unit 1005, when the tree node to be accessed is a target internal node in the tree index, determines a target split node unit according to the target key of the current access.

[0202] A pointer search unit 1006 reads the target split node unit from the target internal node to the local, and searches for a pointer to a lower-level child node in the target split node unit. The lower-level child node is the tree node to be accessed in the next access.

[0203] Optionally, the process of determining the target split node unit according to the target key of the current access includes:

[0204] Obtain the split granularity of the target internal node;

[0205] Determine the sub key-value ranges corresponding to the split node units in the target internal node according to the complete key-value range corresponding to the target internal node and the split granularity;

[0206] Determine the split node unit corresponding to the target sub-key value range to which the target key belongs as the target split node unit.

[0207] Optionally, the process of finding a pointer to a lower-level child node in the target split node unit includes:

[0208] Find the smallest key greater than the target key in the target split node unit;

[0209] Determine the pointer corresponding to the smallest key as the pointer to the lower-level child node.

[0210] Optionally, read the left split node unit of the target split node unit from the target internal node to the local; find the first largest key less than or equal to the target key in the target split node unit and the left split node unit; determine the complete key value range corresponding to the lower-level child node based on the smallest key and the first largest key.

[0211] Optionally, the second largest key in each split node unit is stored in the rightmost slot of the split node unit, and the process of reading the left split node unit from the target internal node to the local includes:

[0212] Read the second largest key stored in the rightmost slot of the left split node unit from the target internal node to the local;

[0213] The process of finding the first largest key less than or equal to the target key in the target split node unit and the left split node unit includes:

[0214] Find the first largest key less than or equal to the target key in the target split node unit and the second largest key.

[0215] Optionally, when adding a new key to the target internal node, determine the sub-key value range to which the new key belongs. When there is an empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, insert the new key and its corresponding pointer into the empty slot.

[0216] Optionally, when there is no empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, merge the split node unit and the adjacent split node unit, and perform a merge process on the remaining unmerged split node units so that the size of the sub-key value range corresponding to each merged node unit after merging is the same, and update the split granularity of the target internal node.

[0217] Optionally, the process of inserting the new key and its corresponding pointer into the empty slot includes:

[0218] Compare the size of the new key with the current second-largest key stored in the rightmost slot of the split node unit corresponding to the sub-key value range to which the new key belongs;

[0219] In the case where the new key is smaller than the current second-largest key, insert the new key and its corresponding pointer into the empty slot.

[0220] Optionally, in the case where the new key is larger than the current second-largest key, move the current second-largest key and its corresponding pointer to the empty slot, and insert the new key and its corresponding pointer into the rightmost slot.

[0221] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor runs the executable instructions to implement the steps of the method described in any of the above embodiments.

[0222] Based on the same concept as the above method, this specification also provides a computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0223] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.

Claims

1. A memory access method is applied to a computing device in a disaggregated memory system. The disaggregated memory system further includes a memory device, in which a tree - shaped index is deployed. The tree - shaped index includes a number of leaf nodes, and one or more key - value entries are stored in the leaf nodes. Each leaf node includes multiple hash buckets, and one or more key - value entries can be stored in each hash bucket. The method includes: When the tree node to be accessed is the target leaf node in the tree - shaped index, determining a target hash bucket according to the target key of the current access; Reading the target hash bucket from the target leaf node to the local; In the case that the current access is a write access, storing the target key and its corresponding target value into the target hash bucket, and after the storage is completed, writing the target hash bucket into the target leaf node; In the case that the current access is a read access, looking up the target value corresponding to the target key based on the key - value entries stored in the target hash bucket.

2. The method according to claim 1, the process of determining the target hash bucket according to the target key of the current access includes: Calculating the hash value of the target key; Obtaining the number of buckets in the hash buckets of the leaf node; Determining the target hash bucket according to the hash value and the number of buckets.

3. The method according to claim 1, each hash bucket in the leaf node is bound to an overflow bucket, and one or more key - value entries can be stored in the overflow bucket. The process of reading the target hash bucket from the target leaf node to the local includes: Reading the target hash bucket and its bound target overflow bucket from the target leaf node to the local; The process of looking up the target value corresponding to the target key based on the key - value entries stored in the target hash bucket includes: Looking up the target value corresponding to the target key based on the key - value entries stored in the target hash bucket and the target overflow bucket; The process of storing the target key and its corresponding target value into the target hash bucket includes: In the case that the target key is not stored in both the target hash bucket and its bound target overflow bucket, if the target hash bucket is not full, storing the target key and its corresponding target value into the target hash bucket.

4. The method according to claim 3 further includes: In the case that the target key is not stored in both the target hash bucket and its bound target overflow bucket, if the target hash bucket is full, storing the target key and its corresponding target value into the target overflow bucket, and after the storage is completed, writing the target overflow bucket into the target leaf node.

5. The method according to claim 3 further includes: In the case that the target key is stored in the target hash bucket or its bound target overflow bucket, updating the current value corresponding to the target key stored in the bucket to the target value, and writing the target hash bucket or the target overflow bucket storing the target key into the target leaf node.

6. According to the method of claim 3, the number of overflow buckets in the leaf node is less than the number of hash buckets.

7. The method according to claim 1, wherein the tree index further comprises a plurality of internal nodes, wherein the internal nodes correspond to a complete key value interval, wherein keys belonging to the complete key value interval and their corresponding pointers are stored; wherein the internal nodes comprise a plurality of ordered split node units, wherein each split node unit corresponds to a sub-key value interval in the complete key value interval, wherein keys belonging to the sub-key value interval and their corresponding pointers are stored, and sub-key value intervals corresponding to adjacent split node units are continuous, and the method further comprises: When the tree node to be accessed is a target internal node in the tree index, determining a target segmentation node unit according to the target key of this access; The target segmentation node unit is read from the target internal node to the local, and a pointer pointing to a lower-level child node is searched in the target segmentation node unit, where the lower-level child node is the tree node to be visited during the next visit.

8. According to the method of claim 7, the process of determining the target segmentation node unit according to the target key of the current access comprises: Obtaining the segmentation granularity of the target internal node; Determine the sub-key value interval corresponding to each segmentation node unit in the target internal node according to the complete key value interval corresponding to the target internal node and the segmentation granularity; The split node unit corresponding to the target sub-key value interval to which the target key belongs is determined as the target split node unit.

9. The method according to claim 7, wherein the process of searching for a pointer to a lower-level child node in the target segmentation node unit comprises: Searching for a minimum key greater than the target key in the target split node unit; The pointer corresponding to the minimum key is determined as a pointer pointing to the lower-level child node.

10. The method according to claim 9, further comprising: Read the left split node unit of the target split node unit from the target internal node to the local; Searching for a first-category maximum key that is less than or equal to the target key in the target split node unit and the left split node unit; A complete key value interval corresponding to the lower-level child node is determined based on the minimum key and the first-category maximum key.

11. The method according to claim 10, wherein the second largest key in each split node unit is stored in the rightmost slot in the split node unit, and the process of reading the left split node unit from the target internal node to the local comprises: Read the second-category maximum key stored in the rightmost slot of the left-side split node unit from the target internal node to the local; The process of searching for the first type maximum key that is less than or equal to the target key in the target split node unit and the left split node unit includes: Search the target split node unit and the second-type maximum key for a first-type maximum key that is less than or equal to the target key.

12. The method according to claim 7, further comprising: When adding a new key in the target internal node, determine the sub-key value interval to which the new key belongs, and when there is an empty slot in the split node unit corresponding to the sub-key value interval to which the new key belongs, insert the new key and its corresponding pointer into the empty slot.

13. The method according to claim 12 further includes: When there is no empty slot in the split node unit corresponding to the sub-key value range to which the new key belongs, merging the split node unit and the adjacent split node unit, and performing a merging process on the remaining unmerged split node units, so that the size of the sub-key value range corresponding to each merged node unit obtained after merging is the same, and updating the splitting granularity of the target internal node.

14. The method according to claim 12, the process of inserting the new key and its corresponding pointer into the empty slot includes: Comparing the new key with the current second largest key stored in the rightmost slot of the split node unit corresponding to the sub-key value range to which the new key belongs; When the new key is less than the current second largest key, inserting the new key and its corresponding pointer into the empty slot.

15. The method according to claim 14 further includes: When the new key is greater than the current second largest key, moving the current second largest key and its corresponding pointer to the empty slot, and inserting the new key and its corresponding pointer into the rightmost slot.

16. A memory access device is applied to a computing device in a disaggregated memory system. The disaggregated memory system further includes a memory device, and a tree index is deployed in the memory device. The tree index includes a plurality of leaf nodes, and one or more key-value entries are stored in the leaf nodes. Each leaf node includes a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. The device includes: A hash bucket determination unit, when the tree node to be accessed is the target leaf node in the tree index, determining a target hash bucket according to the target key of the current access; A hash bucket reading unit, reading the target hash bucket from the target leaf node to the local; A write access unit, when the current access is a write access, storing the target key and its corresponding target value into the target hash bucket, and writing the target hash bucket into the target leaf node after the storage is completed; A read access unit, when the current access is a read access, looking up the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

17. A computing device, comprising: A processor; A memory for storing processor-executable instructions; wherein, the processor runs the executable instructions to implement the steps of the method according to any one of claims 1-15.

18. A memory device, a tree index is deployed in the memory device. The tree index includes a plurality of leaf nodes, and one or more key-value entries are stored in the leaf nodes. Each leaf node includes a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. When accessing the memory device, the computing device executes the steps of the method according to any one of claims 1-15.

19. A separated memory system, which includes a computing device and a memory device. A tree index is deployed in the memory device. The tree index includes a number of leaf nodes. One or more key-value entries are stored in the leaf nodes. Each leaf node includes a plurality of hash buckets, and one or more key-value entries can be stored in each hash bucket. When the computing device accesses the memory device, the following steps are performed: When the tree node to be accessed is the target leaf node in the tree index, determine the target hash bucket according to the target key of this access; Read the target hash bucket from the target leaf node to the local; In the case that this access is a write access, store the target key and its corresponding target value into the target hash bucket, and after the storage is completed, write the target hash bucket into the target leaf node; In the case that this access is a read access, search for the target value corresponding to the target key based on the key-value entries stored in the target hash bucket.

20. A computer-readable storage medium, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any one of claims 1-15 are implemented.

21. A computer program product, including computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the method described in any one of claims 1-15 are implemented.

Citation Information

Cited By

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

    CN120929393A

  • A memory management method, device, storage medium and computer device

    CN120929393B