Data access method and data access controller for a split memory system

CN122985702APending Publication Date: 2026-10-27HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611184654.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0005]针对现有技术的以上缺陷或改进需求,本发明提供了一种面向分离式内存系统的数据访问方法及数据访问控制器,由此解决远程网络往返次数高、网络开销和锁竞争开销大的技术问题

Benefits of technology

通过在计算节点侧建立块级所有权窗口,并将同一数据块上的后续读写请求委托给所有者线程处理,能够复用已经抓取到计算节点侧的数据块状态和本地可写副本,使读请求在本地返回、写请求在本地合并后再写回,减少热点块访问中的重复远程加锁、重复网络数据读取以及额外网络往返,降低热点范围访问时的锁竞争和网络资源占用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985702A_ABST
    Figure CN122985702A_ABST
Patent Text Reader

Abstract

The application discloses a data access method and a data access controller for a separated memory system. By establishing a block-level ownership window on the computing node side and entrusting subsequent read-write requests on the same data block to the owner thread for processing, the data block state and the local writable copy that have been captured to the computing node side can be reused, and repeated remote locking, repeated network data reading and additional network round trips in hot block access can be reduced. In addition, when locating a target key, by caching local prediction correction information of each slot of the data block on the computing node side and using an offset item to trim a candidate prediction window formed by model prediction errors, the situation that irrelevant records are captured together can be reduced. Further, when retraining the data node, the release of the new node metadata is separated from the migration of the old node data, so that the maintenance blocking caused by waiting for complete migration under dynamic load can be reduced, and the influence of model update lag on the foreground access path can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of key-value storage and remote memory access technology, and more specifically, relates to a data access method and data access controller for discrete memory systems. Background Technology

[0002] Decoupled memory is a system architecture that decouples computing resources from memory resources. In this type of architecture, compute nodes and memory nodes can be interconnected through a Remote Direct Memory Access (RDMA) network, thereby enabling independent scaling of compute and memory resources.

[0003] In ordered key-value stores with separate memory, indexes typically need to support point queries, inserts, updates, deletions, and range queries. Since index data access involves remote interaction between compute nodes and memory nodes, the index organization and access paths directly affect single-access latency, compute node cache usage, memory node maintenance load, and RDMA network overhead.

[0004] Specifically, in existing index access scenarios for separated memory, the computing resources on the memory node side are limited. If multiple remote interactions or synchronous processing are required during request processing or index maintenance, it will increase access latency and exacerbate network contention. Especially in hotspot range access scenarios, multiple requests often focus on accessing adjacent key ranges or the same data block. If each request independently performs remote locking, remote fetching, and remote commit, it is difficult to reuse the data block state already brought back to the compute node by previous accesses. Under this processing method, even if the compute node has obtained a copy of the target data block, it is difficult to reuse this copy for subsequent requests within the same hotspot window, resulting in repeated network round trips and additional lock contention overhead. Therefore, how to reduce the number of remote network round trips is an important problem that needs to be solved for data access for separated memory. Summary of the Invention

[0005] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a data access method and data access controller for discrete memory systems, thereby solving the technical problems of high remote network round trips, large network overhead, and high lock contention overhead.

[0006] To achieve the above objectives, according to a first aspect of the present invention, a data access method for a discrete memory system is provided, comprising: In response to a data access request for the discrete memory system, wherein the discrete memory system includes compute nodes and memory nodes interconnected via a network; The target data block to be accessed by the data access request is determined based on the target key of the data access request. When the target data block is a hot data block, determine whether the data access request meets the local read / write conditions; wherein, the local read / write conditions are that the current data access request arrives at the compute node within the block-level ownership window of the current owner thread of the target data block; the owner thread is the thread that the compute node allocates to hold the local lock of the target data block for the write request for the target data block; If the data access request meets the local read / write conditions, the data access request is allocated to the read queue or write queue of the target data block according to its data access operation type. The owner thread is configured to establish a read queue and a write queue after successfully acquiring the local lock of the target data block, acquire the remote lock of the target data block, and fetch block data of the target data block from the memory node after acquiring the remote lock, so as to complete the local execution of the write requests and data access requests in the read queue and write queue based on the fetched block data. After completing the local execution of the write requests handled by the owner thread, the owner thread closes the read queue and write queue, and waits for the data access requests that were added to the read queue and write queue before the queues were closed to complete their local execution.

[0007] Based on any of the above data access methods for discrete memory systems Based on the captured block data, the local execution of write requests handled by the owner thread, as well as data access requests in the read and write queues, is completed, specifically including: Set the captured block data as read-only blocks and create a corresponding local writable copy; Based on the read-only block and the local writable copy, the local execution of write requests handled by the owner thread and data access requests in the read and write queues is completed in the following manner: If the current data access request is a read request in the read queue, predict the candidate position range of the target key in the corresponding read request, locate the slot corresponding to the target key in the corresponding read request based on the key-value pair in the candidate position range corresponding to the read-only block, and return the value data stored in the slot. If the current data access request is a write request handled by the owner thread or a write request in the write queue, predict the candidate position range of the target key in the corresponding write request, locate the slot corresponding to the target key in the corresponding write request based on the key-value pair in the candidate position range corresponding to the local writable copy, and perform the write operation of the corresponding write request at the corresponding slot of the local writable copy. After the data access requests that have been added to the read queue and write queue before the queue is closed are completed locally, the owner thread writes the modification results in the local writable copy back to the target data block of the memory node and releases the remote lock and local lock of the target data block.

