Data reading method and device, computer equipment, storage medium and program product

By managing Key and Value in the static cache area and the hot temporary storage area, the data reading process is dynamically optimized, and the performance bottleneck of the LSM tree during data reading is solved, achieving more efficient reading performance.

CN119248769APending Publication Date: 2025-01-03DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411140494.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

LSM trees frequently access disks when reading data, resulting in limited read performance. Traditional optimization methods such as index structure optimization and the use of Bloom filters may bring additional disk I/O operations, affecting performance.

Method used

By querying the target key in the static cache area and determining the heat value and bits of the key using preset mapping methods, dynamically manage the Key and Value in the hot temporary storage area and the static cache area, optimize the data reading process to reduce disk access .

Benefits of technology

Improves data reading performance, reduces dependence on disk, and improves read efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248769A_ABST
    Figure CN119248769A_ABST
Patent Text Reader

Abstract

The invention relates to a data reading method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: receiving a data reading request, wherein the data reading request carries a target key; in response to the data reading request, whether a target Key exists in a static cache region or not is inquired, and the number of historical access times of active key value pairs included in the static cache region is larger than a preset threshold value; and under the condition that the target Key exists in the static cache region, obtaining a target value Value corresponding to the target Key from the active key value pairs included in the static cache region. By adopting the method, the reading performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and in particular to a data reading method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] Log-Structured Merge (LSM) tree is an efficient data storage structure, widely used in databases such as rocksDB and levelDB. LSM tree achieves fast writing by first writing data to the memory table (MemTable) in memory, and then periodically persisting the data in MemTable to the sorted string table (SST) on disk. When reading data, it is necessary to access the disk multiple times, so that the reading performance of LSM tree is limited by disk I / O, which affects the reading performance.

[0003] In traditional technology, the reading efficiency is improved by optimizing the index structure of SST and using Bloom filters. However, this method may bring additional disk I / O operations, resulting in lower reading performance. Summary of the invention

[0004] Based on this, it is necessary to provide a data reading method, device, computer equipment, computer-readable storage medium and computer program product that can improve reading performance in response to the above technical problems.

[0005] In a first aspect, the present application provides a data reading method. The method comprises:

[0006] Receive a data read request, wherein the data read request carries a target key Key;

[0007] In response to the data read request, query whether the target Key exists in the static cache, and the number of historical accesses of active key-value pairs included in the static cache is greater than a preset threshold;

[0008] In the case that the target Key exists in the static cache area, a target value Value corresponding to the target Key is obtained from active key-value pairs included in the static cache area.

[0009] In one of the embodiments, the static cache area is a first storage space in the memory associated with the query sort string table SST.

[0010] In one embodiment, the method further comprises:

[0011] In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

[0012] In one embodiment, the method further comprises:

[0013] If the target key does not exist in the static cache area, query whether the target key exists in the disk space corresponding to the SST;

[0014] If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0015] In one embodiment, the method further comprises:

[0016] Using a preset mapping method, determine that the target Key is mapped to a target bit in a preset bitmap, where each bit in the bitmap is used to indicate whether each Key has been accessed in a historical time;

[0017] According to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

[0018] In one embodiment, the determining, using a preset mapping method, to map the target Key to a target bit in a preset bitmap includes:

[0019] According to a preset division strategy, the target Key is divided into at least one sub-Key;

[0020] According to the number of bits of the bitmap, determine the number of left shifts of each sub-Key;

[0021] The modulo result between each sub-Key after the left shift and the length of the bitmap is determined as the position of the target bit in the bitmap.

[0022] In one embodiment, the method further comprises:

[0023] If there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

[0024] In one embodiment, the method further comprises:

[0025] If the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value.

[0026] In one embodiment, the method further comprises:

[0027] If the value of the target bit is the second value, the value of the target bit is set to the first value.

[0028] In one embodiment, the method further comprises:

[0029] According to a preset time period, each Key included in the heat temporary storage area is transferred to the static cache area;

[0030] The Value corresponding to each Key included in the temporary heat storage area is obtained from the disk space, and each Value corresponding to each Key is added to the static cache area.

[0031] In one embodiment, the method further comprises:

[0032] In the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0033] In one embodiment, the method further comprises:

[0034] According to the time period, the heat value corresponding to each Key in the static cache area is reduced by 1, and the Key in the static cache area whose heat value is the second value is deleted.

[0035] In one embodiment, the static cache includes a Key storage area and a Value storage area, and obtaining a target value Value corresponding to the target Key from an active key-value pair included in the static cache includes:

[0036] Obtaining the Key information corresponding to the target Key from the Key storage area;

[0037] Determine the storage location of the target Value corresponding to the target Key according to the Key information;

[0038] In the Value storage area, the target Value is obtained from the storage location of the target Value.

[0039] In a second aspect, the present application also provides a data reading device. The device comprises:

[0040] A receiving module, used for receiving a data reading request, wherein the data reading request carries a target key Key;

[0041] A query module, configured to query, in response to the data read request, whether the target key exists in a static cache area, and the number of historical accesses of active key-value pairs included in the static cache area is greater than a first threshold;

[0042] The acquisition module is used to acquire a target value Value corresponding to the target Key from active key-value pairs included in the static cache area when the target Key exists in the static cache area.

[0043] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect are implemented.

[0044] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0045] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0046] In the above-mentioned data reading method, apparatus, computer device, computer-readable storage medium and computer program product, the server receives a data reading request carrying a target key Key, and then, in response to the data reading request, queries whether the target Key exists in the static cache area, and then, when the target Key exists in the static cache area, obtains the target value Value corresponding to the target Key from the active key-value pairs included in the static cache area. In this data reading method, since the historical access count of the active key-value pairs included in the static cache area is greater than the preset threshold, if the historical access count of the target Key is greater than the preset threshold, the target Key and the active key-value pair corresponding to the target Key can be quickly found in the static cache area without having to search for the active key-value pair corresponding to the target Key in the entire disk space, thereby improving the reading performance of data reading. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] FIG1 is a diagram of an application environment for data reading in one embodiment;

[0049] FIG2 is a schematic diagram of a flow chart of a data reading method in one embodiment;

