Data processing method, device and equipment based on key value database, storage medium and key value database system

By directly reading and writing data from the video memory of the graphics processing unit using Remote Direct Memory Access Protocol (RDMA) in the distributed KV storage scenario, the problem of slow processing speed caused by memory replication in the prior art is solved, and efficient key-value data processing is achieved.

CN119938713APending Publication Date: 2025-05-06BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510038702.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In distributed KV storage scenarios, the existing technology requires data processing through processes such as memory copying, resulting in slow processing speed and lack of efficient key-value data processing methods.

Method used

After the key-value data to be cached in the graphics processing unit's video memory, the data storage request is sent to the key-value database server, the storage address information and storage length information are carried, and the first network card and the second network card are communicated using the Remote Direct Memory Access Protocol (RDMA), and the data is directly read and written from the video memory to avoid memory copying.

Benefits of technology

It realizes efficient storage and processing of key-value data in GPU video memory, improves the processing efficiency of key-value data, and reduces data transmission delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938713A_ABST
    Figure CN119938713A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a data processing method and device based on a key value database, equipment, a storage medium and a key value database system.The method comprises the steps that after it is determined that to-be-cached key value data exists in a video memory of a graphic processing unit, a data storage request for the to-be-cached key value data is sent to a key value database server side, the data storage request carries storage address information and storage length information of value data of to-be-cached key value data in a video memory; receiving a data reading request which is sent by a key value database server and carries storage address information, and controlling the first network card supporting the remote direct memory access protocol to read value data of the key value data to be cached from the video memory according to the storage address information, sending the value data to the key value database server side, and writing the value data through the second network card supporting the remote direct memory access protocol. Visibly, according to the embodiment of the invention, the key value data in the GPU video memory can be stored without a memory copying process, and the processing efficiency of the key value data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a data processing method, device, equipment, storage medium and key-value database system based on a key-value database. Background Art

[0002] KV cache (Key-Value Cache) is a technology used in natural language processing models to optimize the performance of the self-attention mechanism. It is usually used in reasoning tasks such as text generation. The self-attention mechanism calculates the corresponding key (Key) and value (Value) for each input token, and caches the calculated key and value in the graphics processing unit GPU, so that when a new token is generated later, the previously calculated key and value can be directly read from the KV cache to generate new key-value data without recalculating the previous key-value data, thereby improving the efficiency and performance of model reasoning.

[0003] Since the storage space of GPU video memory is limited and the cost is high, if the key-value data is cached in the GPU video memory every time it is generated, the cost of the GPU will increase. Therefore, in order to reduce the cost, the related technology usually uses a distributed KV storage component to store the key-value data. Specifically, the key-value data is first copied from the GPU video memory to the host memory, and then the key-value data is taken out from the host memory and sent to the distributed KV storage space through the network, thereby completing the storage of the key-value data.

[0004] Obviously, the above-mentioned distributed KV storage processing method requires memory replication and other processes, resulting in a slow processing speed. Therefore, in the distributed KV storage scenario, how to achieve a more efficient key-value data processing method is a technical problem that urgently needs to be solved. Summary of the invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data processing method, device, equipment, storage medium and key-value database system based on a key-value database.

[0006] In a first aspect, an embodiment of the present disclosure provides a data processing method based on a key-value database, the method comprising:

[0007] After determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request for the key-value data to be cached is sent to the key-value database server; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0008] Receive a data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card; the first network card and the second network card communicate through the remote direct memory access protocol.

[0009] In an optional implementation manner, the method further includes:

[0010] After determining that the graphics processing unit has key-value data to be obtained, sending a data acquisition request to the key-value database server; the data acquisition request carries key data of the key-value data to be obtained and information of the second target storage area in the video memory of the graphics processing unit, and the data acquisition request is used to request the key-value database server to obtain value data of the key-value data to be obtained according to the key data;

[0011] Receive the value data of the key-value data to be obtained returned by the key-value database server, and control the first network card to write the value data of the key-value data to be obtained into the second target storage area.

[0012] In an optional implementation manner, before controlling the first network card to read the value data of the first target key-value data from the graphics processing unit according to the storage address information, the method further includes:

[0013] Part or all of the storage area in the video memory of the graphics processing unit is registered in the first network card, so that the first network card has the right to access the part or all of the storage area.

[0014] In an optional implementation, after determining that there is key-value data to be cached in the video memory of the graphics processing unit, sending a data storage request to the key-value database server includes:

[0015] After determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request is sent to the key-value database server through the first network card using a message sending operation in the remote direct memory access protocol, so that the second network card receives the data storage request using a message receiving operation in the remote direct memory access protocol.

[0016] In an optional implementation manner, the receiving a data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request includes:

[0017] A data read request is received from the key-value database server through a second network card using a read operation in a remote direct memory access protocol, so that the second network card uses a write operation in the remote direct memory access protocol to write the value data of the key-value data to be cached.

[0018] In a second aspect, an embodiment of the present disclosure provides a data processing method based on a key-value database, which is applied to a key-value database server, and the method includes:

[0019] Receive a data storage request from a key-value database client; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0020] Determine, according to the storage length information, a first target storage area corresponding to the value data of the key-value data to be cached;

[0021] In response to the data storage request, a data read request carrying the storage address information is sent to the key-value database client through the second network card; the data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card and the second network card communicate through a remote direct memory access protocol;

[0022] After receiving the value data of the key-value data to be cached, the value data of the key-value data to be cached is written into the first target storage area through the second network card.

[0023] In an optional implementation manner, after receiving the value data of the key-value data to be cached, writing the value data of the key-value data to be cached into the first target storage area includes:

[0024] After receiving the value data of the key-value data to be cached, the value data of the key-value data to be cached is written into the first target storage area through the second network card; the second network card supports the remote direct memory access protocol.

[0025] In an optional implementation manner, the method further includes:

[0026] A virtual memory space of a preset memory size is obtained, and the virtual memory space is registered in the second network card; the virtual memory space of the preset memory size is a preset integer number of memory block sizes.

[0027] In an optional implementation, determining the first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information includes:

