Data acquisition method, device, storage medium and computer equipment

By building version mapping tables and key-value mapping tables in fixed-length databases, the problem of low data acquisition efficiency is solved, and faster data acquisition speed and higher efficiency are achieved.

CN114969121BActive Publication Date: 2025-04-11SHENZHEN HEYTAP TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210639541.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-07
Publication Date
2025-04-11
Estimated Expiration
2042-06-07

AI Technical Summary

Technical Problem

The prior art is less efficient when acquiring fixed-length data, resulting in slow data acquisition speed.

Method used

By building a fixed-length database and building version mapping tables and key-value mapping tables in it, these mapping tables are used to locate target data, thereby improving data acquisition efficiency.

Benefits of technology

This improves the acquisition speed of fixed-length data, and thus improves the acquisition efficiency of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969121B_ABST
    Figure CN114969121B_ABST
Patent Text Reader

Abstract

The present application discloses a data acquisition method, device, storage medium and computer equipment, wherein the method comprises: in response to a data acquisition request, acquiring a target version number and a target key value in the data acquisition request; determining a target key value mapping table corresponding to the target version number in a version mapping table of a fixed-length database, wherein the version mapping table includes at least one version number and a key value mapping table corresponding to each version number in the at least one version number; determining a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value; based on the target first address and the data length corresponding to the target version number, acquiring the target data corresponding to the data acquisition request in the fixed-length database. The present application improves the efficiency of data acquisition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data acquisition method, device, storage medium and computer equipment. Background Art

[0002] With the rapid development of computer technology, the number and scale of applications have also increased qualitatively, and the applications have also generated a large amount of application data that needs to be stored. By storing the application data in a universal cache system, in the subsequent application process, data can be acquired based on the universal cache system, and then the acquired application data can execute the corresponding functions of the application. Summary of the invention

[0003] The present application provides a data acquisition method, apparatus, storage medium and computer equipment, which can solve the technical problem of how to improve the efficiency of data acquisition.

[0004] In a first aspect, an embodiment of the present application provides a data acquisition method, the method comprising:

[0005] In response to the data acquisition request, acquiring a target version number and a target key value in the data acquisition request;

[0006] In the version mapping table of the fixed-length database, determine a target key-value mapping table corresponding to the target version number, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number;

[0007] Determine the target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and the first address corresponding to each key value in the at least one key value;

[0008] Based on the target first address and the data length corresponding to the target version number, the target data corresponding to the data acquisition request is obtained in the fixed-length database.

[0009] In a second aspect, an embodiment of the present application provides a data acquisition device, including:

[0010] A request response module, used to respond to a data acquisition request and obtain a target version number and a target key value in the data acquisition request;

[0011] A mapping table determination module, used to determine a target key-value mapping table corresponding to the target version number in a version mapping table of a fixed-length database, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number;

[0012] A first address acquisition module, used to determine a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value;

[0013] A data acquisition module is used to acquire the target data corresponding to the data acquisition request in the fixed-length database based on the target first address and the data length corresponding to the target version number.

[0014] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.

[0015] In a fourth aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0016] In an embodiment of the present application, a fixed-length database for fixed-length data is constructed, and according to the version and key value of the fixed-length data, a version mapping table and a key value mapping table for locating the fixed-length data are constructed, and a method for acquiring fixed-length data is designed, that is, the target data corresponding to the data acquisition request is jointly located by the version mapping table and the key value mapping table, and data acquisition is no longer based on complicated variable-length data acquisition methods, which improves the acquisition speed of fixed-length data and thereby improves data acquisition efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A device architecture diagram of a data acquisition device provided in an embodiment of the present application;

[0019] Figure 2 A system architecture diagram of a data acquisition system provided in an embodiment of the present application;

[0020] Figure 3 A flowchart of a data acquisition method provided in an embodiment of the present application;

[0021] Figure 4 A flowchart of a data acquisition method provided in an embodiment of the present application;

[0022] Figure 5 A flowchart of a data acquisition method provided in an embodiment of the present application;

[0023] Figure 6 A schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application;

[0025] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0027] In order to ensure its universality, the existing general cache system is composed of a database of indefinite length. It can be understood that the data stored in the general cache system can be either fixed-length data or indefinite-length data, but the data acquisition method set by the general cache system is a data acquisition method designed for indefinite-length data. Specifically, the detailed address of the requested data is calculated through a complicated data positioning method, and then the data is acquired in the general cache system based on the address.

[0028] In actual applications, different scenarios and systems have different data caching requirements. For example, unlike the caching requirements of general strings, files, and images, in the caching scenario of machine learning feature vectors, the data that needs to be cached is fixed-length numeric keys and feature vector data. If data is still acquired through the acquisition method for variable-length data, the access performance of fixed-length data will be limited, that is, the acquisition speed of fixed-length data is slow, resulting in low data acquisition efficiency.

[0029] To improve the efficiency of data acquisition, please refer to Figure 1 , Figure 1 A device architecture diagram of a data acquisition device provided in an embodiment of the present application.

[0030] like Figure 1 As shown, the device architecture of the data acquisition device 10 includes: a processor 11 and a memory 12, wherein.

[0031] The data acquisition device 10 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc., which are not specifically limited here. The processor 11 is an execution unit of the data acquisition device 10, which is used to process the received data. The memory 12 is a storage medium for storing data in the data acquisition device 10. It can be understood that the memory 12 stores a fixed-length database.

[0032] When the data acquisition device 10 receives a data acquisition request, the processor 11 responds to the data acquisition request and parses the data acquisition request to obtain the target version number and target key value in the data acquisition request. The processor 11 obtains the version mapping table of the fixed-length database stored in the memory 12, and then based on the target version number, determines the target key value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, obtains the target key value mapping table in multiple key value mapping tables of the fixed-length database, and then based on the target key value, determines the target starting address corresponding to the target key value in the target key value mapping table, and also obtains the data length corresponding to the target version number. Finally, based on the target starting address and the data length corresponding to the target version number, the target data corresponding to the target key value is obtained in the fixed-length database.

