Data processing method and apparatus
By migrating the server CPU load to the smart network interface card processor, the performance bottleneck and bandwidth utilization issues of RDMA memory key-value databases in high-concurrency scenarios are resolved, achieving efficient data storage and access.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2026-03-27
AI Technical Summary
Traditional RDMA-based in-memory key-value databases suffer from issues such as server node CPU processing bottlenecks, complex access protocol implementations and multiple network round-trip overheads, and low hardware bandwidth utilization efficiency in high-concurrency scenarios, making it difficult to meet the needs of efficient data storage and access.
By migrating the server's CPU load to the FPGA processor in the smart network interface card (NIC), the smart NIC handles the client's data operation requests, using a single network round trip. The smart NIC abstracts database access, reducing the server's CPU pressure, and the data operation process is optimized through the index module and execution engine module.
It effectively reduces the processing pressure on the server CPU, maximizes the use of network bandwidth, improves access throughput, reduces data copying and network transmission overhead, and supports efficient data access in high-concurrency scenarios.
Smart Images

Figure CN117785997B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, and particularly relates to a data processing method and device. BACKGROUND
[0002] A key-value database (KV-store, referred to as KVS) is a new type of non-relational database (NoSQL database), which mainly stores data in the form of key-value pairs. In terms of data storage, the key-value database is more flexible than the traditional relational database; in terms of access interface, the key-value database uses simple data access interfaces such as writing (PUT) and reading (GET) to meet a large number of business requirements, and therefore, the key-value database is widely used in various fields.
[0003] With the rapid development of the Internet, the network usage presents an explosive growth, and the access pressure of the database is increasing. For high-concurrency access scenarios of the database, such as simultaneous access of hundreds or thousands of users, the performance of the database will be reduced. Therefore, how to improve the performance of the key-value database is a problem to be solved at present. SUMMARY
[0004] In order to solve the above technical problems, the present disclosure provides a data processing method and device.
[0005] In a first aspect, the present disclosure provides a data processing method, comprising:
[0006] receiving, by a network card module in an intelligent network card, a data operation request sent by a client;
[0007] calling a request analysis module in the intelligent network card to analyze the data operation request to obtain to-be-processed data and data operation type information, and inputting the to-be-processed data and the data operation type information to an execution engine module in the intelligent network card;
[0008] calling the execution engine module to execute a data operation indicated by the data operation type information based on the to-be-processed data to obtain a data operation result;
[0009] calling the request analysis module to encapsulate the data operation result to obtain a response of the data operation request, and sending the response of the data operation request to the client through the network card module.
[0010] In a second aspect, the present disclosure provides a data processing device, comprising:
[0011] a network card module, configured to receive a data operation request sent by a client;
[0012] The request analysis module is configured to analyze the received data operation request to obtain to-be-processed data and data operation type information, and input the to-be-processed data and the data operation type information to the execution engine module;
[0013] The execution engine module is configured to perform a data operation indicated by the data operation type information based on the to-be-processed data to obtain a data operation result;
[0014] The request analysis module is further configured to encapsulate the data operation result to obtain a response to the data operation request.
[0015] The network card module is further configured to send the response to the data operation request to the client.
[0016] In a third aspect, the present disclosure provides an electronic device, comprising a memory and a processor.
[0017] The memory is configured to store computer program instructions.
[0018] The processor is configured to execute the computer program instructions, so that the electronic device implements the data processing method according to the first aspect.
[0019] In a fourth aspect, the present disclosure provides a readable storage medium, comprising computer program instructions, and at least one processor of an electronic device executes the computer program instructions, so that the electronic device implements the data processing method according to the first aspect.
[0020] In a fifth aspect, the present disclosure provides a computer program product, which, when executed by an electronic device, causes the electronic device to implement the data processing method according to the first aspect.
[0021] The present disclosure provides a data processing method and device, wherein the method comprises: receiving, by a network card module in an intelligent network card, a data operation request sent by a client; calling a request analysis module in the intelligent network card to obtain to-be-processed data and data operation type information from the data operation request, and inputting the to-be-processed data and the data operation type information to an execution engine module in the intelligent network card; performing, by the execution engine module, a data operation indicated by the data operation type information based on the to-be-processed data to obtain a data operation result; calling the request analysis module to encapsulate the data operation result to obtain a response to the data operation request, and sending, by the network card module, the response to the data operation request to the client. By migrating some workloads of a CPU of a server to the intelligent network card, the intelligent network card processes the data operation request sent by the client, and the intelligent network card presents an access abstraction to a database to the client node, without requiring the server CPU to participate in processing of the data operation request, thereby effectively reducing the processing pressure of the CPU of the server. BRIEF DESCRIPTION OF DRAWINGS
[0022] The accompanying drawings, which are incorporated herein and constitute part of this specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the description herein.
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure or the prior art, the drawings required to be used in the embodiments or the prior art description will be briefly introduced as follows. Obviously, those skilled in the art can obtain other drawings according to these drawings without any creative effort.
[0024] Figure 1 A schematic diagram of a framework of a data processing system according to an embodiment of the present disclosure is provided.
[0025] Figure 2 A data structure diagram of a data operation request / response according to an embodiment of the present disclosure is provided.
[0026] Figure 3 A schematic diagram of a flow of a data processing method according to an embodiment of the present disclosure is provided.
[0027] Figure 4 A schematic diagram of a framework of a data processing system according to another embodiment of the present disclosure is provided.
[0028] Figure 5 A schematic diagram of a framework of a hash index mechanism according to an embodiment of the present disclosure is provided.
[0029] Figure 6 A data structure diagram of an index slot in an index structure according to an embodiment of the present disclosure is provided.
[0030] Figure 7 A schematic diagram of a flow of a data processing method according to another embodiment of the present disclosure is provided.
[0031] Figure 8 A schematic diagram of a data storage manner according to an embodiment of the present disclosure is provided.
[0032] Figure 9 A schematic diagram of a structure of a data processing system according to an embodiment of the present disclosure is provided.
[0033] Figure 10 A schematic diagram of a memory management mechanism adopted by a memory allocator according to an embodiment of the present disclosure is provided.
[0034] Figure 11 A schematic diagram of a structure of a data processing system according to another embodiment of the present disclosure is provided.
[0035] Figure 12 A schematic diagram of a structure of a data relay station according to an embodiment of the present disclosure is provided.
[0036] Figure 13 A flowchart of a data processing method according to another embodiment of the present disclosure is shown in FIG. 6.
[0037] Figure 14 A flowchart of a data processing method according to another embodiment of the present disclosure is shown in FIG. 6.
[0038] Figure 15 A flowchart of a data processing method according to another embodiment of the present disclosure is shown in FIG. 6. DETAILED DESCRIPTION
[0039] In order to enable a more thorough understanding of the above-mentioned objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0040] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present disclosure, but the present disclosure can also be implemented in other manners different from those described herein; obviously, the embodiments described in the specification are only a part of the embodiments of the present disclosure, and not all the embodiments.
[0041] KVS has been widely used in many fields due to its unique advantages. At present, in order to support higher performance data storage and access, deploying business and application in the memory key value database has become a new solution.
[0042] With the rapid development of distributed system design, distributed memory key value database has become a new research hotspot. Distributed memory key value database transmits data through network, and allows data to be stored on multiple nodes, which not only provides larger key value data pair storage space, but also has more flexible expansion capability (i.e. dynamically adding or deleting storage service nodes).
[0043] Remote Direct Memory Access (RDMA) technology has the characteristics of high bandwidth and low delay, which is consistent with the goal of KVS pursuing high throughput and low delay. In addition, RDMA technology supports not only the bilateral message semantics similar to the traditional socket network transmission mechanism, but also the unilateral memory semantics.
[0044] Among them, the main interaction process of data processing using bilateral message semantics is as follows: the client node sends an operation request to the server node, the server node executes the corresponding PUT / GET data operation locally, and returns the operation result to the client node. After the client node receives the result feedback by the server node, the operation is completed.
[0045] In the single-sided memory semantics, the client can directly read and write the memory space of the server in a server-bypass manner. The single-sided memory semantics provides a more convenient way for the distributed system to build a shared memory and a load / store-like application program interface (API). The main interaction process of data processing using the single-sided memory semantics is as follows: for the GET operation, the RDMA READ action is used to complete the reading of the key-value pair data; for the PUT operation, the RDMA ATOMIC, RDMA WRITE and RDMA READ actions need to be reasonably combined to support consistent data writing. In the single-sided memory semantics scenario, the server node needs to participate in data storage and initial communication establishment, and basically does not need to respond on the subsequent key data path.
[0046] The memory KVS based on the double-sided message semantics and the single-sided memory semantics has respective advantages. The double-sided message semantics can support more flexible and rich interface definition (because the data operation process can be hidden from the user side), and the single-sided memory semantics can realize more rapid and efficient data access in a single network round trip (RTT).
[0047] However, the traditional RDMA-based memory key value database at least has the following problems:
[0048] 1. CPU processing bottleneck problem of the server node.
[0049] The memory key-value database based on the bilateral message semantic RPC mechanism needs to send operation requests to the server node, and the CPU of the server node is responsible for executing specific data storage logic and returning the data operation result to the client. This processing mechanism will cause the CPU of the server node to become a performance bottleneck on the critical path in a high concurrency scenario (such as hundreds or even thousands of clients accessing simultaneously), and thus a high tail latency can be generated. This is not only due to the multi-core frequency limitation of a single server, but also related to the interaction mode of the CPU and the network card. The CPU of the server node not only needs to prepare a receive request work (RECV WR) and be responsible for polling the completion queue (CQ) for each data operation request of the client node, but also needs to process the operation request, copy data, prepare a send work request (SEND WR), and the like, which generates a lot of additional access overhead. In addition, since the CPU of the server node is the core device for executing KVS access, it is necessary to deploy more expensive and efficient CPU components and adaptive mainboards and the like on the server. This deviates from the storage separation architecture idea (i.e., the calculation resource and the storage resource are decoupled, and the storage node can focus on data storage) advocated in the current cloud computing field, and it is difficult to control the total cost of ownership (TCO) of the storage node.
[0050] 2. Complex KVS access protocol implementation and multiple network round-trip overheads.
[0051] The memory key-value database based on the unilateral memory semantic allows the client to perform index query and locate the memory address of the corresponding key-value pair data in the server node, and complete the GET / PUT operation through READ and WRITE actions. However, this not only requires the client node to cache the index structure of the key-value pair data of the server node, but also puts forward higher challenges to the consistency of concurrent operations: the traditional server node centralized consistency guarantee mechanism needs to be upgraded to a distributed consistency guarantee, which is more complex and more difficult to ensure correctness. Moreover, even if the data write operation supporting consistency is supported by combining multiple WRITE, ATOMIC, READ operations, there are also multiple network round-trip overheads. Due to the lack of transaction support, the memory level abstraction provided by RDMA is not suitable for building an efficient KVS.
[0052] 3. Low utilization efficiency of hardware bandwidth, and throughput performance bottleneck.
[0053] Hardware bandwidth such as network card line speed, PCIe bandwidth, memory bandwidth, etc. determines the upper limit of the memory key value database access. As mentioned above, both the memory key value database system based on bilateral message semantics and unilateral memory semantics have performance bottlenecks (CPU processing bottleneck, multiple network round trips). This makes them unable to efficiently use the bandwidth resources of the hardware. For example, when the CPU becomes a processing bottleneck, the memory bandwidth and the network bandwidth are wasted; when the network round trip becomes a bottleneck, the PCIe bandwidth and the network bandwidth are wasted. Naturally, bandwidth waste will lead to a bottleneck in throughput, which cannot support the construction of an efficient memory key value database in an ideal state.
[0054] With the continuous development of Internet technology, network cards (NICs) supporting RDMA technology, such as RoCE, Inifiniband HCA, etc., are gradually popularized in network deployment. At the same time, another evolution trend of hardware acceleration is emerging in data centers. More and more data center servers are equipped with smart network cards (SmartNIC, also known as programmable network cards). The core component of the smart network card is a field programmable gate array (FPGA) with an embedded network card chip to connect to the network and a PCIe connector to connect to the server (host).
[0055] Therefore, the data processing method provided by the present disclosure migrates some workloads of the CPU of the server to the smart network card, uses the FPGA in the smart network card as a processor chip to process the data operation request sent by the client, and presents the KVS access abstraction to the client node through the smart network card, without requiring the CPU of the server to participate in the processing process of the data operation request, effectively reducing the processing pressure of the CPU of the server. In addition, the PUT / GET operation supports one network round trip operation delay, which maximizes the use of network bandwidth to improve access throughput. It should be noted that the data processing method provided by the present disclosure is also applicable to databases with similar problems.
[0056] Next, the data processing method provided by the present disclosure will be described in detail through some embodiments in combination with the drawings and scenarios. The data processing method can be executed by the data processing device provided by the present disclosure, which can be realized by any software and / or hardware, for example, it can be a software system. In the following embodiments, the data processing device is taken as a data processing system, and the database deployed in the server is taken as a memory key value database.
[0057] Figure 1 The architecture schematic diagram of the data processing system provided by an embodiment of the present disclosure is shown in FIG. 1. Please refer to FIG. 1. Figure 1As shown, the data processing system 100 is deployed in a smart NIC, and the data processing system 100 can access and operate a database in the memory of a server. Among them, the NIC module in the smart NIC is mainly used to receive the data operation request sent by the client and send it to the corresponding module of the data processing system 100, and the response generated by the data processing system 100 is transmitted to the client.
[0058] Among them, the data processing system 100 can include a request analysis module 101 and an execution engine module 102. The request analysis module 101 is mainly used to analyze, identify and encapsulate and deliver the data operation request transmitted by the NIC module in the smart NIC. Among them, the request analysis module 101 can include a request decoder 101a and a request encoder 101b, the request decoder 101a is mainly used to obtain the data operation request sent by the client from the NIC module for analysis and identification; the request encoder 101b is mainly used to encapsulate the data operation result delivered by the execution engine module 102 to obtain the response of the data operation request and deliver it to the NIC module, and the response is fed back to the client through the NIC module.
[0059] The execution engine module 102 is mainly used to perform corresponding actions (such as write / read / delete data operations, etc.) according to the data operation type indicated by the data operation request sent by the client, and deliver the data operation result to the request analysis module 101. The execution engine module 102 can interact with the memory of the server to realize the operation on the key-value pair data.
[0060] As a possible implementation, the request decoder 101a and the request encoder 101b in the request analysis module 101 can share the same data structure, that is, the data operation request and the data operation result can share the same data structure. Please refer to Figure 2 As shown, Figure 2 The schematic diagram of the data structure shared by the data operation request / response is exemplarily shown.
[0061] Among them, the data operation request / response can include one or more of transaction identification information, the number of total requests / responses constituting this transaction, the order information of this request among all requests / responses, the data operation type, the total length of the key corresponding to this transaction, the total length of the value of this transaction, the length of the key contained in this request / response, the length of the value contained in this request / response, the field used to accommodate all or part of the key data of this transaction, the field used to accommodate all or part of the value data of this transaction, and the check information.
[0062] In the embodiments of the present disclosure, the data size of the data operation request / response is not limited, such as 32 bytes, 64 bytes, 128 bytes, etc., and exemplarily, Figure 2In the illustrated embodiment, the data operation request / response can be exemplified by taking a 64-byte size as an example. Specifically, it can include a 4-byte TxID field (referring to a globally unique transaction ID, which can be specified by a user), a 2-byte Num field (indicating the total number of requests / responses constituting this transaction, so that variable-length keys and values can be handled), a 2-byte Seq field (indicating the order of this request / response in all requests / responses of this transaction, for data splicing after all requests or responses are received), a 2-byte Opcode field (indicating the data operation type, such as read / write / delete, etc.), a 2-byte Tkey_len field (indicating the total length of the key of this transaction, which can span multiple requests), a 2-byte Tvalue_len field (indicating the total length of the value of this transaction, which can span multiple requests / responses), a 1-byte Key_len field (the length of the key contained in this request), a 1-byte Value_len field (the length of the value contained in this request / response), a 16-byte Key field (containing all or part of the key data of this transaction), a 24-byte Value field (containing all or part of the value data of this transaction), and an 8-byte Checksum field (i.e., check information, which can be the checksum of a single request, used to check the integrity and accuracy of the request / response data after network transmission).
[0063] Figure 3 A flowchart of a data processing method provided by an embodiment of the present application is shown. Referring to Figure 3 The method provided by the embodiment includes:
[0064] S301, receiving, by a network card module in an intelligent network card, a data operation request sent by a client.
[0065] S302, calling a request analysis module in the intelligent network card to parse the data operation request to obtain to-be-processed data and data operation type information, and inputting the to-be-processed data and the data operation type information to an execution engine module in the intelligent network card.
[0066] In combination with Figure 1 The network card module of the intelligent network card can receive a data operation request sent by a client, and transmit the data operation request to a request decoder, which parses the data operation request to obtain data operation type, key-value pair data, and other information in the data structure corresponding to the data operation request.
[0067] In some embodiments, a client can send a separate data operation request to a data processing system. Accordingly, the request decoder of the data processing system can obtain information therein by parsing the separate data operation request, and perform corresponding actions.
[0068] In some embodiments, the client can send multiple data operation requests to the data processing system, so that the data processing system performs corresponding actions on the super-long key-value pair data by aggregating the multiple data operation requests. For example, in combination with the data structure shown in Figure 2 The request decoder of the data processing system can parse the multiple data operation requests to obtain the TxID field, Seq field, Checksum field, and the like in each data operation request, identify whether the multiple data operation requests belong to the same transaction based on the TxID, restore the order of the data operation requests based on the Seq field, and check data consistency based on the Checksum field, so as to implement data operation on the super-long key-value pair data. In this case, the request decoder can parse multiple data operation requests with the same transaction identifier to obtain multiple Key fields, and concatenate the multiple Key fields in the order indicated by the Seq field to obtain the to-be-processed data corresponding to the transaction. In addition, the data operation types indicated in the data operation requests with the same transaction identifier are consistent. It should be noted that if the Value field is required to execute the data operation request, the parsed Value field can also be concatenated in the above manner.
[0069] S303, obtaining a data operation result by invoking the execution engine module in the intelligent network card to perform a data operation indicated by the data operation type information based on the to-be-processed data.
[0070] The data operation request can be a data read request, a data write request, or a data deletion request. The execution engine module of the data processing system can perform a read operation, a write operation, or a deletion operation based on the data operation type indicated by the data operation request, and obtain a corresponding data operation result.
[0071] If the data operation request is a data read request, the data operation result obtained by the execution engine module can be target data (such as value data) indicated by the to-be-processed data. If the data operation request is a data write operation, the data operation result obtained by the execution engine module can be information about success / failure of the write operation. If the data operation request is a data deletion request, the data operation result obtained by the execution engine module can be information about success / failure of the deletion operation.
[0072] S304, encapsulating the data operation result by invoking the request analysis module to obtain a response to the data operation request.
[0073] The request encoder can fill the data operation result into a specified field of the data structure corresponding to the data operation request to obtain the response.
[0074] For example, in the data structure of the embodiment shown in Figure 2
[0075] Exemplarily, if the data operation request is a data read request, the read value data (i.e., the data operation result) can be filled into the Value field in the data structure corresponding to the data operation request to obtain a response of the data operation request.
[0076] As a possible implementation, if the data read request is an operation on the super-long key-value pair data, the data amount of the read value data can be large. Since the size of the corresponding field in the data operation request cannot meet the data amount of the read value data, multiple response structures can be created according to the data amount of the read value data to meet the read value data.
[0077] For example, in combination with the data structure shown in Figure 2 The value field is 24 bytes. If the read value data is less than 24 bytes, the read value data can be written into the value field. If the read value data is greater than 24 bytes, multiple required response structures can be created, and the read value data can be written into the value fields corresponding to the multiple response structures, respectively.
[0078] If the data operation request is a data write request or a data deletion request, the request encoder can modify the field (Opcode field) in the data structure shown in Figure 2 to ack / null, which represents the success / failure of the write / deletion operation. The ack can represent the success of the write / deletion operation, and the null can represent the failure of the write / deletion operation.
[0079] It should be noted that the implementation mode of the multiplexed data structure shown herein is only an example, and the data structure of the request / response and the multiplexing mode can also be implemented by other modes, which are not limited by the present disclosure.
[0080] S305, sending the response of the data operation request to the client through the network card module.
[0081] The request encoder passes the encapsulated response to the network card module of the intelligent network card, and transmits the response to the client through the network card module. After receiving the response, the client parses the response, can match the TxID field first, then check the Opcode field to confirm the data operation type, and then go to the Value field to obtain the data if necessary. For example, when the data operation request is a data read request, the data in the Value field can be obtained. When the data operation request is a data write request / data deletion request, the client can obtain the Opcode field to determine whether the data write / deletion is successful.
[0082] The method provided by the embodiment effectively reduces the processing pressure of the CPU of the server by migrating some workloads of the CPU of the server to the smart NIC, processing the data operation request sent by the client by the smart NIC, and presenting the access abstraction of the database to the client node. In addition, the data structure for responding to the multiplexed data operation request can greatly reduce the space allocation and data copy overhead of the server through the data structure multiplexing mechanism. In addition, the data structure supporting the aggregated multiple data operation requests is cache-aligned, so that the network transmission overhead caused by boundary misalignment can be reduced during data transmission, and the read-write amplification problem can be avoided.
[0083] From the perspective of storage, the key-value database can include two parts: an index structure and a key-value pair data, wherein the key-value pair data is the target object of the data operation performed by the user, and the index structure is a retrieval data structure used to find the storage location of the requested key-value pair data.
[0084] Figure 4 An architecture schematic diagram of the data processing system provided by an embodiment of the present disclosure is provided. As shown in Figure 4 The data processing system provided by the embodiment can be used to process the data operation request sent by the client. Figure 1 The data processing system provided by the embodiment can be used to process the data operation request sent by the client.
[0085] In the case of setting the index module 103 in the memory of the smart NIC for storing the index structure, the calling execution engine module 102 for processing the data operation request sent by the client can also need to interact with the index module 103.
[0086] The specific implementation of the index structure is not limited in the present disclosure. As a possible implementation, the index structure can adopt a hash index structure, such as a chained hash index structure, a cuckoo hash index structure, a hopscotch hash index structure, etc. Of course, the index structure can also adopt a binary tree, a radix tree, a B tree, a B+ tree, a red-black tree, etc.
[0087] In this embodiment, in order to improve the memory utilization rate of the intelligent network card, the index structure can be implemented in a sub-index structure organization and a multi-path index mechanism. The sub-index structure organization means that the index structure is composed of multiple sub-index structures, each of which can include multiple index slots, and each index slot can be used to store the related information of a key-value pair data. The multi-path index mechanism means that the data operation request is mapped to multiple sub-index structures by using a plurality of preset mapping modes. Through the sub-index structure organization and the multi-path index mechanism, load balancing processing for index structure access can be realized, thereby avoiding a large access pressure caused by a large number of accesses to the same index structure.
[0088] When the index structure is implemented by using a hash index structure, the index structure can include a plurality of hash buckets, and a multi-path hash mode is used for mapping when processing a data operation request. Among them, Figure 5 An example is taken to illustrate the schematic diagram of the hash index mechanism in the form of a hash bucket and a two-way hash.
[0089] Referring to Figure 5 The two hash buckets are hash bucket X and hash bucket Y, and the hash bucket X and the hash bucket Y can be cache-aligned, so that the access overhead of accessing the same hash bucket can be greatly reduced by using the spatial locality of the cache. Each hash bucket can include a plurality of index slots, a field for indicating whether each index slot in the bucket is an idle slot, and a field for indicating whether the index slot in the bucket is occupied by a thread.
[0090] Suppose a hash bucket is 64 bytes in size, and the hash bucket is cache-aligned, each hash bucket can contain 4 bytes of metadata: 1 byte of Bitmap field (each bit represents whether the corresponding index slot in the bucket is an idle slot, 0 is idle, 1 is occupied), 1 byte of Lockmap field (each bit represents whether the corresponding index slot in the bucket is occupied by a thread, 0 is idle, 1 is occupied), 2 bytes of Padding field (this field is a meaningless bit, only used for alignment 4 bytes). Each hash bucket can contain 4 15-byte index slots, and each index slot can be used to store the index information of a key-value pair data.
[0091] It should be noted that the number of index slots included in each hash bucket is not limited in the present disclosure, and the number of index slots included in each hash bucket can be the same or different. When the number of index slots is different, the byte size of the metadata can be adjusted to ensure that the metadata can completely represent the state of all index slots. In addition, by using the multi-path hash index mechanism, the number and implementation of the mapping mode are not limited in the present disclosure.
[0092] To reduce the access and storage overhead of the key-value pair data, the index structure can be implemented by using an inline storage mechanism, i.e., the key-value pair data satisfying preset conditions is stored in the index slot in a manner of inline storage. When the client needs to access the inline stored key-value pair data, the access to the index structure can be implemented, so that the server memory does not need to be accessed, and the PCIe data channel between the intelligent network card and the server does not need to be accessed, thereby reducing the access and storage pressure of the server.
[0093] As a possible implementation, whether the key-value pair data satisfies the requirement of the inline storage mechanism can be determined according to attribute information of the key-value pair data. Here, the attribute information of the key-value pair data can include but is not limited to the data type of a specific field (such as int8, int16, int32, int64, float32, float64, sring, etc.), the data size, and the like.
[0094] Exemplarily, Figure 6 A data structure diagram of the index slot in the index structure exemplarily shown in the present disclosure is shown. Please refer to Figure 6 As shown, when the inline storage mechanism is used, the index slot can include a field for indicating the data type of the key-value pair data, a field for indicating the storage type of the key and the value, a field for storing the related information of the key, and a field for storing the related information of the value. The present disclosure does not limit the byte size of each field.
[0095] In combination with the foregoing Figure 5 As shown in the embodiment, Figure 6 The embodiment shown in the figure takes the index slot of 15 bytes as an example for illustration. The index slot includes four fields, which are: a field of 6 bits for indicating the data type (also referred to as the type field), a field of 2 bits for indicating the storage mode of the related information of the key and the value (also referred to as the Flag field), a field of 8 bytes for storing the related information of the key (also referred to as the key-info field), and a field of 6 bytes for storing the related information of the value (also referred to as the value-info field).
[0096] The Flag field can have three values: 01, 10, and 11. When the Flag field takes the value of 01, it means that the key and the value in the key-value pair data can be stored in the index slot in a manner of inline storage. When the Flag field takes the value of 10, it means that the key in the key-value pair data can be stored in the index slot in a manner of inline storage, but the value in the key-value pair data cannot be stored in the index slot in a manner of inline storage. When the Flag field takes the value of 11, it means that neither the key nor the value in the key-value pair data can be stored in the index slot in a manner of inline storage.
[0097] Please refer to Figure 6The four index slots are shown, wherein, the index slot 1 stores data of the Int32 type and the index slot 2 stores data of the string type, the byte sizes of the key and the value meet the byte size limits of the key-info field and the value-info field, and therefore, the key and the value are stored in the index slot in a manner of being inline.
[0098] The data stored in the index slot 3 is of the int64 type, the key meets the byte size limit of the key-info field, but the value is greater than 6 bytes and cannot meet the byte size limit of the value-info field, and therefore, the key can be stored in the key-info field of the index slot in a manner of being inline, and the value-info field can be filled with pointer information corresponding to the key-value pair data, that is, the key-value pair data is stored in the memory of the server pointed to by the pointer information.
[0099] The data stored in the index slot 4 is of the string type, the byte size of the key cannot meet the byte size limit of the key-info field, and therefore, the key-value pair data needs to be stored in a manner of being non-inline. Referring to Figure 6 As shown, the key-info field can be used to store fingerprint digest information of the key in the key-value pair data, wherein, the fingerprint digest information of the key can be data obtained by mapping the key and meeting the byte size limit of the key-info field, for example, the key is mapped in a manner of being hashed, and of course, other manners can also be used to map the key to obtain the fingerprint digest information of the key. The value-info field can be filled with pointer information corresponding to the key-value pair data, that is, the key-value pair data is stored in the memory of the server pointed to by the pointer information.
[0100] Next, by Figures 7 to 9 The embodiment shown details how the data processing system processes the data read request, the data write request and the data deletion request sent by the client when the index module is set in the memory of the intelligent network card, and the index structure in the index module adopts the hash bucket, the multi-way hash and the inline storage mechanism as described above.
[0101] Figure 7 A flowchart of a data processing method provided by an embodiment of the present disclosure is shown. Referring to Figure 7 As shown, the method provided by the embodiment includes:
[0102] S701, receiving, by a network card module in the intelligent network card, a data operation request sent by a client.
[0103] S702, calling a request analysis module in the intelligent network card to parse the data operation request to obtain to-be-processed data and data operation type information, and inputting the to-be-processed data and the data operation type information to an execution engine module in the intelligent network card.
[0104] Steps S701 and S702 are respectively similar to steps S301 and S302 in the embodiment shown in FIG. 3, and can be referred to the detailed description of the embodiment shown in FIG. 3. Figure 3 Steps S301 and S302 in the embodiment shown in FIG. 3 can be referred to the detailed description of the embodiment shown in FIG. 3 for brevity. Figure 3 Steps S301 and S302 in the embodiment shown in FIG. 3 can be referred to the detailed description of the embodiment shown in FIG. 3 for brevity.
[0105] S703, calling the execution engine module to determine the target index slot corresponding to the to-be-processed data from the index structure stored in the memory included in the smart NIC based on the to-be-processed data.
[0106] The determination of the target index slot can be implemented by the following manner, but is not limited thereto:
[0107] Step a, calling the execution engine module to perform hash calculation on the to-be-processed data to obtain a hash value, and matching in the index structure based on the hash value to obtain a matching successful hash bucket.
[0108] The data processing system can match the hash bucket by using one or more hash algorithms. When the to-be-processed data is a key-value pair data, a plurality of hash values can be obtained by using a plurality of hash algorithms to calculate the key in the to-be-processed key-value pair data, and a plurality of hash buckets can be matched based on the plurality of hash values.
[0109] Step b, calling the execution engine module to match in the index slot included in the matching successful hash bucket based on the to-be-processed data to obtain a matching result, and determining the target index slot based on the matching result.
[0110] Exemplarily, when the data operation request is a data read request or a data deletion request, the key or the fingerprint summary information of the key in the to-be-processed key-value pair data can be matched in a plurality of matching successful hash buckets, and the matching successful index slot is the target index slot.
[0111] Exemplarily, when the data operation request is a data write request, an idle index slot can be allocated as the target index slot for the to-be-processed data according to the occupation situation of the index slot in the plurality of matching successful hash buckets or other factors, in combination with the foregoing description. Figure 5 The occupation situation of the index slot can be obtained by the 0 or 1 of each bit in the Bitmap field of the hash bucket. In some cases, when the data operation request is a data write request for modifying data, the index slot corresponding to the data to be modified is the target index slot.
[0112] The matching in the hash bucket can be based on the attribute information of the to-be-processed data to determine whether to use the to-be-processed data or the fingerprint summary information of the to-be-processed data for matching.
[0113] As a possible implementation, if the key in the to-be-processed key-value pair data satisfies the requirement of inline storage, the execution engine module is invoked to match the key in the to-be-processed key-value pair data in each index slot included in the hash bucket, and determine an index slot in which the key information filled in the index slot matches the key of the to-be-processed key-value pair as the target index slot. For example, in the data structure in the embodiment shown in FIG. 8, the index slot in which the key filled in the key-info field matches the key in the to-be-processed key-value pair data is determined as the target index slot. Figure 6
[0114] As another possible implementation, if the key in the to-be-processed key-value pair data does not satisfy the requirement of inline storage, the execution engine module is invoked to match the fingerprint summary information of the key in the to-be-processed key-value pair data in each index slot included in the hash bucket, and determine an index slot in which the fingerprint summary information of the key filled in the index slot matches the fingerprint summary information of the key of the to-be-processed key-value pair as the target index slot. For example, in the data structure in the embodiment shown in FIG. 9, the index slot in which the fingerprint summary information of the key filled in the key-info field matches the fingerprint summary information of the key in the to-be-processed key-value pair data is determined as the target index slot. Figure 6
[0115] S704, the execution engine module is invoked to perform the data operation indicated by the data operation type information on the target index slot to obtain a data operation result.
[0116] According to different data operation requests, and in combination with the index, the inline and non-inline storage modes are used, and the execution engine module of the data processing system is illustrated by several different case examples how to perform the data operation request.
[0117] Case one, the data operation request is a data read request, and the Flag field in the target index slot is 01.
[0118] The Flag field in the target index slot is 01, which indicates that the key-value pair data to be read is stored in the target index slot in an inline manner. The execution engine module can read the value data from the value-info field in the target index slot. The execution engine module can determine the data type of the value data according to the type field in the target index slot.
[0119] Case two, the data operation request is a data read request, and the Flag field in the target index slot is 10 or 11.
[0120] The Flag field in the target index slot is 10 or 11, indicating that the key-value pair data to be read is stored in the memory of the server, the execution engine module can read the pointer information from the value-info field in the target index slot, and read the value data from the memory of the server according to the pointer information. And the execution engine module can determine the data type of the value data according to the type field in the target index slot.
[0121] Case three, the data operation request is a data deletion request, and the Flag field in the target index slot is 01.
[0122] The Flag field in the target index slot is 01, indicating that the key-value pair data to be deleted is stored in the target index slot, and the execution engine module can release the target index slot, thereby completing the data deletion.
[0123] Case four, the data operation request is a data deletion request, and the Flag field in the target index slot is 10 or 11.
[0124] The Flag field in the target index slot is 10 or 11, indicating that the key-value pair data to be deleted is stored in the memory of the server, the execution engine module can read the pointer information from the value-info field in the target index slot, and delete the key-value pair data in the memory pointed by the pointer information in the memory of the server, and release the memory of the server occupied by the key-value pair data. And the execution engine module releases the target index slot, thereby completing the data deletion.
[0125] Case five, the data operation request is a data write request, and the key and value in the to-be-processed key-value pair data can be stored in the inline storage.
[0126] The execution engine module fills the Flag field in the target index slot with 01; fills the type field in the target index slot with the data type of the to-be-processed key-value pair data; fills the key in the to-be-processed key-value pair data to the key-info field; and fills the value in the to-be-processed key-value pair data to the value-info field.
[0127] Case six, the data operation request is a data write request, and the key in the to-be-processed key-value pair data can be stored in the inline storage, and the value can be stored in the non-inline storage.
[0128] The calling execution engine module fills the Flag field in the target index slot with 10; fills the type field in the target index slot with the data type of the to-be-processed key-value pair data; fills the key in the to-be-processed key-value pair data into the key-info field; allocates the memory of the server for the to-be-processed key-value pair data, generates pointer information according to the address of the allocated memory of the server, and fills the pointer information into the value-info field. The calling execution engine module delivers the to-be-processed key-value pair data to the server and stores the to-be-processed key-value pair data in the allocated memory of the server.
[0129] Case seven, the data operation request is a data write request, and the key in the to-be-processed key-value pair data is stored in a non-inline manner.
[0130] In the case that the key in the to-be-processed key-value pair data is stored in a non-inline manner, the value in the to-be-processed key-value pair data is also stored in a non-inline manner, and the fingerprint digest information and the pointer information of the key in the to-be-processed key-value pair data need to be stored in the target index slot. Therefore, the calling execution engine module can fill the Flag field in the target index slot with 11; fill the type field in the target index slot with the data type of the to-be-processed key-value pair data; fill the fingerprint digest information of the key in the to-be-processed key-value pair data into the key-info field; allocate the memory of the server for the to-be-processed key-value pair data, generate pointer information according to the address of the allocated memory of the server, and fill the pointer information into the value-info field. The calling execution engine module delivers the to-be-processed key-value pair data to the server and stores the to-be-processed key-value pair data in the allocated memory of the server.
[0131] As a possible implementation, the memory of the server can support the following two ways of data storage:
[0132] Way one, if the key in the key-value pair data is stored in an inline manner, and the data length can be determined according to the data type of the key-value pair data, then only the value in the to-be-processed key-value pair data needs to be stored in the memory of the server. Exemplarily, when the key-value pair data is stored in the memory of the server in way one, the data structure can be as shown in way one in the memory of the server. Figure 8
[0133] Way two, if the key in the key-value pair data is stored in a non-inline manner, or if the key in the key-value pair data is stored in an inline manner and the data length cannot be determined according to the data type of the key-value pair data, then not only the key and the value of the key-value pair data need to be stored in the memory of the server, but also the data length of the key and the data length of the value need to be stored. Exemplarily, when the key-value pair data is stored in the memory of the server in way two, the data structure can be as shown in way two in the memory of the server. Figure 8 It should be noted that when the key-value pair data is stored by the second mode, the data structure can also be stored in other modes, for example, the key-value pair data is stored first, and then the data length information of the key and the data length information of the value of the key-value pair data are stored, or the key-value pair data can also be stored in the order of the key in the key-value pair data, the data length information of the key, the value in the key-value pair data, and the length information of the value, and the present disclosure does not limit this.
[0134] The memory of the server stores the key-value pair data by the first mode, which can avoid unnecessary memory space occupation overhead of the key and related data in the key-value pair data, thereby improving the utilization rate of the memory of the server. In addition, for the second mode, by storing the data length information in the memory of the server, the execution engine of the data processing system can correctly process the access boundary of the data, so that the data operation request sent by the client can be correctly processed and errors will not occur.
[0135] In the scenario shown in the second case described above, if the data to be read is stored by the first mode, the value in the key-value pair data is read from the memory of the server, and if the data to be read is stored by the second mode, the execution engine reads the key-value pair data and the data length information of the key-value pair data from the memory of the server; in the scenario shown in the fourth case described above, if the data to be deleted is stored by the first mode, the value in the stored key-value pair data is deleted from the memory of the server, and if the data to be deleted is stored by the second mode, the key-value pair data and the data length information of the key-value pair data are deleted from the memory of the server; in the scenarios shown in the sixth case and the seventh case, if the requirement of the first mode is met, the key in the key-value pair data can be stored in the memory of the server, and if the requirement of the second mode is met, the key-value pair data and the data length information of the key-value pair data are both stored in the memory of the server.
[0136] S705, the request analysis module is called to encapsulate the data operation result to obtain a response of the data operation request.
[0137] S706, the response of the data operation request is sent to the client through the network card module.
[0138] In the embodiment, S705 and S706 are similar to S304 and S305 in the embodiment shown in Figure 3 The detailed description of the embodiment shown in Figure 3 The detailed description of the embodiment shown in
[0139] In the embodiment, the data processing system greatly reduces the access overhead caused by accessing the same sub-index structure by using the spatial locality of the sub-index structure cache in the manner of sub-index structure organization and multi-path indexing, and effectively improves the memory utilization of the intelligent network card. In addition, the index structure is implemented by using an inline storage mechanism, which can optimize the access and storage overhead of small key-value pair data, thereby reducing the access pressure of the memory of the server and effectively improving the data processing efficiency.
[0140] In combination with the description of cases five to seven in step S705 in the foregoing Figure 7 As described in the foregoing
[0141] In the embodiment, the data processing system greatly reduces the access overhead caused by accessing the same sub-index structure by using the spatial locality of the sub-index structure cache in the manner of sub-index structure organization and multi-path indexing, and effectively improves the memory utilization of the intelligent network card. In addition, the index structure is implemented by using an inline storage mechanism, which can optimize the access and storage overhead of small key-value pair data, thereby reducing the access pressure of the memory of the server and effectively improving the data processing efficiency. Figure 9 Figure 9 As described in the foregoing Figure 4 As described in the foregoing
[0142] In the embodiment, the data processing system greatly reduces the access overhead caused by accessing the same sub-index structure by using the spatial locality of the sub-index structure cache in the manner of sub-index structure organization and multi-path indexing, and effectively improves the memory utilization of the intelligent network card. In addition, the index structure is implemented by using an inline storage mechanism, which can optimize the access and storage overhead of small key-value pair data, thereby reducing the access pressure of the memory of the server and effectively improving the data processing efficiency.
[0143] As a possible implementation, the memory allocator 104 interacts with the server CPU to apply for a memory space of a preset size when the storage resource is insufficient. The preset size is not limited, for example, a large memory space of hundreds of megabytes can be applied for at a time.
[0144] In the embodiment, the data processing system greatly reduces the access overhead caused by accessing the same sub-index structure by using the spatial locality of the sub-index structure cache in the manner of sub-index structure organization and multi-path indexing, and effectively improves the memory utilization of the intelligent network card. In addition, the index structure is implemented by using an inline storage mechanism, which can optimize the access and storage overhead of small key-value pair data, thereby reducing the access pressure of the memory of the server and effectively improving the data processing efficiency.
[0145] For example, refer to Figure 10 The structure diagram of the management mechanism shown, the memory allocator 104 includes 11 stages, respectively, the 0th stage to the 10th stage, the 0th stage to the 10th stage represents the linked list structure of the memory block size of 8B, 16B, 32B, 64B, 128B, 256B, 512B, 1KB, 2KB, 4KB, 8KB in turn, among the above 11 stages, the maximum can support 8KB memory allocation (remove some metadata interference, can support maximum 4KB key value pair data storage).
[0146] It should be noted that when using the slab management mechanism, the number of stages and the memory block size corresponding to each stage can be set according to actual needs. The above Figure 10 The embodiments shown are only examples and are not a limitation on the implementation of the memory allocator 104 managing the host memory.
[0147] Through the memory local management mechanism of the server of the memory allocator, when the data processing system implements key value pair data deletion and writing, the allocation and release of the memory resources of the server can be completed by operating the memory allocator, without interacting with the server CPU, significantly reducing the overall performance overhead of the data processing system, thereby reducing the operation delay and improving the throughput.
[0148] As can be known from the foregoing embodiments, the execution engine module 102 is a core functional module in the data processing device 100 that connects other component modules. In order to further improve the processing efficiency of the data processing system in executing data operation requests, the data processing device 100 provided by the present disclosure can be provided with a data relay station in the intelligent network card, reducing the multiple accesses to the memory of the server caused by the operation of hot key value pair data, thereby optimizing the overall performance of the data processing system. Among them, Figure 11 The structure diagram of the data processing system provided by an embodiment of the present disclosure is shown. Please refer to Figure 11 As shown, the data processing device 100 further includes a data relay station 105 provided in the memory of the intelligent network card.
[0149] The data relay station 105 is mainly used to cache key value pair data that meets the preset requirements, and when the execution engine module 102 executes the data operation request, the execution engine module 102 can first access the data relay station for matching. For example, the data relay station can cache key value pair data whose data amount meets the preset requirements (such as key value pair data whose key and value length are within 8 bytes).
[0150] As a possible implementation, the data relay station 105 can be implemented based on a chain-based hash index structure. Using this structure, for the same key operation, it can be mapped to a fixed linked list for matching each time.
[0151] Among them, Figure 12An exemplary structural diagram of a data relay station is shown. The data relay station 105 includes a plurality of linked list structures, each of which corresponds to an identifier (such as a hash ID shown in Figure 12 The hash value is obtained by performing a hash algorithm on the key in the key-value pair data to be processed, and the hash ID corresponding to each linked list is queried according to the hash value, so as to be mapped to the corresponding target linked list structure, and an operation is performed in the target linked list structure.
[0152] When the execution engine module 102 processes a data read request, it can first perform matching in the data relay station 105 to determine whether there is a matching key in the data relay station 105. If the matching is successful, the value of the latest version corresponding to the key is returned. If the matching fails, null can be returned to indicate that there is no corresponding key in the data relay station 105.
[0153] When the execution engine module 102 processes a data write request and a data deletion request, the execution engine module 102 atomically adds a data item to the target linked list structure hashed to the data item, which includes a field for indicating the data operation type, a field for containing the key, and a field for containing the value. In addition, the execution engine module 102 also deletes the data item with the same key in the target linked list structure.
[0154] Next, the data processing system according to the embodiment shown in Figures 13 to 15 will be described in detail. Figure 11 The data processing system according to the embodiment shown in
[0155] Figure 13 A flowchart of a data processing method according to an embodiment of the present disclosure is provided. As shown in Figure 13 , in this embodiment, the data operation request sent by the client is a data read request. When the data processing system receives the data read request sent by the client, the request decoder is used to parse the key-value pair data to be processed and the data operation type information and pass them to the execution engine module. The execution engine module first needs to determine whether the key in the data read request meets the requirements of inline storage. For example, the size of the key can be used for determination. It is assumed that the size is within 8 bytes, which meets the requirements of inline storage, and the size is greater than 8 bytes, which does not meet the requirements of inline storage.
[0156] If the key meets the requirements of inline storage, the execution engine module is called to access the data relay station to check whether there is a value of the latest version corresponding to the key in the data relay station. If the corresponding data item is found, the value of the latest version is returned.
[0157] If the key meets the requirement of inline storage, but the latest version of the value corresponding to the key is not found in the data relay station, the execution engine module is called to access the index module, the index structure is queried, and the two hash algorithms are mapped to two hash buckets, and the target index slot is determined by matching the key in the two hash buckets. Next, the length of the data to be read and where to read the data are determined according to the Flag field and the type field in the target index slot. If the value of the Flag field is 01, the type information is read from the target index slot to determine the data length of the value, and the value is read from the target index slot, and then the target index slot is unlocked; if the value of the Flag field is 10, the pointer information is read from the target index slot, and the key-value pair data is read from the memory of the server according to the pointer information.
[0158] If the key does not meet the requirement of inline storage, it is first necessary to map to two hash buckets (two hash buckets are taken as an example in this embodiment), and then calculate the fingerprint summary information of the key, and determine the target index slot by matching the fingerprint summary information of the key in the hashed hash bucket. It should be noted that in the matching process, the fingerprint summary information of the key may match multiple index slots, that is, the number of target index slots may be multiple. Next, the key-value pair data is read from the memory of the server according to the pointer information in the target index slot, and if the key of the key-value pair data read from the memory of the server is also completely matched, the value read from the memory of the server is returned, and if the key of the key-value pair data read from the memory of the server is not matched, the next target index slot is matched, and the above process is repeated.
[0159] Figure 14 The flowchart of the data processing method provided by an embodiment of the present disclosure is shown in FIG. 1. Figure 14 As shown in FIG. 1, in this embodiment, the data operation request sent by the client is a data write request, and when the data processing system receives the data write request sent by the client, the request decoder is used to parse the key-value pair data to be processed and the data operation type information, and the execution engine module is used to pass the information to the execution engine module. The execution engine module first needs to judge whether the key in the data write request meets the requirement of inline storage, for example, the size of the key can be used for judgment, assuming that it is within 8 bytes, then it meets the requirement of inline storage, and if it is greater than 8 bytes, it does not meet the requirement of inline storage.
[0160] If the key meets the requirement of inline storage, it is further necessary to judge whether the key-value pair data to be written is small key-value pair data, if it is small key-value pair data, it needs to be written into the data relay station, and if it is not small key-value pair data, it needs to be written into the target index slot or the memory of the server.
[0161] Specifically, if the value meets the preset requirements (the preset requirements are, for example, 8 bytes), the key is hashed to the target linked list structure in the data relay station, and a PUT data item is added to the head of the target linked list structure. Then, the target linked list structure is traversed to delete all data items containing the key. Once the above process is completed, the process can be returned, and subsequent steps can be executed asynchronously.
[0162] in, Figure 14 The steps that need to be executed asynchronously are the same as the steps that the engine module executes synchronously when the value does not meet the preset requirements, that is, the key is hashed into two hash buckets using two hash algorithms. Figure 14 The illustrated embodiment uses two hash buckets as an example. The key is matched between the two hash buckets. If a match is found, the old key-value pair's memory space occupied by that data is released. Next, the execution engine module determines whether the value meets the requirements for inline storage, for example, in... Figure 5 Based on the index slot data structure of the illustrated embodiment, it can be determined whether the value meets the requirements for inline storage by judging whether the value is less than 6 bytes. If it is determined that the value can be stored in memory, the target index slot is filled according to the key-value pair data, and the result is returned. If it is determined that the value cannot be stored inline, it is necessary to determine whether the memory resources are sufficient through the memory allocator. If the memory resources are sufficient, memory space is directly allocated for the key-value pair data, and the key-value pair data is filled in the allocated memory space. Then, the target index slot is filled and the result is returned. If the memory resources are insufficient, a segment of memory resources is requested from the server CPU to pre-allocate (the size of the requested memory resources can be flexibly set). Then, tiered management is established for this segment of memory resources. Then, memory space is allocated for the key-value pair data to be written, and the key-value pairs are filled in the allocated memory space. Then, the index slot is filled and the result is returned.
[0163] If the key does not meet the requirements for inline storage, the execution engine module can process the key using a hash algorithm, hashing the key into two hash buckets. Figure 14 (The illustrated embodiment uses two hash buckets as an example for explanation.) Next, the fingerprint digest information of the key is calculated, and the index slot is matched within the hash bucket based on the fingerprint digest information of the key. If the match is successful, the execution engine module reads the corresponding key-value pair data from the server's memory to check if the key matches. If they match, the execution engine module releases the memory space occupied by the old key-value pair data, and then executes the key-value pair data writing process. If the fingerprint digest information of the key does not match successfully in either hash bucket, a free index slot is allocated and locked for the key-value pair data to be written, and then the key-value pair data writing process is executed.
[0164] The process of writing key-value pairs can be referred to in the aforementioned asynchronous execution steps, which describe whether the value size meets the requirements of inline storage. For the sake of brevity, it will not be repeated here.
[0165] Figure 15 A flowchart illustrating a data processing method provided in one embodiment of this disclosure. Please refer to [link / reference]. Figure 15 As shown in this embodiment, the data operation request sent by the client is a data deletion request. When the data processing system receives the data deletion request sent by the client, it parses the request through the request decoder to obtain the key-value pair data to be processed and the information of the data operation type, and passes it to the execution engine module. The execution engine module first needs to determine whether the key in the data deletion request meets the requirements of inline storage. For example, it can be determined based on the size of the key. If it is within 8 bytes, it meets the requirements of inline storage; if it is greater than 8 bytes, it does not meet the requirements of inline storage.
[0166] If the key meets the requirements of inline storage, it is necessary to further determine whether the key-value pair data to be deleted is a small key-value pair data. If it is a small key-value pair data, it is necessary to first search in the data relay station. If it is not a small key-value pair data, it is necessary to search in the server host memory.
[0167] Specifically, if the value size meets the preset requirement (e.g., 8 bytes), the key is hashed into the target linked list structure in the data relay station, a DEL data item is added to the head of the target linked list structure, and the key-value pair data is written into the DEL data item. After deleting data items with the same key from the target linked list structure, the process can return. The remaining steps can be executed asynchronously. The asynchronous execution steps are similar in logic to the write operation, that is, the key is hashed into two hash buckets (…). Figure 15 The illustrated embodiment uses two hash buckets as an example. The key is matched between the two hash buckets. If a match is successful, the value of the Flag field in the target index slot determines whether the data is stored in the target index slot or in the server's memory. If the Flag field is 01, the target index slot is unlocked, and the memory occupied by the key-value pair data is released. If the Flag field is 10, the key-value pair data is read from the server's memory based on the pointer information in the target index slot, and the memory occupied by the key-value pair data is released. The target index slot is then unlocked, and the process returns.
[0168] If the key does not meet the requirements for inline storage, a hash algorithm is applied to the key, hashing it into two hash buckets. Then, the fingerprint digest of the key is calculated, and a match is made in the hash buckets based on this fingerprint digest. It should be noted that there may be multiple index slots in the two hash buckets that match the key's fingerprint digest; that is, there may be multiple target index slots. The pointer information is read from the successfully matched target index slots. Based on this pointer information, the key-value pair data is read from the server's memory. If the key matches the read key-value pair data, the memory occupied by the key-value pair data is released, the target index slot is unlocked, and the process returns. If the key does not match the read key-value pair data, the pointer information in the next target index slot is read, and the matching is performed, repeating the above process.
[0169] In conjunction with the foregoing embodiments, this disclosure migrates some of the server's CPU workload to the smart network interface card (NIC), which then handles the data operation requests sent by the client. The smart NIC presents a KVS access abstraction to the client node without requiring the server CPU to participate in the processing of data operation requests. Furthermore, the data processing system significantly reduces the server's performance bottleneck and improves the access overhead of the memory key-value database by using a sub-index structure organization, a multi-way index mechanism, an inline storage mechanism, a data relay station acceleration structure, and a memory allocator to pre-allocate and manage the server's memory. For the client, the low latency provides a better user experience.
[0170] exist Figures 13 to 15 In the illustrated embodiment, if the key-value pairs stored in the data relay station have requirements on the size of the key but not on the size of the value, then when determining whether to enter the data relay station for querying, it is sufficient to determine whether the size of the key meets the preset conditions, without needing to determine the size of the value.
[0171] By way of example, this disclosure also provides an electronic device, including a memory and a processor. This disclosure does not limit the type of memory and processor, etc., wherein the memory and processor can be connected via a data bus. The memory is configured to store computer program instructions, and the processor is configured to execute the computer program instructions, causing the electronic device to implement the data processing method as shown in any of the above method embodiments.
[0172] By way of example, embodiments of this disclosure also provide a computer-readable storage medium, including: computer program instructions, which, when executed by at least one processor of an electronic device, cause the electronic device to implement the data processing method as shown in any of the above method embodiments.
[0173] Exemplarily, the embodiments of the present disclosure further provide a computer program product, when an electronic device executes the computer program product, so that the electronic device implements the data processing method as shown in any of the method embodiments.
[0174] It should be noted that, in this document, the terms such as "first" and "second" are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0175] The above description is merely a specific implementation of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method, characterized in that, include: The network interface card (NIC) module in the smart NIC receives data operation requests sent by the client. The request analysis module in the smart network card is invoked to parse the data operation request to obtain the data to be processed and the data operation type information, and the data to be processed and the data operation type information are input into the execution engine module in the smart network card; The execution engine module is invoked to determine the target index slot corresponding to the data to be processed from the index structure stored in the memory of the smart network card; wherein, the index structure includes multiple sub-index structures, and each sub-index structure includes multiple index slots; the index slots are used to store key-value pair data related information; The execution engine module is invoked to perform the data operation indicated by the data operation type information for the target index slot to obtain the data operation result; The request analysis module is invoked to encapsulate the data operation result to obtain a response to the data operation request, and the response to the data operation request is sent to the client through the network card module.
2. The method according to claim 1, characterized in that, The step of calling the request analysis module to encapsulate the data operation result to obtain the response to the data operation request includes: The request analysis module is invoked to update the target field in the data structure corresponding to the data operation request based on the data operation result, thereby obtaining the response to the data operation request.
3. The method according to claim 1, characterized in that, The step of receiving data operation requests sent by the client through the network card module in the smart network card includes: The network interface card module receives multiple data operation requests with the same transaction identifier sent by the client. The step of calling the request analysis module in the smart network card to parse the data operation request to obtain the data to be processed and the data operation type information includes: The request analysis module is invoked to parse the multiple data operation requests with the same transaction identifier to obtain multiple data fields and multiple identical data operation type information. The request analysis module is invoked to concatenate the multiple data fields according to the sequence indication information included in the multiple data operation requests to obtain the data to be processed.
4. The method according to claim 3, characterized in that, The data structures of the multiple data operation requests with the same transaction identifier are consistent.
5. The method according to claim 1, characterized in that, The index structure is implemented using a hash bucket approach, where each hash bucket includes multiple index slots. The step of determining the target index slot corresponding to the data to be processed based on the data to be processed within the index structure stored in the memory of the smart network interface card, using the execution engine module, includes: The execution engine module is invoked to perform hash calculation on the data to be processed to obtain a hash value, and the hash bucket that successfully matches is obtained by matching the hash value in the index structure. The execution engine module is invoked to perform a matching operation on the index slots included in the successfully matched hash bucket based on the data to be processed, and the target index slot is determined based on the matching result.
6. The method according to claim 5, characterized in that, The process of calling the execution engine module to perform hash calculations on the data to be processed to obtain a hash value, and then matching the hash value with the index structure to obtain a successfully matching hash bucket, includes: The execution engine module is invoked to perform hash calculations on the data to be processed using various preset hash algorithms to obtain multiple hash values; The execution engine module is invoked to match the multiple hash values with the identifiers of each hash bucket included in the index structure to obtain multiple hash buckets that successfully match.
7. The method according to claim 5, characterized in that, The process of calling the execution engine module to obtain a matching result involves matching the data to be processed within the index slots of the successfully matched hash bucket, including: The execution engine module is invoked to perform a match in the hash buckets that have successfully matched the data to be processed; or, the execution engine module is invoked to calculate the fingerprint digest information corresponding to the data to be processed, and a match is performed in the hash buckets that have successfully matched the fingerprint digest information.
8. The method according to claim 1, characterized in that, If the data operation request is a data read request, the step of calling the execution engine module to perform the data operation indicated by the data operation type information for the target index slot to obtain the data operation result includes: If it is determined that both the data to be processed and the target data corresponding to the data to be processed are stored inline, then the target data indicated by the data to be processed is read from the target index slot. If it is determined that the data to be processed is stored in an inline manner, the target data corresponding to the data to be processed is stored in a non-inline manner; or, if it is determined that the data to be processed is stored in a non-inline manner, then pointer information is obtained from the target index slot, and the target data corresponding to the data to be processed is read from the server memory indicated by the pointer information.
9. The method according to claim 1, characterized in that, If the data operation request is a data deletion request, then the step of calling the execution engine module to perform the data operation indicated by the data operation type information for the target index slot to obtain the data operation result includes: If it is determined that both the data to be processed and the target data indicated by the data to be processed are stored in inline, then the target index slot is deleted. If it is determined that the data to be processed is stored in an inline manner, the target data indicated by the data to be processed is stored in a non-inline manner; or, if it is determined that the data to be processed is stored in a non-inline manner, then the pointer information is obtained from the target index slot, the data in the server's memory indicated by the pointer information is deleted, and the target index slot is released.
10. The method according to claim 9, characterized in that, Deleting the data in the memory of the server indicated by the pointer information includes: The execution engine module controls the memory management module of the smart network card to release the server memory indicated by the pointer information. The memory management module is used to manage the server's memory.
11. A data processing apparatus, characterized in that, include: The network interface card (NIC) module is used to receive data operation requests sent by the client. The request analysis module is used to parse the received data operation request to obtain the data to be processed and the data operation type information, and input the data to be processed and the data operation type information into the execution engine module; An execution engine module is used to determine the target index slot corresponding to the data to be processed from the index structure stored in the memory of the smart network interface card; wherein, the index structure includes multiple sub-index structures, and each sub-index structure includes multiple index slots; the index slots are used to store key-value pair data-related information; and data operations indicated by the data operation type information are performed on the target index slot to obtain data operation results; The request analysis module is also used to encapsulate the data operation result to obtain a response to the data operation request; The network interface card module is also used to send a response to the data operation request to the client.
12. An electronic device, characterized in that, include: Memory and processor; The memory is configured to store computer program instructions; The processor is configured to execute the computer program instructions, causing the electronic device to implement the data processing method as described in any one of claims 1 to 10.
13. A computer program product, characterized in that, When the computer program product is executed by an electronic device, the electronic device performs the data processing method as described in any one of claims 1 to 10.
14. A readable storage medium, characterized in that, include: Computer program instructions, wherein at least one processor of an electronic device executes the computer program instructions, causing the electronic device to implement the data processing method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Intelligent network card, network storage method of intelligent network card and medium
CN114285676A
Data access method and device
CN114817232A