[0028] Determine a target number of memory blocks from the virtual memory space according to the storage length information; the memory size corresponding to the target number of memory blocks is not less than the memory size corresponding to the storage length information;

[0029] The target number of memory blocks is determined as a first target storage area corresponding to the value data of the key-value data to be cached.

[0030] In an optional implementation manner, the method further includes:

[0031] Receiving a data acquisition request from a key-value database client; the data acquisition request carries key data of the key-value data to be acquired and information of a second target storage area in the video memory of the graphics processing unit;

[0032] Acquire value data of the key-value data to be acquired according to the key data of the key-value data to be acquired, and control the second network card to write the value data of the key-value data to be acquired into the second target storage area of ​​the key-value database client.

[0033] In a third aspect, an embodiment of the present disclosure provides a key-value database system, the key-value database system comprising a key-value database client and a key-value database server;

[0034] The key-value database client is used to send a data storage request for the key-value data to be cached to the key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address position information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0035] The key-value database server is configured to determine, after receiving the data storage request, a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information, and send a data read request carrying the storage address information to the key-value database client;

[0036] The key-value database client is further configured to, after receiving a data read request carrying the storage address information sent by the key-value database server through the second, control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and send the value data of the key-value data to be cached to the key-value database server; the first network card and the second network card communicate through a remote direct memory access protocol;

[0037] The key-value database server is further configured to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached.

[0038] In a fourth aspect, the present disclosure provides a data processing device based on a key-value database, the device comprising:

[0039] A first sending module is used to send a data storage request for the key-value data to be cached to a key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0040] The reading module is used to receive a data reading request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send the value data of the key-value data to be cached to the key-value database server through the second network card for writing; the first network card and the second network card communicate through the remote direct memory access protocol.

[0041] In a fifth aspect, the present disclosure provides a data processing device based on a key-value database, which is applied to a key-value database server, and the device includes:

[0042] A first receiving module is configured to receive a data storage request from a key-value database client; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0043] A determination module, configured to determine a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information;

[0044] a third sending module, configured to send a data read request carrying the storage address information to the key-value database client via the second network card in response to the data storage request; the data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card and the second network card communicate via a remote direct memory access protocol;

[0045] A writing module is used to write the value data of the key-value data to be cached into the first target storage area after receiving the value data of the key-value data to be cached.

[0046] In the sixth aspect, an embodiment of the present disclosure also provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a data processing method based on a key-value database as provided in an embodiment of the present disclosure.

[0047] In a seventh aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute a data processing method based on a key-value database as provided in an embodiment of the present disclosure.

[0048] In an eighth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0049] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0050] In the data processing method based on the key-value database provided by the embodiment of the present disclosure, after determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request for the key-value data to be cached is sent to the key-value database server, and the data storage request carries storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics data unit; a data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request is received, and the first network card is controlled to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card, wherein the first network card and the second network card communicate through the remote direct memory access protocol.

[0051] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card supporting the remote direct memory access protocol, so that the key-value data to be cached is stored by the key-value database server through the second network card supporting the remote direct memory access protocol. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the process of memory copying, etc., which improves the processing efficiency of the key-value data. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0053] Figure 1 A schematic diagram of the structure of a database system provided for the disclosed embodiment;

[0054] Figure 2 A storage flow chart of a database system provided by an embodiment of the present disclosure;

[0055] Figure 3 A flowchart of a data processing method based on a key-value database provided in an embodiment of the present disclosure;

[0056] Figure 4 A flowchart of another data processing method based on a key-value database provided in an embodiment of the present disclosure;

[0057] Figure 5 A structural schematic diagram of a data processing device based on a key-value database provided in an embodiment of the present disclosure;

[0058] Figure 6 A structural schematic diagram of another data processing device based on a key-value database provided in an embodiment of the present disclosure;

[0059] Figure 7 A structural schematic diagram of a data processing device based on a key-value database provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0060] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0061] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0062] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0063] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0064] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0065] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0066] The Transformer model is a deep learning model architecture used for natural language processing and sequence data processing. The self-attention mechanism is the core mechanism of the Transformer model. The attention score is calculated using keys and values. Each input token generates a key and a value to determine the degree of attention to other input tokens.

[0067] A graphics processing unit (GPU) is an electronic computing device used to process graphics and video rendering tasks. GPU has a highly parallel architecture and can process large amounts of graphics data simultaneously, thereby improving the speed and efficiency of graphics processing.

[0068] KV cache (Key-Value Cache) is a technology used in the Transformer model to optimize the performance of the self-attention mechanism. It is usually used in reasoning tasks such as text generation. The self-attention mechanism calculates the corresponding key (Key) and value (Value) for each input token, and caches the calculated key and value in the GPU, so that when a new token is generated later, the previously calculated key and value can be directly read from the KV cache to generate new key-value data without recalculating the previous key-value data, thereby improving the efficiency and performance of model reasoning.

[0069] Since the storage space of GPU video memory is limited and the cost is high, caching key-value data in GPU video memory will increase the cost of GPU. Therefore, in order to reduce costs, the prior art generally uses distributed KV storage components to store key-value data. For example, in the application scenario of text generation, the GPU can swap out the inactive KV cache from the GPU video memory to the distributed KV storage space, and reload it from the distributed KV storage space to the GPU video memory during the next message conversation, thereby improving the concurrency of the GPU processing context and reducing costs.

[0070] For another example, in the scenario of model inference, it can be divided into two stages: prefill and decode. Usually, GPUs with different performances are used to reduce costs. Specifically, after GPU0 completes prefill, it needs to pass the KV cache to GPU1 to continue decoding. In the scenario where distributed KV storage is not used, GPU0 needs to wait for GPU1 to be idle and release the video memory space before sending the KV cache to GPU1's video memory for processing. Obviously, this processing method will cause the GPU to wait, which will affect the computing performance of the GPU. In the scenario of distributed KV storage, after GPU0 completes prefill, it immediately stores the generated KV cache in the distributed KV storage space and continues to process other prefill requests, thereby improving the computing performance of the GPU.

