Data processing method and device, computer equipment and storage medium
By hashing, type conversion or thermal processing on the data, the target interval and sub-interval in the cache are determined, which solves the problem of low efficiency of traditional storage systems and realizes efficient data storage and query.
Patent Information
- Application Number
- CN202311758732.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2025-06-20
AI Technical Summary
Traditional cardinal tree structure storage systems and zippered hash structure storage systems are inefficient in data query or storage.
By hashing, type conversion or thermal processing of the to be processed data, the target interval and target sub-interval in the cache are determined to achieve efficient storage or query of data.
Improves the efficiency of data storage or query and enhances the accuracy of data query or storage.
Smart Images

Figure CN120179149A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer storage technologies, and particularly to a data processing method, apparatus, computer device, and storage medium. Background Art
[0002] With the rapid development of storage technologies, data has become ubiquitous, and how to properly store this data has become an important issue. To meet the requirements of high performance and large capacity, storage systems have emerged.
[0003] Traditional storage systems include radix tree-based storage systems and zipper hash-based storage systems. However, when performing data query or data storage based on a radix tree-based storage system or a zipper hash-based storage system, there is a problem of low efficiency. Summary of the Invention
[0004] Based on this, it is necessary to provide a data processing method, apparatus, computer device, and storage medium that can improve efficiency for the above technical problems.
[0005] In a first aspect, this application provides a data processing method, including:
[0006] Processing the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion processing, and heat processing;
[0007] Determining a target interval in the cache according to the first information; the target interval includes multiple sub-intervals;
[0008] Determining a target sub-interval in the target interval;
[0009] Storing or querying the data to be processed within the target sub-interval.
[0010] The above method realizes two-positioning by first performing interval positioning on the cache and then positioning the sub-intervals in the interval, narrowing the range of the query or storage interval. Thus, storing or querying data based on the interval determined by the two-positioning can improve the storage or query efficiency of the data to be processed. In addition, compared with the existing methods of storing or querying by traversing a large number of intervals in a radix tree-based storage system or a zipper hash-based storage system, the above method can improve the accuracy of data query or storage while improving efficiency.
[0011] In one of the embodiments, the above method further includes:
[0012] Determining second information of the data to be processed;
[0013] Determining the target sub-interval in the target interval includes:
[0014] Determine the target sub-interval in the target interval according to the second information.
[0015] The method for determining the second information provided by the embodiments of the present application obtains the second information through calculation and locates the target sub-interval in the target interval based on the second information. Compared with the traditional method of traversing and searching one by one, the above method greatly improves the processing efficiency of the data to be processed.
[0016] In one embodiment, the above processing includes hash processing. Determining the target interval in the cache according to the first information includes:
[0017] Determine the interval corresponding to the hash value in the first information in the cache as the target interval.
[0018] The method for determining the target interval provided by the embodiments of the present application determines the storage interval where the data to be processed is located based on the consistency between the hash value and the stored data in the interval. The determination method is simple and greatly improves the data processing efficiency.
[0019] In one embodiment, the above determining the target sub-interval in the target interval according to the second information includes:
[0020] Determine the sub-interval corresponding to the data value in the second information in the target interval as the target sub-interval.
[0021] The method for determining the target sub-interval provided by the embodiments of the present application determines the storage sub-interval where the data to be processed is located based on the consistency between the data value in the second information and the serial number of the sub-interval. The determination method is simple and greatly improves the data processing efficiency.
[0022] In one embodiment, the above multiple sub-intervals include multiple data sub-intervals and multiple hash sub-intervals. Determining the target sub-interval in the target interval according to the second information includes:
[0023] Determine the target data sub-interval among the multiple data sub-intervals according to the data value in the second information;
[0024] Determine the target hash sub-interval corresponding to the target data sub-interval according to the corresponding relationship between the data sub-interval and the hash sub-interval;
[0025] Determine the target data sub-interval and the target hash sub-interval as the target sub-interval.
[0026] The method for determining the target sub-interval provided by the embodiments of the present application stores the data value in the second information into the target data sub-interval and stores the hash value into the target hash sub-interval. This enables, when storing a large amount of data in the hash structure, after determining the position of the target data sub-interval, directly determining the position of the target hash sub-interval according to the position of the target data sub-interval, which greatly improves the data search efficiency.
[0027] In one embodiment, the above processing includes hash processing. Determining a target range in the cache according to the first information includes:
[0028] Determine whether there is an idle sub-range in the range that matches the hash value in the first information. If not, re-hash the data to be processed to obtain new first information, and return to execute the step of determining the target range in the cache according to the first information.
[0029] The method for obtaining a target range provided by the embodiments of the present application can re-locate a new target range when there is no idle sub-range in the target range, and determine a target sub-range based on the new target range, providing another implementation method for data query and insertion, so that data can be stored more reasonably in the hash ring structure.
[0030] In one embodiment, the above processing includes type conversion processing. Determining a target range in the cache according to the first information includes:
[0031] Perform inverse type conversion on the first information to obtain a first conversion value;
[0032] Determine the range in the cache corresponding to the first conversion value as the target range.
[0033] The method for determining a target range provided by the embodiments of the present application determines a conversion value based on simple type conversion, and can determine the target range according to the conversion value. Compared with the data processing method of traversing each data in the target range one by one, the above method directly obtains the conversion value through simple type conversion to locate the target range, greatly improving the location efficiency of the target range, and thus improving the data processing efficiency.
[0034] In one embodiment, determining the target sub-range in the above target range includes:
[0035] Perform inverse type conversion on the first information to obtain a second conversion value;
[0036] Determine the sub-range in the target range corresponding to the second conversion value as the target sub-range.
[0037] The method for determining a target sub-range provided by the embodiments of the present application determines a conversion value based on simple type conversion, and can determine the target sub-range according to the conversion value. Compared with the data processing method of traversing each sub-range in the target range one by one, the above method directly obtains the conversion value through simple type conversion to locate the target sub-range in the target range, greatly improving the location efficiency of the target sub-range, and thus improving the data processing efficiency.
[0038] In one embodiment, the above processing includes heat processing, and the cache further includes a first heat table. Determining a target range in the cache according to the first information includes:
[0039] Query the first heat table to determine a target sub-range corresponding to the heat value in the first information.
[0040] The method for determining the target range provided by the embodiment of the present application is based on querying the heat value in the first heat table in the cache, and the position of the target sub-range can be determined according to the heat value. Compared with the data processing method of traversing each range in the physical hash range one by one, the above method can directly locate the target range through simple heat value query, greatly improving the positioning efficiency of the target range, and thus improving the data processing efficiency.
[0041] In one embodiment, the above processing includes heat processing, and the target range further includes a heat range. Determining a target sub-range in the target range according to the second information includes:
[0042] Determine the sub-range corresponding to the highest heat value in the heat range as the target sub-range, or use the idle sub-range in the target range as the target sub-range.
[0043] The method for determining the target sub-range provided by the embodiment of the present application is based on querying the heat value in the heat range in the target range, and the position of the target sub-range can be determined according to the heat value. Compared with the data processing method of traversing each sub-range in the target range one by one, the above method can directly locate the target sub-range through simple heat value query, greatly improving the positioning efficiency of the target sub-range, and thus improving the data processing efficiency.
[0044] In one embodiment, the above method further includes:
[0045] Set the heat value corresponding to the target sub-range to a first value, and increase the heat value corresponding to other sub-ranges by a second value.
[0046] The method for determining the heat value provided by the embodiment of the present application determines the heat value corresponding to different sub-ranges based on the usage situation of the data in different sub-ranges, so that the heat values of different sub-ranges can reflect the state of the stored data in the sub-ranges in real time, providing a basis for subsequent data processing based on the heat value.
[0047] In one embodiment, determining the target sub-range in the target range includes:
[0048] Traverse all sub-ranges in the target range in sequence, and use the first traversed idle range as the target sub-range.
[0049] The method for obtaining the target sub - interval provided in the embodiments of the present application determines the target sub - interval through traversal, providing a basis for subsequent processing of the data to be processed in the target sub - interval.
[0050] In one embodiment, determining the target sub - interval in the above - mentioned target interval includes:
[0051] Label each sub - interval according to the arrangement order of the sub - intervals in the target interval to obtain the head sub - interval and the tail sub - interval;
[0052] Take the tail sub - interval as the target sub - interval.
[0053] In the embodiments of the present application, based on the labeled head sub - interval and tail sub - interval, and directly determining the target sub - interval according to the tail sub - interval, the steps of determining the target sub - interval are greatly simplified, thereby improving the data processing efficiency.
[0054] In one embodiment, the above - mentioned method further includes:
[0055] When storing the data to be processed in the target sub - interval, take the head sub - interval as the new tail sub - interval, and take the sub - interval adjacent to the head sub - interval as the new head sub - interval.
[0056] The update method for the head sub - interval and tail sub - interval provided in the embodiments of the present application can, based on the updated head sub - interval and tail sub - interval, directly determine the target sub - interval according to the new tail sub - interval, greatly simplifying the steps of determining the target sub - interval, thereby improving the data processing efficiency.
[0057] In a second aspect, the present application further provides a data processing device, including:
[0058] A first processing module, configured to process the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion, and heat processing;
[0059] A first determination module, configured to determine the target interval in the cache according to the first information; the target interval includes a plurality of sub - intervals;
[0060] A second determination module, configured to determine the target sub - interval in the target interval;
[0061] A second processing module, configured to store or query the data to be processed in the target sub - interval.
[0062] In a third aspect, the present application further provides a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0063] Process the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion processing, and heat processing;
[0064] Determine a target range in the cache according to the first information; the target range includes a plurality of sub-ranges;
[0065] Determine a target sub-range in the target range;
[0066] Store the data to be processed or query the data to be processed within the target sub-range.
[0067] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0068] Process the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion processing, and heat processing;
[0069] Determine a target range in the cache according to the first information; the target range includes a plurality of sub-ranges;
[0070] Determine a target sub-range in the target range;
[0071] Store the data to be processed or query the data to be processed within the target sub-range.
[0072] In a fifth aspect, the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0073] Process the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion processing, and heat processing;
[0074] Determine a target range in the cache according to the first information; the target range includes a plurality of sub-ranges;
[0075] Determine a target sub-range in the target range;
[0076] Store the data to be processed or query the data to be processed within the target sub-range.
[0077] The above data processing method, apparatus, computer device, and storage medium. The method includes: processing the data to be processed to obtain first information, where the processing includes any one of hash processing, type conversion processing, and heat processing; determining a target range in the cache according to the first information, the target range including a plurality of sub-ranges; determining a target sub-range in the target range; and storing or querying the data to be processed within the target sub-range. The above method realizes two-positioning by first performing range positioning on the cache and then performing sub-range positioning within the range, narrowing the range of the query or storage range. Thus, storing or querying data based on the range determined by the two-positioning can improve the storage or query efficiency of the data to be processed. In addition, compared with the existing radix tree structure storage system or zipper hash structure that needs to traverse a large number of ranges for storage or query, the above method can improve the accuracy of data query or storage while improving the efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0079] Figure 1 It is an application environment diagram of the data processing method in an embodiment;
[0080] Figure 2 It is an application environment diagram of the data processing method in an embodiment;
[0081] Figure 3 It is a flowchart of the data processing method in an embodiment;
[0082] Figure 4 It is a flowchart of the data processing method in another embodiment;
[0083] Figure 5 It is a schematic diagram of a combined hash structure in an embodiment;
[0084] Figure 6 It is a flowchart of the data processing method in another embodiment;
[0085] Figure 7 It is a schematic diagram of a split hash structure in an embodiment;
[0086] Figure 8 It is a schematic diagram of re-hash addressing in an embodiment;
[0087] Figure 9Schematic flowchart of a data processing method in another embodiment;
[0088] Figure 10 Schematic diagram of a double - layer hash structure in one embodiment;
[0089] Figure 11 Schematic flowchart of a data processing method in another embodiment;
[0090] Figure 12 Schematic diagram of inserting data in one embodiment;
[0091] Figure 13 Schematic diagram of querying data in one embodiment;
[0092] Figure 14 Schematic diagram of inserting data in an idle sub - interval in one embodiment;
[0093] Figure 15 Schematic diagram of traversing sub - intervals for addressing in one embodiment;
[0094] Figure 16 Schematic flowchart of a data processing method in another embodiment;
[0095] Figure 17 Schematic flowchart of a data processing method in another embodiment;
[0096] Figure 18 Schematic diagram of sub - interval addressing in one embodiment;
[0097] Figure 19 Schematic diagram of sub - interval coverage transfer in one embodiment;
[0098] Figure 20 Schematic block diagram of a data processing device in one embodiment. Detailed implementation manners
[0099] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0100] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above - mentioned drawings are intended to cover non - exclusive inclusion.
[0101] In the description of the embodiments of the present application, technical terms such as "first" and "second" are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity, specific order or primary-secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "a plurality of" is more than two, unless otherwise specifically limited.
[0102] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0103] With the rapid development of storage technology, data has become ubiquitous. How to properly store this data has become an important issue. The storage media for storing data have evolved from magnetic tapes to floppy disks, then from mechanical hard disks to solid-state drives. Each transformation is an epoch-making technological innovation. To meet the requirements of high performance and large capacity, storage systems have emerged. The underlying medium of earlier storage systems was mechanical hard disks, and their performance was limited by hardware with relatively low performance requirements. With the development of NVMe solid-state drives (SSDs), storage systems based on NVMe SSD all-flash hard disks have started to stand out and play an important role in various fields with their high-performance advantages.
[0104] Traditional storage systems include radix tree-based storage systems and zippered hash-based storage systems. However, when performing data query or data storage based on a radix tree-based storage system or a zippered hash-based storage system, there is a problem of low efficiency. This application aims to solve this problem.
[0105] After introducing the background technology of the data processing method provided by the embodiments of the present application as above, below, the implementation environment involved in the data processing method provided by the embodiments of the present application will be briefly described. The data processing method provided by the embodiments of the present application can be applied to Figure 1 the hash ring structure as shown. The hash ring structure is applied to the storage subsystem of the cache and is used to continuously store data by hashing. The addressing range composed of the indexes obtained by serializing the keys that can be processed in the hash ring structure can be split to obtain multiple logical intervals (i.e., Figure 1 the logical hash intervals in Figure 1 ). Each logical interval can further include multiple physical sub-intervals. The hash ring structure uses fixed-length memory as the carrier for hashing (such as 8 kb), and these fixed-length memories are called physical sub-intervals (i.e.,
[0106] The physical hash interval consists of multiple physical intervals. Each physical interval stores data with different hash values. The physical interval consists of multiple physical sub - intervals. Each physical sub - interval stores data with the same hash value but different key values. For example, physical interval 1 stores key - value pairs with a hash value of 1. Physical sub - interval 10 in physical interval 1 stores the key - value pair (5,1), physical sub - interval 11 in physical interval 1 stores the key - value pair (9,1), and physical sub - interval 12 in physical interval 1 stores the key - value pair (13,1). In the embodiments of the present application, the key and the value can be stored together in a physical sub - interval, or the key and the value can be separately stored in a data sub - interval and a hash sub - interval within a physical sub - interval.
[0107] Since the cache stores data in a hash ring structure in this solution, when it is necessary to store the data to be processed into the hash ring structure or query the data to be queried from the hash ring structure, the participation of a computer device is required. The data processing method provided in the embodiments of the present application is applied to a Figure 2 computer device as shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non - volatile storage medium and an internal memory. The non - volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non - volatile storage medium. The database of the computer device is used to store cache data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for processing a cache.
[0108] Those skilled in the art can understand that Figure 1 the structure shown in Figure 1 is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in
[0109] After introducing the application scenario of the data processing method provided in the embodiments of the present application above, the data processing method described in the present application will be introduced in detail below.
[0110] In one embodiment, asFigure 3 As shown, a data processing method is provided. Taking the computer device to which this method is applied as an example for illustration, the method includes the following steps: Figure 2 in the following for illustration.
[0111] S201. Process the data to be processed to obtain first information.
[0112] The data to be processed refers to the data to be inserted into the hash ring structure, or can also be the data to be queried in the hash ring structure. The processing includes any one of hash processing, type conversion processing, and heat processing. Hash processing refers to performing a hash function operation on the data to be processed. Type conversion processing refers to performing binary, octal, or hexadecimal conversion on the index after serializing the data to be processed. Heat processing refers to a way of processing the data to be processed according to the number of times the data to be processed is called or selected by the Central Processing Unit (CPU). The first information includes the hash value obtained by calculating the data to be processed through the hash function, and the index calculated using the hash function, and the high-order data information obtained after performing binary or hexadecimal conversion on the index. For example, if the data to be processed is 9 and the hash function is hash(x) = x % 4, then the hash value is 1, the binary number of 9 is 1001, and the high-order data information is 10.
[0113] In the embodiments of the present application, when it is necessary to insert the data to be inserted into the hash ring structure into the hash ring structure, or when it is necessary to query the position of the data to be queried in the hash ring structure, the data to be inserted or the data to be queried can be processed first to obtain the first information after processing the data to be inserted or the data to be queried. Optionally, the data to be inserted or the data to be queried can be subjected to hash processing to obtain the first information after hash processing. For example, if the data to be processed is 9 and the hash function is hash(x) = x % 4, then the first information is 1. Optionally, the data to be inserted or the data to be queried can also be subjected to type conversion processing to obtain the first information after type conversion processing. For example, if the data to be processed is 9, after binary conversion, it is 1001, and the high-order 10 after binary conversion is taken as the first information. Optionally, the data to be inserted or the data to be queried can also be subjected to heat processing to obtain the first information after heat processing.
[0114] S202. Determine the target interval in the cache according to the first information.
[0115] The cache is a buffer for data exchange. In the embodiments of the present application, the storage system uses a hash ring structure as the data structure of the cache subsystem. That is to say, the data structure of the cache includes multiple hash ring structures. The hash ring structure provided by the present application is as above Figure 1As shown, a hash ring structure includes multiple logical hash intervals. Each logical hash interval includes multiple physical hash intervals. Each physical hash interval includes multiple intervals. An interval includes multiple sub-intervals. The target interval refers to an interval in the hash ring structure determined according to the first information.
[0116] In the embodiments of the present application, after obtaining the first information, the target interval can be determined in the (cache) hash ring structure according to the first information. Optionally, after determining which physical hash interval in the hash ring structure the data to be processed is in according to the existing addressing method, it can continue to determine which interval in the physical hash interval the data to be processed is in according to the first information obtained above; for example, after determining that the data to be processed is in physical hash interval 1 in the hash ring structure according to the existing addressing method, if the determined first information is 3, then according to the first information, it is determined that the data to be processed is located in the interval storing the hash value of 3 in the physical hash interval; for another example, after determining that the data to be processed is in physical hash interval 1 in the hash ring structure according to the existing addressing method, if the determined first information is 10 (binary number), then according to the relationship between the first information and each interval in the physical hash interval, it is determined that the data to be processed is located in the interval in the physical hash interval.
[0117] S203. Determine the target sub-interval in the target interval.
[0118] In the embodiments of the present application, after determining the target interval where the data to be processed is located, it can continue to determine the target sub-interval in the target interval where the data to be processed is located; optionally, if the data to be processed is data to be inserted, then each sub-interval in the target interval can be traversed. If there is an idle sub-interval during the traversal, it is determined that the idle sub-interval is the target sub-interval; if the data to be processed is data to be queried, then each sub-interval in the target interval can be traversed. If there is an index that is the same as the index of the data to be queried during the traversal, the subspace where the index is located is determined as the target sub-interval.
[0119] S204. Store the data to be processed or query the data to be processed in the target sub-interval.
[0120] In the embodiments of the present application, after determining the target sub-interval, the data to be processed can be directly stored in the target sub-interval or the data to be queried can be directly queried; optionally, if the data to be processed is data to be inserted, then the data to be inserted can be directly stored in the target sub-interval; optionally, if the data to be processed is data to be queried, then the data to be queried can be directly queried in the target sub-interval.
[0121] The data processing method provided by the embodiments of the present application processes the data to be processed to obtain first information. The processing includes any one of hash processing, type conversion processing, and heat processing. The target interval in the cache is determined according to the first information. The target interval includes multiple sub-intervals. The target sub-interval in the target interval is determined, and the data to be processed is stored or the data to be processed is queried within the target sub-interval. By first performing interval positioning on the cache and then performing positioning on the sub-intervals within the interval, the above method realizes two-positioning, reduces the range of the query or storage interval, so that data storage or query can be performed based on the interval determined by the two-positioning, which can improve the storage or query efficiency of the data to be processed. In addition, compared with the existing radix tree structure storage system or zipper hash structure that needs to traverse a large number of intervals for storage or query, the above method can improve the accuracy of data query or storage while improving the efficiency.
[0122] In one embodiment, on the basis of the embodiment shown above, as Figure 3 shown, the above method further includes: Figure 4 shown, the above method further includes:
[0123] S205. Determine the second information of the data to be processed.
[0124] Wherein, the second information may include the serial number of the sub-space when traversing each sub-space in the target interval until the sub-space is an idle sub-space or the index of the data stored in the sub-space is the index of the data to be queried. The second information may also be the index obtained by performing a hash function calculation on the data to be processed, and the low-order data information obtained after converting the index into binary or hexadecimal. For example, if the data to be processed is 9, the binary number of 9 is 1001, and the low-order data information is 01.
[0125] In the embodiments of the present application, after determining the target interval of the data to be processed in the hash ring structure, the data to be processed may be further processed to obtain the second information after processing the data to be processed. Optionally, type conversion processing may also be performed on the data to be processed to obtain the second information after type conversion processing. For example, if the data to be processed is 9, after binary conversion, it is 1001, and the low-order 01 after binary conversion is taken as the second information. Optionally, heat processing may also be performed on the data to be processed to obtain the second information after heat processing. For example, by monitoring the number of times the data stored in the hash ring structure is called by the CPU, the heat of each stored data in the hash ring structure is obtained. It should be noted that the more times the data is called by the CPU, the higher the heat.
[0126] The above S203 "determine the target sub-interval in the target interval" includes:
[0127] S203. Determine the target sub-interval in the target interval according to the second information.
[0128] In the embodiments of the present application, after determining the target interval and the second information where the data to be processed is located, the target sub-interval can be determined in the target interval according to the second information; optionally, the data to be processed can be subjected to type conversion processing to obtain the second information after the type conversion processing, and then the corresponding target sub-interval can be found in the target interval according to the second information. For example, if the data to be processed is 9, the binary number of 9 is 1001, the second information is 01, and the second information is converted to decimal to get 1, then the sub-interval at the first position is found in the target interval as the target sub-interval. As Figure 5 shown, a combined hash structure is given, which places the data value of the data to be processed and the hash value of the data to be processed together.
[0129] The method for determining the second information provided by the embodiments of the present application obtains the second information by calculation and locates the target sub-interval in the target interval based on the second information. Compared with the traditional method of sequentially traversing and searching, the above method greatly improves the processing efficiency of the data to be processed.
[0130] In one embodiment, based on the above Figure 3 or Figure 4 On the basis of the embodiment shown, in the case where the above processing is hash processing, the process of determining the target interval can be described, that is, S202 "determine the target interval in the cache according to the first information" includes:
[0131] Determine the interval corresponding to the hash value in the first information in the cache as the target interval.
[0132] Among them, after performing hash processing on the data to be processed to obtain the hash value, the interval corresponding to the hash value in the first information in the cache can be determined as the target interval. For example, after determining that the data to be processed is in the physical hash interval 1 in the hash ring structure according to the existing addressing method, if the hash value in the determined first information is 3, then the interval storing the hash value 3 in the physical hash interval is determined as the target interval according to the hash value 3.
[0133] The method for determining the target interval provided by the embodiments of the present application determines the storage interval where the data to be processed is located based on the fact that the hash value is consistent with the stored data in the interval. The determination method is simple and greatly improves the data processing efficiency.
[0134] In one embodiment, based on the above embodiment, the process of determining the target sub-interval can be described, that is, S203 "determine the target sub-interval in the target interval according to the second information" includes:
[0135] Determine the sub-interval corresponding to the data value in the second information in the target interval as the target sub-interval.
[0136] Wherein, the data value in the second information refers to the data value with the same serial number as the target sub-interval. The data value in the second information can be obtained by traversing each sub-interval in the target interval, or can be obtained by performing conversion processing on the data to be processed and according to the conversion result.
[0137] In the embodiment of the present application, after determining the target interval where the data to be processed is located and the second information as described above, the sub-interval corresponding to the data value in the second information in the target interval can be determined as the target sub-interval; optionally, the data to be processed can be subjected to type conversion processing to obtain the second information after the type conversion processing, and then the corresponding target sub-interval can be found in the target interval according to the second information. For example, if the data to be processed is 9, the binary number of 9 is 1001, the second information is 01, and the second information is converted to decimal to get 1, then the sub-interval at the first position is found in the target interval as the target sub-interval.
[0138] The method for determining the target sub-interval provided by the embodiment of the present application determines the storage sub-interval where the data to be processed is located based on the consistency between the data value in the second information and the serial number of the sub-interval. The determination method is simple and greatly improves the data processing efficiency.
[0139] In one embodiment, on the basis of the above embodiment, if the above-mentioned multiple sub-intervals include multiple data sub-intervals and multiple hash sub-intervals, the process of obtaining the target sub-interval can be further described, such as Figure 6 shown, that is, S203 "determine the target sub-interval in the target interval according to the second information" includes:
[0140] S301. Determine the target data sub-interval in the multiple data sub-intervals according to the data value in the second information.
[0141] Wherein, the sub-interval includes a data sub-interval and a hash sub-interval. The data sub-interval refers to the sub-interval storing the data value in the second information, and the hash sub-interval refers to the sub-interval storing the hash value in the second information. The positions of the data sub-interval and the hash sub-interval correspond, and the position of the hash sub-interval can be determined according to the position of the data sub-interval.
[0142] In the embodiment of the present application, after determining the data value in the second information as described above, the data sub-interval consistent with the data value in the second information can be determined in the multiple data sub-intervals according to the data value in the second information, and the data sub-interval is determined as the target data sub-interval. For example, if the data value in the second information is 5, then the data sub-interval storing the index value of 5 is found in each data sub-interval in the sub-interval as the target data sub-interval.
[0143] S302. Determine a target hash sub - interval corresponding to the target data sub - interval according to the correspondence between the data sub - intervals and the hash sub - intervals.
[0144] In the embodiments of the present application, after determining the position of the target data sub - interval as described above, the target hash sub - interval corresponding to the target data sub - interval can be determined according to the correspondence between the position of the data sub - interval and the position of the hash sub - interval. For example, according to the position of the target data sub - interval among the data sub - intervals, determine the position of the target hash sub - interval among the hash sub - intervals.
[0145] S303. Determine the target data sub - interval and the target hash sub - interval as the target sub - interval.
[0146] In the embodiments of the present application, after determining the target data sub - interval and the target hash sub - interval as described above, the target data sub - interval and the target hash sub - interval can be determined as the target sub - interval of the data to be processed. As Figure 7 shown, a split - type hash structure is provided, which places the data value of the data to be processed and the hash value of the data to be processed in the data sub - interval and the hash sub - interval respectively.
[0147] The method for determining the target sub - interval provided by the embodiments of the present application stores the data value in the second information into the target data sub - interval and stores the hash value into the target hash sub - interval. This enables, when storing a large amount of data in the hash structure, directly determining the position of the target hash sub - interval according to the position of the target data sub - interval after determining the position of the target data sub - interval, which greatly improves the data search efficiency.
[0148] In one embodiment, based on the above - mentioned embodiment, if the processing includes hash processing, the process of obtaining the target interval can be described, that is, S202 "Determine the target interval in the cache according to the first information" includes:
[0149] Determine whether there is an idle sub - interval in the interval that matches the hash value in the first information. If not, re - perform hash processing on the data to be processed to obtain new first information, and return to execute the step of determining the target interval in the cache according to the first information.
[0150] In the embodiment of the present application, after the hash value in the first information corresponding to the data to be processed is determined as above, it is possible to sequentially search in the interval corresponding to the hash value to check whether there is an idle sub-interval or a sub-interval consistent with the index of the data to be queried. If there is, the data to be inserted is directly inserted into the idle sub-interval, or the data to be queried is searched in the sub-interval consistent with the index of the data to be queried. If not, the data to be processed is re-hashed using a new hash function to obtain new first information, and the target interval in the hash ring structure is determined according to the hash value in the new first information. As Figure 8 shown, a method is provided to determine whether there is an idle sub-interval in the interval matching the hash value in the first information. If not, the data to be processed is re-hashed to obtain new first information, and the target interval is re-located according to the new first information, and it is determined whether there is an idle sub-interval in the target interval. And in the case where there is an idle sub-interval in the target interval, the data to be inserted is inserted into the idle sub-interval.
[0151] The method for obtaining the target interval provided by the embodiment of the present application can re-locate a new target interval in the case where there is no idle sub-interval in the target interval, and determine the target sub-interval based on the new target interval, providing another implementation method for data query and insertion, so that data can be stored more reasonably in the hash ring structure.
[0152] In one embodiment, based on the above embodiment, if the processing includes type conversion processing, as Figure 9 shown, the process of obtaining the target interval can be described, that is, S202 "determine the target interval in the cache according to the first information" includes:
[0153] S401. Perform inverse type conversion on the first information to obtain a first conversion value.
[0154] In the embodiment of the present application, after the data to be processed is serialized to obtain the index of the data to be processed, and then the index of the data to be processed is type-converted to obtain the first information, the first information can be inversely type-converted to obtain the first conversion value. For example, the index (index) of the data to be processed is 9, the binary conversion of the index of the data to be processed is 1001, the binary-converted data is split into 10 and 01, where 10 is the high-order data and 01 is the low-order data. The high-order data is determined as the first information, and then the first information is converted to decimal to obtain the first conversion value 2.
[0155] S402. Determine the interval corresponding to the first conversion value in the cache as the target interval.
[0156] In an embodiment of the present application, after the first conversion value is determined as described above, the interval corresponding to the first conversion value in the hash ring structure can be determined as the target interval. For example, if the first conversion value determined as described above is 2, then after determining the physical hash interval where the data to be processed is located in the hash ring structure based on a preset addressing method, according to the first conversion value determined as described above in the physical hash interval, the interval corresponding to the first conversion value is determined as the target interval. As Figure 10 shown, a combined double-layer hash structure is given, which can find the interval corresponding to the first conversion value through the first conversion value.
[0157] The method for determining the target interval provided by the embodiment of the present application determines the conversion value based on simple type conversion, and the target interval can be determined according to the conversion value. Compared with the data processing method of traversing each data in the target interval one by one, the above method directly locates the target interval through the conversion value obtained by simple type conversion, greatly improving the positioning efficiency of the target interval, and thus improving the data processing efficiency.
[0158] In one embodiment, on the basis of the above Figure 9 embodiment, as Figure 11 shown, the process of obtaining the target sub-interval can be described, that is, S203 "determine the target sub-interval in the target interval" includes:
[0159] S501. Perform type reverse conversion on the first information to obtain a second conversion value.
[0160] In an embodiment of the present application, after the data to be processed is serialized to obtain the index of the data to be processed, and then the index of the data to be processed is type-converted to obtain the first information as described above, the first information can be type-reverse converted to obtain the second conversion value. For example, the index of the data to be processed (index) is 9, the index of the data to be processed is binary-converted to 1001, the binary-converted data is split into 10 and 01, where 10 is the high-order data and 01 is the low-order data, the low-order data is determined as the first information, and then the first information is decimal-converted to obtain the second conversion value 1.
[0161] S502. Determine the sub-interval corresponding to the second conversion value in the target interval as the target sub-interval.
[0162] In an embodiment of the present application, after the second conversion value is determined as described above, the sub-interval corresponding to the second conversion value in the target interval can be determined as the target sub-interval. For example, if the second conversion value determined as described above is 1, then after the target interval where the data to be processed is located is determined as described above, according to the second conversion value determined as described above in the target interval, the sub-interval corresponding to the second conversion value is determined as the target sub-interval. As Figure 10As shown, a combined double-layer hash structure is given, which can find the sub-interval corresponding to the second conversion value through the second conversion value.
[0163] The method for determining the target sub-interval provided by the embodiments of the present application determines the conversion value based on simple type conversion, and can determine the target sub-interval according to the conversion value. Compared with the data processing method of traversing each sub-interval in the target interval one by one, the above method directly locates the target sub-interval in the target interval through the conversion value obtained by simple type conversion, greatly improving the location efficiency of the target sub-interval, and thus improving the data processing efficiency.
[0164] In one embodiment, on the basis of the above Figure 3 embodiment, if the above processing includes heat processing, the above cache further includes a first heat table, and the process of obtaining the target interval can be described, that is, S202 "determine the target interval in the cache according to the first information" includes:
[0165] Query the first heat table to determine the target sub-interval corresponding to the heat value in the first information.
[0166] Among them, the first heat table includes multiple heat values. The number of heat values in the first heat table is the same as the number of intervals in the physical hash interval. The first heat table is set at the head position of the physical hash interval. After arranging the first heat table at the head position in the physical hash interval, the intervals in the physical hash interval are arranged in sequence according to the order of each heat value in the first heat table. The heat value is used to represent the number of times the data stored in the hash ring structure is called by the CPU. The more times the data is called by the CPU, the higher the heat value of the data.
[0167] In the embodiments of the present application, if the physical hash interval of the hash ring structure includes a first heat table, when inserting the data to be processed into the hash ring structure or querying the data to be queried in the hash ring structure, after determining the target physical hash interval where the data to be processed is located, the first heat table in the target physical hash interval can be queried, and the interval whose heat value in the first information is consistent with the heat value in the first heat table is determined as the target interval.
[0168] The method for determining the target interval provided by the embodiments of the present application determines the position of the target sub-interval based on querying the heat value in the first heat table in the cache, and can determine the target sub-interval according to the heat value. Compared with the data processing method of traversing each interval in the physical hash interval one by one, the above method directly locates the target interval through simple heat value query, greatly improving the location efficiency of the target interval, and thus improving the data processing efficiency.
[0169] In one embodiment, based on the above embodiment, if the above processing includes heat processing, the target range further includes a heat range, and the process of obtaining the target sub-range can be described. That is, S203 "determine the target sub-range in the target range according to the second information" includes:
[0170] Determine the sub-range corresponding to the highest heat value in the heat range as the target sub-range, or use the idle sub-range in the target range as the target sub-range.
[0171] Among them, each range further includes a heat range, the heat includes multiple heat values, the number of heat values in the heat range is the same as the number of sub-ranges in the target range, the heat range is set at the head position in the target range, and after arranging the heat range at the head position in the target range, the sub-ranges in the target range are arranged in sequence according to the order of each heat value in the heat range. The heat value is used to represent the number of times the data stored in the hash ring structure is called by the CPU. The more times the data is called by the CPU, the higher the heat value. The idle sub-range refers to the sub-range not occupied by data.
[0172] In the embodiment of the present application, if the range of the physical hash range includes a heat range, when inserting the data to be processed into the hash ring structure or querying the data to be queried in the hash ring structure, after determining the target range where the data to be processed is located, the heat values in the heat range in the target range can be queried, and the sub-range corresponding to the highest heat value in the heat range can be determined as the target sub-range, or the idle sub-range in the target range can be determined as the target sub-range. As Figure 12 shown, an implementation method for determining the insertion position of the newly inserted data KV5 according to the heat value is provided, that is, inserting the newly inserted data KV5 at the position with the highest heat value.
[0173] The method for determining the target sub-range provided by the embodiment of the present application is based on querying the heat values in the heat range of the target range, and the position of the target sub-range can be determined according to the heat value. Compared with the data processing method of traversing each sub-range in the target range one by one, the above method can directly locate the target sub-range through simple heat value query, greatly improving the positioning efficiency of the target sub-range, and thus improving the data processing efficiency.
[0174] In one embodiment, based on the above embodiment, the above method further includes:
[0175] Set the heat value corresponding to the target sub-range to the first value, and increase the heat values corresponding to other sub-ranges by the second value.
[0176] Among them, the first value can be 0, and the second value can be 1.
[0177] In the embodiments of the present application, after processing the target sub-interval based on the data to be processed, the heat value corresponding to the target sub-interval can be set to 0, and the heat values corresponding to other sub-intervals can be increased by 1 respectively. Optionally, after inputting the data to be input into the target sub-interval, the heat value corresponding to the target sub-interval can be set to 0, and the heat values corresponding to other sub-intervals can be increased by 1 respectively. Optionally, after the target sub-interval queries the data to be queried, the heat value corresponding to the target sub-interval can be set to 0, and the heat values corresponding to other sub-intervals can be increased by 1 respectively. As Figure 13 shown, an implementation method for determining the query position of the query data KV3 according to the heat value is provided, that is, modifying the heat value of the sub-interval where the query data KV3 is located to 0, and increasing the heat values at other positions by 1 respectively. As Figure 14 shown, a situation where there is an idle sub-interval in the target interval is also provided, that is, inserting the newly inserted data KV1 into the first sub-interval during the traversal process, modifying the heat value of this sub-interval to 0, and increasing the heat values at other positions by 1 respectively.
[0178] The method for determining the heat value provided by the embodiments of the present application determines the heat values corresponding to different sub-intervals based on the usage conditions of the data in different sub-intervals, so that the heat values of different sub-intervals can reflect the state of the stored data in the sub-intervals in real time, providing a basis for subsequent processing of the data based on the heat values.
[0179] In one embodiment, based on the above embodiment, the process of determining the target sub-interval can be described. The above method further includes:
[0180] Traverse all sub-intervals in the target interval in sequence, and use the first idle interval encountered as the target sub-interval.
[0181] Among them, the idle sub-interval refers to the sub-interval in the target interval that is not occupied by data.
[0182] In the embodiments of the present application, a method for determining the target sub-interval in the target interval is also provided, that is, after determining the target interval where the data to be processed is located, all sub-intervals in the target interval can be traversed in sequence, and the first idle interval encountered during the traversal process can be used as the target sub-interval. Optionally, after determining the target interval into which the data to be input can be input, the sub-intervals in the target interval can be traversed in sequence, find the first idle sub-interval in the target interval during the traversal process, and determine this idle sub-interval as the target sub-interval, and store the data to be input into the target sub-interval. As Figure 15 shown, an implementation method for traversing all sub-intervals in the target interval in sequence and using the first idle interval encountered as the target sub-interval is given.
[0183] The method for obtaining the target sub-interval provided in the embodiments of the present application determines the target sub-interval through traversal, providing a basis for subsequent processing of the data to be processed in the target sub-interval.
[0184] In one embodiment, based on the above embodiment, as Figure 16 shown, the process of determining the target sub-interval can be described. The above method further includes:
[0185] S601. Label each sub-interval according to the arrangement order of the sub-intervals in the target interval to obtain a head sub-interval and a tail sub-interval.
[0186] Among them, the head sub-interval refers to the first sub-interval labeled in the target interval, and the tail sub-interval refers to the last sub-interval labeled in the target interval.
[0187] In the embodiments of the present application, a method for determining the target sub-interval in the target interval is also provided, that is, after the target interval is determined, the sub-intervals in the target interval can be arranged in ascending or descending order, and each sub-interval is labeled in turn to obtain a head sub-interval and a tail sub-interval.
[0188] S602. Take the tail sub-interval as the target sub-interval.
[0189] In the embodiments of the present application, after the tail sub-interval is determined, the tail sub-interval can be used as the target sub-interval. Optionally, if the data to be processed is the data to be input, and the tail sub-interval is an idle sub-interval, the data to be input is directly input into the tail sub-interval.
[0190] In the embodiments of the present application, based on the labeled head sub-interval and tail sub-interval, and directly determining the target sub-interval according to the tail sub-interval, the steps of determining the target sub-interval are greatly simplified, thereby improving the data processing efficiency.
[0191] In one embodiment, based on the above Figure 16 shown embodiment, as Figure 17 shown, the above method further includes:
[0192] S603. When the target sub-interval stores the data to be processed, take the head sub-interval as the new tail sub-interval, and take the sub-interval adjacent to the head sub-interval as the new head sub-interval.
[0193] In the embodiments of the present application, when all the sub-intervals in the above target interval store data, when the data to be processed is input to the target sub-interval axis, the original head sub-interval in the target interval is used as the new tail sub-interval, and the sub-interval adjacent to the original head sub-interval and not the tail sub-interval is used as the new head sub-interval. As Figure 18As shown, a method is provided to organize sub - intervals within each interval into a ring, record the position posHead of the head sub - interval and the position posRear of the tail sub - interval. When new data is inserted, it is default to insert from the position of the tail sub - interval. In the case where data has been stored at the position of the tail sub - interval, then move the position cursors of the head sub - interval and the tail sub - interval forward by 1 bit to overwrite the data item at the tail.
[0194] In one embodiment, as Figure 19 shown, a covering transfer method is also provided, that is, when the atomic interval is covered, judge the heat value of the atomic interval before covering. If it is relatively hot, move the atomic interval to the hot interval.
[0195] The update method for the head sub - interval and the tail sub - interval provided by the embodiments of the present application can be based on the updated head sub - interval and tail sub - interval, and directly determine the target sub - interval according to the new tail sub - interval, greatly simplifying the steps of determining the target sub - interval, thereby improving the data processing efficiency.
[0196] It should be understood that although the steps in the flowcharts involved in the above - mentioned embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above - mentioned embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0197] Based on the same inventive concept, the embodiments of the present application also provide a data processing device for implementing the above - mentioned data processing method. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above - mentioned method. Therefore, the specific limitations in one or more embodiments of the data processing device provided below can refer to the limitations on the data processing method in the above text, and will not be repeated here.
[0198] In an exemplary embodiment, as Figure 20 shown, a data processing device is provided, including: a first processing module 10, a first determination module 11, a second determination module 12, and a second processing module 13, where:
[0199] The first processing module 10 is used to process the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion, and heat processing.
[0200] The first determination module 11 is configured to determine a target range in the cache according to the first information; the target range includes a plurality of sub-ranges.
[0201] The second determination module 12 is configured to determine a target sub-range in the target range.
[0202] The second processing module 13 is configured to store the data to be processed or query the data to be processed within the target sub-range.
[0203] In an exemplary embodiment, the above device further includes: a third determination module, configured to determine second information of the data to be processed;
[0204] The above second determination module 12 is configured to determine a target sub-range in the target range according to the second information.
[0205] In an exemplary embodiment, the above processing includes hash processing, and the first determination module 11 is further configured to determine the range in the cache corresponding to the hash value in the first information as the target range.
[0206] In an exemplary embodiment, the above second determination module 12 is further configured to determine the sub-range in the target range corresponding to the data value in the second information as the target sub-range.
[0207] In an exemplary embodiment, the above plurality of sub-ranges includes a plurality of data sub-ranges and a plurality of hash sub-ranges, and the second determination module 12 is configured to determine a target data sub-range from the plurality of data sub-ranges according to the data value in the second information; determine a target hash sub-range corresponding to the target data sub-range according to the correspondence between the data sub-range and the hash sub-range; and determine the target data sub-range and the target hash sub-range as the target sub-range.
[0208] In an exemplary embodiment, the above processing includes hash processing, and the first determination module 11 is configured to determine whether there is an idle sub-range in the range matching the hash value in the first information. If not, re-perform hash processing on the data to be processed to obtain new first information, and return to execute the step of determining the target range in the cache according to the first information.
[0209] In an exemplary embodiment, the above processing includes type conversion processing, and the first determination module 11 is configured to perform inverse type conversion on the first information to obtain a first conversion value; and determine the range in the cache corresponding to the first conversion value as the target range.
[0210] In an exemplary embodiment, the above second determination module 12 is configured to perform inverse type conversion on the first information to obtain a second conversion value; and determine the sub-range in the target range corresponding to the second conversion value as the target sub-range.
[0211] In an exemplary embodiment, the above processing includes heat processing, the cache further includes a first heat table, and the first determination module 11 is configured to query the first heat table to determine a target sub-interval corresponding to the heat value in the first information.
[0212] In an exemplary embodiment, the above processing includes heat processing, the target interval further includes a heat interval, and the second determination module 12 is configured to determine the sub-interval corresponding to the highest heat value in the heat interval as the target sub-interval, or use the idle sub-interval in the target interval as the target sub-interval.
[0213] In an exemplary embodiment, the first determination module 11 includes a setting unit, specifically configured to set the heat value corresponding to the target sub-interval to a first value, and increase the heat values corresponding to other sub-intervals by a second value.
[0214] In an exemplary embodiment, the second determination module 12 is configured to sequentially traverse all sub-intervals in the target interval and use the first traversed idle interval as the target sub-interval.
[0215] In an exemplary embodiment, the second determination module 12 is configured to label each sub-interval according to the arrangement order of the sub-intervals in the target interval to obtain a head sub-interval and a tail sub-interval; use the tail sub-interval as the target sub-interval.
[0216] In an exemplary embodiment, the second determination module 12 is further configured to, when the target sub-interval stores data to be processed, use the head sub-interval as the new tail sub-interval, and use the sub-interval adjacent to the head sub-interval as the new head sub-interval.
[0217] Each module in the above data processing device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above respective modules.
[0218] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 2As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store first information data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a data processing method.
[0219] Those skilled in the art can understand that Figure 2 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0220] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0221] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0222] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0223] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0224] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0225] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A data processing method, characterized in that, The method includes: Processing the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion processing, and heat processing; Determining a target range in the cache according to the first information; the target range includes a plurality of sub-ranges; Determining a target sub-range in the target range; Storing the data to be processed or querying the data to be processed within the target sub-range.
2. The method according to claim 1, characterized in that, The method further includes: Determining second information of the data to be processed; The determining the target sub-range in the target range includes: Determining the target sub-range in the target range according to the second information.
3. The method according to claim 2, characterized in that, The processing includes the hash processing, and the determining the target range in the cache according to the first information includes: Determining the range in the cache corresponding to the hash value in the first information as the target range.
4. The method according to claim 3, characterized in that, The determining the target sub-range in the target range according to the second information includes: Determining the sub-range in the target range corresponding to the data value in the second information as the target sub-range.
5. The method according to claim 3, characterized in that, The plurality of sub-ranges includes a plurality of data sub-ranges and a plurality of hash sub-ranges, and the determining the target sub-range in the target range according to the second information includes: Determining a target data sub-range in the plurality of data sub-ranges according to the data value in the second information; Determining a target hash sub-range corresponding to the target data sub-range according to the correspondence between the data sub-range and the hash sub-range; Determining the target data sub-range and the target hash sub-range as the target sub-range.
6. The method according to claim 2, characterized in that, The processing includes the hash processing, and the determining the target range in the cache according to the first information includes: Determining whether there is an idle sub-range in the range matching the hash value in the first information. If not, re-performing hash processing on the data to be processed to obtain new first information, and returning to execute the step of determining the target range in the cache according to the first information.
7. The method according to claim 1, characterized in that, The processing includes type conversion processing, and the determining the target range in the cache according to the first information includes: Performing inverse type conversion on the first information to obtain a first conversion value; Determining the range in the cache corresponding to the first conversion value as the target range.
8. The method according to claim 7, characterized in that, The determining the target sub-range in the target range includes: Performing inverse type conversion on the first information to obtain a second conversion value; Determining the sub-range in the target range corresponding to the second conversion value as the target sub-range.
9. The method according to claim 1, characterized in that, The processing includes heat processing, and the cache further includes a first heat table. The determining the target range in the cache according to the first information includes: Querying the first heat table to determine the target range corresponding to the heat value in the first information.
10. The method according to claim 2, characterized in that, The processing includes heat processing, and the target range further includes a heat range. The determining the target sub-range in the target range according to the second information includes: Determining the sub-range corresponding to the highest heat value in the heat range as the target sub-range, or using the idle sub-range in the target range as the target sub-range.
11. The method according to claim 9, characterized in that, The method further includes: Set the heat value corresponding to the target sub - interval to the first value, and increase the heat values corresponding to other sub - intervals by the second value.
12. The method according to claim 1, wherein, The determining the target sub - interval in the target interval includes: Traverse all sub - intervals in the target interval in sequence, and use the first traversed idle interval as the target sub - interval.
13. The method according to claim 1, wherein, The determining the target sub - interval in the target interval includes: According to the arrangement order of sub - intervals in the target interval, label each sub - interval to obtain a head sub - interval and a tail sub - interval; Use the tail sub - interval as the target sub - interval.
14. The method according to claim 13, wherein, The method further includes: When the target sub - interval stores the data to be processed, use the head sub - interval as the new tail sub - interval, and use the sub - interval adjacent to the head sub - interval as the new head sub - interval.
15. A data processing device, wherein, The device includes: A first processing module for processing the data to be processed to obtain first information; the processing includes any one of hash processing, type conversion, and heat processing; A first determination module for determining a target interval in the cache according to the first information; the target interval includes a plurality of sub - intervals; A second determination module for determining a target sub - interval in the target interval; A second processing module for storing or querying the data to be processed within the target sub - interval.
16. A computer device, comprising a memory and a processor, the memory storing a computer program, wherein, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 14.
17. A computer-readable storage medium, having a computer program stored thereon, wherein, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 14.