[0008] According to any of the above data access methods for split memory systems, when the target data block is not a hot data block, or when the data access request is a read request and does not meet local read / write conditions, the method further includes: Predict the range of candidate locations for the target key in the data access request; The computing node requests key-value pairs within the candidate location range from the memory node via the network, locates the slot corresponding to the target key in the data access request based on the received key-value pairs within the candidate location range, and performs the data access operation of the data access request at that slot.

[0009] Based on any of the above data access methods for split memory systems, predicting the candidate location range of the target key in any data access request specifically includes: The computing node obtains the data node model corresponding to the target key in any data access request based on the locally stored learning index cache. After determining the original prediction position of the corresponding target key and the candidate prediction window centered on the original prediction position based on the data node model, it prunes the candidate prediction window of the target key based on the locally stored offset cache to determine the candidate position range of the corresponding target key. The learning index cache is used to cache the data node model corresponding to each data node in the memory node. Any data node covers a continuous key range and is divided into multiple data blocks. The data node model corresponding to any data node is used to predict the position of the key within that data node. The offset cache is used to cache the local prediction correction information of each data block in the data node of the memory node.

[0010] According to any of the above data access methods for split memory systems, one offset cache line in the offset cache corresponds to one data block; the offset cache line stores the offset entries corresponding to each slot within the corresponding data block; the offset entry includes at least an occupancy flag and an offset value, wherein the occupancy flag is used to indicate whether the corresponding slot stores a key-value pair, and the offset value is used to indicate the non-negative position difference between the location of the corresponding slot and the prediction reference position of the key stored in that slot; the prediction reference position of any key is the lower bound of the candidate prediction window centered on the original prediction position corresponding to that key; The candidate prediction window for the target key is pruned based on the offset cache of local storage to determine the candidate position range of the corresponding target key, specifically including: Determine the number of data blocks covered by the candidate prediction window, and retrieve the offset cache based on each data block covered by the candidate prediction window; If the data blocks covered by the candidate prediction window are not hit in the offset cache, then the candidate position range is determined to be the candidate prediction window for the target key; Otherwise, the prediction reference position of the target key is matched with each offset in the hit offset cache line, and the candidate prediction window of the target key is truncated based on the slot corresponding to the matched offset, to determine the candidate position range. Alternatively, if none of the offsets in the hit offset cache line match, and if there are unoccupied offsets in the hit offset cache line, the candidate prediction window of the target key is truncated based on the slot corresponding to the unoccupied offset, to determine the candidate position range. The unoccupied offset refers to an offset whose occupancy flag is not set to indicate that the corresponding slot is occupied. The unoccupied offset includes offsets whose corresponding slots do not store key-value pairs and offsets that have not yet been initialized. Wherein, when some data blocks covered by the candidate prediction window are hit in the offset cache and some data blocks are not hit, the candidate position range includes the range truncated based on the hit offset cache line and the range where the candidate prediction window overlaps with the data blocks that are not hit in the offset cache.

[0011] According to any of the above data access methods for split memory systems, the predicted reference position of the target key is matched with each offset entry in the hit offset cache line, specifically including: When matching the predicted reference position of the target key with any offset item in the hit offset cache line, if the occupied flag of the offset item indicates that the corresponding slot has stored a key-value pair, and the sum of the predicted reference position of the target key and the offset value in the offset item is equal to the position of the slot corresponding to the offset item, then the offset item is determined to meet the matching condition.

[0012] Based on any of the above data access methods for split memory systems, the candidate prediction window for the target key is truncated according to the slot corresponding to the matched offset to determine the candidate position range, specifically including: If there is a unique offset that satisfies the matching condition, the candidate position range is determined to be the area covering the slot corresponding to the matching offset. If there are multiple offset items that meet the matching conditions, the candidate position range is determined as the smallest continuous area covering the slots corresponding to the multiple matching offset items.

[0013] According to any of the above data access methods for split memory systems, if none of the offset entries in the hit offset cache line match, and if there are unoccupied offset entries in the hit offset cache line, then the candidate prediction window for the target key is pruned based on the slot corresponding to the unoccupied offset entries to determine the candidate position range, specifically including: If there are unoccupied offset entries in the hit offset cache line, the candidate position range is determined as the smallest continuous area covering the slots corresponding to the unoccupied offset entries. If the occupancy flags of the offset entries in the hit offset cache line all indicate that the corresponding slot has already stored a key-value pair, then it is determined that the target key does not exist in the data block corresponding to the hit offset cache line.

[0014] According to any of the above-described data access methods for discrete memory systems, the method further includes: The memory node side determines the data nodes to be retrained based on performance indicators and / or node fill rate, and allocates retraining threads accordingly. The retraining thread reconstructs the model based on the valid key-value pairs in the data node to be retrained, obtains the new data node model corresponding to the data node, records the data block currently corresponding to the data node as the old node data block, allocates a new data block for the data node based on the new data node model to store the valid key-value pairs therein, and generates new node metadata corresponding to the data node based on the new data node model and the new data block. Write the new node metadata into the synchronization area of ​​the memory node; The retraining thread publishes publication information corresponding to the new node metadata; the publication information is used to indicate the starting position of the new node metadata in the synchronization area and the number of new node metadata. After publishing the new node metadata, the retraining thread sets the old node data blocks to a synchronized state and scans each old node data block in turn. Key-value pairs in the data blocks that can be successfully locked are inserted into the new data blocks according to the original prediction positions predicted by the new data node model. After all key-value pairs in any old node data block have been migrated to the new data block, the old node data block is marked as invalid. Before any old node data block is marked as invalid, it can still be accessed by data access requests.