[0033] based on Figure 1 The device framework shown constructs a fixed-length database for fixed-length data, and according to the version and key value of the fixed-length data, constructs a version mapping table and a key value mapping table for locating the fixed-length data, and designs a method for acquiring fixed-length data, that is, the target data corresponding to the data acquisition request is jointly located through the version mapping table and the key value mapping table, and data acquisition is no longer based on complicated variable-length data acquisition methods, thereby improving the acquisition speed of fixed-length data and further improving data acquisition efficiency.

[0034] It is understandable that the data acquisition request received by the data acquisition device 10 may be generated by an application program within the data acquisition device 10, or may be input by a user based on an input device of the data acquisition device 10. The data acquisition device 10 may also act as a server to receive a data acquisition request sent by a client that is in communication with the data acquisition device 10.

[0035] When the data acquisition device 10 acts as a server, the existing data acquisition device 10 receives a data acquisition request sent by a client through a network card driver. After the network card driver parses the request, the parsed request data is sent to the kernel-mode protocol stack, and then the request data is sent to the user-mode protocol stack via the thread corresponding to the kernel-mode protocol stack, so as to obtain the data corresponding to the data acquisition request through the thread corresponding to the user-mode protocol stack. Due to the kernel scheduling requirements, the response process of the data acquisition request is relatively cumbersome, and the processor resources are not stable, resulting in slow data acquisition and low efficiency.

[0036] To improve the efficiency of data acquisition, please refer to Figure 2 , Figure 2 A system architecture diagram of a data acquisition system 1 provided in an embodiment of the present application.

[0037] like Figure 2 As shown, the system architecture of the data acquisition system 1 includes: a data acquisition device 10 and a client 20, wherein the data acquisition device 10 includes a processor 11, a memory 12 and a network card driver 13, and the processor 11 includes a user state main thread 111, a main thread protocol stack 112, a working thread 113, a buffer queue 114,

[0038] The data acquisition device 10 and the client 20 can be various electronic devices, including but not limited to smart phones, tablet computers, laptops and desktop computers, etc., which are not specifically limited here. The user-state main thread 111 is the main thread in the data acquisition device 10 with calling authority in the user state; the main thread protocol stack 112 is the protocol stack for the user-state main thread 111, which belongs to the user space in the data acquisition device 10; the buffer queue 114 is a buffer tool for the working thread 113. The memory 12 is a storage medium for storing data in the data acquisition device 10. It can be understood that a fixed-length database is stored in the memory 12. The network card driver 13 is used to receive a data acquisition request sent by the client 20 and return the data acquisition request to the client 20.

[0039] After the network card driver 13 receives the communication connection request sent by the client 20, it sends the communication connection request to the main thread protocol stack 112. The user-state main thread 111 collects the communication connection request in the main thread protocol stack 112 by polling, and then establishes a communication connection between the data acquisition device 10 and the client 20 based on the communication connection request, and then allocates a working thread 113 to the client 20. Specifically, a working thread 113 is selected from the multiple working threads 113 of the data acquisition device 10 to be bound to the client 20. It can be understood that when the data acquisition device 10 receives the data acquisition request sent by the client, it can be processed through the working thread 113 corresponding to the client 20.

[0040] After the network card driver 13 receives the data acquisition request sent by the client 20, it sends the data acquisition request to the buffer queue 114 of the working thread 113 corresponding to the client 20. The working thread 113 collects the data acquisition request in the buffer queue 114 by polling, and then responds to the data acquisition request and parses the data acquisition request to obtain the target version number and the target key value in the data acquisition request. The working thread 113 obtains the version mapping table of the fixed-length database stored in the memory 12, and then based on the target version number, determines the target key value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, obtains the target key value mapping table in multiple key value mapping tables of the fixed-length database, and then based on the target key value, determines the target first address corresponding to the target key value in the target key value mapping table, and also obtains the data length corresponding to the target version number. Based on the target first address and the data length corresponding to the target version number, obtains the target data corresponding to the target key value in the fixed-length database, and finally sends the obtained target data to the network card driver 13, and then returns the obtained target data to the client 20 through the network port driver 13.

[0041] based on Figure 2 The system framework shown controls the network card driver to send the received request directly to the corresponding thread, so as to directly respond to the received request through the thread without the need for secondary forwarding by the kernel state thread, thereby improving the data acquisition speed by increasing the response speed of the request; it also improves the speed and efficiency of data acquisition by allocating working threads to the client and binding processor resources.

[0042] The following will be combined Figure 3-Figure 5 , the data acquisition method provided in the embodiment of the present application is introduced in detail.

[0043] See also Figure 3 , is a flow chart of a data acquisition method provided in an embodiment of the present application. Figure 3 As shown, the method may include the following steps S101-S104.

[0044] S101, in response to a data acquisition request, acquiring a target version number and a target key value in the data acquisition request.

[0045] In one implementation, the data acquisition request includes a target version number and a target key value, wherein the target version number is the version information to which the target data requested by the data acquisition request belongs, and the target key value is the unique identifier of the target data requested by the data acquisition request. It is understandable that the same application has at least one program version, and the data length of the fixed-length data generated by applications of different program versions may be different. The version information is used to indicate which program version of the application generated the target data.

[0046] The data acquisition device receives the data acquisition request, and then responds to the data acquisition request, performs request parsing on the data acquisition request, and obtains the target version number and the target key value in the data acquisition request.

[0047] S102, determining a target key-value mapping table corresponding to the target version number in a version mapping table of a fixed-length database, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number.

[0048] In one implementation, the fixed-length database is used to store fixed-length data, including the fixed-length data stored in the fixed-length database, a version mapping table and a key-value mapping table set based on the storage location of the fixed-length data. The fixed-length database includes a version mapping table, which includes at least one version number and a key-value mapping table corresponding to each version number in at least one version number, which is used to indicate the relationship between the version number and the key-value mapping table.

[0049] Exemplarily, the version mapping table may be as shown in Table 1:

[0050] Version Number Key-value mapping table V0 Key-value mapping table 1 V1 Key-value mapping table 2 V2 Key-value mapping table 3 …… …… VN Key-value mapping table N

[0051] Table 1

[0052] For example, the key-value mapping table corresponding to the version number V0 is key-value mapping table 1.