[0050] FIG3 is a schematic flow chart of a data reading method in another embodiment;

[0051] FIG4 is a schematic flow chart of a data reading method in another embodiment;

[0052] FIG5 is a schematic diagram of a temporary heat storage area in one embodiment;

[0053] FIG6 is a schematic diagram of storing target Keys in a hot temporary storage area in one embodiment;

[0054] FIG7 is a schematic diagram of a flow chart of step 401 in one embodiment;

[0055] FIG8 is a schematic flow chart of a data reading method in another embodiment;

[0056] FIG9 is a schematic flow chart of a data reading method in another embodiment;

[0057] FIG10 is a schematic diagram of a Key storage area and a Value storage area in a static cache area in one embodiment;

[0058] FIG11 is a schematic flow chart of a data reading method in another embodiment;

[0059] FIG12 is a block diagram of a data reading device in one embodiment;

[0060] FIG. 13 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with 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.

[0062] Generally, the reading performance of the LSM tree can be optimized from two aspects: index optimization and cache optimization. Among them, index optimization can set a Bloom filter at each layer of the LSM tree to reduce the number of invalid disk accesses, thereby reducing read amplification. However, the Bloom filter has a certain false alarm rate and may bring additional disk I / O operations; or, an auxiliary index can be set to improve the query speed of a specific type of Key, but the auxiliary index will increase the complexity of write operations and memory overhead. Cache optimization can be to use block cache to cache active data blocks and reduce disk I / O operations, but the cache strategy and the management structure of the cache space may take up more memory; or, set a multi-level SST in the disk and write new data to a higher level first. However, when reading data, the hierarchical cache structure needs to be queried multiple times, which affects the query performance. Therefore, there is a problem of low data reading performance in traditional technologies. Based on this, the present application proposes a data reading method that improves reading performance.

[0063] The data reading method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the server 102 communicates with the terminal 104 through the network, and the data storage system can store the data that the server 102 needs to process. The data storage system can be integrated on the server 102, or it can be placed on the cloud or other network servers. The server 102 receives a data reading request carrying a target key Key, and in response to the data reading request, queries whether the target Key exists in the static cache area. When the target Key exists in the static cache area, the target value Value corresponding to the target Key is obtained from the active key-value pairs included in the static cache area. Among them, the terminal 104 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 102 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0064] In an exemplary embodiment, as shown in FIG2 , a data reading method is provided, which is described by taking the method applied to the server in FIG1 as an example, and includes the following steps 201 to 203:

[0065] Step 201: Receive a data read request, where the data read request carries a target key Key.

[0066] The data read request is used to obtain data from the server. Optionally, the server may receive the data read request from the terminal via the network, or the server may receive the data read request by responding to the request information input by the user. When the data read is completed, the server may obtain the data from the server according to the data read request and return the data to the terminal via the network, or display the data to the user via the display screen.

[0067] It should be noted that in the embodiment of the present application, the storage structure of the data stored in the database in the server is in the form of key-value pairs. In this embodiment, the Key of the data to be read in the data reading request can be determined as the target Key.

[0068] In this embodiment, the server may receive the data read request in real time, and parse the data read request to obtain the target Key carried in the data read request from the parsing result.

[0069] Step 202: In response to a data read request, query whether a target key exists in a static cache, and the number of historical accesses of active key-value pairs included in the static cache is greater than a preset threshold.

[0070] It should be noted that in a server, memory is a random access memory used to temporarily store the calculation data in the CPU and exchange data with external memory. It has a high read and write rate and a small storage capacity. The disk is a device that provides storage space for the system and software. It can store data permanently. It has a low read and write rate and a large storage capacity. Usually, in order to store more data and ensure the reliability of data storage, data will be stored on the disk. However, the read and write rate of the disk is low. Therefore, in order to increase the read and write rate of data, data with a relatively high access frequency can be stored in the memory, that is, active data can be stored in the memory.

[0071] The static cache is a storage space in the memory. In the static cache, multiple active key-value pairs can be stored in the storage format of key-value pairs, and each active key-value pair includes Key and Value. In this embodiment, the historical access times of each key-value pair in the historical time period can be obtained, and then the key-value pairs with historical access times greater than the preset threshold are determined as active key-value pairs, and then the active key-value pairs are stored in the static cache. The preset threshold can be 1, indicating that the key-value pair has been accessed in the historical time.

[0072] In this embodiment, the server can query whether there is a key identical to the target key in the static cache according to the target key in response to a data read request, thereby determining whether there is the target key in the static cache according to the query result.

[0073] Exemplarily, the data read request provided by the present application can be applied to the scenario of reading data from the data structure of LSM. As a data storage structure, the LSM tree can store data in a memory table (MemTable) in memory, and then periodically store the data in the MemTable in a sorted string table (SST) on disk. Among them, the SST includes multiple SST layers, each SST layer includes multiple SSTs, the top SST layer stores the data most recently written to the disk by the LSM, and the bottom SST layer stores the most data written to the disk by the LSM.

[0074] As a possible embodiment, the above-mentioned static cache area can be the first storage space associated with the query sort string table SST in the memory. It can be understood that the identifier of the SST associated with the static cache area can be stored in the static cache area to associate the static cache area with the SST. In the memory, multiple static cache areas can be included, and each static cache area can be associated with each SST in the bottom SST layer. It should be noted that each SST in the hard disk corresponds to a part of the storage space, and the storage space is used to store key-value pairs that are regularly transferred from the memory to the disk. If the number of times the key-value pair in the SST is accessed is greater than a preset threshold, it can be determined that the key-value pair is an active key-value pair, and the active key-value pair is stored in the static cache area associated with the SST.

[0075] Step 203: When the target Key exists in the static cache, a target value Value corresponding to the target Key is obtained from the active key-value pairs included in the static cache.

[0076] There may be multiple active key-value pairs in the static cache area, each of which includes a Key and a Value. In this embodiment, the Value corresponding to the target Key may be determined as the target Value.

[0077] In this embodiment, when the target Key exists in the static cache area, the server can search for an active key-value pair with the same Key as the target Key from the static cache area based on the target Key, then determine the Value in the active key-value pair as the target Value, and then obtain the target Value from the static cache area.