[0015] According to a second aspect of the present invention, a data access controller for discrete memory is provided, comprising: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method as described in the first aspect.

[0016] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: By establishing a block-level ownership window on the compute node side and delegating subsequent read and write requests on the same data block to the owner thread, the data block state already captured on the compute node side and the local writable copy can be reused. This allows read requests to return locally and write requests to be merged locally before being written back, reducing repeated remote locking, repeated network data reading, and additional network round trips in hot block access, and reducing lock contention and network resource consumption during hotspot range access.

[0017] Furthermore, when locating the target key, by caching the local prediction correction information of each slot of the data block on the computing node side, and using the offset term to prune the candidate prediction window formed by the model prediction error, the remote crawling range can be reduced from the complete prediction window to the record area covering the target candidate slot. This reduces the situation where irrelevant records are crawled along with the data, reduces the read amplification of the learned index in the separate memory scenario, thereby saving network bandwidth and reducing the remote read overhead of access operations such as point queries.

[0018] Furthermore, during the retraining of data nodes, the publication of new node metadata is separated from the migration of old node data. This allows computing nodes to obtain the location information of new nodes in the synchronization region, and old data blocks can still be accessed as foreground objects before they are marked as invalid. After old data blocks are marked as invalid, computing nodes are redirected to the new node based on the published new node metadata. This avoids having to wait for all records of the old node to be migrated before the retraining results take effect, thereby reducing maintenance blockage caused by waiting for complete migration under dynamic load and reducing the impact of model update lag on the foreground access path. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating a data access method for a discrete memory system provided in an embodiment of the present invention.

[0020] Figure 2 This is a schematic diagram of the memory node data structure provided in an embodiment of the present invention.

[0021] Figure 3 This is a schematic diagram of the offset cache prediction and correction access process provided in an embodiment of the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0023] This invention provides a data access method for discrete memory systems, which is applied to computing nodes in discrete memory systems, such as... Figure 1 As shown, it includes: Step 110, in response to a data access request for the discrete memory system; wherein the discrete memory system includes compute nodes and memory nodes interconnected via a network; Step 120: Determine the target data block to be accessed by the data access request based on the target key of the data access request; Step 130: When the target data block is a hot data block, determine whether the data access request meets the local read / write conditions; wherein, the local read / write conditions are that the current data access request arrives at the compute node within the block-level ownership window of the current owner thread of the target data block; the owner thread is the thread that the compute node allocates to hold the local lock of the target data block for the write request for the target data block; Step 140: If the data access request meets the local read / write conditions, then the data access request is allocated to the read queue or write queue of the target data block according to its data access operation type. The owner thread is configured to establish a read queue and a write queue after successfully acquiring the local lock of the target data block, acquire the remote lock of the target data block, and fetch block data of the target data block from the memory node after acquiring the remote lock, so as to complete the local execution of the write requests and data access requests in the read queue and write queue based on the fetched block data. After completing the local execution of the write requests handled by the owner thread, the owner thread closes the read queue and write queue, and waits for the data access requests that were added to the read queue and write queue before the queues were closed to complete their local execution.

[0024] Specifically, this method is applied to a discrete memory system interconnected via a network (e.g., an RDMA network) for storing key-value pair data, and includes at least compute nodes and memory nodes. The data access method in this embodiment accesses key-value pairs stored on the memory node side.

[0025] Before data access, the basic data structures supporting data access must first be established in the separate memory system. This includes establishing a basic index structure on the memory node side. For example... Figure 2 As shown, the basic index structure includes multiple data blocks in the data area and data nodes composed of multiple data blocks. Data blocks are used to store key-value pair records and serve as the basic granularity for index data storage and block-level locking; each data block can store a preset number of records, each containing at least a key and a value. In one implementation, the records may also include verification information for consistency checks, which the compute nodes can use to perform consistency checks on the retrieved records.

[0026] Furthermore, in the basic index structure, multiple data blocks form a data node. Each data node covers a continuous key range and is associated with a linear model used to predict the key's position within that data node. To accommodate changes in data distribution caused by subsequent insertion operations, data nodes can reserve empty positions during creation to absorb subsequent insertions. Regarding the model training method, this embodiment can employ a piecewise linear approximation approach to train the intra-node linear model, providing position prediction capabilities with error bounds.

[0027] Furthermore, data blocks may include block information, and data nodes may include node control records. For example... Figure 2 As shown, the data area of ​​a memory node includes a node control record and multiple data blocks. The node control record format may include performance indicators, node block count, node status, and a publication word. The node status represents states such as synchronization or invalidation, and the publication word records the starting position of new node metadata in the synchronization area and the number of new nodes. The data block format may include a write lock, block information, and multiple records. The block information may include an overflow block number, block status, and a publication word. The overflow block number records the overflow block number allocated during insertion due to insufficient space in the current data block. The block status indicates whether the data block is still valid, in the process of migration synchronization, or has expired. The publication word records the publication information of the new node metadata in the synchronization area after retraining, enabling the compute node to read the corresponding new node metadata from the synchronization area based on the publication word.