[0053] The fixed-length database includes at least one key-value mapping table, which includes at least one key value and the first address corresponding to each key value in at least one key value. It can be understood that the first address corresponding to the key value is the storage address of the data corresponding to the key value, and the storage address indicates the specific address where the first bit of data in the data corresponding to the key value is located. It can be understood that the key-value mapping table is used to indicate the relationship between the key value and the storage address of the data corresponding to the key value. It should be noted that the fixed-length database is stored in the memory space of the data acquisition device.

[0054] Exemplarily, the key-value mapping table 1 may be as shown in Table 2:

[0055] Key-value First address Key1 <![CDATA[A+L V0 ]]> Key2 <![CDATA[A+2L V0 ]]> Key3 <![CDATA[A+3L V0 ]]> …… …… KeyN <![CDATA[A+NL V0 ]]>

[0056] Table 2

[0057] It should be noted that A in Table 2 is the first address of the memory block corresponding to the key-value mapping table 1, L V0 is the data length corresponding to version V0, and V0 is the version number corresponding to key-value mapping table 1. For example, the first address corresponding to the key value of Key1 is A+L V0 .

[0058] The data acquisition device acquires the version mapping table of the fixed-length database, and then determines whether there is a pre-stored version number consistent with the target version number in the version mapping table based on the target version number. If there is a pre-stored version number consistent with the target version number, the key-value mapping table corresponding to the pre-stored version number consistent with the target version number is used as the target key-value mapping table corresponding to the target version number. If there is no pre-stored version number consistent with the target version number, an error prompt is generated indicating that there is no data corresponding to the data acquisition request, and the error prompt is output.

[0059] S103, determining a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value.

[0060] In one implementation, the data acquisition device obtains a target key value mapping table corresponding to the target version number from multiple key value mapping tables in a fixed-length database, and then determines whether there is a pre-stored key value consistent with the target key value in the target key value mapping table based on the target key value. If there is a pre-stored key value consistent with the target key value, the first address corresponding to the pre-stored key value consistent with the target key value is used as the target first address corresponding to the target key value. If there is no pre-stored key value consistent with the target key value, an error prompt is generated indicating that there is no data corresponding to the data acquisition request, and the error prompt is output.

[0061] S104, based on the target first address and the data length corresponding to the target version number, obtaining the target data corresponding to the data acquisition request in the fixed-length database.

[0062] In one implementation, after the data acquisition device obtains the target version number in the data acquisition request, it obtains the data length corresponding to the target version number. Optionally, the data length corresponding to the target version number is stored in the data acquisition device, that is, the data acquisition device stores a mapping relationship between the data length and the version number, and the data length corresponding to the target version number can also be directly sent to the data acquisition device along with the data acquisition request, that is, the data acquisition request includes the target version number, the data length corresponding to the target version number, and the target key value. Then, when the data acquisition device responds to the data acquisition request and parses the data acquisition request, it will simultaneously obtain the target version number, the data length corresponding to the target version number, and the target key value in the data acquisition request.

[0063] The data acquisition device determines the specific position of the first bit of data in the target data in the fixed-length database based on the target starting address, and uses the specific position as the starting position. Then, based on the data length corresponding to the target version number, the device acquires data of the corresponding data length in the fixed-length database, and uses the acquired data as the target data corresponding to the target key value, that is, the target data corresponding to the data acquisition request.

[0064] In an embodiment of the present application, a fixed-length database for fixed-length data is constructed, and according to the version and key value of the fixed-length data, a version mapping table and a key value mapping table for locating the fixed-length data are constructed, and a method for acquiring fixed-length data is designed, that is, the target data corresponding to the data acquisition request is jointly located by the version mapping table and the key value mapping table, and data acquisition is no longer based on complicated variable-length data acquisition methods, which improves the acquisition speed of fixed-length data and thereby improves data acquisition efficiency.

[0065] See also Figure 4 , is a flow chart of a data acquisition method provided in an embodiment of the present application. Figure 4 As shown, the method may include the following steps S201-S211.

[0066] S201, using a network card driver to receive a communication connection request sent by a client, and sending the communication connection request to a main thread protocol stack.

[0067] In one implementation, the communication connection request includes a client address and a client interface, the client is a terminal device that generates the communication connection request, and the communication connection request is used to request a communication connection from the data acquisition device.

[0068] When the network card driver of the data acquisition device receives a data packet, it performs a preliminary analysis on the data packet to determine the specific type of the data packet. If the data packet carries a communication connection request, the communication connection request is sent to the main thread protocol stack of the data acquisition device.

[0069] S202, using a user-mode main thread to parse a communication connection request in the main thread protocol stack to obtain a client address and a client port in the communication connection request.

[0070] In one implementation, the user-mode main thread of the data acquisition device polls the cached data in the main thread protocol stack, and then performs data processing based on the cached data.

[0071] The user state main thread of the data acquisition device performs request parsing on the polled communication connection request to obtain the client address and client port carried in the communication connection request.

[0072] S203: Establish a communication connection with the client based on the client address and the client port, and allocate a working thread to the client.

[0073] In one implementation, the user state main thread of the data acquisition device establishes a communication connection with the client based on the client address and the client port. Exemplarily, the user state main thread of the data acquisition device performs a three-way handshake with the client based on the client address and the client port. At the end of the three-way handshake, data can be transmitted between the data acquisition device and the client, thereby establishing a communication connection between the data acquisition device and the client.

[0074] After the communication connection between the data acquisition device and the client is established, the user-state main thread of the data acquisition device selects a working thread from multiple working threads of the data acquisition device as the working thread corresponding to the client according to the set load balancing rules, and binds the client to the working thread based on the communication connection.

[0075] By establishing a communication connection between the data acquisition device and the client, and then allocating a bound working thread to the client based on the communication connection, the data acquisition device directly responds to data through the working thread bound to it each time it receives a data packet sent by the client of the communication connection, so that the processor does not need to schedule the working thread frequently, avoiding resource instability caused by the scheduling of the working thread.

[0076] S204, using the network card driver to receive a data acquisition request sent by the client.

[0077] In one implementation, the data acquisition request includes a target version number and a target key value, wherein the target version number is the version information to which the target data requested by the data acquisition request belongs, and the target key value is the unique identifier of the target data requested by the data acquisition request. It is understandable that the same application has at least one program version, and the data length of the fixed-length data generated by applications of different program versions may be different. The version information is used to indicate which program version of the application generated the target data.