[0078] In the above data reading method, the server receives a data reading request carrying a target key Key, and then, in response to the data reading request, queries whether the target Key exists in the static cache area, and then, when the target Key exists in the static cache area, obtains the target value Value corresponding to the target Key from the active key-value pairs included in the static cache area. In this data reading method, since the historical access times of the active key-value pairs included in the static cache area are greater than the preset threshold, if the historical access times of the target Key are greater than the preset threshold, the target Key and the active key-value pairs corresponding to the target Key can be quickly found in the static cache area. Since the static cache area is a storage space in the memory, compared with reading data from the disk space, reading data from the static cache area has a higher reading efficiency, so that the target Value corresponding to the target Key can be quickly obtained from the active key-value pairs in the static cache area, thereby improving the reading performance of data reading.

[0079] It is understandable that when the target Key exists in the static cache, it indicates that the number of accesses to the active key-value pair where the target Key is located has increased, and the number of accesses to the active key-value pair can be updated. In one embodiment, the heat value in the Key information corresponding to the target Key is accumulated by 1 in the static cache.

[0080] The heat value is used to indicate the number of accesses to each active key-value pair in the historical time period. In this embodiment, when the target key exists in the static cache, the server can obtain the heat value corresponding to the target key from the static cache, and then add 1 to the heat value, thereby accumulating 1 in the heat value of the key information corresponding to the target key in the static cache.

[0081] In an embodiment of the present application, the server can timely update the heat value corresponding to the target Key by accumulating 1 in the heat value in the Key information corresponding to the target Key in the static cache area, thereby ensuring that the active key-value pairs stored in the static cache area are key-value pairs whose historical access times are greater than a preset threshold, thereby improving the hit rate of obtaining the target Value in the static cache area.

[0082] Based on the embodiment shown in Figure 2, referring to Figure 3, this embodiment relates to a process of how the server obtains the target Value when the target Key does not exist in the static cache area. As shown in Figure 3, the server can execute steps 301 and 302 to implement the process.

[0083] Step 301, when the target Key does not exist in the static cache area, query whether the target Key exists in the disk space corresponding to the SST.

[0084] It should be noted that if the key-value pair corresponding to the target Key has not been accessed within the historical time period, or if the number of historical accesses to the key-value pair corresponding to the target Key within the historical time period is less than the preset threshold, the server will not store the key-value pair corresponding to the target Key in the static cache area, that is, the target Key does not exist in the static cache area.

[0085] In this embodiment, when the target key does not exist in the static cache area of ​​the server, the server can search for the target key from the disk space corresponding to each SST in the server's disk through I / O operations, thereby determining whether the target key exists in the disk space corresponding to the SST.

[0086] As a possible implementation, the data read request may include the identifier of the SST where the target Key is located. If the target Key does not exist in the static cache area of ​​the server, the server may search for the target Key from the SST according to the identifier of the SST corresponding to the target Key.

[0087] Step 302: If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0088] It can be understood that the storage format of data in the disk space of SST can be Key-Value. If the target Key exists in the disk space, then if there is no storage failure in the disk space, the target Value corresponding to the target Key must exist in the disk space.

[0089] In this embodiment, when it is determined that the target Key exists in the disk space, the server may obtain the key-value pair corresponding to the target Key from the disk space according to the target Key, and then obtain the target Value from the key-value pair.

[0090] In an embodiment of the present application, when the target Key does not exist in the static cache area, the server can query whether the target Key exists in the disk space corresponding to the SST. If the target Key exists in the disk space, the server can obtain the target Value from the disk space, thereby responding to the data reading request and completing the reading of the target Value corresponding to the target Key, thereby improving the reliability of data reading.

[0091] In one embodiment, referring to Fig. 4, this embodiment relates to a process in which a server writes a target Key into a temporary hot storage area. As shown in Fig. 4, the server can execute steps 401 and 402 to implement the process.

[0092] Step 401, using a preset mapping method, determine that a target Key is mapped to a target bit in a preset bitmap, and each bit in the bitmap is used to indicate whether each Key has been accessed in a historical time.

[0093] Among them, the preset mapping method refers to a mapping method that establishes a mapping relationship between the Key and a storage location in the bitmap. The preset mapping method can be a hash algorithm. In this embodiment, the value corresponding to the Key can be calculated by the hash algorithm, and then the value is matched with the storage location in the bitmap to determine the mapping relationship between the Key and the bitmap.

[0094] In this embodiment, the bit corresponding to the target Key in the bitmap can be determined as the target bit. The bitmap refers to an array that uses a binary bit to represent the state. For example, 0 can represent that the Key does not hit in the static cache area, and 1 can represent that the Key hits in the static cache area, so that each bit in the bitmap represents whether each Key has been accessed in the historical time.

[0095] In this embodiment, the server can calculate the target Key to the value on the bitmap according to a preset mapping method, and then determine the storage position in the bitmap according to the value, and then determine the bit corresponding to the storage position as the target bit.

[0096] Step 402, according to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each Key in the hot temporary storage area is greater than a preset threshold.

[0097] The value of the target bit can be represented by one bit, for example, the value of the target bit can be 0, or the value of the target bit can be 1. It can be understood that if the value of the target bit is 1, it can be said that the target Key has been accessed in the historical time, and it can be determined that the target Key may be a frequently accessed Key. The server can put the target Key into a memory with a higher reading rate, that is, a hot temporary storage area, so as to increase the rate of obtaining the target Value corresponding to the target Key when the target Key is accessed next time.

[0098] Among them, the second storage space in the memory of the hot temporary storage area corresponds to the SST in the disk, and the hot temporary storage area is also associated with the static cache area corresponding to the SST. In this embodiment, the hot temporary storage area can store keys with relatively high access times. For example, if the number of accesses of the key is greater than a preset threshold, the key can be stored in the hot temporary storage area. It should be noted that since the storage space in the hot temporary storage area is limited, in order to enable the hot temporary storage area to store more frequently accessed keys, only keys can be stored in the hot temporary storage area, and when the keys in the hot temporary storage area are transferred to the static cache area, the corresponding values ​​are stored only in the static cache area.