[0028] After system initialization, compute nodes begin responding to data access requests from clients. When a compute node receives a data access request for a split-memory system (this request can be any of the following: point query, insert, update, delete, or range query), it first parses the request to obtain its target key. Then, the compute node determines the target data block to be accessed based on the target key of the data access request. In some implementations, the compute node can determine the target data block by: first obtaining the data node model information corresponding to the target key; calculating the original predicted position of the target key based on the model; and then determining the data block in which the target key might fall based on the original predicted position and error bounds, and using that data block as the target data block.

[0029] When the target data block is a hot data block, this embodiment of the invention provides a block-level ownership delegation mechanism. Under this mechanism, the compute node further determines whether the data access request meets the local read / write conditions. The local read / write conditions are that the current data access request arrives at the compute node within the block-level ownership window of the current owner thread of the target data block. Here, the owner thread is the thread that the compute node allocates to hold the local lock of the target data block for the write request. Hot data blocks can be identified using various methods known in the art, such as based on access frequency statistics. When the number of accesses to a data block exceeds a preset threshold within a unit of time, the data block is marked as a hot data block. This embodiment of the invention does not specifically limit this approach.

[0030] If a data access request meets the local read / write conditions, the compute node allocates the request to the read or write queue of the target data block according to its data access operation type. Specifically, if the request is a read request (such as a point query), it is allocated to the read queue; if the request is a write request (such as an insert, update, or delete), it is allocated to the write queue. The complete workflow of the owner thread is as follows: After successfully acquiring the local lock of the target data block, the owner thread establishes the read and write queues, acquires a remote lock from the memory node via the network (such as RDMA), and fetches the block data of the target data block. The block-level ownership window corresponds to the time window between the establishment and closure of the read and write queues. Then, the owner thread executes the local execution of the write requests it is responsible for based on the fetched block data. After the owner thread completes the local execution of the write requests it is responsible for, it closes the read and write queues to stop receiving new data access requests and waits for the data access requests added to the read and write queues before the queues were closed to complete their local execution.

[0031] If the target data block is not a hot data block, or if the data access request is a read request and does not meet local read / write conditions, the compute node processes the request according to the regular remote access path. In one implementation, within the regular remote access path, the candidate location range of the target key in the data access request can be predicted. Then, the compute node requests key-value pairs within the candidate location range from the memory node via the network. Based on the received key-value pairs within the candidate location range, the compute node locates the slot corresponding to the target key in the data access request and performs the data access operation at that slot. Specifically, for read requests, after locating the slot corresponding to the target key, the value data stored in that slot is read and returned. For write requests (insert, update, or delete), after locating the slot corresponding to the target key, the compute node first acquires the remote lock of the target data block, then performs the write, update, or logical delete operation at the corresponding slot, and finally releases the remote lock. It should be noted that if the target data block is a hot data block and the data access request is a write request but does not meet the local read / write conditions, a worker thread can be assigned to it and compete for the local lock of the target data block. After the worker thread successfully acquires the local lock and becomes the owner thread, the above process is executed.

[0032] In one implementation, when executing write operations for write requests and data access operations for data access requests in the read and write queues of the fetched block data, the owner thread sets the fetched block data as a read-only block and establishes its corresponding local writable copy. Then, it performs local execution on all write requests handled by the owner thread and all data access requests in the read and write queues. The local execution process for any data access request (including write requests handled by the owner thread) is as follows: (1) Processing of read requests: If the data access request is a read request in the read queue, predict the candidate position range of the target key for the corresponding read request, locate the slot corresponding to the target key based on the key-value pair in the candidate position range of the read-only block, and return the value data stored in the slot.

[0033] (2) Handling of write requests: If the data access request is a write request that the owner thread is responsible for or a write request in the write queue, then predict the candidate position range of the target key for the corresponding write request, locate the slot corresponding to the target key based on the key-value pair in the candidate position range of the local writable copy, and complete the write operation of the corresponding write request at the corresponding slot of the local writable copy.

[0034] For example, after thread A becomes the owner thread of data block B1, if thread C is responsible for the read request for the target data block, then thread C's read request is added to the read queue and the read is completed locally based on data block B1; if thread B is responsible for the update request for the target data block and thread D is responsible for the insert request, then thread B and thread D's write requests are added to the write queue and merged and executed on the local writable copy corresponding to data block B1.

[0035] (3) Commit and release: After the owner thread completes the local execution of the write request it is responsible for, it closes the read queue and the write queue, and waits for the data access requests that were added to the read queue and the write queue before the closure to complete the local execution. After the data access requests that were added to the read queue and the write queue before the closure are completed, the owner thread writes the modification results in the local writable copy back to the target data block of the memory node, and releases the remote lock and local lock of the target data block.

[0036] In one implementation, the write-back operation only covers the smallest contiguous region containing the modified record. Subsequent requests arriving after the queue is closed can fall back to the normal access path, re-executing local lock contention and remote access.

[0037] All the above solutions involve predicting the candidate location range of the target key in a data access request. Especially for regular remote access paths, it's necessary to read data within this range from memory nodes to compute nodes for target key location based on the candidate location range. Therefore, to reduce the amount of data transmitted over the network, one implementation can establish an access cache corresponding to the aforementioned basic index structure on the compute node side. This access cache includes a learned index cache and an offset cache. The learned index cache is used to cache data node model information and index metadata, enabling compute nodes to obtain the data node model information corresponding to the target key without performing remote index traversal. The data node model information and index metadata are generated by memory nodes during the index building phase or the data node retraining phase. Specifically, each data node corresponds to a continuous key range and is associated with a data node model (such as a linear model) used to predict key positions. During initialization, the compute node obtains the aforementioned data node model information and index metadata of the initialized memory node via remote reading and caches them in the learned index cache. The offset cache is used to cache the local prediction correction information of each data block in the data node of the memory node. In one implementation, the cache line in the offset cache corresponds to a data block, the offset cache line is labeled with the data block identifier, and stores the offset items corresponding to each slot in the data block.