[0078] The network card driver of the data acquisition device receives a data acquisition request sent by the client. The data acquisition request can be transmitted as a communication data packet between the data acquisition device and the client.

[0079] S205: In response to the data acquisition request, determine a target working thread corresponding to the client.

[0080] In one implementation, after the network card driver of the data acquisition device receives a communication data packet including a data acquisition request, it performs preliminary data analysis on the communication data packet in response to the data acquisition request to determine the client that sent the communication data packet, and then determines the target working thread corresponding to the client.

[0081] S206: Use the network card driver to send the data acquisition request to the buffer queue corresponding to the target working thread.

[0082] In one implementation, the network card driver of the data acquisition request determines the buffer queue corresponding to the target working thread among multiple buffer queues of the data acquisition device, and then sends the data acquisition request to the buffer queue corresponding to the target working thread.

[0083] S207, using the target working thread to parse the data acquisition request in the buffer queue to obtain the target version number and target key value in the data acquisition request.

[0084] In one implementation, the target working thread of the data acquisition device collects the data acquisition requests cached in the buffer queue corresponding to the target working thread through polling. It should be noted that the buffer queue is used to store the pending data of the corresponding working thread. The target working thread parses the data acquisition request to obtain the target version number and target key value carried in the data acquisition request.

[0085] By sending the data acquisition request to the buffer queue of the target working thread corresponding to the client, the target working thread directly processes the data acquisition request sent by the client, so that the processor does not need to frequently schedule the working thread for the request sent by the client, thereby avoiding resource instability caused by the working thread scheduling.

[0086] In one implementation, the adopting the target working thread to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request includes the following steps:

[0087] Determine the setting protocol corresponding to the client;

[0088] The target working thread is used to parse the data acquisition request in the buffer queue based on the set protocol to obtain the target version number and the target key value in the data acquisition request.

[0089] The set protocol is a data parsing protocol agreed upon by the client and the data acquisition device when establishing a communication connection, and the set protocol includes at least one parsing rule. It is understandable that the communication data packets transmitted between the client and the data acquisition device are encapsulated and / or encrypted according to the set protocol.

[0090] The target working thread of the data acquisition device determines the setting protocol corresponding to the client that sends the data acquisition request based on the data acquisition request received through polling, then obtains the parsing rules in the setting protocol, and then performs data parsing on the data acquisition request based on the parsing rules in the setting protocol to parse out the target version number and target key value in the data acquisition request.

[0091] Through the set protocol between the client and the data acquisition request, the target version number and target key value in the data acquisition request are parsed, avoiding problems such as data leakage caused by transparent transmission of data acquisition requests.

[0092] S208, determining a target key-value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number.

[0093] In one implementation, a fixed-length database is used to store fixed-length data, including fixed-length data stored in the fixed-length database, a version mapping table and a key-value mapping table set based on the storage location of the fixed-length data. . Wherein, the fixed-length database includes a version mapping table, which includes at least one version number and a key-value mapping table corresponding to each version number in at least one version number, used to indicate the relationship between the version number and the key-value mapping table. The fixed-length database includes at least one key-value mapping table, which includes at least one key value and a first address corresponding to each key value in at least one key value. It can be understood that the first address corresponding to the key value is the storage address of the data corresponding to the key value, and the storage address indicates the specific address of the first bit of data in the data corresponding to the key value. It can be understood that the key-value mapping table is used to indicate the relationship between the key value and the storage address of the data corresponding to the key value. It should be noted that the fixed-length database is stored in the memory space of the data acquisition device.

[0094] The target working thread of the data acquisition device obtains the version mapping table of the fixed-length database, and then determines whether there is a pre-stored version number consistent with the target version number in the version mapping table based on the target version number. If there is a pre-stored version number consistent with the target version number, the key-value mapping table corresponding to the pre-stored version number consistent with the target version number is used as the target key-value mapping table corresponding to the target version number. If there is no pre-stored version number consistent with the target version number, an error prompt is generated that the data corresponding to the data acquisition request does not exist, and the error prompt is output.

[0095] S209, determining a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value.

[0096] In one implementation, the target working thread of the data acquisition device obtains the target key value mapping table corresponding to the target version number from multiple key value mapping tables in the fixed-length database, and then determines whether there is a pre-stored key value consistent with the target key value in the target key value mapping table based on the target key value. If there is a pre-stored key value consistent with the target key value, the first address corresponding to the pre-stored key value consistent with the target key value is used as the target first address corresponding to the target key value. If there is no pre-stored key value consistent with the target key value, an error prompt is generated indicating that there is no data corresponding to the data acquisition request, and the error prompt is output.

[0097] S210, based on the target first address and the data length corresponding to the target version number, obtain the target data corresponding to the data acquisition request in the fixed-length database.

[0098] In one implementation, after the target working thread of the data acquisition device obtains the target version number in the data acquisition request, it obtains the data length corresponding to the target version number. Optionally, the data length corresponding to the target version number is stored in the data acquisition device, that is, the data acquisition device stores a mapping relationship between the data length and the version number, and the data length corresponding to the target version number can also be directly sent to the data acquisition device along with the data acquisition request, that is, the data acquisition request includes the target version number, the data length corresponding to the target version number, and the target key value. Then, when the data acquisition device responds to the data acquisition request and parses the data acquisition request, it will simultaneously obtain the target version number, the data length corresponding to the target version number, and the target key value in the data acquisition request.

[0099] The target working thread of the data acquisition device determines the specific position of the first bit of data in the target data in the fixed-length database based on the target first address, and takes the specific position as the starting position, and then obtains data of the corresponding data length in the fixed-length database based on the data length corresponding to the target version number, and uses the obtained data as the target data corresponding to the target key value, that is, the target data corresponding to the data acquisition request.

[0100] S211, writing the target data into the network card driver, so as to return the target data to the client through the network card driver.

[0101] In one implementation, the target working thread of the data acquisition device writes the acquired target data into the network card driver. When the network card driver of the data acquisition device detects the target data, it returns the target data to the client corresponding to the target working thread.

[0102] By returning the target data to the client, the client's data acquisition purpose is achieved.

