Data processing method and apparatus, and data insertion method and apparatus
By designing a Trie tree structure where leaf nodes are consistent with cache lines, memory access and management are optimized, the problem of low Trie tree space utilization is solved, and efficient data storage and retrieval are achieved.
Patent Information
- Application Number
- PCT/IB2025/052625
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-27
- Filing Date
- 2025-03-12
- Publication Date
- 2025-12-04
AI Technical Summary
Existing Trie trees suffer from low space utilization during data storage and retrieval, especially at deeper nodes where there are many null pointers, leading to inefficient memory management.
By designing the leaf node size to be consistent with the cache line, the data in the leaf node is loaded at once using the cache line. The leaf node is also configured with a data mapping area to store the initial key-value pairs and a data management area to store index information, thus optimizing memory access and management.
It improves system performance, reduces memory access latency, makes full use of hardware cache resources, reduces the waste of invalid memory space, and achieves efficient management and fast retrieval of target data.
Smart Images

Figure IB2025052625_04122025_PF_FP_ABST
Abstract
Description
[0001] This disclosure claims priority to Chinese Patent Application No. 202410667718.X, filed on May 27, 2024, entitled "Data Processing Method and Apparatus, Data Insertion Method and Apparatus," the entire contents of which are incorporated herein by reference. Technical Field Embodiments of this disclosure relate to the field of computer technology, and particularly to data processing methods and apparatus, and data insertion methods and apparatus. Background Art
[0002] Trie trees, also known as prefix trees or trie trees, are tree-based index structures used for fast data indexing. They are commonly used to store large amounts of data, enabling rapid operations such as lookup, insertion, and deletion. One of the most important features of Trie trees is their shared prefix structure, which makes them widely used in various applications such as dictionary processing, auto-completion, spell checking, and IP route lookup. Their core competitive advantage lies in their support for multi-threaded concurrent data structures and algorithms.
[0003] Each node in a Trie tree has an array of pointers. Each pointer either points to the next level node or to a final key-value pair (KV). During the search process, the x-th segment (x=0, 1, ...) of the key to be searched is used as the index of the pointer array of the x-th level node (level 0 is the root node) in the Trie tree, guiding the search to the next level node or the final KV. However, Trie trees have always suffered from low space utilization, with deeper nodes containing more null pointers. Therefore, solving the space utilization problem, especially the memory management problem of deeper nodes, is a challenge for Trie trees. In view of this, the present disclosure provides a data processing method. One or more embodiments of the present disclosure also relate to a data insertion method, a data processing apparatus, a data insertion device, a computing device, a computer-readable storage medium, and a computer program product, to solve the technical defects existing in the prior art. According to a first aspect of the present disclosure, a data processing method is provided, comprising: responding to a data processing request, determining a target prefix tree corresponding to the target data based on a target key of target data carried in the data processing request; searching for the target key from the root node of the target prefix tree to determine a leaf node corresponding to the target key, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; loading the cache line corresponding to the at least one initial key-value pair and the index information, and obtaining the at least one initial key-value pair and the index information from the cache line; determining the target data from the at least one initial key-value pair based on the index information and the target key, and performing data processing on the target data according to the data processing request to obtain a data processing result.According to a second aspect of the present disclosure, a data insertion method is provided, comprising: responding to a data insertion request, determining a target prefix tree corresponding to the target data based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted; searching for the key to be inserted from the root node of the target prefix tree, determining a target branch node corresponding to the key to be inserted, and determining a leaf node of the key to be inserted based on the target branch node, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; loading the cache line corresponding to the at least one initial key-value pair and the index information, and obtaining the at least one initial key-value pair and the index information from the cache line; inserting the key to be inserted and the data to be inserted into the data mapping area according to the index information, and updating the index information. According to a third aspect of the present disclosure, a data processing apparatus is provided, comprising: a response module configured to, in response to a data processing request, determine a target prefix tree corresponding to the target data based on a target key of target data carried in the data processing request; a determination module configured to search for the target key from the root node of the target prefix tree and determine a leaf node corresponding to the target key, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; a loading module configured to load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line; and an obtaining module configured to, based on the index information and the target key, determine the target data from the at least one initial key-value pair, and perform data processing on the target data according to the data processing request to obtain a data processing result.According to a fourth aspect of the present disclosure, a data insertion apparatus is provided, comprising: a response module configured to, in response to a data insertion request, determine a target prefix tree corresponding to the data to be inserted based on the data to be inserted carried in the data insertion request and a key to be inserted corresponding to the data to be inserted; a determination module configured to, search for the key to be inserted from the root node of the target prefix tree, determine a target branch node corresponding to the key to be inserted, and determine a leaf node of the key to be inserted based on the target branch node, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; a loading module configured to, load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line; and an insertion module configured to, insert the key to be inserted and the data to be inserted into the data mapping area according to the index information. The index information is updated. According to a fifth aspect of this disclosure, a computing device is provided, comprising: a memory and a processor; the memory is used to store a computer program / instructions, and the processor is used to execute the computer program / instructions, wherein the computer program / instructions, when executed by the processor, implement the steps of the above-described method. According to a sixth aspect of this disclosure, a computer-readable storage medium is provided, storing a computer program / instructions, wherein the computer program / instructions, when executed by a processor, implement the steps of the above-described method. According to a seventh aspect of this disclosure, a computer program product is provided, comprising a computer program / instructions, wherein the computer program / instructions, when executed by a processor, implement the steps of the above-described method.This disclosure provides a data processing method according to an embodiment, comprising: responding to a data processing request, determining a target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request; searching for the target key from the root node of the target prefix tree to determine the leaf node corresponding to the target key, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; loading the cache line corresponding to the at least one initial key-value pair and the index information, and obtaining the at least one initial key-value pair and the index information from the cache line; determining the target data from the at least one initial key-value pair based on the index information and the target key, and performing data processing on the target data according to the data processing request to obtain a data processing result. Based on this, the data processing method provided in this disclosure, by determining the target key of the target data from the data processing request, can quickly locate the corresponding leaf node according to the character sequence of the target key. By designing the size of the leaf node to be consistent with the cache line, when retrieving data from the leaf node in the cache, all data in the leaf node can be retrieved at once through the cache line. This can make greater use of the CPU (Central Processing Unit) cache, reduce memory access latency, and while helping to make full use of hardware cache resources, it also minimizes the waste of invalid space in memory allocation, thereby improving system performance. Furthermore, by setting up a data mapping area in the leaf node to store the initial key-value pairs and storing the index information of the initial key-value pairs in the data management area, the management and retrieval of target data becomes more convenient and efficient, and the target data can be located quickly.Figure 1 is a schematic diagram of a data processing method according to an embodiment of the present disclosure; Figure 2 is a flowchart of a data processing method according to an embodiment of the present disclosure; Figure 3 is a structural diagram of a leaf node data structure according to an embodiment of the present disclosure; Figure 4 is a flowchart of a data insertion method according to an embodiment of the present disclosure; Figure 5 is a schematic diagram of a data deletion process according to an embodiment of the present disclosure; Figure 6 is a schematic diagram of another data deletion process according to an embodiment of the present disclosure; Figure 7 is a schematic diagram of a data insertion process according to an embodiment of the present disclosure; Figure 8 is a schematic diagram of another data insertion process according to an embodiment of the present disclosure; Figure 9 is a structural schematic diagram of a data processing device according to an embodiment of the present disclosure; Figure 10 is a structural schematic diagram of a data insertion device according to an embodiment of the present disclosure; Figure 11 is a structural block diagram of a computing device according to an embodiment of the present disclosure. Detailed Description Many specific details are set forth in the following description to provide a thorough understanding of the present disclosure. However, the present disclosure can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the present disclosure. Therefore, the present disclosure is not limited to the specific embodiments disclosed below. The terminology used in one or more embodiments of the present disclosure is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of the present disclosure. The singular forms “a,” “the,” and “the” used in one or more embodiments of this disclosure and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this disclosure refers to and includes any or all possible combinations of one or more associated listed items. It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this disclosure, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, first may also be referred to as second, and similarly, second may also be referred to as first, without departing from the scope of one or more embodiments of this disclosure. Depending on the context, the word “if,” as used herein, can be interpreted as “when,” “when,” or “in response to a determination.”Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. The collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. First, the terms and concepts involved in one or more embodiments of this disclosure will be explained. Index: In the fields of computer science and information retrieval, an index typically refers to a data structure used to improve data retrieval speed. The purpose of an index is to allow for quick searching or access to data items without traversing the entire dataset. Indexes are widely used in various applications, such as database systems, search engines, file systems, and other applications requiring fast data retrieval. However, creating and maintaining an index requires additional storage space, and the index also needs to be updated accordingly when data is updated, which may affect data writing performance. Therefore, when designing an index, a balance must be struck between retrieval speed and maintenance costs to achieve a better performance equilibrium. Trie tree: Also known as a dictionary tree or prefix tree, it is a tree structure used to store and retrieve strings (but not limited to strings) in a logical manner; the core idea of a trie tree is to use the common prefixes of strings to reduce query time, thereby improving query efficiency.
[0004] Branch nodes in a Trie tree: In the context of a Trie tree, a branch node is an internal node with at least one child node; these nodes act as forks in the tree, with each child node representing a different character choice, thus allowing different string paths to be taken starting from that node.
[0005] Leaf nodes in a Trie tree: Leaf nodes represent the end of the string, and the search process ends at a leaf node.
[0006] Cache Line: A cache line is the basic unit of data transfer in a computer processor's cache. A cache is a small, fast memory located between the processor and main memory (RAM). Its purpose is to reduce latency when accessing main memory and improve data access speed. Because access to main memory is typically much slower than access to the processor, the cache improves performance by storing recently or frequently accessed data.
[0007] The conventional design of Trie trees suffers from thread safety issues, thus requiring serial execution under lock protection. While various lock-free or micro-lock designs have emerged, they generally suffer from performance bottlenecks or implementation difficulties due to design complexity. This disclosure provides a simple Trie tree design that is easy to implement and exhibits good performance, thereby effectively improving the efficiency and reliability of data processing services. This disclosure also provides a data processing method, a data processing apparatus, a data insertion method and apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments. Referring to Figure 1, Figure 1 illustrates a scenario diagram of a data processing method according to an embodiment of this disclosure. Specifically, this data processing method is implemented using an end-side device 102 and a server 104. The end-side device 102 sends a data processing request to the server 104, such as a data query request. The server 104 can receive data processing requests sent by the end-side device or by other servers; this is not limited here. In server 104, a Trie tree index structure is used to assist in storing and retrieving data. When server 104 receives a data processing request from end device 102, it obtains the target key of the target data carried in the request. Based on this target key, it determines the target prefix tree corresponding to the target data and searches from the root node of the prefix tree to determine the leaf node corresponding to the target key. If the number of bytes used by the leaf node matches the number of bytes in the cache line, the data in the leaf node can be loaded into the cache line all at once. By loading the cache line corresponding to the leaf node, at least one initial key-value pair from the leaf node and the data mapping area, as well as the index information of the data management area, can be obtained from the cache line at once. Using the index information of the data management area in the leaf node, and based on this index information and the target key, the target key-value pair is determined from the initial key-value pairs in the data mapping area, thus determining the target data. Finally, the target data is processed according to the data processing request to obtain the data processing result. For example, if the data processing request is a data query request, a message indicating a successful query and the retrieved target data are returned to the end device 102; if the data processing request is a data deletion request, a data deletion operation is performed on the target data, and a message indicating successful deletion is returned to the end device 102.The edge device 102 may include a browser, an app (APP), or a web application such as an H5 (Hypertext Markup Languages) application, a lightweight application (also known as a mini-program), or a cloud application. The edge device may be developed based on a software development kit (SDK) provided by the server, such as a Real-Time Communication (RTC) SDK. The edge device may be deployed in an electronic device and depends on the device's operation or certain apps within the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal like a mobile phone, tablet, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, data processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software. Server 104 can be understood as a server providing various services, including physical servers and cloud servers. For example, it could be a server providing communication services to multiple clients, a server supporting backend training of models used on clients, or a server processing data sent by clients. It's important to note that Server 104 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. Server 104 can also be a server in a distributed system, or a server integrated with blockchain. Server 104 can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.It is worth noting that the data processing method provided in this embodiment can be executed by server 104. In other embodiments of this disclosure, the database can be deployed in the end-side device 102, so that the end-side device 102 can also have similar functions to server 104, thereby executing the data processing method provided in this embodiment. In other embodiments, the data processing method provided in this embodiment can also be jointly executed by end-side device 102 and server 104. The data processing method provided in this disclosure, by determining the target key of the target data from the data processing request, can quickly locate the corresponding leaf node based on the character sequence of the target key. By designing the size of the leaf node to be consistent with the cache line, when retrieving data from the leaf node in the cache, all data in the leaf node can be retrieved at once through the cache line, which can make greater use of the CPU cache, reduce memory access latency, and help to make full use of hardware cache resources while minimizing the waste of invalid space in memory allocation, thus improving system performance. Furthermore, a data mapping area is set in the leaf node to store the initial key-value pairs, and the index information of the initial key-value pairs is stored in the data management area, making the management and retrieval of target data more convenient and efficient, and enabling rapid location of target data. Referring to Figure 2, Figure 2 shows a flowchart of a data processing method provided in an embodiment of this disclosure, specifically including the following steps. Step 202: In response to the data processing request, determine the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request. In this context, a data processing request can be understood as an instruction or request issued by an application or system to a data storage or computing service, requesting a certain operation on specific data, such as a data query request, a data deletion request, or a data update request. A target key can be understood as one or more fields that uniquely identify a record or a set of related data. In a data structure like a Trie tree, the target key is usually in string form, used to guide the search and manipulation of target data within the Trie tree. Target data can be understood as the specific data unit or object to be manipulated according to the data processing request. For example, in a data processing request, target data could be the object to be queried, a new value to be updated, a new record to be inserted, or an old record to be deleted. In Trie tree applications, target data can be any type of value associated with the target key; for example, in a dictionary lookup, target data could be information such as definitions and example sentences related to a word.A prefix tree can be understood as a pre-constructed tree-like data structure indexed by string prefixes. Each internal node of the prefix tree represents a common prefix, while the leaf nodes represent the end of the string and store key-value pairs. Specifically, when a data processing request is received from a client or other server, the target key of the target data carried in the data processing request is obtained. This target key can be represented by a string, thereby determining the target prefix tree corresponding to the target data. The target data is then searched from this target prefix tree and processed. In one or more embodiments of this disclosure, there can be one or more initial prefix trees. When there are multiple initial prefix trees, the target prefix tree can be accurately determined based on the attribute information of the target key. The specific implementation is as follows: Responding to a data processing request, determining the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request includes: If the number of initial prefix trees is determined to be one, determining the initial prefix tree as the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request; or if the number of initial prefix trees is determined to be multiple, determining the attribute information of the target key based on the target key of the target data carried in the data processing request, and determining the target prefix tree corresponding to the target data from the multiple initial prefix trees based on the attribute information of the target key. Here, the initial prefix tree can be understood as a pre-constructed, existing Trie tree; the target prefix tree can be understood as a Trie tree in the initial prefix tree associated with the target data and target key in the data processing request. Specifically, when there is only one initial prefix tree, no additional decision-making steps are needed; this unique prefix tree is directly used as the target prefix tree for searching and processing the target data, simplifying the search process and improving the efficiency of processing the target data. When multiple initial prefix trees exist, the target prefix tree related to the target data is selected based on the attribute information of the target key (such as specific prefixes, tags, categories, or other key features), thereby better adapting to diverse data organization forms and complex query needs. By performing queries specifically on specific target prefix trees, the system load is reduced, and data processing performance and accuracy are improved.The data processing method provided in this disclosure, when there is a single prefix tree, directly locates the existing initial prefix tree through the target key, simplifying the search process and enabling fast and accurate access and processing of target data. When multiple initial prefix trees exist, the target prefix tree can be accurately selected based on the attribute information of the target key, thereby ensuring efficient completion of data processing requests even in complex and diverse data environments. Step 204: Search for the target key from the root node of the target prefix tree to determine the leaf node corresponding to the target key. The number of bytes used by the leaf node is consistent with the number of bytes in the corresponding cache line. The leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area. The root node can be understood as the starting point of the tree structure. It has no parent node, and all other nodes are directly or indirectly connected to the root node. The cache line can be understood as a unit of data processed in computer hardware (especially CPU cache). It is the size of a data block read or written from memory at one time, usually 64 bytes or a multiple thereof. The data mapping area can be understood as a region within the leaf node, used to store initial key-value pairs. This area can manage multiple slots, each storing the address of a key-value pair. The data management area can be understood as another region within the leaf node, used to store index or management information for each key-value pair in the data mapping area. This includes, but is not limited to, the offset table, the trie key table (used to store prefix information for key-value pairs; the trie key refers to the string key used for insertion and searching), the last offset, and the last index. Specifically, in a Trie tree, starting from the root node, the search proceeds downwards along the branch nodes of the Trie tree based on each character of the target key until a leaf node matching the target key is found. Taking a cache line size of 64 bytes as an example, the number of bytes used by the leaf node is the same as the number of bytes in the cache line, which is also 64 bytes. This design can optimize memory access efficiency by loading all the data of a leaf node into the CPU cache line at once, thereby reducing the number of main memory accesses and improving data processing speed.The leaf node is internally divided into two areas: a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, meaning that a leaf node can be associated with multiple initial key-value pairs. The data management area stores the index information of these initial key-value pairs, which helps to quickly locate and manage the data structure of the initial key-value pairs. Through this design, the system can not only quickly locate the leaf node where the target key is located, but also efficiently manage and access the target data related to the target key within the leaf node, thereby achieving effective processing of the target data. Step 206: Load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line. Specifically, determine the data in the leaf node, i.e., the cache line address of at least one initial key-value pair and the index information. Since the cache reads and writes data in units of cache lines, by loading the cache line corresponding to at least one initial key-value pair and the index information into the cache, at least one initial key-value pair and the index information can be obtained from the cache line at once, i.e., all the data of the leaf node in the cache line can be obtained at once. In practical applications, when a cache line has not yet been loaded into the cache (i.e., a cache miss), a further request is made to read data from the next level of memory (usually main memory). This involves loading the cache line containing at least one initial key-value pair and the index information from the determined leaf node into the cache. Thus, the required data can be accessed directly from the cache line. Since the cache is much faster than main memory, this process significantly speeds up data processing. With at least one initial key-value pair and index information obtained from the cache line, subsequent data processing can be performed based on this information. By precisely controlling data loading and access, and utilizing the high-speed access characteristics of the cache, direct access to main memory is reduced, thereby significantly improving data processing efficiency. In one or more embodiments of this disclosure, the data management area may include a first data management area and a second data management area. Data in the data mapping area can only be processed if the leaf node version identifiers corresponding to these two data management areas are consistent.The specific implementation is as follows: The data management area includes a first data management area and a second data management area. The first data management area stores first index information of the initial key-value pairs in the data mapping area. The first index information includes a first leaf node version identifier. The second data management area stores second index information of the initial key-value pairs in the data mapping area. The second index information includes a second leaf node version identifier. Determining the target data from the at least one initial key-value pair based on the index information and the target key includes: obtaining the first leaf node version identifier from the first index information and obtaining the second leaf node version identifier from the second index information; determining the target data from the at least one initial key-value pair based on the first leaf node version identifier, the second leaf node version identifier, the first index information, the second index information, and the target key. The index information is composed of the first index information and the second index information. The first leaf node version identifier can be understood as version information recorded in the first data management area, used to track changes in leaf nodes. Whenever the data of a leaf node changes (such as adding, deleting, or modifying key-value pairs), the version identifier changes. It can be used to detect and control data consistency in a concurrent environment. The second leaf node version identifier corresponds to the first leaf node version identifier and is the version information recorded in the second data management area for the same leaf node. Before data processing, the data consistency of the leaf node is determined by comparing these two version identifiers, thereby deciding whether it is necessary to re-acquire the latest leaf node information. Specifically, when the data management area is divided into a first data management area and a second data management area, it is necessary to ensure data consistency when processing data. Therefore, the first leaf node version identifier of the first data management area and the second leaf node version identifier of the second data management area are used for judgment, thereby determining the target data from the at least one initial key-value pair based on the first index information, the second index information, and the target key. The data processing method provided in this embodiment, when the data management area is divided, can process the data in the data mapping area only when the version identifiers of each data management area are consistent, by using the version identifiers contained in each data management area. This enables the accurate acquisition of data in the data mapping area. Based on the index information of each data management area, the target data corresponding to the target key in the data mapping area can be quickly indexed and located through the target key.In one or more embodiments of this disclosure, to ensure data security and effectively guarantee data consistency in a concurrent environment, data processing is only performed when the first leaf node version identifier and the second leaf node version identifier are consistent. The specific implementation is as follows: Determining the target data from at least one initial key-value pair based on the index information and the target key includes: if the first leaf node version identifier and the second leaf node version identifier are consistent, determining the target data from at least one initial key-value pair based on the index information and the target key; if the first leaf node version identifier and the second leaf node version identifier are inconsistent, continuing to execute the steps of obtaining the first leaf node version identifier from the first index information and obtaining the second leaf node version identifier from the second index information. Specifically, in a concurrent environment, the system first compares whether the first leaf node version identifier and the second leaf node version identifier are consistent. If they are consistent, it indicates that the data of the leaf node has not changed during the comparison period. At this time, the target data can be directly located and obtained from the initial key-value pairs of the leaf node based on the index information and the target key for processing. When the version identifier of the first leaf node is inconsistent with that of the second leaf node, it indicates that the data in the leaf node has been updated by other threads or processes during this period. In this case, to avoid using expired data, the system needs to re-obtain the latest index information of the data management area in the leaf node until the version identifiers of the first and second leaf nodes are consistent. Then, the system searches for the target data based on the target key and performs subsequent data processing operations. This ensures data consistency and operational correctness in a concurrent environment. The data processing method provided in this embodiment effectively solves the data consistency problem in a concurrent environment by comparing version identifiers, ensuring that inconsistencies caused by data updates do not occur when reading and operating data. This improves the system's concurrent processing capability and data security, effectively guarantees data consistency in a concurrent environment, reduces invalid operations, and improves the efficiency of data search and processing. See Figure 3, which shows a structural diagram of the leaf node data structure provided in an embodiment of this disclosure.Based on the principles of cache friendliness and memory pool standardization, both branch nodes and leaf nodes of the Trie tree use a cache library, which is 64 bytes, as the memory block size of a node. To make full use of memory, a 32-bit integer offset is chosen to identify the address of the next-level node or to store the address of the user's key-value pair. The highest bit is used to identify the type: if the highest bit is 0, it indicates that the slot in the current node stores the address of the next-level node, and the slot value of 0 indicates the end; if the highest bit is 1, it indicates that the slot in the current node stores the address of the key-value pair. Specifically, each leaf node uses a CacheLine-friendly 64-byte memory block to manage 12 32-bit integer slots, occupying a total of 48 bytes. The number of slots and the number of bits occupied by each slot can be set according to actual needs; no limit is set here. Each slot uses an AppendOnly method to store the KV address (a data recording strategy where new data items do not overwrite old data items, but are appended to the existing data). This means that data in the slot can only be appended, not modified or deleted. Each slot points to a Value Node (a node used to store the actual data, containing key-value pairs). This design ensures data consistency and correctness, avoiding data loss or corruption in a multi-threaded environment. The remaining 16 bytes maintain the slot index information using two atomic 64-bit integers, High / Low (H and L in the diagram). The index information includes version information, an offset table (i.e., the target offset table mentioned above), a prefix information table (i.e., the target prefix table mentioned above, also known as the Trie Key table), a last offset, a last index, and a lock. Version information indicates the version number of the leaf node; the offset table is used to quickly locate the position of the target data; the prefix information table stores the prefix information of key-value pairs, helping to quickly find and classify key-value pairs; the last offset indicates the offset of the last data item; the last index indicates the index position of the last data item; and the lock is used to synchronize operations that modify the data structure. The initial number of key-value pairs can be obtained by determining the last index.In practical applications, because some 64-bit systems cannot guarantee 128-bit atomicity, version information is introduced. The data management area is divided into a first data management area (High part) and a second data management area (Low part). Both the first and second data management areas include version information (i.e., the version information of the High part is the version identifier of the first leaf node mentioned above, and the version information of the Low part is the version identifier of the second leaf node mentioned above). The system can atomically operate on the High and Low parts separately. If the version information of the two parts is consistent, they are considered to belong to the same 128-bit atomic operation. Other index information besides the version information can be randomly distributed in the High and Low parts. Of course, if the system can guarantee 128-bit atomicity, it is not necessary to divide the data management area into two parts. In this case, the index information does not need to include the version identifier. In scenarios with good randomness, nodes near the root node in a Trie tree generally have a high load rate, minimal memory waste, and high storage efficiency. Different Trie tree design schemes have basically the same design for such nodes. However, the closer to the leaf node, the higher the probability of empty slots, resulting in wasted memory. Furthermore, if the depth increases, the probability of cache misses (the phenomenon where the required data is not in the cache when the computer system executes instructions or reads data, causing the processor to search for the required data in slower main memory (RAM) or even lower-level storage devices (such as hard drives)) increases, impacting performance. Therefore, the leaf node data structure provided in this embodiment reduces the impact of cache misses on Trie performance by using cache-friendly byte memory blocks, achieving high space utilization, good performance, and simple design. Step 208: Based on the index information and the target key, determine the target data from the at least one initial key-value pair, and perform data processing on the target data according to the data processing request to obtain the data processing result. The data processing result can be understood as the result after performing corresponding operations on the target data, such as the query result, the updated new value, or the success or failure of a deletion operation. Specifically, based on the index information and the target key, the target data is located in the leaf node, and the target data is processed according to the requirements of the data processing request to obtain the data processing result that meets the request requirements.In one or more embodiments of this disclosure, the index information includes the number of initial key-value pairs, a target offset table, and a target prefix table; thereby, target key-value pairs can be quickly determined from the data mapping area based on the specific data in the index information and the target key. The specific implementation is as follows: Determining the target data from the at least one initial key-value pair based on the index information and the target key includes: determining the target key-value pair from the at least one initial key-value pair based on the number of initial key-value pairs, the target offset table, the target prefix table, and the target key; if the key in the target key-value pair matches the target key, the value in the target key-value pair is determined as the target data. Specifically, based on the number of initial key-value pairs stored in the data management area of the leaf node (determined by the last index), the target offset table, and the target prefix table, the target key-value pair matching the target key is located in the initial key-value pairs of the leaf node; if the target key-value pair is determined (i.e., the key is the same as the target key), the value in the target key-value pair is extracted and determined as the target data. The data processing method provided in this disclosure, through a target offset table and a target prefix table, can quickly locate target key-value pairs, greatly improving the speed of finding a specified target key among a large number of key-value pairs, reducing unnecessary traversal and comparison. By comparing the target key and the keys in the target key-value pair, it ensures that the obtained target data strictly corresponds to the target key in the request, avoiding the possibility of mismatch, improving the accuracy and reliability of data processing. Furthermore, by utilizing the characteristics of a Trie tree, key-value pairs with the same prefix are effectively organized, reducing storage redundancy and improving space utilization. The target offset table makes memory access more contiguous, helping to improve cache hit rate, thereby improving overall system performance. In one or more embodiments of this disclosure, by comparing the prefix information of a determined reference key-value pair with the prefix information of the target key, the target key-value pair value can be accurately filtered.The specific implementation method is as follows: Determining the target key-value pair from the at least one initial key-value pair based on the number of initial key-value pairs, the target offset table, the target prefix table, and the target key includes: determining a reference key-value pair from the at least one initial key-value pair based on the number of initial key-value pairs and the target offset table, wherein the reference key-value pair is the key-value pair in the middle position after sorting the at least one initial key-value pair according to the number of initial key-value pairs and the target offset table; determining the prefix information of the reference key-value pair based on the reference key-value pair and the target prefix table; and determining the reference key-value pair as the target key-value pair if the prefix information matches the prefix information of the target key. The reference key-value pair can be understood as the key-value pair in the middle position determined after sorting at least one initial key-value pair according to the number of initial key-value pairs and the target offset table when performing a binary search. Specifically, the search operation can be performed using a binary search. First, the index of the last ordered key-value pair in the current leaf node is obtained using the last index. Then, the slot position of the midpoint key-value pair is located using the target offset table and the last index. Based on this slot position, the prefix information (Trie Key) of the reference key-value pair is obtained using the target prefix table. This prefix information is compared with the prefix information of the target key. If they match, the reference key-value pair is identified as the target key-value pair. In one or more embodiments of this disclosure, by adjusting the position of the reference key-value pair, the search range can be gradually narrowed, getting closer to the target key-value pair, avoiding unnecessary full searches, and greatly improving the efficiency of searching for target key-value pairs in large-scale data. The specific implementation method is as follows: After determining the prefix information of the reference key-value pair based on the reference key-value pair and the target prefix table, the method further includes: if the prefix information is inconsistent with the prefix information of the target key, determining the next reference key-value pair based on the number of the at least one initial key-value pair, the target offset table, and the position of the reference key-value pair in the sorted at least one initial key-value pair; determining the next reference key-value pair as the reference key-value pair, and continuing to execute the step of determining the prefix information of the reference key-value pair based on the reference key-value pair and the target prefix table.Specifically, the process first compares the prefix information of the reference key-value pair with that of the target key. If they match, the reference key-value pair is considered the target key-value pair. If they don't match, the search direction is determined based on the comparison result (prefix information greater than or less than the target key's prefix information): the search continues to the right or left of the reference key-value pair's position in at least one of the sorted initial key-value pairs. For example, if the prefix information is greater than the target key's prefix information, the search continues to the left of the reference key-value pair's position. Next, based on the new search direction, combined with the number of initial key-value pairs, the target offset table, and the position of the reference key-value pair, the position of the next reference key-value pair to be checked is located. Then, the prefix information of the new reference key-value pair is obtained again from the target prefix table and compared with the target key's prefix information. This process is iterated until a target key-value pair whose prefix information matches the target key's prefix information is found. In practical applications, taking a data query request as an example, this data processing method is explained in detail. A 64-bit atomic `acquire` (a memory sequence marker used to define the memory visibility characteristics of atomic operations; when performing an atomic operation, operations with `acquire` semantics ensure that memory operations preceding them are visible to all threads except the current thread; that is, after executing an `acquire` read operation, the current thread can observe the results of previous write operations) is used to read the 8-byte `High` and `Low` bytes of the leaf node. The index information in the data management area is parsed. If the recorded version information is different, a retry is performed; if the version information of the two parts is consistent, a data query operation is performed. Because the index information in the data management area composed of `High` and `Low` changes dynamically, and the slots recording KV addresses in the leaf nodes are append-only, insertion and deletion operations do not affect the validity of the index information obtained by the read operation. Based on the index information, the search operation can be performed using binary search. First, the index of the last ordered key-value pair of the current node is obtained through the last index. Then, the slot of the midpoint key-value pair is located using the offset table and the last index. The Trie key at the corresponding slot position in the prefix information table is compared with the Trie key of the target key. If they match, the actual key is compared. Probabilistically, the 5-bit Trie key can eliminate most false matches, thus improving the performance of the Trie. Then, the range of the binary search is adjusted according to the comparison result of the Trie key, and the search operation can be completed in at most four comparisons.When adding a new key-value pair (KV), the KV address is appended to an empty slot using the `Appendon I y` method. Deletion operations do not modify the slot content. In this case, the KV addresses in each slot are unordered. To improve search efficiency, an ordered index is constructed for the data mapping area using index information. For example, in a leaf node consisting of three KV pairs A(key1), B(key2), and C(key3), if key1 < key2 < key3, the offset table is 00 01 02; if key2 < key3 < key1, the offset table is 01 02 00. oWith this design, we can complete CRUD operations with at most 4 comparisons using binary search. To fully utilize memory, a 4-bit or 5-bit Trie key is reserved for each slot's KV, for a total of 12 slots. This means that a Trie key table (prefix information table) is cached with the Trie keys of all slots' KV values, using a maximum of 5 bits x 12 = 60 bits. Through this index, the Trie key can be retrieved within a single cache. Probabilistically, only keys that actually match will access the KV content; KV values from other slots can be excluded through the Trie key table, thus reducing the impact of cache misses on Trie performance. Furthermore, a 4-bit final index is used to record the index of the last ordered key-value pair of the current node, which is the last index of the offset table and the prefix information table. For example, when the final index is 2, the larger index is 2. At most two comparisons are needed to complete the CRUD operations. The final offset can also be used to quickly locate the insertion position when adding a node in Appendix I y. The data processing method provided in this disclosure improves data retrieval efficiency by utilizing the structural characteristics of the prefix tree and quickly narrowing the search range through prefix matching. Moreover, the target key-value pair can be locked in a finite number of iterations. Compared to exhaustive search, this method better utilizes computing resources, especially in distributed storage and cloud computing environments, reducing network transmission and computing costs.In one or more embodiments of this disclosure, the specific implementation method for data insertion is as follows: In response to a data insertion request, based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted, a target prefix tree corresponding to the target data is determined; the key to be inserted is searched from the root node of the target prefix tree, and a target branch node corresponding to the key to be inserted is determined; a leaf node of the key to be inserted is determined based on the target branch node, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, and the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area; the cache line corresponding to the at least one initial key-value pair and the index information is loaded, and the at least one initial key-value pair and the index information are obtained from the cache line; based on the index information, the key to be inserted and the data to be inserted are inserted into the data mapping area, and the index information is updated. In this context, a data insertion request can be understood as a request from an external system or user to add a new key-value pair (the data to be inserted and its corresponding key) to a data structure (here, a Trie tree). The data to be inserted is the specific data content to be added to the Trie tree, forming a key-value pair with the key to be inserted. The key to be inserted is the identifier of the data to be inserted, which allows the appropriate position in the Trie tree to be located for insertion. The target branch node is the node obtained by searching along the character sequence of the key to be inserted from the root node, reflecting the prefix information of the key to be inserted. Specifically, when a data insertion request is received, the target prefix tree to which the data should be inserted is first determined based on the data to be inserted and its corresponding key. Starting from the root node of the target prefix tree, the target branch node is determined by searching layer by layer through the key to be inserted, and then the corresponding leaf node of the key to be inserted is determined. Since the leaf node is designed to be consistent with the number of cache lines in bytes, memory access efficiency is ensured. Based on the index information provided by the data management area within the leaf node, the key to be inserted and the data to be inserted are inserted into the data mapping area, and the index information of the data management area is updated accordingly to reflect that the new key-value pair has been successfully added to the Trie tree, ensuring the validity and consistency of the entire data structure.The data processing method provided in this disclosure can directly insert key-value pairs into appropriate positions when the data mapping area is not full, and update index information in a timely manner, thereby achieving fast and direct insertion operations and improving the efficiency of data insertion. When the data mapping area is full, the original nodes are split by creating new branch nodes and leaf nodes, which effectively expands the data storage capacity. At the same time, the key-value pairs are reasonably classified and distributed to achieve load balancing and avoid performance bottlenecks caused by excessively large single nodes. The data processing method provided in this disclosure, by determining the target key of the target data from the data processing request, can quickly locate the corresponding leaf node based on the character sequence of the target key. By designing the size of the leaf node to be consistent with the cache line, it can make full use of the CPU cache and reduce memory access latency. While helping to make full use of hardware cache resources, it also minimizes the waste of invalid space in memory allocation. Furthermore, a data mapping area is set in the leaf node to store the initial key-value pairs, and the index information of the initial key-value pairs is stored in the data management area, making the management and retrieval of the target data more convenient and efficient. It can not only quickly locate the target data, but also, as shown in Figure 4, a flowchart of a data insertion method provided in an embodiment of this disclosure, specifically includes the following steps. Step 402: In response to the data insertion request, determine the target prefix tree corresponding to the data to be inserted based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted. Step 404: Locate the key to be inserted from the root node of the target prefix tree, determine the target branch node corresponding to the key to be inserted, and determine the leaf node of the key to be inserted based on the target branch node. The number of bytes used by the leaf node is consistent with the number of bytes in the corresponding cache line. The leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area. Step 406: Load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line. Step 408: Based on the index information, insert the key to be inserted and the data to be inserted into the data mapping area, and update the index information. For details, please refer to the above embodiment; further details will not be repeated here.In one or more embodiments of this disclosure, the step of inserting the key to be inserted and the data to be inserted into the data mapping area according to the index information, and updating the index information, includes: if it is determined according to the index information that the data mapping area is not full, inserting the key to be inserted and the data to be inserted into the data mapping area according to the index information, and updating the index information; if it is determined according to the index information that the data mapping area is full, creating a new branch node, and classifying the at least one initial key-value pair according to the prefix information table in the index information, classifying them into target key-value pairs and other key-value pairs, wherein the other key-value pairs are key-value pairs other than the target key-value pair among the at least one initial key-value pairs; creating a target leaf node under the new branch node, storing the other key-value pairs in the target branch node, storing the target key-value pair, the key to be inserted, and the data to be inserted in the new leaf node, and updating the index information of the data management area in the new branch node and the new leaf node. Specifically, there are two scenarios when inserting a new key-value pair into a Trie tree: If there is still space in the data mapping area of the current leaf node, the key-value pair to be inserted is directly inserted, and the index information is updated; if the data mapping area is full, a split operation is performed. First, the initial key-value pairs are classified according to their prefix information. If there are at least two corresponding key-value pairs in the prefix information, it is determined as the target key-value pair, and a new branch node and leaf node are created. The target key-value pair and other key-value pairs are stored in the new leaf node and the new branch node, respectively. The index information of the data management area in the created branch node and leaf node is updated to ensure that the subsequent lookup and management of these key-value pairs remains efficient and accurate. The data insertion method provided in this disclosure can directly insert key-value pairs into appropriate positions when the data mapping area is not full, and update index information in a timely manner, achieving fast and direct insertion operations and improving data insertion efficiency. When the data mapping area is full, the original nodes are split by creating new branch nodes and leaf nodes, effectively expanding the data storage capacity. At the same time, the key-value pairs are reasonably classified and distributed to achieve load balancing, avoiding performance bottlenecks caused by excessively large single nodes. Referring to Figure 5, Figure 5 shows a schematic diagram of a data deletion process provided in an embodiment of this disclosure, specifically including the following steps.When performing a deletion operation on a leaf node with at least two valid key-value pairs, the following process is followed: Since the key-value address is appended to an empty slot using an append-only method, the slot content is not modified during deletion. This method does not perform a traditional physical deletion operation; that is, it does not directly erase the key-value pair from the storage medium. Instead, it manages data validity at the logical level. Therefore, valid key-value pairs refer to those that are still recognized as valid by the system and have not been marked as deleted or expired. First, atomic operations are used to read the two 8-byte bytes (Hig and Low) of the leaf node in "acquire" mode. These two parts together form the index information of the data management area. This index information contains the version information of the leaf node. If the version information read from the two parts is inconsistent, the program will retry reading the two 8-byte bytes (Hig and Low) of the leaf node until consistent version information is read. Only then will the following operations be performed. After obtaining consistent version information, the next step is to attempt to acquire the lock of the leaf node. This lock is implemented based on the lock bit in the index information. Only the thread that successfully acquires the lock can become the sole writer of the current leaf node. Once the leaf node is successfully locked, a binary search is used to search for the key to be deleted within the leaf node. If the key to be deleted is not found, the lock is released and the result of deletion operation failure is returned. If the key to be deleted is found and its specific position in the leaf node index information is obtained, a new and updated index information is constructed. In the new version of the index information, the version information increments to indicate that this is an updated version of the index information, and the last valid index is decremented by one, reflecting the deletion of a key-value pair. Then, the data item corresponding to the index returned by the binary search is removed from the offset table and the prefix information table, but the last offset remains unchanged because it reflects the end position of the data area. The updated index information is encoded into two unsigned 64-bit integers, and then atomically updated using the "release" operation. Atomic updates via release tell the compiler and processor that this operation is not only atomic but should also "release" the memory effects of all previous operations, making these changes visible to other threads. In concurrent programming, it is often used in conjunction with the `acquire` operation to form a "release-acquire" synchronization mechanism, ensuring data consistency and synchronization.By updating the leaf node's index information using a re-ease method, it ensures that other threads can see the latest and correct values when reading this information, without affecting other threads (concurrent lookup operations on user data in the value node). The data is written back to the leaf node's 8-byte fields, High and Low, respectively. Thus, during the entire deletion process, only the portion of the leaf node used for metadata storage is atomically modified, while the value node area that actually stores user data remains unchanged. Therefore, even in a concurrent environment, other threads performing lookup operations will not be affected by the deletion operation. The data deletion method provided in this embodiment uses a lightweight locking mechanism. After successful locking, the thread becomes the sole writer of the current leaf node. This limits the number of threads performing write operations on the same leaf node simultaneously, protecting operations in critical areas while maintaining high concurrency. Furthermore, the deletion operation updates the index information and achieves logical deletion of key-value pairs by modifying corresponding entries in the offset table and prefix information table, without moving user data, reducing space overhead and the number of modifications to existing data. This effectively solves the data contention and consistency problems in high-concurrency environments, while ensuring efficient data structure lookup and updates, thus improving the overall system performance and stability. Referring to Figure 6, which illustrates another data deletion process provided in an embodiment of this disclosure, the specific steps include: In a scenario where only two valid key-value pairs remain in a leaf node, the deletion process is as shown in Figure 6: Similarly, atomic operations are used to read the two 8-byte values (Hig and Low) of the leaf node in "acquire" mode. These two parts together form the index information of the data management area. This index information contains the version information of the leaf node. If the version information read from the two parts is inconsistent, the program will retry reading the two 8-byte values (Hig and Low) of the leaf node until consistent version information is read, after which the following operations will be performed. The lock of the leaf node is acquired through the lock part of the index information. Successful locking indicates that the thread is the sole writer of the current leaf node. After successful locking, if the number of remaining nodes is equal to 2, and deletion is successful, the leaf node reclamation process is initiated.The key to be deleted is searched using a binary search. If it is not found, the lock is released and deletion fails. Otherwise, the index of the key to be deleted is obtained from the index information, and new index information is generated. The version information is set to 0xOF, indicating that the current leaf node is about to be recycled. It can be used for querying but cannot be modified. Then, it is encoded into two unsigned 64-bit integers and updated to the High and Low fields of the leaf node using a real ease method. Afterwards, the address of the remaining KV after deletion is stored in the corresponding slot of the upper-level branch node using CAS (Compare and Swap, a lock-free programming technique mainly used to implement atomic operations in a multi-threaded environment). Throughout the process, the query operation either sees the leaf node that is about to be recycled or sees the result modified by the CAS operation. This operation only atomically modifies the two 8 bytes of the High and Low parts. The value in the slot used to store user data will not be modified as long as it is visible on the Trie, thus not affecting the concurrent search operation. See Figure 7, which shows a schematic diagram of a data insertion process provided by an embodiment of this disclosure, specifically including the following steps. When there are remaining slots in the leaf node, the insertion process is as shown in Figure 7. Similarly, atomic operations are used to read the two 8-byte values (Hig and Low) of the leaf node in "acquire" mode. These two parts together form the index information of the data management area. This index information contains the version information of the leaf node. If the version information read from the two parts is inconsistent, the program will retry reading the two 8-byte values (Hig and Low) of the leaf node until consistent version information is read. Only then will the following operations be performed. The lock of the leaf node is acquired through the lock part of the index information. Successful locking indicates that the thread is the only writer of the current leaf node. Because the write operation in this operation is very light, only a one-bit spin lock is needed. After successful locking, a binary search is used to determine whether the key to be inserted already exists in the leaf node. If it exists, the lock is released, and the insertion failure is returned; otherwise, during the search, the position index of the first existing key-value pair greater than the key to be inserted is returned.The key-value (KV) address is stored in the slot at the last offset plus 1 of the current leaf node. Simultaneously, new index information is generated, mainly including incrementing version information (ensuring uniqueness for each operation), incrementing the last offset (pointing to the newly inserted KV address), and incrementing the last index. The last offset and the new node's Trie Key are inserted at the appropriate positions in the offset table and prefix information table (the index position returned by binary search). These are then encoded into two unsigned 64-bit integers and updated to the High and Low fields of the leaf node via re-ease. Throughout this process, only two 8-byte segments in the High and Low parts are atomically modified. The value stored in the slot for the user's KV address remains unchanged as long as it is visible on the Trie, thus not affecting concurrent query operations. See Figure 8, which illustrates another data insertion process according to an embodiment of this disclosure, specifically including the following steps. When the leaf nodes are full, the insertion process is as shown in Figure 8. Similarly, atomic operations are used to read the two 8-byte values (High and Low) of the leaf node in "acquire" mode. These two parts together form the index information of the data management area. This index information contains the version information of the leaf node. If the version information read from the two parts is inconsistent, the program will retry reading the two 8-byte values (High and Low) of the leaf node until consistent version information is read. Only then will the following operations be performed. The lock of the leaf node is acquired through the lock part of the index information. Successful locking indicates that the thread is the only writer of the current leaf node. After successful locking, if it is found that the last offset is already a large number of slots, it means that the current leaf node has no free slots to accept the newly inserted node. At this time, the node splitting function needs to be started. A new branch node is created. Each KV pair is classified according to the prefix information table in the current index information. If a Trie Key has only one KV pair, it is directly recorded in the slot corresponding to the new branch Trie Key. If more than one key-value pair shares the same Trie Key, a new leaf node is created for these key-value pairs, and the keys are stored in the new leaf node in order. Since the original leaf node was locked during the splitting process, the thread holding the lock is the only executor capable of making modifications.At this point, the pointer in the parent node (Branch Node) pointing to the original leaf node will not be changed by other query operations during the splitting process. Therefore, after the leaf node splitting is completed, a CAS operation can be used to atomically change the pointer in the parent node pointing to the old leaf node to point to the newly created branch node, thus smoothly completing the leaf node splitting and new node insertion operations without blocking any query operations. Corresponding to the above method embodiment, this disclosure also provides a data processing device embodiment. Figure 9 shows a schematic diagram of the structure of a data processing device provided in an embodiment of this disclosure. As shown in Figure 9, the device includes: a response module 902, configured to respond to a data processing request and determine a target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request; a determination module 904, configured to search for the target key from the root node of the target prefix tree and determine the leaf node corresponding to the target key, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, and the leaf node includes a data mapping area and a data management area, wherein the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; a loading module 906, configured to load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line; and an obtaining module 908, configured to determine the target data from the at least one initial key-value pair based on the index information and the target key, and perform data processing on the target data according to the data processing request to obtain a data processing result. Optionally, the obtaining module 908 is further configured to: obtain the first leaf node version identifier from the first index information and the second leaf node version identifier from the second index information; and determine the target data from the at least one initial key-value pair based on the first leaf node version identifier, the second leaf node version identifier, the first index information, the second index information, and the target key.Optionally, the obtaining module 908 is further configured to: when the first leaf node version identifier and the second leaf node version identifier are consistent, determine the target data from the at least one initial key-value pair according to the index information and the target key; when the first leaf node version identifier and the second leaf node version identifier are inconsistent, continue to execute the steps of obtaining the first leaf node version identifier from the first index information and obtaining the second leaf node version identifier from the second index information. Optionally, the obtaining module 908 is further configured to: determine the target key-value pair from the at least one initial key-value pair according to the number of initial key-value pairs, the target offset table, the target prefix table, and the target key; when the key in the target key-value pair is consistent with the target key, determine the value in the target key-value pair as the target data. Optionally, the obtaining module 908 is further configured to: determine a reference key-value pair from the at least one initial key-value pair according to the number of initial key-value pairs and the target offset table, wherein the reference key-value pair is the key-value pair in the middle position after sorting the at least one initial key-value pair according to the number of initial key-value pairs and the target offset table; determine the prefix information of the reference key-value pair according to the reference key-value pair and the target prefix table; and determine the reference key-value pair as the target key-value pair if the prefix information is consistent with the prefix information of the target key. The apparatus further includes: a lookup module, configured to, if the prefix information is inconsistent with the prefix information of the target key, determine a next reference key-value pair according to the number of the at least one initial key-value pair, the target offset table, and the position of the reference key-value pair in the sorted at least one initial key-value pair; determine the next reference key-value pair as the reference key-value pair, and continue executing the step of determining the prefix information of the reference key-value pair according to the reference key-value pair and the target prefix table. Optionally, the response module 902 is further configured to: when the number of initial prefix trees is determined to be one, determine the initial prefix tree as the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request; or when the number of initial prefix trees is determined to be multiple, determine the attribute information of the target key based on the target key of the target data carried in the data processing request, and determine the target prefix tree corresponding to the target data from the multiple initial prefix trees based on the attribute information of the target key.The apparatus further includes: an insertion module configured to, in response to a data insertion request, determine a target prefix tree corresponding to the target data based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted; search for the key to be inserted from the root node of the target prefix tree, determine the target branch node corresponding to the key to be inserted, and determine the leaf node of the key to be inserted based on the target branch node, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, and the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores index information of the initial key-value pair in the data mapping area; load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line; insert the key to be inserted and the data to be inserted into the data mapping area according to the index information, and update the index information. The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing device and the technical solution of the aforementioned data processing method belong to the same concept. Details not described in detail in the technical solution of the data processing device can be found in the description of the technical solution of the aforementioned data processing method. Corresponding to the above method embodiments, this disclosure also provides a data insertion device embodiment. Figure 10 shows a schematic diagram of the structure of a data insertion device provided in one embodiment of this disclosure. As shown in Figure 10, the device includes: a response module 1002, configured to, in response to a data insertion request, determine a target prefix tree corresponding to the data to be inserted based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted; a determination module 1004, configured to search for the key to be inserted from the root node of the target prefix tree and determine the leaf node corresponding to the key to be inserted, wherein the number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line, the leaf node includes a data mapping area and a data management area, the data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area; a loading module 1006, configured to load the at least one initial key-value pair and the cache line corresponding to the index information, and obtain the at least one initial key-value pair and the index information from the cache line; and an insertion module 1008, configured to, according to the index information, insert the key to be inserted and the data to be inserted into the data mapping area, and update the index information.Optionally, the insertion module 1008 is further configured to: when it is determined according to the index information that the data mapping area is not full, insert the key to be inserted and the data to be inserted into the data mapping area according to the index information, and update the index information. Optionally, the insertion module 1008 is further configured to: when it is determined according to the index information that the data mapping area is full, create a new branch node, and classify the at least one initial key-value pair according to the prefix information table in the index information, classifying them into target key-value pairs and other key-value pairs, wherein the other key-value pairs are the key-value pairs other than the target key-value pairs among the at least one initial key-value pairs; create a target leaf node under the new branch node, store the other key-value pairs in the target branch node, store the target key-value pair, the key to be inserted, and the data to be inserted in the new leaf node, and update the index information of the data management area in the new branch node and the new leaf node. The above is an illustrative scheme of a data insertion device in this embodiment. It should be noted that the technical solution of this data insertion device and the technical solution of the aforementioned data insertion method belong to the same concept. Details not described in detail in the technical solution of the data insertion device can be found in the description of the technical solution of the aforementioned data insertion method. Figure 11 shows a structural block diagram of a computing device 1100 according to an embodiment of this disclosure. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data. The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet.Access device 1140 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX (World Wide Interface for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface. In one embodiment of this disclosure, the aforementioned components of computing device 1100, as well as other components not shown in FIG. 11, may also be interconnected, for example, via a bus. It should be understood that the computing device block diagram shown in FIG. 11 is merely for illustrative purposes and is not intended to limit the scope of this disclosure. Those skilled in the art may add or replace other components as needed. The computing device 1 100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1 100 can also be a mobile or stationary server. The processor 1 120 is used to execute a computer program / instructions that, when executed by the processor, implement the steps of the above-described data processing method. The various embodiments in this disclosure are described in a progressive manner; similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computing device embodiments are basically similar to the data processing method embodiments, so the description is relatively simple; relevant parts can be referred to in the description of the data processing method embodiments.This disclosure also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above. The various embodiments in this disclosure are described in a progressive manner; similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computer-readable storage medium embodiment is basically similar to the data processing method embodiment, so the description is relatively simple; relevant parts can be referred to the description of the data processing method embodiment. This disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above. The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above data processing method belong to the same concept. Details not described in detail in the technical solution of the computer program product can be referred to the description of the technical solution of the above data processing method. Specific embodiments of this disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous. The computer instructions include computer program code, which may be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this disclosure are not limited to the described order of actions, because according to the embodiments of this disclosure, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this disclosure. In the above embodiments, the descriptions of each embodiment have different focuses; for parts not described in detail in a certain embodiment, refer to the relevant descriptions of other embodiments. The preferred embodiments of this disclosure disclosed above are only used to help illustrate this disclosure. Optional embodiments do not describe all details exhaustively, nor do they limit the invention to the specific implementation described. Obviously, many modifications and variations can be made based on the content of the embodiments of this disclosure. This disclosure selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this disclosure, so that those skilled in the art can well understand and utilize this disclosure. This disclosure is only limited by the claims and their full scope and equivalents.
Claims
Claims 1. A data processing method, comprising: In response to a data processing request, a target prefix tree corresponding to the target data is determined based on the target key of the target data carried in the data processing request. The target key is found from the root node of the target prefix tree, and the leaf node corresponding to the target key is determined. The number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line. The leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area. Load the cache line corresponding to the at least one initial key-value pair and the index information, and obtain the at least one initial key-value pair and the index information from the cache line; Based on the index information and the target key, the target data is determined from the at least one initial key-value pair, and the target data is processed according to the data processing request to obtain the data processing result.
2. The data processing method according to claim 1, wherein the data management area includes a first data management area and a second data management area, the first data management area stores first index information of the initial key-value pairs in the data mapping area, the first index information including a first leaf node version identifier, the second data management area stores second index information of the initial key-value pairs in the data mapping area, the second index information including a second leaf node version identifier; the step of determining the target data from the at least one initial key-value pair according to the index information and the target key includes: Obtain the first leaf node version identifier from the first index information, and obtain the second leaf node version identifier from the second index information; The target data is determined from the at least one initial key-value pair based on the first leaf node version identifier, the second leaf node version identifier, the first index information, the second index information, and the target key.
3. The data processing method according to claim 2, wherein determining the target data from the at least one initial key-value pair based on the index information and the target key comprises: If the first leaf node version identifier and the second leaf node version identifier are consistent, the target data is determined from the at least one initial key-value pair according to the index information and the target key; if the first leaf node version identifier and the second leaf node version identifier are inconsistent, the steps of obtaining the first leaf node version identifier from the first index information and obtaining the second leaf node version identifier from the second index information are continued.
4. The data processing method according to any one of claims 1-3, wherein the index information includes the number of initial key-value pairs, a target offset table, and a target prefix table; 25 Determining the target data from the at least one initial key-value pair based on the index information and the target key includes: Based on the number of initial key-value pairs, the target offset table, the target prefix table, and the target key, a target key-value pair is determined from the at least one initial key-value pair. If the key in the target key-value pair matches the target key, the value in the target key-value pair is determined as the target data.
5. The data processing method according to claim 4, wherein determining the target key-value pair from the at least one initial key-value pair based on the number of initial key-value pairs, the target offset table, the target prefix table, and the target key comprises: Based on the number of initial key-value pairs and the target offset table, a reference key-value pair is determined from the at least one initial key-value pair, wherein the reference key-value pair is the key-value pair in the middle position after sorting the at least one initial key-value pair according to the number of initial key-value pairs and the target offset table; based on the reference key-value pair and the target prefix table, the prefix information of the reference key-value pair is determined; if the prefix information is consistent with the prefix information of the target key, the reference key-value pair is determined as the target key-value pair.
6. The data processing method according to claim 5, after determining the prefix information of the reference key-value pair based on the reference key-value pair and the target prefix table, further includes: If the prefix information is inconsistent with the prefix information of the target key, the next reference key-value pair is determined based on the number of the at least one initial key-value pair, the target offset table, and the position of the reference key-value pair in the sorted at least one initial key-value pair. Once the next reference key-value pair is determined as the reference key-value pair, the step of determining the prefix information of the reference key-value pair based on the reference key-value pair and the target prefix table continues.
7. The data processing method according to any one of claims 1-6, wherein in response to a data processing request, determining a target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request includes: If the number of initial prefix trees is determined to be one, the initial prefix tree is determined as the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request; Alternatively, if the number of initial prefix trees is determined to be multiple, the attribute information of the target key is determined based on the target key of the target data carried in the data processing request, and the target prefix tree corresponding to the target data is determined from the multiple initial prefix trees based on the attribute information of the target key.
8. The data processing method according to any one of claims 1-7, wherein the data processing request includes any one of the following requests: a data query request, a data deletion request, and a data modification request.
9. A data insertion method, comprising: In response to a data insertion request, the target prefix tree corresponding to the data to be inserted is determined based on the data to be inserted carried in the data insertion request and the insertion key corresponding to the data to be inserted. The process begins by locating the key to be inserted from the root node of the target prefix tree, determining the target branch node corresponding to the key, and then determining the leaf node of the key based on the target branch node. The leaf node uses the same number of bytes as the corresponding cache line. Each leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pairs in the data mapping area. The process then loads the cache line corresponding to the at least one initial key-value pair and the index information, and retrieves the at least one initial key-value pair and the index information from the cache line. Finally, based on the index information, the key to be inserted and the data to be inserted are inserted into the data mapping area, and the index information is updated.
10. The data insertion method according to claim 9, wherein inserting the key to be inserted and the data to be inserted into the data mapping area according to the index information, and updating the index information, comprises: If it is determined from the index information that the data mapping area is not full, the key to be inserted and the data to be inserted are inserted into the data mapping area according to the index information, and the index information is updated.
1. The data insertion method according to claim 9 or 10, wherein inserting the key to be inserted and the data to be inserted into the data mapping area according to the index information, and updating the index information, comprises: If the data mapping area is determined to be full based on the index information, a new branch node is created, and the at least one initial key-value pair is classified according to the prefix information table in the index information into target key-value pairs and other key-value pairs, wherein the other key-value pairs are the key-value pairs other than the target key-value pairs among the at least one initial key-value pairs; a target leaf node is created under the new branch node, the other key-value pairs are stored in the target branch node, the target key-value pair, the key to be inserted, and the data to be inserted are stored in the new leaf node, and the index information of the data management area in the new branch node and the new leaf node is updated.
12. A data processing apparatus, comprising: The response module is configured to respond to a data processing request by determining the target prefix tree corresponding to the target data based on the target key of the target data carried in the data processing request. The determination module is configured to search for the target key from the root node of the target prefix tree and determine the leaf node corresponding to the target key. The number of bytes used by the leaf node is consistent with the number of bytes of the corresponding cache line. The leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area. The loading module is configured to load the cache corresponding to the at least one initial key-value pair and the index information. The system retrieves at least one initial key-value pair and the index information from the cached line; the obtaining module is configured to determine the target data from the at least one initial key-value pair based on the index information and the target key, and perform data processing on the target data according to the data processing request to obtain the data processing result.
13. A data insertion device, comprising: The response module is configured to, in response to a data insertion request, determine the target prefix tree corresponding to the data to be inserted based on the data to be inserted carried in the data insertion request and the key to be inserted corresponding to the data to be inserted. The determination module is configured to search for the key to be inserted from the root node of the target prefix tree, determine the target branch node corresponding to the key to be inserted, and determine the leaf node of the key to be inserted based on the target branch node. The leaf node uses the same number of bytes as the corresponding cache line. The leaf node includes a data mapping area and a data management area. The data mapping area stores at least one initial key-value pair, and the data management area stores the index information of the initial key-value pair in the data mapping area. The loading module is configured to load the cache line corresponding to the at least one initial key-value pair and the index information, and to obtain the at least one initial key-value pair and the index information from the cache line; The insertion module is configured to insert the key to be inserted and the data to be inserted into the data mapping area according to the index information, and update the index information.
14. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 11.
15. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11.
16. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11. 28
Citation Information
Patent Citations
Learning type indexing method and system based on time sequence data features
CN116881243A
Method of maintaining data consistency
US20160357673A1
Cache sensitive search (CSS) tree indexing system and method
US6711562B1
Cited By
Method for quickly retrieving messages in message queue
CN121658433A