[0038] Specifically, when predicting the candidate position range of a target key in any data access request, embodiments of the present invention provide a prediction correction mechanism. Under this mechanism, the compute node obtains the data node model corresponding to the target key in the data access request based on a locally stored learned index cache, and determines the original predicted position of the corresponding target key and a candidate prediction window centered on that original predicted position based on the data node model. In one implementation, the number of slots that a data block can accommodate can be set to correspond to the number of slots in the candidate prediction window, so that the candidate prediction window spans at most two consecutive data blocks.

[0039] Taking a linear model as an example, this model can be represented as pos = slope × key + intercept, where pos is the original predicted position, slope is the slope of the linear model, intercept is the pivot of the linear model, and key is the numerical representation of the target key. The prediction error boundary of the linear model is denoted as A. The true position of the record corresponding to the target key lies within a continuous range from pA to p+A-1 (a total of 2A consecutive slots). This continuous range from pA to p+A-1 is denoted as the candidate prediction window for the target key, where p is the original predicted position. Then, the computing node can use pA as the prediction reference position (i.e., the lower bound of the candidate prediction window) and form a candidate prediction window of length 2A starting from the prediction reference position. It can be seen that the candidate prediction window is centered on the aforementioned original prediction position. Then, the computing node prunes the candidate prediction window for the target key based on the offset cache stored locally, determining the candidate position range for the corresponding target key to reduce the amount of data that needs to be remotely transmitted in the conventional remote access path.

[0040] Here, the offset cache is used to cache the local prediction correction information of each data block in the data node of the memory node, so as to further narrow the candidate prediction window of the target key based on the local prediction correction information to obtain a smaller position range. In one implementation, one offset cache line in the offset cache corresponds to one data block; the offset cache line stores the offset entries corresponding to each slot in the corresponding data block. The offset entry includes at least an occupancy flag and an offset value, wherein the occupancy flag is used to indicate whether the corresponding slot stores a key-value pair, and the offset value is used to indicate the non-negative position difference between the position of the corresponding slot and the prediction reference position of the key stored in the slot. Here, the prediction reference position of any key is the lower bound (i.e., pA) of the candidate prediction window centered on the original prediction position corresponding to the key, which will not be elaborated further below.

[0041] The specific steps for pruning the candidate prediction window for the target key based on the offset cache of local storage are as follows: Step 1: Determine one or two data blocks covered by the candidate prediction window, and retrieve the offset cache based on the data blocks covered by the candidate prediction window.

[0042] Step 2: If the data block covered by the candidate prediction window is not hit in the offset cache, the candidate position range of the target key is determined as the candidate prediction window for that target key (i.e., a continuous range of length 2A starting from the prediction reference position). Record data within this range is fetched from the memory node via the network, and the corresponding offset is initialized based on the fetched records. Specifically, the compute node sets an occupancy flag for slots with stored records and writes an offset value based on the difference between the actual slot position of the record and its corresponding prediction reference position. For slots without stored records, the compute node sets the corresponding occupancy flag to unoccupied. When a subsequent access hits the offset cache line, the compute node can trim the candidate prediction window based on the occupancy flag and the offset value.

[0043] Step 3: If the data block covered by the candidate prediction window is hit in the offset cache, then the prediction reference position of the target key is matched with each offset item in the hit offset cache line. In one implementation, the matching condition is: if the occupancy flag of the offset item indicates that the corresponding slot has stored a key-value pair, and the sum of the prediction reference position of the target key and the offset value in the offset item is equal to the position of the slot corresponding to the offset item, then the offset item is determined to meet the matching condition.

[0044] Step 4: Based on the matching results, prune the candidate prediction window to determine the candidate location range. This can be done by pruning the candidate prediction window for the target key based on the slots corresponding to the matched offsets, or by pruning the candidate prediction window for the target key based on the slots corresponding to the unused offsets in the matched offset cache lines, if no offsets match in the matched offset cache lines. It should be noted that when the candidate prediction window covers part of the data blocks that are matched in the offset cache and part of the data blocks that are not matched in the offset cache, the candidate location range includes the range pruned based on the matched offset cache lines (pruning method as above) and the range where the candidate prediction window overlaps with the data blocks that are not matched in the offset cache.

[0045] In one implementation, such as Figure 3 As shown, the matching results specifically include the following four scenarios: Scenario 1 (Unique Match): If there is a unique offset that satisfies the matching condition, the candidate position range is determined to be the area covering the slot corresponding to the matching offset, that is, only the record at that single slot is captured.

[0046] Scenario 2 (Multiple Matches): If multiple offsets satisfy the matching conditions, the candidate position range is determined as the smallest continuous area covering the slots corresponding to the multiple matching offsets. For example, when multiple keys may correspond to the same prediction reference position or adjacent candidate slots, the compute node captures a continuous area covering multiple candidate records through a single RDMA read.

[0047] Scenario 3 (No match but unoccupied items exist): If none of the offset items in the hit offset cache line match, but there are unoccupied offset items in the hit offset cache line, then the candidate position range is determined to be the smallest continuous area covering the slot corresponding to the unoccupied offset item, so as to complete further verification locally.