[0103] In an embodiment of the present application, a communication connection is established between a data acquisition device and a client, and then a bound working thread is allocated to the client based on the communication connection. Each time the data acquisition device receives a data packet sent by a communication-connected client, the data acquisition device directly responds to data through the working thread bound thereto, so that the processor does not need to frequently schedule working threads, thereby avoiding resource instability caused by working thread scheduling; by sending a data acquisition request to a buffer queue of a target working thread corresponding to the client, the target working thread directly processes the data acquisition request sent by the client, so that the processor does not need to frequently schedule working threads for the request sent by the client, thereby avoiding resource instability caused by working thread scheduling; by setting a protocol between the client and the data acquisition request, the target version number and target key value in the data acquisition request are parsed, thereby avoiding problems such as data leakage caused by transparent transmission of data acquisition requests; by returning the target data to the client, the client's data acquisition purpose is achieved.

[0104] See also Figure 5 , is a flow chart of a data acquisition method provided in an embodiment of the present application. Figure 5 As shown, the method may include the following steps S301-S311.

[0105] S301, obtaining a target key-value pair, where the target key-value pair includes a target key value and target data.

[0106] In one implementation, the target key-value pair includes a target key value and target data, and the target key value and the target data are associated and stored in a storage medium in the form of a target key-value pair. The target key-value pair is a key-value pair that needs to be stored in a fixed-length database, and the fixed-length database is stored in the memory of the data acquisition device. It should be noted that the time length for the data acquisition device to acquire data stored in the storage medium is defined as the first acquisition time length, the time length for the data acquisition device to acquire data stored in the memory is defined as the second acquisition time length, and the time length for the data acquisition device to acquire data stored in the buffer is defined as the third acquisition time length. When the data acquisition device acquires the same target key-value pair that needs to be selected by the user in different storage locations, the first acquisition time length is greater than the second acquisition time length, and the second acquisition time length is greater than the third acquisition time length, wherein the user may be an application, etc.

[0107] The data acquisition device responds to the data cache instruction and acquires the target key-value pair corresponding to the data cache instruction in the storage medium. Optionally, the data cache instruction carries a data reading rule, such as acquiring a target key-value pair that meets the target type, acquiring a set number of target key-value pairs, acquiring a target key-value pair at a set storage location, acquiring a target key-value pair generated by a target application, acquiring a target key-value pair generated within a set time range, etc., which are not limited here.

[0108] S302, storing the target key-value pair in a fixed-length database.

[0109] In one implementation, the data acquisition device first determines a target storage space in a fixed-length database that is in an idle state, and then stores the target key-value pair in the target storage space.

[0110] S303: Determine a target version number corresponding to the target key-value pair, and based on the target version number, determine a key-value mapping table corresponding to the target version number.

[0111] In one implementation, when the data acquisition device acquires the target key-value pair in the storage medium, it will also determine the target version number corresponding to the target key-value pair based on the relevant information of the target key-value pair (such as storage information, version information, application information, etc.), and determine the key-value mapping table corresponding to the target version number in multiple key-value mapping tables of the fixed-length database based on the version mapping table of the fixed-length database. When there is no key-value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, that is, there is no key-value mapping table corresponding to the target version number in multiple key-value mapping tables of the fixed-length database, a blank key-value mapping table is acquired, that is, a key-value mapping table that does not record any data, and then the currently acquired blank key-value mapping table is used as the key-value mapping table corresponding to the target version number, and then a mapping relationship between the target version number and the blank key-value mapping table is established, and the mapping relationship between the currently established target version number and the blank key-value mapping table is written into the version mapping table of the fixed-length database.

[0112] S304: Update the key-value mapping table corresponding to the target version number based on the target key value and the target first address of the target key-value pair stored in the fixed-length database.

[0113] In one implementation, the data acquisition device obtains the address where the first bit of data in the target data of the target key-value pair is stored based on the storage position of the target key-value pair in the fixed-length database, and uses the address as the target first address of the target key-value pair in the fixed-length database, and then establishes a mapping relationship between the target key value in the target key-value pair and the target first address corresponding to the target key-value pair, and obtains the key value mapping table corresponding to the target version number from multiple key value mapping tables in the fixed-length database, and then writes the mapping relationship between the currently established target key value and the target first address into the key value mapping table corresponding to the target version number.

[0114] In one implementation, the data acquisition device responds to the database construction instruction and acquires a memory space of a set size as a storage area. The set size is the space size carried in the database construction instruction, which can be M bytes, for example. The data acquisition device divides the acquired storage area into multiple memory blocks. For example, the database construction instruction also carries a set memory block size, which can be B bytes. Then, based on the set memory block size, the data acquisition device divides the data area of ​​M bytes into M / B memory blocks of B bytes. The database acquisition device constructs an integer array IsFree[M / B] of size M / B, i.e., a free mark array, which is used to mark whether each memory block in the M / B memory blocks has free storage space. It should be noted that the integer array IsFree[M / B] stores the number of array elements corresponding to the total number of memory blocks. According to the storage order of the memory blocks, the array elements in the array sequentially mark whether the corresponding memory blocks have free storage space. Further, the array element includes a first tag value and a second tag value, the first tag value is used to indicate that there is no spatial storage space in the corresponding memory block, and the second tag value is used to indicate that there is spatial storage space in the corresponding memory block. Exemplarily, if the data acquisition device includes three memory blocks: memory block A, memory block B, and memory block C, and the integer array IsFree[M / B]={1,0,0}, the value "1" indicates that there is no spatial storage space in the corresponding memory block, and the value "0" indicates that there is spatial storage space in the corresponding memory block, which means that there is no free storage space in memory block A, and there is spatial storage space in memory block B and memory block C.

[0115] At the same time, the database acquisition device also constructs a pointer array Address[M / B] of size M / B, that is, an addressing array, which is used to indicate the memory block first address of each memory block in the M / B memory blocks, and the memory block first address is the address information corresponding to the first bit storage position of the memory block. It should be noted that the pointer array Address[M / B] stores the number of array elements corresponding to the total number of memory blocks. According to the storage order of the memory blocks, the array elements in the array sequentially indicate the memory block first addresses of the corresponding memory blocks. Optionally, the array elements in the pointer array Address[M / B] are data pointers, which point to the first bit of the corresponding memory block. Exemplarily, if the data acquisition device includes three memory blocks: memory block A, memory block B and memory block C, and the integer array Address[M / B] = {ptr_1, ptr_2, ptr_3}, it means that the first address of memory block A is ptr_1, the first address of memory block B is ptr_2, and the first address of memory block C is ptr_3.