[0071] It can be seen that in the above two distributed KV storage scenarios, the key-value data is first copied from the GPU video memory to the host memory, and then the KV data is taken out from the host memory and sent to the remote distributed KV storage space through the network, thereby completing the storage of the key-value data.

[0072] Obviously, the above-mentioned distributed KV storage processing method requires memory replication and other processes, resulting in a slow processing speed. Therefore, in the distributed KV storage scenario, how to achieve a more efficient key-value data processing method is a technical problem that urgently needs to be solved.

[0073] To this end, an embodiment of the present disclosure provides a data processing method based on a key-value database. Specifically, after determining that there is key-value data to be cached in the video memory of a graphics processing unit, a data storage request for the key-value data to be cached is sent to a key-value database server, and the data storage request carries storage address information and storage length information of value data of the key-value data to be cached in the video memory of the graphics data unit; a data read request carrying storage address information sent by the key-value database server is received, and a first network card is controlled to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through a second network card, wherein both the first network card and the second network card communicate through a remote direct memory access protocol.

[0074] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU's video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card that supports the remote direct memory access protocol, so that the key-value data to be cached can be stored by the key-value database server through the second network card that supports the remote direct memory access protocol. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0075] Based on this, the present disclosure provides a database system, referring to Figure 1 , is a structural diagram of a database system provided in a public embodiment, wherein a database system 101 includes multiple key-value database clients and a key-value database server, and is specifically described by taking a key-value database client 102 and a key-value database server 103 as examples.

[0076] The key-value database client 102 is used to send a data storage request for the key-value data to be cached to the key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit.

[0077] Among them, the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address location information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit.

[0078] In the disclosed embodiments, the video memory of the graphics processing unit refers to the memory in the graphics processing unit GPU specifically used to store graphics data and other computing task data. For example, in the inference stage of the natural language processing model, the GPU video memory can be used to store key-value data calculated by the self-attention mechanism. By caching the key-value data, the key-value data can be directly obtained from the cache for calculation when processing long sequences later, thereby reducing the computational overhead in the inference process.

[0079] In the disclosed embodiments, the key-value data to be cached may include key-value data generated during the training phase or the inference phase of the model, etc. The key-value data to be cached includes key data (Key) and value data (Value), wherein the key data can be used to uniquely identify the data to be cached, and the value data refers to the specific data corresponding to the key data.

[0080] In the disclosed embodiment, after determining that there is key-value data to be cached in the video memory of the graphics processing unit GPU, the key-value database client first sends a data storage request for the key-value data to be cached to the key-value database server. The data storage request is used to request the key-value database server to write the key-value data to be cached into the storage space of the key-value database server, so as to reduce the occupation of the GPU video memory by the key-value data to be cached.

[0081] In the disclosed embodiment, the data storage request carries key data of the key-value data to be cached, and storage area information of the value data of the key-value data to be cached, wherein the storage area information includes storage address information and storage length information of the value data of the key-value data to be cached in the GPU video memory, the storage address information includes the starting address information of the value data of the data to be cached in the GPU video memory, and the storage length information refers to the length or size of the key-value data to be cached in the GPU video memory.

[0082] In the disclosed embodiment, by carrying the key data of the key-value data to be cached in the data storage request, the security and correct access rights in the remote access and data storage process can be improved. In addition, the data storage request also carries the storage length information of the value data of the key-value data to be cached in the GPU's video memory, so that the key-value database server can determine the storage area of ​​the key-value data to be cached in the key-value database server based on the storage length information.

[0083] The key-value database server 103 is used to determine the first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information after receiving the data storage request, and send a data reading request carrying the storage address information to the key-value database client.

[0084] In the disclosed embodiment, after receiving a data storage request sent by a key-value database client, the key-value database server first parses the data storage request to obtain storage area information of the value data of the key-value data to be cached and the key data of the data to be cached, and then determines the first target storage area corresponding to the value data of the key-value data to be cached based on the storage length information in the storage area information, so that the first target storage area can be used to store the value data of the key-value data to be cached subsequently.

[0085] In the disclosed embodiment, after determining the first target storage area corresponding to the value data of the key-value data to be cached, the key-value database server sends a data read request carrying storage address information to the key-value database client through the second network card, so as to request the key-value database client to read the value data of the key-value data to be cached from the video memory of the graphics processing unit based on the storage address information.

[0086] The key-value database client 102 is also used to control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information after receiving a data read request carrying the storage address information sent by the key-value database server through the second network card, and send the value data of the key-value data to be cached to the key-value database server.

[0087] The first network card communicates with the second network card via a remote direct memory access protocol.

[0088] Remote Direct Memory Access (RDMA) is an efficient network communication technology that allows a device or service in a network to directly access the memory of another device or service without the intervention of an operating system, which can reduce latency and improve the speed and efficiency of data transmission. Since the first network card and the second network card in the disclosed embodiment both communicate via the remote direct memory access protocol, the key-value data to be cached can be directly sent from the GPU video memory to the key-value database server without copying the data in the memory of the key-value database client, which can improve the transmission speed of the key-value data to be cached.

[0089] In the disclosed embodiment, after receiving a data read request carrying storage address information sent by the key-value database server through the second network card, the key-value database client does not need to copy the key-value data to be cached to the memory of the key-value database client before sending it. Instead, after reading the value data of the key-value data to be cached, the key-value database client directly sends it to the key-value database server through the first network card, so that the key-value database server stores the key-value data to be cached, thereby improving the storage efficiency of the key-value data.

[0090] The key-value database server 103 is further configured to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached.

[0091] In the disclosed embodiment, after receiving the value data of the key-value data to be cached sent by the key-value database client, the key-value database server writes the value data of the key-value data to be cached into the first target storage area through the second network card. Since the second network card communicates through the remote memory direct access protocol, there is no need to copy data, thereby achieving efficient storage of the key-value data to be cached.

[0092] like Figure 2 As shown, it is a storage flow chart of a key-value database system provided by an embodiment of the present disclosure. The key-value database system includes a key-value database client and a key-value database server, wherein the key-value database client can be deployed on a host machine, and the key-value database server can be deployed on a server.