[0099] Optionally, in this embodiment, if the value of the target bit is 1, the server can determine that the target Key has been accessed in the historical time, that is, at the current time, the target Key is repeatedly accessed, and the server can determine the target Key as an active Key, thereby determining to write the target Key into the hot temporary storage area; if the value of the target bit is 0, it can be determined that the target Key has not been accessed in the historical time, and the server may not write the target Key into the hot temporary storage area.

[0100] Exemplarily, according to the target Key mapped to the target bit value in the preset bitmap, the process of storing the target Key in the temporary heat storage area can be shown in Figure 5. In Figure 5, when the target Key is accessed for the second time and the fourth time, the value of the target bit is 1, then the target Key is stored in the temporary heat storage area, and 1 is set to 0, and when the target Key is accessed for the first time and the third time, the value of the target bit is 0, then 0 is set to 1.

[0101] As a possible implementation, if the value of the target bit is 0, it is possible that the target Key has been accessed in the past. However, in order to prevent the same Key from being written repeatedly into the hot temporary storage area, the value of the target bit can be set to 0 when it is determined that the target Key has been accessed.

[0102] As a possible implementation of step 402, if the value of the target bit is the first value, the target Key is stored in the hot temporary storage area, and the value of the target bit is set to the second value.

[0103] Among them, the first value can be 1, and the second value can be 0. When the value of the target bit is 1, it can be determined that the target Key has been accessed within the historical time period, and the target Key can be stored in the hot temporary storage area, and the value of the target bit can be set from 1 to 0 to avoid repeatedly storing the target Key in the hot temporary storage area when the next target Key is accessed, resulting in multiple duplicate target keys in the hot temporary storage area.

[0104] As another possible implementation of step 402, if the value of the target bit is the second value, the value of the target bit is set to the first value.

[0105] If the value of the target bit is the second value, it may indicate that the target key has not been accessed within the historical time, or that the target key has been accessed multiple times within the historical time and then reset to 0. Then, at the current time, when the target key is accessed, the value of the target bit may be set to 1 to indicate that the target key has been accessed, so that the next time the target key is accessed, the target key may be quickly identified as an active key based on the value of the target bit and written into the hot temporary storage area.

[0106] As a possible implementation, if there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

[0107] In this embodiment, the temporary hot storage area may be a ring storage area. Exemplarily, the process of storing each Key in the ring storage area may be shown in FIG6 . In FIG6 , when the temporary hot storage area is full, the newly added target Key may be stored at the position where the Key is first stored, so that when there is no available storage space in the temporary hot storage area, the target Key may be used to replace the first stored Key in the temporary hot storage area, and the Key in the temporary hot storage area may be updated in time to ensure that the Key in the temporary hot storage area is the Key with the most access times in the current time period.

[0108] In an embodiment of the present application, the server uses a preset mapping method to determine that the target Key is mapped to a target bit in a preset bitmap, and then determines whether to write the target Key into a hot temporary storage area based on the value of the target bit. The hot temporary storage area is a second storage space in the memory that is associated with the static cache area. By writing the target Key into the hot temporary storage area, the target Key that has been accessed from the disk space can be transferred to the memory to improve the reading efficiency the next time the target Key is accessed; in addition, since it is possible to quickly determine whether to write the target Key into the hot temporary storage area based on the value of the target bit, the speed of writing the target Key into the hot temporary storage area can be increased.

[0109] In one embodiment, referring to FIG. 7 , this embodiment relates to a process of how a server determines how to map a target Key to a target bit in a preset bitmap using a preset mapping method. Step 401 includes steps 501 to 503 shown in FIG. 7 :

[0110] Step 501: divide the target Key into at least one sub-Key according to a preset division strategy.

[0111] It should be noted that, in the process of mapping the target Key to the target bit position in the bitmap, the target Key may be mapped to the target bit position in the preset bitmap according to the mapping relationship.

[0112] In this process, first, the target key can be divided into several parts according to the business scenario, and then the target key is divided and processed to obtain several sub-keys. For example, if the business scenario determines that the target key is divided into 3 parts, the target key can be evenly divided into 3 parts to obtain 3 sub-keys.

[0113] Step 502: Determine the number of left shifts for each sub-Key according to the number of bits in the bitmap.

[0114] It is understandable that if the number of bits of each sub-Key after division cannot be converted into a numerical value corresponding to each storage position in the bitmap, the number of bits of each sub-Key needs to be shifted.

[0115] In this embodiment, the difference between the number of bits of each sub-Key and the number of bits of the bitmap may be determined first, and then the number of bits of each sub-Key that needs to be shifted left may be determined according to the difference.

[0116] Exemplarily, if the storage length of the bitmap is 64 bytes, that is, the number of bits of the bitmap is 8 bits, and the target Key is 12 bytes, that is, the target Key corresponds to 4 bits, then if the target Key corresponds to 3 sub-Keys, each sub-Key is 4 bytes, that is, each sub-Key corresponds to 2 bits, then the difference between the 8 bits of the bitmap and the 2 bits corresponding to each sub-Key can be determined to determine the number of left shift bits corresponding to each sub-Key.

[0117] Step 503: determine the modulo result between each sub-Key after the left shift and the length of the bitmap as the position of the target bit in the bitmap.

[0118] In this embodiment, each sub-key after the left shift can be modulo the length of the bitmap, and then the value of the modulo result is used to represent the position of the target bit in the bitmap. For example, if the modulo result is 10, it means that the position of the target bit in the bitmap is the 10th.

[0119] In an embodiment of the present application, the server divides the target key into at least one sub-key according to a preset division strategy, and then determines the number of left shift bits of each sub-key according to the number of bits of the bitmap, and then determines the remainder of each sub-key after the left shift and the length of the bitmap as the position of the target bit in the bitmap. The method for determining the position of the target bit in the bitmap is simple and can quickly determine the target bit, thereby improving the efficiency of determining whether to store the target key value in the hot temporary storage area according to the value of the target bit.

[0120] In one embodiment, based on the above embodiment, referring to Figure 8, this embodiment relates to a process of how the server transfers the Key in the hot temporary storage area to the static cache area. As shown in Figure 8, the server can execute steps 601 and 602 to implement the process.