[0048] Scenario 4 (No match and all occupied): If none of the offset entries in the hit offset cache line match, and the occupied flags of the offset entries in the hit offset cache line all indicate that the corresponding slot has stored a key-value pair, then it is determined that the target key does not exist in the data block corresponding to the hit offset cache line, and there is no need to initiate remote fetching for that data block.

[0049] To adapt to changes in data distribution caused by insertion, this embodiment of the invention also employs a data node retraining and maintenance mechanism. This involves pre-establishing a synchronization region and setting up a retraining thread on the memory node side. For example... Figure 2 As shown, the synchronization region is used to store the metadata of the new node after retraining. This metadata may include the pivot and slope of the corresponding data node's model, the starting block number, and the total number of blocks. The pivot and slope represent the model parameters of the retrained data node model; the starting block number indicates the physical number of the first data block within the contiguous storage range of the new data node; and the total number of blocks indicates the number of data blocks contained in the new data node. The new node metadata is written to the synchronization region by the retraining thread of the memory node after the data node retraining is complete. The publication word in the node control record and block information points to the new node metadata in the synchronization region, enabling the compute node to obtain the new node's model information, the number of data blocks it contains, and the physical number of the starting data block based on this publication word.

[0050] During the data node retraining phase, the memory node side determines the data nodes to be retrained based on performance indicators and / or node fill rate, and allocates retraining threads accordingly. Performance indicators are used to identify data nodes that require priority retraining; for example, a performance indicator is generated when the model prediction error of a data node exceeds a preset threshold. Node fill rate reflects the space utilization within a data node; for example, retraining of a data node is triggered when its fill rate exceeds a preset threshold (e.g., 80%).

[0051] After identifying the data node to be retrained, the retraining thread reconstructs the model based on the valid key-value pairs in the data node, obtaining a new data node model corresponding to that data node. Specifically, the retraining thread reads the still valid key-value pairs (i.e., records that have not been logically deleted) from the data node to be retrained, retrains the linear model used to predict key positions based on the key distribution of these valid key-value pairs (e.g., using a piecewise linear approximation method), and records the data block currently corresponding to that data node as the old node data block. Then, the retraining thread allocates a new data block for that data node based on the new data node model to store the valid key-value pairs therein, and generates new node metadata corresponding to that data node based on the new data node model and the new data block.

[0052] Next, the new node metadata is written to the synchronization region of the memory node. Then, the retraining thread publishes the publication information corresponding to the new node metadata. Here, the publication information indicates the starting position of the new node metadata in the synchronization region and the number of new node metadata entries. Specifically, the retraining thread updates the publication word in the corresponding node control record, which points to the starting position of the new node metadata in the synchronization region and records the number of new node metadata entries.

[0053] After publishing the new node metadata, the retraining thread sets the old node data blocks to a synchronized state and scans each old node data block sequentially. Key-value pairs from data blocks that can be successfully locked are inserted into the new data blocks according to their original predicted positions as predicted by the new data node model. Locking here refers to acquiring a remote write lock on the memory node side of the old data block. If an old data block is currently occupied by foreground access and a remote write lock cannot be acquired, the retraining thread temporarily skips that data block and retrys it later. After all key-value pairs in any old node data block have been migrated to the new data block, that old node data block is marked as invalid. Before being marked as invalid, any old node data block can still be accessed by data access requests; that is, the old data block remains a foreground access object before being marked as invalid.

[0054] Specifically, for read requests, compute nodes can read and perform consistency checks on old data blocks if the block state of the old data block is not marked as invalid. When a compute node detects that the block state of the old data block is invalid, it redirects the access to the corresponding new node based on the published new node metadata.

[0055] Here, for write requests (such as inserts or updates), if the compute node fails to acquire write permissions for the target old node's data block, it checks the block information corresponding to that old node's data block. If the block information indicates that the old node's data block has been marked as invalid, the insert or update operation is redirected to the corresponding new data node for execution. If the compute node successfully acquires the remote write lock for the old node's data block, it can perform insert-assisted migration based on that old node's data block. This involves writing the valid key-value pairs in the old node's data block and the currently written key-value pairs to the corresponding new data node according to the retrained data node model, and then marking the old node's data block as invalid after completion.

[0056] Based on the aforementioned prediction correction mechanism, block-level ownership delegation mechanism, and retraining maintenance mechanism, the data access requests in this embodiment of the invention include index operations such as point queries, insertions, updates, deletions, and range queries. The specific implementations of each operation are as follows: (1) Point query: The candidate location range is determined according to the aforementioned prediction and correction mechanism. Key-value pairs within the candidate location range are retrieved from the network. The key-value pairs are compared locally, and the record corresponding to the target key is returned or the result of the key not existing is returned. If it is within the block-level ownership window, the point query request is added to the read queue and completed locally based on the read-only block.