[0093] The host machine may include a key-value database client, a memory, a first network card, and a graphics processing unit integrated on the host machine's motherboard or installed on the host machine through a slot, etc. The server may include a key-value database server, a memory, a second network card, etc.

[0094] After determining that there is key-value data to be cached in the GPU video memory, the key-value database client sends a data storage request for the key-value data to be cached to the key-value database server. The data storage request carries storage area information of the value data of the key-value data to be cached and the key data of the key-value data to be cached. The storage area information includes storage address information and storage length information of the value data of the key-value data to be cached in the GPU video memory.

[0095] After receiving the data storage request, the key-value database server determines the first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information carried in the data storage request, and sends a data reading request carrying the storage address information to the key-value database client through the second network card.

[0096] ① After receiving a data read request carrying storage address information sent by the key-value database server, the key-value database client controls the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information; ② Then the key-value data to be cached is sent to the key-value database server through the network.

[0097] Wherein, the first network card and the second network card both communicate via a remote direct memory access protocol.

[0098] ③ After receiving the value data of the key-value data to be cached sent by the key-value database client, the key-value database server writes the value data of the key-value data to be cached into the first target storage area through the second network card.

[0099] In a database system provided by an embodiment of the present disclosure, a key-value database client is used to send a data storage request for the key-value data to be cached to a key-value database server after determining that there is key-value data to be cached in a video memory of a graphics processing unit, wherein the data storage request carries storage address information and storage length information of value data of the key-value data to be cached; the key-value database server is used to determine a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information after receiving the data storage request, and send a data read request carrying the storage address information to the key-value database client; the key-value database client is also used to control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information after receiving the data read request carrying the storage address information sent by the key-value database server, and send the value data to the key-value database server; the key-value database server is also used to write the value data into the first target storage area after receiving the value data.

[0100] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU's video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card that supports the remote direct memory access protocol, so that the key-value data to be cached is stored by the key-value database server. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0101] To facilitate understanding of the above embodiments, the present disclosure also provides a data processing method based on a key-value database, which is applied to a key-value database client, such as a key-value database client deployed on a host server, etc. The method is introduced below in conjunction with a specific embodiment.

[0102] like Figure 3 As shown, it is a flow chart of a data processing method based on a key-value database provided by an embodiment of the present disclosure. The method can be executed by a data processing device based on a key-value database, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 3 As shown, the method includes:

[0103] S301: after determining that there is key-value data to be cached in the video memory of the graphics processing unit, sending a data storage request for the key-value data to be cached to a key-value database server.

[0104] Among them, the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit.

[0105] In the disclosed embodiment, after determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request for the key-value data to be cached is first sent to the key-value database server to request the key-value database server to write the key-value data to be cached into the storage area of ​​the key-value database server, thereby reducing the video memory occupancy of the graphics processing unit by the key-value data to be cached.

[0106] In an optional implementation, by carrying the key data of the key-value data to be cached in the data storage request, the security and correct access rights during remote access and data storage can be improved. In addition, the data storage request also carries the storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit, so that the key-value database server can determine the first target storage area of ​​the key-value data to be cached in the key-value database server based on the storage length information, so as to be used for subsequent storage of the value data of the key-value data to be cached.

[0107] In another optional implementation, the data storage request may also carry a remote access key for the graphics processing unit's video memory, wherein the remote access key is a mechanism for controlling access rights to remote memory areas, which can ensure that only authorized servers can access designated memory areas. By carrying the remote access key in the data storage request, the security and effectiveness of data transmission can be improved.

[0108] S302: Receive a data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card.

[0109] The first network card and the second network card both communicate via a remote direct memory access protocol, and the key-value database server is used to write the received value data of the key-value data to be cached via the second network card.

[0110] Since the first network card in the embodiment of the present disclosure supports the remote direct memory access protocol, after receiving the data read request carrying the storage address information sent by the key-value database server, there is no need to copy the key-value data to be cached to the system memory and then send it. Instead, the first network card is controlled to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and then the value data of the key-value data to be cached is directly sent to the key-value database server, so that the key-value database server stores the key-value data to be cached, thereby improving the storage efficiency of the key-value data.

[0111] In actual applications, when using distributed KV storage space to store key-value data in GPU video memory, it is usually necessary to first copy the data from the GPU video memory of the first server to the system memory, and then transmit it to another server through the network. The other server also needs to perform another data copy operation. Obviously, this distributed KV storage method requires multiple data copying and has a high communication delay.

[0112] Therefore, before controlling the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, the embodiment of the present disclosure can also register part or all of the storage area in the video memory of the graphics processing unit in the first network card, so that the first network card has the right to access part or all of the storage area.

[0113] Since part or all of the storage area in the GPU video memory is registered in advance in the first network card, after receiving the data read request returned by the key-value database server through the second network card, the first network card can be controlled to directly access part or all of the storage area in the GPU video memory to read the value data of the key-value data to be cached. Since the data transmission path bypasses the host memory and the central processing unit (CPU), the data transmission efficiency can be improved and the communication delay can be reduced.

[0114] In an optional implementation, after determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request can be sent to the key-value database server through the first network card using a message sending operation in the remote direct memory access protocol, so that the second network card receives the data storage request using a message receiving operation in the remote direct memory access protocol.

[0115] Since the remote direct memory access RDMA technology allows data to be transmitted directly between network cards without copying the data to the system memory, the embodiment of the present disclosure uses the message sending operation SEND in RDMA through the first network card to send a data storage request to the key-value database server, and carries the storage area information of the value data of the key-value data to be cached and the key data of the key-value data to be cached in the data storage request, so as to request the key-value database server to determine the first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information included in the storage area information.

[0116] In addition, the key-value database server can also use the message receiving operation RECV in RDMA through the second network card to receive the data storage request sent by the key-value database client, and write the value data of the key-value data to be cached to the first target storage area through the second network card.

[0117] In an optional implementation, the key-value database client and the key-value database server may also negotiate through a specified communication mechanism (such as a transmission control protocol and an Internet protocol) during the communication using the RDMA protocol to determine the maximum length of the key data to be stored and the maximum length of the command word. The command word length refers to the length of the control information used for the RDMA operation, and the RDMA operation may include, for example, a message sending operation SEND, a message receiving operation RECV, and the like.