[0116] Furthermore, the data acquisition device also constructs a version mapping table and multiple key-value mapping tables.

[0117] The data acquisition device responds to the data cache instruction, obtains the target key-value pair corresponding to the data cache instruction in the storage medium, determines the free memory block with free storage space based on the integer array IsFree[M / B], and then determines the memory block head address corresponding to the free memory block based on the pointer array Address[M / B], and then searches the free memory block based on the memory block head address, starting from the memory block head address, determines the storage position of the first free free storage space in the free memory block, and then writes the target key-value pair corresponding to the data cache instruction into the free storage space of the free memory block one by one. During the data writing process, if the current free storage space (the first free storage space) is full, it is directly stored in the next free storage space (the second free storage space), and the tag value corresponding to the first free storage space in the integer array IsFree[M / B] is updated.

[0118] Finally, the data acquisition device obtains the address where the first bit of data in the target data of the target key-value pair is stored based on the storage position of the target key-value pair in the fixed-length database, and uses the address as the target first address of the target key-value pair in the fixed-length database, and then establishes a mapping relationship between the target key value in the target key-value pair and the target first address corresponding to the target key-value pair, and obtains the key value mapping table corresponding to the target version number from the multiple key value mapping tables in the fixed-length database, and then writes the mapping relationship between the currently established target key value and the target first address into the key value mapping table corresponding to the target version number.

[0119] By constructing a fixed-length database, the key-value pairs stored in the storage medium are stored in the fixed-length database, so that when a data acquisition device acquires data, it is no longer necessary to acquire data from the storage medium. By acquiring data in a memory with a shorter acquisition time, the data acquisition speed is improved.

[0120] S305 , in response to the data acquisition request, acquiring a target version number and a target key value in the data acquisition request.

[0121] Please refer to step S101 for details, which will not be described again here.

[0122] S306: Based on the target version number and the target key value, obtain the target data corresponding to the data acquisition request in the data buffer of the fixed-length database.

[0123] In one implementation, the data buffer may be a buffer in a data acquisition device, in which a certain amount of access data is stored. The access data stored in the data buffer includes: a target version number, a target key value, target data, and a mapping relationship between the target version number, the target key value, and the target data.

[0124] The data acquisition device determines the data buffer corresponding to the fixed-length database, and then obtains the target data corresponding to the target version number and the target key value from the multiple groups of buffer data stored in the data buffer, and uses the obtained target data as the target data corresponding to the data acquisition request.

[0125] S307, if the target data corresponding to the data acquisition request is not obtained, then determine the target key-value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, and the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number.

[0126] In one implementation, if the data acquisition device does not obtain the target data corresponding to the target version number and the target key value from the multiple groups of buffered data stored in the data buffer, that is, the data buffer stores the target data corresponding to the target version number and the target key value, the data acquisition device obtains the version mapping table of the fixed-length database, and then based on the target version number, determines whether there is a pre-stored version number consistent with the target version number in the version mapping table, and if there is a pre-stored version number consistent with the target version number, the key value mapping table corresponding to the pre-stored version number consistent with the target version number is used as the target key value mapping table corresponding to the target version number. If there is no pre-stored version number consistent with the target version number, an error prompt is generated indicating that there is no data corresponding to the data acquisition request, and the error prompt is output.

[0127] By caching the data in the buffer, the acquisition time of the data acquisition device can be further shortened when acquiring data, thereby improving the data acquisition speed.

[0128] S308, determining a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value.

[0129] For details, please refer to step S103, which will not be described again here.

[0130] S309: Based on the target first address and the data length corresponding to the target version number, obtain the target data corresponding to the data acquisition request in the fixed-length database.

[0131] For details, please refer to step S104, which will not be described again here.

[0132] S310, storing the target version number, the target key value and the target data in association with each other in a data buffer of the fixed-length database.

[0133] In one implementation, the data acquisition device constructs a mapping relationship among the target version number, the target key value and the target data, and based on the mapping relationship, associates and stores the target version number, the target key value and the target data in a data buffer of a fixed-length database.

[0134] By caching the data in the buffer, the acquisition time of the data acquisition device can be further shortened when acquiring data, thereby improving the data acquisition speed.

[0135] In the embodiment of the present application, by constructing a fixed-length database, the key-value pairs stored in the storage medium are stored in the fixed-length database, so that when the data acquisition device acquires data, it is no longer necessary to acquire data in the storage medium, and the data acquisition speed is improved by acquiring data in a memory with a shorter acquisition time. By caching data in a buffer, the acquisition time of the data acquisition device when acquiring data is further shortened, thereby improving the data acquisition speed.

[0136] The following will be combined with the attached Figure 6 -Attached Figure 7 The data acquisition device provided in the embodiment of the present application is described in detail. Figure 6 -Attached Figure 7 Data acquisition device, used to execute this application Figure 3-Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 3-Figure 5 The embodiment shown.

[0137] See also Figure 6 , is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 6 As shown, the data acquisition device 2 of the embodiment of the present application may include: a request response module 21, a mapping table determination module 22, a first address acquisition module 23 and a data acquisition module 24.

[0138] The request response module 21 is used to respond to the data acquisition request and obtain the target version number and target key value in the data acquisition request;

[0139] A mapping table determination module 22 is used to determine a target key-value mapping table corresponding to the target version number in a version mapping table of a fixed-length database, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number;

[0140] A first address acquisition module 23, used to determine a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value;

[0141] The data acquisition module 24 is used to acquire the target data corresponding to the data acquisition request in the fixed-length database based on the target first address and the data length corresponding to the target version number.

[0142] In an embodiment of the present application, a fixed-length database for fixed-length data is constructed, and according to the version and key value of the fixed-length data, a version mapping table and a key value mapping table for locating the fixed-length data are constructed, and a method for acquiring fixed-length data is designed, that is, the target data corresponding to the data acquisition request is jointly located by the version mapping table and the key value mapping table, and data acquisition is no longer based on complicated variable-length data acquisition methods, which improves the acquisition speed of fixed-length data and thereby improves data acquisition efficiency.