[0057] (2) Insertion operation: The candidate position range is determined according to the prediction correction mechanism. If the target key does not exist and there is an available slot, the data is written; if there is no available slot, an overflow block is allocated. If the data is within the block-level ownership window, the insertion request is added to the write queue and executed on the local writable copy. Further, in one implementation, the insertion operation can use speculative locking: while initiating the candidate position range fetching, a remote locking request is concurrently initiated for the first candidate data block; wherein, the first candidate data block is the first data block arranged in storage order among the data blocks covered by the candidate position range. If locking is successful, after the compute node returns the record data corresponding to the candidate position range, it determines the target data block that actually needs to be written in this insertion operation based on the captured records, and determines whether the target data block is the locked first candidate data block. If locking is successful and the data block is verified as the correct target data block, execution continues. If locking fails or the locked data block is not the correct target data block, the compute node searches for available insertion slots based on the records in the captured candidate position range, and determines the data block where the available insertion slot is located as the correct target data block. If locking is successful but the locked data block is not the correct target data block, the compute node releases the erroneous lock. Subsequently, the compute node performs remote locking on the correct target data block.

[0058] (3) Update operation: Locate the target key according to the point query path. If it exists, obtain write permission or enter the block-level ownership delegation path and modify the corresponding value; if it does not exist, return update failure.

[0059] (4) Deletion operation: Locate the target key according to the point query path. If it exists, obtain write permission or enter the block-level ownership delegation path, and use the logical deletion method to retain the target key and mark the corresponding value field as invalid.

[0060] (5) Range query: Using the start key and end key of the range as inputs, the start block and end block are predicted by the data node model. The continuous data blocks from the start block to the next adjacent additional data block after the end block are crawled through the network, and the records that fall into the query range are filtered locally.

[0061] In summary, the method provided by this invention, by establishing a block-level ownership window on the compute node side and delegating subsequent read and write requests on the same data block to the owner thread, can reuse the data block state already fetched on the compute node side and the local writable copy. This allows read requests to return locally and write requests to be merged locally before being written back, reducing repeated remote locking, repeated network data reading, and additional network round trips in hotspot block access, and reducing lock contention and network resource consumption during hotspot range access. Furthermore, when locating the target key, by caching the local prediction correction information of each slot of the data block on the compute node side and using the offset term to prune the candidate prediction window formed by the model prediction error, the remote fetching range can be reduced from the complete prediction window to the record area covering the target candidate slot. This reduces the situation where irrelevant records are fetched along with the data, reduces the read amplification of the learned index in the separate memory scenario, thereby saving network bandwidth and reducing the remote read overhead of access operations such as point queries. Furthermore, during the retraining of data nodes, the publication of new node metadata is separated from the migration of old node data. This allows computing nodes to obtain the location information of new nodes in the synchronization region, and old data blocks can still be accessed as foreground objects before they are marked as invalid. After old data blocks are marked as invalid, computing nodes are redirected to the new node based on the published new node metadata. This avoids having to wait for all records of the old node to be migrated before the retraining results take effect, thereby reducing maintenance blockage caused by waiting for complete migration under dynamic load and reducing the impact of model update lag on the foreground access path.

[0062] This invention provides a data access controller for discrete memory, comprising: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method as described in any of the above embodiments.

[0063] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A data access method for a discrete memory system, characterized in that, include: In response to a data access request for the discrete memory system, wherein the discrete memory system includes compute nodes and memory nodes interconnected via a network; The target data block to be accessed by the data access request is determined based on the target key of the data access request. When the target data block is a hot data block, determine whether the data access request meets the local read / write conditions; wherein, the local read / write conditions are that the current data access request arrives at the compute node within the block-level ownership window of the current owner thread of the target data block; the owner thread is the thread that the compute node allocates to hold the local lock of the target data block for the write request for the target data block; If the data access request meets the local read / write conditions, the data access request is allocated to the read queue or write queue of the target data block according to its data access operation type. The owner thread is configured to establish a read queue and a write queue after successfully acquiring the local lock of the target data block, acquire the remote lock of the target data block, and fetch block data of the target data block from the memory node after acquiring the remote lock, so as to complete the local execution of the write requests and data access requests in the read queue and write queue based on the fetched block data. After completing the local execution of the write requests handled by the owner thread, the owner thread closes the read queue and write queue, and waits for the data access requests that were added to the read queue and write queue before the queues were closed to complete their local execution.

2. The data access method for a discrete memory system as described in claim 1, characterized in that, Based on the captured block data, the local execution of write requests handled by the owner thread, as well as data access requests in the read and write queues, is completed, specifically including: Set the captured block data as read-only blocks and create a corresponding local writable copy; Based on the read-only block and the local writable copy, the local execution of write requests handled by the owner thread and data access requests in the read and write queues is completed in the following manner: If the current data access request is a read request in the read queue, predict the candidate position range of the target key in the corresponding read request, locate the slot corresponding to the target key in the corresponding read request based on the key-value pair in the candidate position range corresponding to the read-only block, and return the value data stored in the slot. If the current data access request is a write request handled by the owner thread or a write request in the write queue, predict the candidate position range of the target key in the corresponding write request, locate the slot corresponding to the target key in the corresponding write request based on the key-value pair in the candidate position range corresponding to the local writable copy, and perform the write operation of the corresponding write request at the corresponding slot of the local writable copy. After the data access requests that have been added to the read queue and write queue before the queue is closed are completed locally, the owner thread writes the modification results in the local writable copy back to the target data block of the memory node and releases the remote lock and local lock of the target data block.

3. The data access method for a discrete memory system as described in claim 1, characterized in that, When the target data block is not a hot data block, or when the data access request is a read request and does not meet the local read / write conditions, the method further includes: Predict the range of candidate locations for the target key in the data access request; The computing node requests key-value pairs within the candidate location range from the memory node via the network, locates the slot corresponding to the target key in the data access request based on the received key-value pairs within the candidate location range, and performs the data access operation of the data access request at that slot.