[0118] In the embodiment of the present disclosure, after determining the maximum length of the key data of the key-value data to be stored and the maximum length of the command word, when a data storage request is sent to the key-value database server through the first network card using the message sending operation SEND in RDMA, the length of the data storage request is the sum of the length of the key data of the key-value data to be stored and the length of the command word.

[0119] It can be seen that the embodiment of the present disclosure determines the maximum length of key data and the maximum length of command words through negotiation between the key-value database client and the key-value database server, thereby ensuring that both the key-value database client and the key-value database server can correctly parse and process RDMA operations.

[0120] The data processing method based on the key-value database provided by the embodiment of the present disclosure sends a data storage request for the key-value data to be cached to the key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit, wherein the data storage request carries storage address information and storage length information of value data of the key-value data to be cached in the video memory of the graphics data unit; receives a data read request carrying storage address information sent by the key-value database server, controls the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and sends the value data to the key-value database server for writing, wherein the first network card and the second network card both communicate through the remote direct memory access protocol.

[0121] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU's video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card that supports the remote direct memory access protocol, so that the key-value data to be cached can be stored by the key-value database server through the second network card that supports the remote direct memory access protocol. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0122] In actual applications, in text generation scenarios, after the key-value database client swaps out the key-value data from the GPU memory to the remote key-value database server, it needs to retrieve the key-value data from the remote key-value database server and load it into the GPU memory of the key-value database client during the next message conversation to generate a message conversation.

[0123] Therefore, after determining that the graphics processing unit has key-value data to be obtained, the embodiment of the present disclosure can also send a data acquisition request to the key-value database server to write the value data of the key-value data to be obtained from the remote key-value database server to the key-value database client. Specifically, after determining that the graphics processing unit has key-value data to be obtained, a data acquisition request is sent to the key-value database server; wherein the data acquisition request carries the key data of the key-value data to be obtained and information about the second target storage area in the graphics memory of the graphics processing unit.

[0124] In the embodiment of the present disclosure, the second target storage area can be used to represent the storage location of the data to be acquired read from the key-value database server in the graphics processing unit of the key-value database client. The information of the second target storage area may include the starting address information and storage length information of the value data of the key-value data to be acquired in the video memory of the graphics processing unit.

[0125] In the disclosed embodiment, after receiving a data acquisition request, the key-value database server first parses the data acquisition request to obtain the key data of the key-value data to be obtained, and then obtains the corresponding value data from the key-value pairs stored in the database based on the key data, and sends the value data to the key-value database client. Among them, the storage of key-value pairs in the database can be implemented using a hash table, and specifically the key data can be used as an index of the hash table, so that the corresponding value data can be quickly located.

[0126] In the disclosed embodiment, after receiving the value data of the key-value data to be obtained returned by the key-value database server, the first network card is controlled to write the value data of the key-value data to be obtained into the second target storage area, thereby completing the reading process of the key-value data to be obtained.

[0127] In an optional implementation, in order to reduce the communication delay during the transmission process, the key-value data in the GPU video memory can also be read into the memory block of the remote key-value database server through the read operation in the remote direct memory access protocol RDMA. In the embodiment of the present disclosure, a data read request sent by the key-value database server using the read operation in the remote direct memory access protocol is received.

[0128] It can be seen that since the read operation in the remote direct memory access protocol allows the key-value database client to directly read the value data of the key-value data to be cached from the video memory of the graphics processing unit and send it to the key-value database server through the network, the data reading process does not require the participation of the CPU, thereby reducing latency and improving data transmission efficiency.

[0129] In addition, since the embodiment of the present disclosure uses the message sending operation SEND and the message receiving operation RECV in the remote direct memory access protocol RDMA to transmit the key data of the key-value data to be obtained, and uses the read operation READ and the write operation WRITE in the remote direct memory access protocol RDMA to transmit the value data of the key-value data to be obtained, it is possible to independently transmit the key data and the value data in the key-value data to be cached in the GPU video memory to the key-value database server, and write the value data with a relatively large data volume directly from the GPU video memory to the first target storage area of ​​the key-value database server through the first network card, so that the key-value data in the GPU video memory can be stored without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0130] Accordingly, the present disclosure also provides a data processing method based on a key-value database, which is applied to a key-value database server. Figure 4, is a flow chart of another data processing method based on a key-value database provided by an embodiment of the present disclosure, the method can be executed by a data processing device based on a key-value database, wherein the device can be implemented by software and / or hardware, and can generally be integrated in an electronic device. Figure 4 As shown, the method includes:

[0131] S401: receiving a data storage request from a key-value database client.

[0132] Among them, the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit.

[0133] In the disclosed embodiment, after receiving a data storage request from a key-value database client, the data storage request is first parsed to obtain storage area information of the value data of the key-value data to be cached carried in the data storage request, as well as the key data of the key-value data to be cached.

[0134] Since the data storage request carries the storage length information of the value data of the key-value data to be cached in the GPU video memory corresponding to the key-value database client, the key-value database server can determine the first target storage area of ​​the key-value data to be cached in the key-value database server based on the storage length information after receiving the data storage request from the key-value database client.

[0135] In addition, the data storage request also carries key data of the key-value data to be cached. Since the key data can be used to uniquely identify the key-value data to be cached, it can improve security and correct access rights during remote access and data storage.

[0136] S402: Determine a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information.

[0137] In the implementation of the present disclosure, after receiving a data storage request from a key-value database client, the first target storage area corresponding to the value data of the key-value data to be cached is first determined based on the storage length information carried in the data storage request, so that the first target storage area can be used to store the value data of the key-value data to be cached subsequently.

[0138] In practical applications, the partner system can be used to manage the virtual memory space of the key-value database server. Specifically, the virtual memory space of the preset memory size can be divided into a preset integer number of memory blocks according to the preset byte size, and the memory size of the value data used to store the key-value data is the preset byte size × the preset integer number. When the key-value database server applies to the partner system for allocation or release of memory of the target byte size, it is necessary to align the target byte size with the preset byte size. Exemplarily, the virtual memory space can be divided into 1024 memory blocks of 4096 bytes in size. Assuming that the target byte size applied for is 8000 bytes, the aligned memory size is 8192 bytes, that is, two consecutive memory blocks of 4096 bytes are required.