[0143] In one implementation, the request response module 21 is specifically configured to:

[0144] Using the network card driver to receive the data acquisition request sent by the client;

[0145] In response to the data acquisition request, determining a target working thread corresponding to the client;

[0146] Using the network card driver, sending the data acquisition request to the buffer queue corresponding to the target working thread;

[0147] The target working thread is used to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request.

[0148] In one implementation, the request response module 21 is specifically configured to:

[0149] Determine the setting protocol corresponding to the client;

[0150] The target working thread is used to parse the data acquisition request in the buffer queue based on the set protocol to obtain the target version number and the target key value in the data acquisition request.

[0151] In one implementation, see Figure 7 , is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 7 As shown, the data acquisition device 2 of the embodiment of the present application may further include: a thread allocation module 25.

[0152] The thread allocation module 25 is specifically used for:

[0153] Using a network card driver, receiving a communication connection request sent by a client, and sending the communication connection request to the main thread protocol stack;

[0154] Using a user state main thread, parsing the communication connection request in the main thread protocol stack to obtain a client address and a client port in the communication connection request;

[0155] Based on the client address and the client port, a communication connection is established with the client, and a working thread is allocated to the client.

[0156] In one implementation, see Figure 7 , is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 7 As shown, the data acquisition device 2 of the embodiment of the present application may further include: a data returning module 26.

[0157] The data return module 26 is specifically used for:

[0158] The target data is written into the network card driver, so as to return the target data to the client through the network card driver.

[0159] In one implementation, see Figure 7 , is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 7 As shown, the data acquisition device 2 in the embodiment of the present application may further include: a data storage module 27.

[0160] The data storage module 27 is specifically used for:

[0161] Obtain a target key-value pair, wherein the target key-value pair includes a target key value and target data;

[0162] Storing the target key-value pair in a fixed-length database;

[0163] Determine a target version number corresponding to the target key-value pair, and based on the target version number, determine a key-value mapping table corresponding to the target version number;

[0164] Based on the target key value and the target first address of the target key-value pair stored in the fixed-length database, the key-value mapping table corresponding to the target version number is updated.

[0165] In one implementation, the data acquisition module 24 is specifically configured to:

[0166] Based on the target version number and the target key value, obtaining target data corresponding to the data acquisition request in a data buffer of the fixed-length database;

[0167] If the target data corresponding to the data acquisition request is not obtained, the mapping determination module 22 is called to execute the version mapping table in the fixed-length database to determine the target key-value mapping table corresponding to the target version number.

[0168] In one implementation, see Figure 7 , is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 7 As shown, the data acquisition device 2 of the embodiment of the present application may further include: a data cache module 28.

[0169] The data cache module 28 is specifically used for:

[0170] The target version number, the target key value and the target data are associated and stored in a data buffer of the fixed-length database.

[0171] The present application also provides a storage medium, which can store multiple program instructions, which are suitable for being loaded and executed by a processor as described above. Figure 3-Figure 5 The method steps of the embodiment shown in the figure can be found in the specific implementation process. Figure 3-Figure 5 The specific description of the illustrated embodiment will not be repeated here.

[0172] See also Figure 8 , which is a schematic diagram of the structure of a computer device according to an embodiment of the present application. Figure 8 As shown, the computer device 1000 may include: at least one processor 1001, at least one communication bus 1002, at least one input and output interface 1003, at least one network interface 1004 and at least one memory 1005. Among them, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect the various parts within the entire computer device 1000, and executes various functions and processes data of the terminal 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. The memory 1005 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 can optionally be at least one storage device located away from the aforementioned processor 1001. Among them, the network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The communication bus 1002 is used to realize the connection and communication between these components. As Figure 8 As shown, the memory 1005 as a storage medium of a terminal device may include an operating system, a network communication module, an input / output interface module, and a data acquisition program.

[0173] exist Figure 8 In the computer device 1000 shown, the input-output interface 1003 is mainly used to provide an input interface for the user and the access device, and to obtain data input by the user and the access device.

[0174] In one embodiment.

[0175] The processor 1001 may be used to call the data acquisition program stored in the memory 1005, and specifically perform the following operations:

[0176] In response to the data acquisition request, acquiring a target version number and a target key value in the data acquisition request;

[0177] In the version mapping table of the fixed-length database, determine a target key-value mapping table corresponding to the target version number, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number;

[0178] Determine the target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and the first address corresponding to each key value in the at least one key value;

[0179] Based on the target first address and the data length corresponding to the target version number, the target data corresponding to the data acquisition request is obtained in the fixed-length database.

[0180] Optionally, when executing the step of responding to the data acquisition request and acquiring the target version number and the target key value in the data acquisition request, the processor 1001 specifically performs the following operations:

[0181] Using the network card driver to receive the data acquisition request sent by the client;

[0182] In response to the data acquisition request, determining a target working thread corresponding to the client;

[0183] Using the network card driver, sending the data acquisition request to the buffer queue corresponding to the target working thread;

[0184] The target working thread is used to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request.

[0185] Optionally, when the processor 1001 executes the use of the target working thread to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request, the processor 1001 specifically performs the following operations:

[0186] Determine the setting protocol corresponding to the client;

[0187] The target working thread is used to parse the data acquisition request in the buffer queue based on the set protocol to obtain the target version number and the target key value in the data acquisition request.

[0188] Optionally, before executing the step of using the network card driver to receive the data acquisition request sent by the client, the processor 1001 further performs the following operations:

[0189] Using a network card driver, receiving a communication connection request sent by a client, and sending the communication connection request to the main thread protocol stack;

[0190] Using a user state main thread, parsing the communication connection request in the main thread protocol stack to obtain a client address and a client port in the communication connection request;

[0191] Based on the client address and the client port, a communication connection is established with the client, and a working thread is allocated to the client.

[0192] Optionally, after executing the step of acquiring the target data corresponding to the data acquisition request in the fixed-length database based on the data length corresponding to the target version number and the target first address, the processor 1001 further performs the following operations:

[0193] The target data is written into the network card driver, so as to return the target data to the client through the network card driver.