[0121] Step 601, according to a preset time period, transfer each Key included in the hot temporary storage area to the static cache area.

[0122] The preset time period refers to a data sorting period, for example, a time period may be 1 minute, or a time period may be 5 minutes, which is not limited in this embodiment. It is understandable that during the data reading process, since the Key stored in the hot temporary storage area cannot be accessed, it is necessary to transfer the Key in the hot temporary storage area to the static cache area.

[0123] In this embodiment, the server may transfer each Key included in the hot temporary storage area to the static cache area at the end of a preset time period, so that the Key in the hot temporary storage area becomes cache data that can be queried in static mixed access.

[0124] As an optional implementation, in the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0125] It is understandable that in the process of data reading, there may be a key that is repeatedly accessed and stored in the hot temporary cache area, and then after a time period, it is transferred to the static cache area. After a period of time, the key is repeatedly accessed again and stored in the hot temporary cache area again. After another time period, it is transferred to the static cache area again, resulting in duplicate keys in the static cache area. Therefore, in the process of transferring each key included in the hot temporary cache area to the static cache area, if the first key included in the hot temporary cache area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area to avoid duplicate keys in the static cache area.

[0126] Furthermore, if the first key included in the temporary heat storage area is repeated with the second key included in the static cache area, the heat value of the repeated key in the temporary heat storage area can be accumulated to timely update the heat value of the second key in the static cache area. For example, if there is a first key identical to the second key in the temporary heat storage area, the heat value of the second key is increased by 1; if there are three first keys identical to the second key in the temporary heat storage area, the heat value of the second key is increased by 3.

[0127] Step 602, obtaining the Value corresponding to each Key included in the hot temporary storage area from the disk space, and adding each Value corresponding to each Key to the static cache area.

[0128] It is understandable that the Key stored in the hot temporary storage area is a Key that has been accessed many times. In order to improve the efficiency of obtaining the Value corresponding to the Key, the Key and the corresponding Value can also be stored in the static cache area. In the static cache area, there is an association relationship between each Key and the corresponding Value.

[0129] In this embodiment, the server can obtain the Value corresponding to each Key from the disk space according to each Key included in the hot temporary storage area, and add the obtained Value corresponding to each Key to the static cache area.

[0130] In an embodiment of the present application, the server transfers each key included in the hot temporary storage area to the static cache area according to a preset time period, and then obtains the Value corresponding to each key included in the hot temporary storage area from the disk space, and adds each Value corresponding to each key to the static cache area, so that each key in the hot temporary storage area whose access times is greater than a preset threshold can be queried in the static cache area, thereby improving the query speed of each key in the hot temporary storage area, and because the Value corresponding to each key is added to the static cache area, when the key in the static cache area is accessed, the Value corresponding to the key can be quickly obtained from the static cache area, thereby improving the data reading speed.

[0131] Since the storage capacity of the static cache is limited, and the number of accesses to each key-value pair is constantly changing in different time periods, there may be active key-value pairs in the historical time period that are inactive in the current time period. Therefore, when the number of active key-value pairs in the static cache exceeds the storage threshold, active key-value pairs with low heat values ​​can be deleted. In one embodiment, according to the time period, the heat value corresponding to each Key in the static cache is reduced by 1, and the Key with the second heat value in the static cache is deleted.

[0132] Among them, the second value can be 0, which means that the heat value of a certain Key is 0. It can be understood that if the number of accesses to a certain Key in the historical time period is greater than the threshold, it will be stored in the static cache area. However, if the Key has not been accessed continuously in the current time period, the heat value of the Key will not increase. In order to ensure the real-time performance of the Keys with a high number of accesses stored in the static cache area, the heat value of each Key in the static cache area can be periodically reduced by 1, so as to use the elimination mechanism to delete the Key with a heat value of 0.

[0133] In this embodiment, the server may traverse the heat values ​​corresponding to each Key in the static cache at the end of a time period, reduce each heat value that is not 0 by 1, and delete the Key with a heat value of 0.

[0134] As a possible implementation, when the server deletes a Key with a heat value of 0, the Value corresponding to the Key may also be deleted from the static cache area to ensure the association between the Key and the Value.

[0135] In an embodiment of the present application, the server reduces the heat value corresponding to each Key in the static cache area by 1 according to a time period, and deletes the Key with the second heat value in the static cache area, which can automatically eliminate the low-heat Key-Value, so that the Key-Value stored in the static cache area is a long-term active Key-Value, thereby improving the hit rate of finding the target Key from the static cache area and improving the efficiency of obtaining the target Value.

[0136] In one embodiment, based on the above embodiment, the static cache includes a Key storage area and a Value storage area, see Figure 9, this embodiment involves how the server obtains the target Value corresponding to the target Key from the active key-value pair included in the static cache. As shown in Figure 9, the server can execute steps 701-703 to implement the process.

[0137] Step 701, obtain the Key information corresponding to the target Key from the Key storage area.

[0138] It should be noted that in order to increase the speed of reading data in the static cache area, different storage areas are set in the static cache area, which are used to store Key and Value respectively. Among them, the Key storage area is used to store Key-related information. For example, multiple block areas are set in the Key storage area to store Key information corresponding to different Keys. A block index area for storing index information of block areas can also be set in the Key storage area. Among them, each Key information can include each Key, the heat value of each Key, and the offset of the storage location where the Value corresponding to each Key is located.

[0139] In this embodiment, the server may first determine the block area corresponding to the target Key from the block index area in the Key storage area, then query the storage location of the target Key from the block area, and then obtain the Key information corresponding to the target Key from the storage location.

[0140] Step 702: Determine the storage location of the target Value corresponding to the target Key according to the Key information.

[0141] Among them, the storage location of the target Value refers to the storage location in the Value storage area in the static cache. It can be understood that since the Key information corresponding to the target Key stores the offset of the storage location of the target Value, only the starting storage location of the target Value can be determined based on the offset, and in the static cache, Key and Value are stored in sequence, therefore, the offset corresponding to the next Value can be obtained from the Key information of the Key adjacent to the Key information corresponding to the target Key, thereby determining the storage location of the target Value corresponding to the target Key based on the two offsets.