[0139] In actual applications, after receiving the value data of the key-value data to be cached, the remote service needs to perform another data replication before storing the value data of the key-value data to be cached in the remote service. Obviously, this distributed KV storage method requires multiple data replications, and the processing efficiency of key-value data is low.

[0140] Therefore, in order to further improve the processing efficiency of key-value data, the embodiment of the present disclosure can also write the value data of the key-value data to be cached to the first target storage area through the second network card after receiving the value data of the key-value data to be cached. The second network card is a network card that supports the remote direct memory access protocol.

[0141] Since the second network card in the embodiment of the present disclosure supports the remote direct memory access protocol, after receiving the value data of the key-value data to be cached, there is no need to copy the value data of the key-value data to be cached, but the value data of the key-value data to be cached is directly written to the first target storage area to complete the storage of the value data of the key-value data to be cached, thereby improving the storage efficiency of the key-value data.

[0142] In an optional implementation, in order to allow the second network card to directly access part or all of the virtual memory space, a virtual memory space of a preset memory size may be obtained and the virtual memory space may be registered in the second network card.

[0143] Among them, the virtual memory space of the preset memory size is a preset integer number of memory block sizes. For example, assuming that the size of the memory block is 128 bytes, the memory size of the virtual memory space is an integer multiple of 128 bytes, such as 256 bytes, 512 bytes, etc.

[0144] In an optional implementation, determining the first target storage area corresponding to the value data of the key-value data to be cached based on the storage length information may include: determining a target number of memory blocks from the virtual memory space based on the storage length information, wherein the memory size corresponding to the target number of memory blocks is not less than the memory size corresponding to the storage length information.

[0145] Exemplarily, it is assumed that a 4096-byte virtual memory space is pre-registered in the second network card, wherein the 4096-byte virtual memory space is composed of 32 memory blocks of 128 bytes in size. Assuming that the memory size corresponding to the storage length information is 500 bytes, it can be determined according to the storage length information that 4 memory blocks need to be determined from the virtual memory space, and the 4 128-byte memory blocks are determined as the first target storage area corresponding to the value data of the key-value data to be cached.

[0146] In actual applications, when 500 bytes of memory space are generated for the partner system, assuming that the size of the virtual memory space is 384 bytes, it means that there is no memory space of appropriate size at this time, and a message indicating that data storage failed is returned to the key-value database client.

[0147] S403: Sending a data read request carrying the storage address information to the key-value database client.

[0148] The data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card supports remote direct memory access protocol.

[0149] In an embodiment of the present disclosure, a first target storage area corresponding to the value data of the key-value data to be cached is determined based on the storage length information carried in the data storage request, and a data read request carrying the storage address information is sent to the key-value database client to request the key-value database client to control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information.

[0150] Since the first network card in the disclosed embodiment supports the remote direct memory access protocol, after the key-value database client receives the data read request carrying the storage address information sent by the key-value database server, it is not necessary to copy the key-value data to be cached to the system memory before sending it. Instead, after controlling the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, the value data of the key-value data to be cached is directly sent to the key-value database server, so that the key-value database server stores the key-value data to be cached, thereby improving the storage efficiency of the key-value data.

[0151] S404: After receiving the value data of the key-value data to be cached, write the value data of the key-value data to be cached into the first target storage area.

[0152] In the disclosed embodiment, after receiving the value data of the key-value data to be cached sent by the key-value database client, the value data of the key-value data to be cached is written into the first target storage area to achieve efficient storage of the key-value data to be cached.

[0153] In an optional implementation, a data acquisition request may also be received from a key-value database client, wherein the data acquisition request carries key data of the key-value data to be acquired and information of a second target storage area in a video memory of a graphics processing unit; then, value data of the key-value data to be acquired according to the key data of the key-value data to be acquired, and the first network card is controlled to write the value data of the key-value data to be acquired into the second target storage area of ​​the key-value database client.

[0154] In the disclosed embodiment, the key data of the key-value data to be obtained is first parsed from the data acquisition request, and then it is determined whether the key data of the key-value data to be obtained exists in the database; if the key data exists, the value data of the corresponding key-value data to be obtained is obtained, and the value data of the key-value data to be obtained is sent to the key-value database client, so that the key-value database client controls the first network card to write the value data of the key-value data to be obtained into the second target storage area, thereby completing the process of reading the key-value data from the key-value database server.

[0155] In an optional implementation, if it is determined that the key data of the key-value data to be obtained exists in the database, then the value data corresponding to the key data is obtained, and it is determined whether the memory size of the second target storage area is greater than or equal to the memory size of the value data of the key-value data to be obtained. If it is determined that the memory size of the second target storage area is greater than or equal to the memory size of the value data of the key-value data to be obtained, it means that the second target storage area is sufficient to store the value data of the key-value data to be obtained. At this time, the write operation in the remote direct memory access protocol is used to write the value data of the key-value data to be obtained into the second target storage area.

[0156] If it is determined that the memory size of the second target storage area is smaller than the memory size of the value data of the key-value data to be obtained, it means that the second target storage area is insufficient to store the value data of the key-value data to be obtained, and a message of acquisition failure is returned to prompt the key-value database client that the acquisition of the value data of the key-value data to be obtained has failed.

[0157] The data processing method based on the key-value database provided by the embodiment of the present disclosure sends a data storage request for the key-value data to be cached to the key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit, and the data storage request carries storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics data unit; receives a data read request carrying storage address information sent by the key-value database server, controls a first network card supporting a remote direct memory access protocol to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and sends the value data of the key-value data to be cached to the key-value database server, so that the key-value database server writes the value data of the key-value data to be cached into the first target storage area.

[0158] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU's video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card that supports the remote direct memory access protocol, so that the key-value data to be cached is stored by the key-value database server. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0159] In order to implement the above embodiment, the present disclosure also proposes a data processing device based on a key-value database. Figure 5 The present invention provides a structural diagram of a data processing device based on a key-value database, which can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 5 As shown, the device comprises:

[0160] A first sending module 501 is used to send a data storage request for the key-value data to be cached to a key-value database server after determining that the key-value data to be cached exists in the video memory of the graphics processing unit; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0161] The reading module 502 is used to receive a data reading request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card; the first network card and the second network card can communicate mechanically through the remote direct memory access protocol.

[0162] In an optional implementation, the device further includes:

[0163] A second sending module is used to send a data acquisition request to the key-value database server after determining that the graphics processing unit has key-value data to be acquired; the data acquisition request carries key data of the key-value data to be acquired and information of a second target storage area in the video memory of the graphics processing unit, and the data acquisition request is used to request the key-value database server to acquire value data of the key-value data to be acquired according to the key data;

[0164] The first writing module is used to receive the value data of the key-value data to be obtained returned by the key-value database server, and control the first network card to write the value data of the key-value data to be obtained into the second target storage area.

[0165] In an optional implementation, the device further includes:

[0166] The first registration module is used to register part or all of the storage area in the video memory of the graphics processing unit in the first network card, so that the first network card has the right to access the part or all of the storage area.

[0167] In an optional implementation manner, the first sending module includes:

[0168] The sending submodule is used to send a data storage request to the key-value database server through the first network card using a message sending operation in a remote direct memory access protocol after determining that there is key-value data to be cached in the video memory of the graphics processing unit, so that the second network card uses a message receiving operation in the remote direct memory access protocol to receive the data storage request.

[0169] In an optional implementation manner, the first writing module includes:

[0170] The receiving submodule is used to receive a data read request sent by the key-value database server through the second network card using a read operation in a remote direct memory access protocol, so that the second network card uses a write operation in the remote direct memory access protocol to write the value data of the key-value data to be cached.

[0171] In the data processing device based on the key-value database provided by the embodiment of the present disclosure, after determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request for the key-value data to be cached is sent to the key-value database server, and the data storage request carries the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics data unit; a data read request carrying the storage address information sent by the key-value database server is received, and the first network card is controlled to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and the value data of the key-value data to be cached is sent to the key-value database server, so that the key-value database server writes the value data of the key-value data to be cached through the second network card, wherein the first network card and the second network card communicate through the remote direct memory access protocol.

[0172] The disclosed embodiment transmits the key data and value data in the key-value data to be cached in the GPU's video memory to the key-value database server independently, and writes the value data with a relatively large amount of data directly from the GPU video memory to the first target storage area of ​​the key-value database server by controlling the first network card that supports the remote direct memory access protocol, so that the key-value data to be cached can be written by the key-value database server through the second network card that supports the remote direct memory access protocol. It can be seen that in the data processing method based on the key-value database provided by the disclosed embodiment, the storage of the key-value data in the GPU video memory can be realized without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0173] Correspondingly, the embodiment of the present disclosure also provides another data processing device based on a key-value database. Figure 6 This is a schematic diagram of the structure of another data processing device based on a key-value database provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 6 As shown, the device comprises:

[0174] The first receiving module 601 is used to receive a data storage request from a key-value database client; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit;

[0175] A determination module 602 is used to determine a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information;

[0176] A third sending module 603 is used to send a data read request carrying the storage address information to the key-value database client through the second network card in response to the data storage request; the data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card and the second network card communicate through the remote direct memory access protocol;

[0177] The second writing module 604 is configured to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached.

[0178] In an optional implementation manner, the second writing module includes:

[0179] A writing submodule is used to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached; the second network card supports the remote direct memory access protocol.

[0180] In an optional implementation, the device further includes:

[0181] The registration module is used to obtain a virtual memory space of a preset memory size and register the virtual memory space in the second network card; the virtual memory space of the preset memory size is a preset integer number of memory block sizes.

[0182] In an optional implementation manner, the determining module includes:

[0183] A first determining submodule is used to determine a target number of memory blocks from the virtual memory space according to the storage length information; the memory size corresponding to the target number of memory blocks is not less than the memory size corresponding to the storage length information;

[0184] The second determining submodule is used to determine the target number of memory blocks as the first target storage area corresponding to the value data of the key-value data to be cached.

[0185] In an optional implementation, the device further includes:

[0186] A second receiving module is used to receive a data acquisition request from a key-value database client; the data acquisition request carries key data of the key-value data to be acquired and information of a second target storage area in the video memory of the graphics processing unit;

[0187] The third writing module is used to obtain the value data of the key-value data to be obtained according to the key data of the key-value data to be obtained, and control the second network card to write the value data of the key-value data to be obtained into the second target storage area of ​​the key-value database client; the second network card supports remote direct memory access protocol.

[0188] It can be seen that in the data processing method based on the key-value database provided in the embodiment of the present disclosure, the key-value data in the GPU video memory can be stored without the need for memory copying and other processes, thereby improving the processing efficiency of the key-value data.

[0189] The data processing device based on the key-value database provided in the embodiment of the present disclosure can execute the data processing method based on the key-value database provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0190] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure also provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the data processing method based on the key-value database described in the embodiments of the present disclosure.

[0191] The embodiment of the present disclosure further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the data processing method based on the key-value database described in the embodiment of the present disclosure is implemented.

[0192] In addition, the present disclosure also provides a data processing device based on a key-value database, see Figure 7 As shown, it may include:

[0193] Processor 701, memory 702, input device 703 and output device 704. The number of processors 701 in the data processing device based on the key-value database can be one or more. Figure 7 In some embodiments of the present disclosure, the processor 701, the memory 702, the input device 703 and the output device 704 may be connected via a bus or other means, wherein: Figure 7 The example of connecting through bus is taken in the following.

[0194] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing of the data processing device based on the key-value database by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 703 may be used to receive input digital or character information, and to generate signal input related to user settings and function control of the data processing device based on the key-value database.

[0195] Specifically in this embodiment, the processor 701 will load the executable files corresponding to the processes of one or more applications into the memory 702 according to the following instructions, and the processor 701 will run the applications stored in the memory 702, thereby realizing the various functions of the above-mentioned key-value database-based data processing device.