[0194] Optionally, before executing the step of responding to the data acquisition request and acquiring the target version number and the target key value in the data acquisition request, the processor 1001 further performs the following operations:

[0195] Obtain a target key-value pair, wherein the target key-value pair includes a target key value and target data;

[0196] Storing the target key-value pair in a fixed-length database;

[0197] Determine a target version number corresponding to the target key-value pair, and based on the target version number, determine a key-value mapping table corresponding to the target version number;

[0198] Based on the target key value and the target first address of the target key-value pair stored in the fixed-length database, the key-value mapping table corresponding to the target version number is updated.

[0199] Optionally, after executing the step of responding to the data acquisition request and acquiring the target version number and the target key value in the data acquisition request, the processor 1001 further performs the following operations:

[0200] Based on the target version number and the target key value, obtaining target data corresponding to the data acquisition request in a data buffer of the fixed-length database;

[0201] If the target data corresponding to the data acquisition request is not obtained, the version mapping table in the fixed-length database is executed to determine the target key-value mapping table corresponding to the target version number.

[0202] Optionally, after executing the step of acquiring the target data corresponding to the data acquisition request in the fixed-length database based on the data length corresponding to the target version number and the target first address, the processor 1001 further performs the following operations:

[0203] The target version number, the target key value and the target data are associated and stored in a data buffer of the fixed-length database.

[0204] In an embodiment of the present application, a fixed-length database for fixed-length data is constructed, and according to the version and key value of the fixed-length data, a version mapping table and a key value mapping table for locating the fixed-length data are constructed, and a method for acquiring fixed-length data is designed, that is, the target data corresponding to the data acquisition request is jointly located by the version mapping table and the key value mapping table, and data acquisition is no longer based on complicated variable-length data acquisition methods, which improves the acquisition speed of fixed-length data and thereby improves data acquisition efficiency.

[0205] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0206] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0207] The above is a description of a data acquisition method, device, storage medium and equipment provided by the present application. For technicians in this field, according to the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data acquisition method, characterized in that: The method comprises: In response to the data acquisition request, acquiring a target version number and a target key value in the data acquisition request; Based on the target version number and the target key value, obtaining target data corresponding to the data acquisition request in a data buffer of a fixed-length database, wherein the data buffer stores multiple groups of buffer data; If the target data corresponding to the data acquisition request is not obtained in the data buffer, determining a target key-value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, wherein the version mapping table includes at least one version number and a key-value mapping table corresponding to each version number in the at least one version number; Determine the target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and the first address corresponding to each key value in the at least one key value; Based on the target first address and the data length corresponding to the target version number, obtaining the target data corresponding to the data acquisition request in the fixed-length database; The target version number, the target key value, and the target data corresponding to the data acquisition request are associated and stored in the data buffer.

2. The method according to claim 1, characterized in that: The step of obtaining, in response to the data acquisition request, a target version number and a target key value in the data acquisition request includes: Using the network card driver to receive the data acquisition request sent by the client; In response to the data acquisition request, determining a target working thread corresponding to the client; Using the network card driver, sending the data acquisition request to the buffer queue corresponding to the target working thread; The target working thread is used to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request.

3. The method according to claim 2, characterized in that The adopting the target working thread to parse the data acquisition request in the buffer queue to obtain the target version number and the target key value in the data acquisition request includes: Determine the setting protocol corresponding to the client; The target working thread is used to parse the data acquisition request in the buffer queue based on the set protocol to obtain the target version number and the target key value in the data acquisition request.

4. The method according to claim 2, characterized in that: The method of using the network card driver to receive the data acquisition request sent by the client also includes: Using a network card driver, receiving a communication connection request sent by a client, and sending the communication connection request to the main thread protocol stack; Using a user state main thread, parsing the communication connection request in the main thread protocol stack to obtain a client address and a client port in the communication connection request; Based on the client address and the client port, a communication connection is established with the client, and a working thread is allocated to the client.

5. The method according to claim 2, characterized in that: After acquiring the target data corresponding to the data acquisition request in the fixed-length database based on the data length corresponding to the target version number and the target first address, the method further includes: The target data is written into the network card driver, so as to return the target data to the client through the network card driver.

6. The method according to claim 1, characterized in that Before the step of responding to the data acquisition request and acquiring the target version number and the target key value in the data acquisition request, the step further includes: Obtain a target key-value pair, wherein the target key-value pair includes a target key value and target data; Storing the target key-value pair in a fixed-length database; Determine a target version number corresponding to the target key-value pair, and based on the target version number, determine a key-value mapping table corresponding to the target version number; Based on the target key value and the target first address of the target key-value pair stored in the fixed-length database, the key-value mapping table corresponding to the target version number is updated.

7. The method according to claim 1, characterized in that After acquiring the target data corresponding to the data acquisition request in the fixed-length database based on the data length corresponding to the target version number and the target first address, the method further includes: The target version number, the target key value and the target data are associated and stored in a data buffer of the fixed-length database.

8. A data acquisition device, characterized in that: include: A request response module, used to respond to a data acquisition request and obtain a target version number and a target key value in the data acquisition request; A mapping table determination module is used to obtain the target data corresponding to the data acquisition request in the data buffer of the fixed-length database based on the target version number and the target key value, wherein the data buffer stores multiple groups of buffer data; if the target data corresponding to the data acquisition request is not obtained in the data buffer, determine the target key value mapping table corresponding to the target version number in the version mapping table of the fixed-length database, wherein the version mapping table includes at least one version number and a key value mapping table corresponding to each version number in the at least one version number; A first address acquisition module, used to determine a target first address corresponding to the target key value in the target key value mapping table, wherein the target key value mapping table includes at least one key value and a first address corresponding to each key value in the at least one key value; A data acquisition module, used for acquiring target data corresponding to the data acquisition request in the fixed-length database based on the target first address and the data length corresponding to the target version number; The target version number, the target key value, and the target data corresponding to the data acquisition request are associated and stored in the data buffer.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data acquisition method according to any one of claims 1 to 7 is implemented.

10. A computer device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the data acquisition method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Network data packet processing method and device

    CN106713462A

  • Indexing method and device based on key value pair KV system, electronic equipment and medium

    CN111241108A