[0142] In this embodiment, the server can obtain the first offset of the storage location where the Value is located from the Key information, and then obtain the second offset from the storage location adjacent to the Key information storage location, and then determine the first offset as the starting storage position of the target Value, and determine the second offset as the ending storage position of the target Value, and then determine the difference between the starting storage position and the ending storage position as the storage position of the target Value.

[0143] Step 703: Get the target Value from the storage location of the target Value in the Value storage area.

[0144] In this embodiment, the server may first determine the starting position of the target Value in the Value storage area based on the starting storage position in the storage location, and then determine the ending position of the target Value in the Valueu storage area based on the ending storage position in the storage location, and finally, determine the Value between the starting position and the ending position as the target Value, and obtain the target Value.

[0145] Exemplarily, the storage structure in the static cache area can be as shown in FIG10. In FIG10, the static cache area includes a Key storage area and a Value storage area, wherein the Key storage area includes a block index area, and the block index area includes multiple maximum Value values, each maximum Value value is used to represent the range of Value values ​​stored in each block index area, and the block area is used to store the Key information corresponding to each Key. The Value storage area is used to store the Value corresponding to each Key, wherein each Key information is stored corresponding to each Value.

[0146] In an embodiment of the present application, the server obtains the Key information corresponding to the target Key from the Key storage area, and then determines the storage location of the target Value corresponding to the target Key based on the Key information. Then, the target Value can be obtained from the storage location of the target Value. Since the Key and Value are stored separately in the static cache area, when it is determined that the target Key exists in the static cache area, the storage location of the target Value can be quickly determined based on the Key information corresponding to the target Key, thereby quickly obtaining the target Value, thereby improving the efficiency of obtaining the target Value.

[0147] In one embodiment, referring to FIG11 , a data reading method is provided, the method comprising:

[0148] Step 801: Receive a data read request, which carries a target key Key.

[0149] Step 802, in response to a data read request, query whether a target Key exists in a static cache area, where the static cache area is a first storage space in the memory associated with the query sort string table SST.

[0150] Step 803: When the target Key exists in the static cache, obtain the Key information corresponding to the target Key from the Key storage area in the static cache.

[0151] Step 804: Determine the storage location of the target Value corresponding to the target Key according to the Key information.

[0152] Step 805: Get the target Value from the storage location of the target Value in the Value storage area.

[0153] Step 806: In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

[0154] Step 807: If the target Key does not exist in the static cache area, query whether the target Key exists in the disk space corresponding to the SST.

[0155] Step 808: If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0156] Step 809, divide the target Key into at least one sub-Key according to a preset division strategy; determine the number of left shifts of each sub-Key according to the number of bits in the bitmap; and determine the modulo result between each sub-Key after the left shift and the length of the bitmap as the position of the target bit in the bitmap.

[0157] Step 8010, determine whether the value of the target bit is the first value.

[0158] Step 8011, if the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value. If there is no available storage space in the heat temporary storage area, the target Key is used to replace the Key first stored in the heat temporary storage area.

[0159] Step 8012: If the value of the target bit is the second value, set the value of the target bit to the first value.

[0160] Step 8013, according to a preset time period, transfer each key included in the heat temporary storage area to the static cache area; in the process of transferring each key included in the heat temporary storage area to the static cache area, if the first key included in the heat temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0161] Step 8014, obtain the Value corresponding to each Key included in the hot temporary storage area from the disk space, and add each Value corresponding to each Key to the static cache area.

[0162] Step 8015, according to the time period, reduce the heat value corresponding to each Key in the static cache by 1, and delete the Key with the heat value of the second value in the static cache.

[0163] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0164] Based on the same inventive concept, the embodiment of the present application also provides a data reading device for implementing the data reading method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data reading device embodiments provided below can refer to the limitations on the data reading method above, and will not be repeated here.

[0165] In an exemplary embodiment, as shown in FIG12 , a data reading device is provided, comprising:

[0166] The receiving module 901 is used to receive a data reading request, wherein the data reading request carries a target key Key;

[0167] The first query module 902 is used to query whether the target key exists in the static cache area in response to the data read request, and the historical access times of the active key-value pairs included in the static cache area are greater than a preset threshold; optionally, the static cache area is the first storage space in the memory associated with the query sort string table SST.

[0168] The first acquisition module 903 is used to acquire a target value Value corresponding to the target Key from active key-value pairs included in the static cache area when the target Key exists in the static cache area.

[0169] In one embodiment, the device further comprises:

[0170] The first accumulation module is used to accumulate 1 the heat value in the Key information corresponding to the target Key in the static cache area.

[0171] In one embodiment, the device further comprises:

[0172] A second query module is used to query whether the target Key exists in the disk space corresponding to the SST when the target Key does not exist in the static cache area;

[0173] The second acquisition module is used to acquire the target Value from the disk space if the target Key exists in the disk space.

[0174] In one embodiment, the device further comprises:

[0175] A first determination module is used to determine the target bit in the preset bitmap mapped to the target key by using a preset mapping method, and each bit in the bitmap is used to indicate whether each key has been accessed in the historical time;

[0176] The second determination module is used to determine whether to write the target Key into a hot temporary storage area according to the value of the target bit, wherein the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

[0177] In one embodiment, the first determining module includes:

[0178] A division unit, configured to divide the target Key into at least one sub-Key according to a preset division strategy;

[0179] A first determining unit, configured to determine the number of left shifts of each sub-Key according to the number of bits of the bitmap;

[0180] The second determining unit is used to determine the modulo result between each sub-Key after the left shift and the length of the bitmap as the position of the target bit in the bitmap.

[0181] In one embodiment, the device further comprises:

[0182] A replacement module is used to replace the Key first stored in the hot temporary storage area with the target Key if there is no available storage space in the hot temporary storage area.

[0183] In one embodiment, the first determining module includes:

[0184] A storage unit is used to store the target Key in the heat temporary storage area if the value of the target bit is the first value, and set the value of the target bit to the second value.

[0185] In one embodiment, the device further comprises:

[0186] A setting module is used to set the value of the target bit to the first value if the value of the target bit is the second value.

[0187] In one embodiment, the device further comprises:

[0188] A transfer module, used to transfer each Key included in the heat temporary storage area to the static cache area according to a preset time period;

[0189] The storage module is used to obtain the Value corresponding to each Key included in the heat temporary storage area from the disk space, and add each Value corresponding to each Key to the static cache area.

[0190] In one embodiment, the device further comprises:

[0191] The second accumulation module is used to prohibit the transfer of the first key to the static cache area if the first key included in the thermal temporary storage area is repeated with the second key included in the static cache area during the process of transferring each key included in the thermal temporary storage area to the static cache area, and to accumulate the thermal value of the second key in the static cache area.

[0192] In one embodiment, the device further comprises:

[0193] The deleting module is used to reduce the heat value corresponding to each Key in the static cache area by 1 according to the time period, and delete the Key whose heat value in the static cache area is the second value.

[0194] In one embodiment, the static cache area includes a Key storage area and a Value storage area, and the first acquisition module includes:

[0195] A first acquisition unit, configured to acquire Key information corresponding to the target Key from the Key storage area;

[0196] A third determining unit, configured to determine a storage location of the target Value corresponding to the target Key according to the Key information;

[0197] The second acquisition unit is used to acquire the target Value from the storage location of the target Value in the Value storage area.

[0198] Each module in the above data reading device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a server in the form of hardware, or can be stored in a memory in a server in the form of software, so that the processor can call and execute operations corresponding to each module.

[0199] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG13. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to 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 disease risk analysis data and / or health status assessment data. The input / output interface of the computer device is used to exchange information between the processor and an external device. 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, a disease risk analysis method and / or a health status assessment method is implemented.

[0200] Those skilled in the art will understand that the structure shown in FIG. 13 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0201] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0202] Receive a data read request, wherein the data read request carries a target key Key;

[0203] In response to the data read request, query whether the target Key exists in the static cache area, and the number of historical accesses of the active key-value pairs included in the static cache area is greater than a preset threshold; optionally, the static cache area is a first storage space in the memory associated with the query sort string table SST;

[0204] In the case that the target Key exists in the static cache area, a target value Value corresponding to the target Key is obtained from active key-value pairs included in the static cache area.

[0205] In one embodiment, the processor implements the following steps when executing the computer program:

[0206] In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

[0207] In one embodiment, the processor implements the following steps when executing the computer program:

[0208] If the target key does not exist in the static cache area, query whether the target key exists in the disk space corresponding to the SST;

[0209] If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0210] In one embodiment, the processor implements the following steps when executing the computer program:

[0211] Using a preset mapping method, determine that the target Key is mapped to a target bit in a preset bitmap, where each bit in the bitmap is used to indicate whether each Key has been accessed in a historical time;

[0212] According to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

[0213] In one embodiment, the processor implements the following steps when executing the computer program:

[0214] According to a preset division strategy, the target Key is divided into at least one sub-Key;

[0215] According to the number of bits of the bitmap, determine the number of left shifts of each sub-Key;

[0216] The modulo result between each sub-Key after the left shift and the length of the bitmap is determined as the position of the target bit in the bitmap.

[0217] In one embodiment, the processor implements the following steps when executing the computer program:

[0218] If there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

[0219] In one embodiment, the processor implements the following steps when executing the computer program:

[0220] If the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value.

[0221] In one embodiment, the processor further implements the following steps when executing the computer program:

[0222] If the value of the target bit is the second value, the value of the target bit is set to the first value.

[0223] In one embodiment, the processor further implements the following steps when executing the computer program:

[0224] According to a preset time period, each Key included in the heat temporary storage area is transferred to the static cache area;

[0225] The Value corresponding to each Key included in the temporary heat storage area is obtained from the disk space, and each Value corresponding to each Key is added to the static cache area.

[0226] In one embodiment, the processor further implements the following steps when executing the computer program:

[0227] In the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0228] In one embodiment, the processor further implements the following steps when executing the computer program:

[0229] According to the time period, the heat value corresponding to each Key in the static cache area is reduced by 1, and the Key in the static cache area whose heat value is the second value is deleted.

[0230] In one embodiment, the processor further implements the following steps when executing the computer program:

[0231] Obtaining the Key information corresponding to the target Key from the Key storage area;

[0232] Determine the storage location of the target Value corresponding to the target Key according to the Key information;

[0233] In the Value storage area, the target Value is obtained from the storage location of the target Value.

[0234] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0235] Receive a data read request, wherein the data read request carries a target key Key;

[0236] In response to the data read request, query whether the target Key exists in the static cache area, and the number of historical accesses of the active key-value pairs included in the static cache area is greater than a preset threshold; optionally, the static cache area is a first storage space in the memory associated with the query sort string table SST;

[0237] In the case that the target Key exists in the static cache area, a target value Value corresponding to the target Key is obtained from active key-value pairs included in the static cache area.

[0238] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0239] In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

[0240] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0241] If the target key does not exist in the static cache area, query whether the target key exists in the disk space corresponding to the SST;

[0242] If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0243] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0244] Using a preset mapping method, determine that the target Key is mapped to a target bit in a preset bitmap, where each bit in the bitmap is used to indicate whether each Key has been accessed in a historical time;

[0245] According to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

[0246] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0247] According to a preset division strategy, the target Key is divided into at least one sub-Key;

[0248] According to the number of bits of the bitmap, determine the number of left shifts of each sub-Key;

[0249] The modulo result between each sub-Key after the left shift and the length of the bitmap is determined as the position of the target bit in the bitmap.

[0250] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0251] If there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

[0252] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0253] If the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value.

[0254] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0255] If the value of the target bit is the second value, the value of the target bit is set to the first value.

[0256] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0257] According to a preset time period, each Key included in the heat temporary storage area is transferred to the static cache area;

[0258] The Value corresponding to each Key included in the temporary heat storage area is obtained from the disk space, and each Value corresponding to each Key is added to the static cache area.

[0259] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0260] In the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0261] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0262] According to the time period, the heat value corresponding to each Key in the static cache area is reduced by 1, and the Key in the static cache area whose heat value is the second value is deleted.

[0263] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0264] Obtaining the Key information corresponding to the target Key from the Key storage area;