4. The data access method for a discrete memory system as described in claim 2 or 3, characterized in that, Predicting the candidate location range of the target key in any data access request, specifically including: The computing node obtains the data node model corresponding to the target key in any data access request based on the locally stored learning index cache. After determining the original prediction position of the corresponding target key and the candidate prediction window centered on the original prediction position based on the data node model, it prunes the candidate prediction window of the target key based on the locally stored offset cache to determine the candidate position range of the corresponding target key. The learning index cache is used to cache the data node model corresponding to each data node in the memory node. Any data node covers a continuous key range and is divided into multiple data blocks. The data node model corresponding to any data node is used to predict the position of the key within that data node. The offset cache is used to cache the local prediction correction information of each data block in the data node of the memory node.

5. The data access method for a discrete memory system as described in claim 4, characterized in that, One offset cache line in the offset cache corresponds to one data block; the offset cache line stores the offset entries corresponding to each slot within the corresponding data block; the offset entry includes at least an occupancy flag and an offset value, wherein the occupancy flag is used to indicate whether the corresponding slot stores a key-value pair, and the offset value is used to indicate the non-negative position difference between the position of the corresponding slot and the prediction reference position of the key stored in the slot; the prediction reference position of any key is the lower bound of the candidate prediction window centered on the original prediction position corresponding to the key; The candidate prediction window for the target key is pruned based on the offset cache of local storage to determine the candidate position range of the corresponding target key, specifically including: Determine the number of data blocks covered by the candidate prediction window, and retrieve the offset cache based on each data block covered by the candidate prediction window; If the data blocks covered by the candidate prediction window are not hit in the offset cache, then the candidate position range is determined to be the candidate prediction window for the target key; Otherwise, the prediction reference position of the target key is matched with each offset in the hit offset cache line, and the candidate prediction window of the target key is truncated based on the slot corresponding to the matched offset, to determine the candidate position range. Alternatively, if none of the offsets in the hit offset cache line match, and if there are unoccupied offsets in the hit offset cache line, the candidate prediction window of the target key is truncated based on the slot corresponding to the unoccupied offset, to determine the candidate position range. The unoccupied offset refers to an offset whose occupancy flag is not set to indicate that the corresponding slot is occupied. The unoccupied offset includes offsets whose corresponding slots do not store key-value pairs and offsets that have not yet been initialized. Wherein, when some data blocks covered by the candidate prediction window are hit in the offset cache and some data blocks are not hit, the candidate position range includes the range truncated based on the hit offset cache line and the range where the candidate prediction window overlaps with the data blocks that are not hit in the offset cache.

6. The data access method for a discrete memory system as described in claim 5, characterized in that, The predicted baseline position based on the target key is matched with each offset entry in the hit offset cache line, specifically including: When matching the predicted reference position of the target key with any offset item in the hit offset cache line, if the occupied flag of the offset item indicates that the corresponding slot has stored a key-value pair, and the sum of the predicted reference position of the target key and the offset value in the offset item is equal to the position of the slot corresponding to the offset item, then the offset item is determined to meet the matching condition.

7. The data access method for a discrete memory system as described in claim 5, characterized in that, The candidate prediction window for the target key is cropped based on the slot corresponding to the matched offset to determine the candidate position range, specifically including: If there is a unique offset that satisfies the matching condition, the candidate position range is determined to be the area covering the slot corresponding to the matching offset. If there are multiple offset items that meet the matching conditions, the candidate position range is determined as the smallest continuous area covering the slots corresponding to the multiple matching offset items.

8. The data access method for a discrete memory system as described in claim 5, characterized in that, If no offset entries match in the hit offset cache line, and if there are unused offset entries in the hit offset cache line, then the candidate prediction window for the target key is pruned based on the slot corresponding to the unused offset entry to determine the candidate position range, specifically including: If there are unoccupied offset entries in the hit offset cache line, the candidate position range is determined as the smallest continuous area covering the slots corresponding to the unoccupied offset entries. If the occupancy flags of the offset entries in the hit offset cache line all indicate that the corresponding slot has already stored a key-value pair, then it is determined that the target key does not exist in the data block corresponding to the hit offset cache line.

9. The data access method for a discrete memory system as described in claim 1, characterized in that, The method further includes: The memory node side determines the data nodes to be retrained based on performance indicators and / or node fill rate, and allocates retraining threads accordingly. The retraining thread reconstructs the model based on the valid key-value pairs in the data node to be retrained, obtains the new data node model corresponding to the data node, records the data block currently corresponding to the data node as the old node data block, allocates a new data block for the data node based on the new data node model to store the valid key-value pairs therein, and generates new node metadata corresponding to the data node based on the new data node model and the new data block. Write the new node metadata into the synchronization area of ​​the memory node; The retraining thread publishes publication information corresponding to the new node metadata; the publication information is used to indicate the starting position of the new node metadata in the synchronization area and the number of new node metadata. After publishing the new node metadata, the retraining thread sets the old node data blocks to a synchronized state and scans each old node data block in turn. Key-value pairs in the data blocks that can be successfully locked are inserted into the new data blocks according to the original prediction positions predicted by the new data node model. After all key-value pairs in any old node data block have been migrated to the new data block, the old node data block is marked as invalid. Before any old node data block is marked as invalid, it can still be accessed by data access requests.

10. A data access controller for discrete memory, characterized in that, include: Computer-readable storage media and processors; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the data access method for a discrete memory system as described in any one of claims 1-9.