[0196] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" 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 includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0197] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can 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 may 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 the 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 based on a key-value database, characterized in that: The method comprises: After determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request for the key-value data to be cached is sent to the key-value database server; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit; Receive a data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card; the first network card and the second network card communicate based on the remote direct memory access protocol.

2. The method according to claim 1, characterized in that The method further comprises: After determining that the graphics processing unit has key-value data to be obtained, sending a data acquisition request to the key-value database server; the data acquisition request carries key data of the key-value data to be obtained and information of the second target storage area in the video memory of the graphics processing unit, and the data acquisition request is used to request the key-value database server to obtain value data of the key-value data to be obtained according to the key data; Receive the value data of the key-value data to be obtained returned by the key-value database server, and control the first network card to write the value data of the key-value data to be obtained into the second target storage area.

3. The method according to claim 1, characterized in that Before controlling the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, the method further includes: Part or all of the storage area in the video memory of the graphics processing unit is registered in the first network card, so that the first network card has the right to access the part or all of the storage area.

4. The method according to claim 1, characterized in that: After determining that there is key-value data to be cached in the video memory of the graphics processing unit, sending a data storage request to the key-value database server includes: After determining that there is key-value data to be cached in the video memory of the graphics processing unit, a data storage request is sent to the key-value database server through the first network card using a message sending operation in the remote direct memory access protocol, so that the second network card receives the data storage request using a message receiving operation in the remote direct memory access protocol.

5. The method according to claim 1, characterized in that The receiving of the data read request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request comprises: A data read request is received from the key-value database server through a second network card using a read operation in a remote direct memory access protocol, so that the second network card uses a write operation in the remote direct memory access protocol to write the value data of the key-value data to be cached.

6. A data processing method based on a key-value database, characterized in that: The method comprises: Receive a data storage request from a key-value database client; the data storage request carries key data of key-value data to be cached and storage area information of value data of the key-value data to be cached, the storage area information includes storage address information and storage length information of the value data of the key-value data to be cached in a video memory of a graphics processing unit; Determine, according to the storage length information, a first target storage area corresponding to the value data of the key-value data to be cached; In response to the data storage request, a data read request carrying the storage address information is sent to the key-value database client through the second network card; the data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card and the second network card communicate based on the remote direct memory access protocol; After receiving the value data of the key-value data to be cached, the value data of the key-value data to be cached is written into the first target storage area through the second network card.

7. The method according to claim 6, characterized in that The method further comprises: A virtual memory space of a preset memory size is obtained, and the virtual memory space is registered in the second network card; the virtual memory space of the preset memory size is a preset integer number of memory block sizes.

8. The method according to claim 7, characterized in that The determining, according to the storage length information, a first target storage area corresponding to the value data of the key-value data to be cached includes: Determine a target number of memory blocks from the virtual memory space according to the storage length information; the memory size corresponding to the target number of memory blocks is not less than the memory size corresponding to the storage length information; The target number of memory blocks is determined as a first target storage area corresponding to the value data of the key-value data to be cached.

9. The method according to claim 6, characterized in that The method further comprises: Receiving a data acquisition request from a client; the data acquisition request carries key data of key-value data to be acquired and information of a second target storage area in a video memory of the graphics processing unit; Acquire value data of the key-value data to be acquired according to the key data of the key-value data to be acquired, and control the second network card to write the value data of the key-value data to be acquired into the second target storage area of ​​the client.

10. A key-value database system, characterized in that: The key-value database system includes a key-value database client and a key-value database server; The key-value database client is used to send a data storage request for the key-value data to be cached to the key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit; The key-value database server is configured to determine, after receiving the data storage request, a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information, and send a data read request carrying the storage address information to the key-value database client through the second network card; The key-value database client is further configured to, after receiving a data read request carrying the storage address information sent by the key-value database server through the second network card, control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information, and send the value data of the key-value data to be cached to the key-value database server; the first network card and the second network card communicate through a remote direct memory access protocol; The key-value database server is further configured to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached.

11. A data processing device based on a key-value database, characterized in that: The device comprises: A first sending module is used to send a data storage request for the key-value data to be cached to a key-value database server after determining that there is key-value data to be cached in the video memory of the graphics processing unit; the data storage request carries the key data of the key-value data to be cached and the storage area information of the value data of the key-value data to be cached, and the storage area information includes the storage address information and storage length information of the value data of the key-value data to be cached in the video memory of the graphics processing unit; The reading module is used to receive a data reading request carrying the storage address information returned by the key-value database server through the second network card in response to the data storage request, and control the first network card to read the value data of the key-value data to be cached from the video memory of the graphics processing unit according to the storage address information and send it to the key-value database server for writing through the second network card; the first network card and the second network card communicate based on the remote direct memory access protocol.

12. A data processing device based on a key-value database, characterized in that: The device comprises: A first receiving module is configured to receive a data storage request from a key-value database client; the data storage request carries key data of the key-value data to be cached and storage area information of the value data of the key-value data to be cached, the storage area information including storage address information and storage length information of the value data of the key-value data to be cached in a video memory of a graphics processing unit; A determination module, configured to determine a first target storage area corresponding to the value data of the key-value data to be cached according to the storage length information; a third sending module, configured to send a data read request carrying the storage address information to the key-value database client via the second network card in response to the data storage request; the data read request is used to trigger the key-value database client to control the first network card to read the value data of the key-value data to be cached from the graphics processing unit according to the storage address information, and the first network card and the second network card communicate via a remote direct memory access protocol; The second writing module is used to write the value data of the key-value data to be cached into the first target storage area through the second network card after receiving the value data of the key-value data to be cached.

13. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the data processing method based on the key-value database as described in any one of claims 1-9.

14. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the data processing method based on the key-value database as described in any one of claims 1 to 9.

15. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the data processing method based on a key-value database as claimed in any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • Computer video memory sharing method and device, equipment and storage medium

    CN120276874A

  • Data transmission method and device, storage medium and electronic equipment

    CN120892163A

  • Memory data processing method, electronic equipment and computer readable storage medium

    CN121166376A