[0265] Determine the storage location of the target Value corresponding to the target Key according to the Key information;

[0266] In the Value storage area, the target Value is obtained from the storage location of the target Value.

[0267] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0268] Receive a data read request, wherein the data read request carries a target key Key;

[0269] In response to the data read request, query whether the target Key exists in the static cache area, and the number of historical accesses of the active key-value pairs included in the static cache area is greater than a preset threshold; optionally, the static cache area is a first storage space in the memory associated with the query sort string table SST;

[0270] In the case that the target Key exists in the static cache area, a target value Value corresponding to the target Key is obtained from active key-value pairs included in the static cache area.

[0271] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0272] In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

[0273] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0274] If the target key does not exist in the static cache area, query whether the target key exists in the disk space corresponding to the SST;

[0275] If the target Key exists in the disk space, the target Value is obtained from the disk space.

[0276] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0277] Using a preset mapping method, determine that the target Key is mapped to a target bit in a preset bitmap, where each bit in the bitmap is used to indicate whether each Key has been accessed in a historical time;

[0278] According to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

[0279] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0280] According to a preset division strategy, the target Key is divided into at least one sub-Key;

[0281] According to the number of bits of the bitmap, determine the number of left shifts of each sub-Key;

[0282] The modulo result between each sub-Key after the left shift and the length of the bitmap is determined as the position of the target bit in the bitmap.

[0283] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0284] If there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

[0285] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0286] If the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value.

[0287] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0288] If the value of the target bit is the second value, the value of the target bit is set to the first value.

[0289] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0290] According to a preset time period, each Key included in the heat temporary storage area is transferred to the static cache area;

[0291] The Value corresponding to each Key included in the temporary heat storage area is obtained from the disk space, and each Value corresponding to each Key is added to the static cache area.

[0292] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0293] In the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

[0294] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0295] According to the time period, the heat value corresponding to each Key in the static cache area is reduced by 1, and the Key in the static cache area whose heat value is the second value is deleted.

[0296] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0297] Obtaining the Key information corresponding to the target Key from the Key storage area;

[0298] Determine the storage location of the target Value corresponding to the target Key according to the Key information;

[0299] In the Value storage area, the target Value is obtained from the storage location of the target Value.

[0300] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and 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-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0301] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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, they should be considered to be within the scope of this specification.

[0302] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data reading method, characterized in that: The method comprises: Receive a data read request, wherein the data read request carries a target key Key; In response to the data read request, query whether the target Key exists in the static cache, and the number of historical accesses of active key-value pairs included in the static cache is greater than a preset threshold; In the case that the target Key exists in the static cache area, a target value Value corresponding to the target Key is obtained from active key-value pairs included in the static cache area.

2. The method according to claim 1, characterized in that The static buffer area is the first storage space in the memory associated with the query sort string table SST.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: In the static cache area, the heat value in the Key information corresponding to the target Key is accumulated by 1.

4. The method according to claim 2, characterized in that: The method further comprises: If the target key does not exist in the static cache area, query whether the target key exists in the disk space corresponding to the SST; If the target Key exists in the disk space, the target Value is obtained from the disk space.

5. The method according to claim 4, characterized in that The method further comprises: Using a preset mapping method, determine that the target Key is mapped to a target bit in a preset bitmap, where the bit in the bitmap is used to indicate whether the Key has been accessed in the historical time; According to the value of the target bit, determine whether to write the target Key into the hot temporary storage area, the hot temporary storage area is a second storage space in the memory associated with the static cache area, and the number of accesses to each of the Keys in the hot temporary storage area is greater than a preset threshold.

6. The method according to claim 5, characterized in that The using a preset mapping method to determine that the target Key is mapped to a target bit in a preset bitmap includes: According to a preset division strategy, the target Key is divided into at least one sub-Key; According to the number of bits of the bitmap, determine the number of left shifts of each sub-Key; The modulo result between each sub-Key after the left shift and the length of the bitmap is determined as the position of the target bit in the bitmap.

7. The method according to claim 6, characterized in that The method further comprises: If there is no available storage space in the hot temporary storage area, the target Key is used to replace the Key first stored in the hot temporary storage area.

8. The method according to claim 5, characterized in that The step of determining whether to write the target Key into the temporary heat storage area according to the value of the target bit includes: If the value of the target bit is the first value, the target Key is stored in the heat temporary storage area, and the value of the target bit is set to the second value.

9. The method according to claim 8, characterized in that The method further comprises: If the value of the target bit is the second value, the value of the target bit is set to the first value.

10. The method according to any one of claims 5 to 9, characterized in that: The method further comprises: According to a preset time period, each Key included in the heat temporary storage area is transferred to the static cache area; The Value corresponding to each Key included in the temporary heat storage area is obtained from the disk space, and each Value corresponding to each Key is added to the static cache area.

11. The method according to claim 10, characterized in that The method further comprises: In the process of transferring each key included in the hot temporary storage area to the static cache area, if the first key included in the hot temporary storage area is repeated with the second key included in the static cache area, it is prohibited to transfer the first key to the static cache area, and the heat value of the second key is accumulated in the static cache area.

12. The method according to claim 10, characterized in that The method further comprises: According to the time period, the heat value corresponding to each Key in the static cache area is reduced by 1, and the Key in the static cache area whose heat value is the second value is deleted.

13. The method according to claim 1, characterized in that The static cache area includes a Key storage area and a Value storage area, and the step of obtaining a target value Value corresponding to the target Key from the active key-value pairs included in the static cache area includes: Obtaining the Key information corresponding to the target Key from the Key storage area; Determine the storage location of the target Value corresponding to the target Key according to the Key information; In the Value storage area, the target Value is obtained from the storage location of the target Value.

14. A data reading device, characterized in that: The device comprises: A receiving module, used for receiving a data reading request, wherein the data reading request carries a target key Key; A query module, configured to query, in response to the data read request, whether the target key exists in a static cache area, and the number of historical accesses of active key-value pairs included in the static cache area is greater than a first threshold; The acquisition module is used to acquire a target value Value corresponding to the target Key from active key-value pairs included in the static cache area when the target Key exists in the static cache area.

15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.