Separation threshold adjustment method, storage medium and program product
By dynamically adjusting the separation threshold of key-value separation storage and optimizing the query resource consumption of key-value pairs according to the data size and query frequency, the adaptability problem of the key-value separation scheme in the existing technology in data changing scenarios is solved, and the system is improved. performance.
Patent Information
- Application Number
- CN202210013270.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-06
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-01-06
AI Technical Summary
Existing key-value separation storage solutions are difficult to adapt to computing scenarios with changing data. Especially in stream computing scenarios, fixed key-value separation conditions cannot effectively optimize system performance and may lead to performance regression.
By obtaining the separation status information of the current key-value separation storage process, including the size of unseparated value data and query frequency, the separation threshold is dynamically adjusted to match the query frequency and data size, thereby optimizing the query resource consumption of key-value pairs.
It realizes the adaptability of the key-value storage separation scheme, is suitable for a variety of different data scenarios, improves system performance, and avoids performance regression.
Smart Images

Figure CN114356866B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data storage technology, and in particular to a separation threshold adjustment method, a storage medium, and a program product. Background Art
[0002] In the key-value separation storage solution, key-value separation can be used to separate large value data, greatly reducing the size of the file used to store the key, thereby greatly optimizing the system's write amplification and improving the overall performance of the system. Therefore, the application of key-value separation storage solutions is becoming more and more widespread.
[0003] In general, fixed key-value separation conditions are mostly used in key-value separation storage, but such key-value separation conditions are difficult to apply to computing scenarios with variable data. For example, in stream computing scenarios, the data used for computing will be constantly updated, and the data characteristics of different data vary greatly. The data characteristics of the same data processing process in different time periods may also vary greatly. Summary of the invention
[0004] In view of this, an embodiment of the present application provides a separation threshold adjustment solution to at least partially solve the above-mentioned problem.
[0005] According to a first aspect of an embodiment of the present application, a separation threshold adjustment method is provided, comprising:
[0006] Acquire separation state information of the current key-value separation storage process, wherein the separation state information includes size information of unseparated value data in the key storage area and a first query frequency of the separated value data in the value storage area, wherein the separated value data is obtained by performing key-value separation on key-value pairs greater than a separation threshold, and the first query frequency is determined according to the number of queries for the separated value data and the total number of queries for the value data;
[0007] According to the size information of the unseparated value data and the first query frequency, the separation threshold is adjusted to adjust the size of the unseparated value data, wherein the resources consumed by querying key-value pairs are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data, and the first query frequency is inversely proportional to the separation threshold and proportional to the frequency at which the value data is queried.
[0008] According to a second aspect of an embodiment of the present application, a separation threshold adjustment method is provided, comprising:
[0009] Acquire separation state information of the current key-value separation storage process, wherein the separation state information includes size information of unseparated value data in the key storage area and a first query frequency of the separated value data in the value storage area, wherein the separated value data is obtained by performing key-value separation on key-value pairs greater than a separation threshold, and the first query frequency is determined according to the number of queries for the separated value data and the total number of queries for the value data;
[0010] Determining a target separation threshold according to the size information of the unseparated value data and the first query frequency to adjust the size of the unseparated value data, wherein resources consumed by querying key-value pairs are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data, and the first query frequency is inversely proportional to the separation threshold and proportional to the query frequency of the value data;
[0011] Display the resources consumed by querying key-value pairs after key-value separation storage is performed according to the current separation threshold, and the resources estimated to be consumed by querying key-value pairs after key-value separation storage is performed according to the target separation threshold;
[0012] In response to the threshold adjustment operation, the separation threshold is adjusted to a target separation threshold.
[0013] According to a third aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the separation threshold adjustment method as described above is implemented.
[0014] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising computer instructions, wherein the computer instructions instruct a computing device to perform operations corresponding to the separation threshold adjustment method as described above.
[0015] According to the scheme provided by the embodiment of the present application, since the first query frequency is inversely proportional to the separation threshold and directly proportional to the frequency with which the value data is queried, the resources consumed by querying the key-value pairs are directly proportional to the first query frequency and inversely proportional to the size information of the unseparated value data. Therefore, by obtaining the size information of the unseparated value data in the key storage area corresponding to the current key-value separation storage process and the first query frequency of the separated value data in the value storage area, and adjusting the separation threshold accordingly, the separation threshold is matched with the probability of the separated value data being queried, and then the first query frequency is matched with the frequency with which the separated value data is queried, and further the resources consumed by querying the key-value pairs are matched with the queried data, so that the key-value storage separation storage scheme provided by this embodiment can be applied to a variety of data with differences. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0017] Figure 1A A schematic flow chart of a stream computing provided in an embodiment of the present application;
[0018] Figure 1B for Figure 1A A schematic diagram of the steps of a key-value separation storage process in the illustrated embodiment;
[0019] Figure 2A A schematic diagram of the structure of a key-value separation storage system provided in an embodiment of the present application;
[0020] Figure 2B A flowchart of a separation threshold adjustment method provided in an embodiment of the present application;
[0021] Figure 3 A flowchart of another separation threshold adjustment method provided in an embodiment of the present application;
[0022] Figure 4A A flowchart of another separation threshold adjustment method provided in an embodiment of the present application;
[0023] Figure 4B A schematic diagram of a key-value separation storage system provided in an embodiment of the present application;
[0024] Figure 4C for Figure 4A A schematic diagram of a scenario in the illustrated embodiment;
[0025] Figure 5 A flowchart of another separation threshold adjustment method provided in an embodiment of the present application;
[0026] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0028] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.
[0029] See also Figure 1A , 1B ,In order to conveniently illustrate the solution of this application, the key-value separation storage process is first introduced.
[0030] See also Figure 1A The left and right stream data (i.e., the left information stream and the right information stream) can be written into the corresponding key-value storage system respectively. The stream computing node JOIN can obtain the corresponding key-value pairs from the key-value storage systems corresponding to the left and right stream data respectively, and perform join matching.
[0031] When matching is performed specifically, the key data in the key-value pair can be obtained and matched from the key-value storage system first. If the key data is matched, the value data in the key-value pair is queried from the key-value storage system and output. When the probability of successful matching of the key data in the left and right stream data is high, the query frequency of the query value data is high. When the probability of successful matching of the key data in the left and right stream data is low, the query frequency of the query value data is low.
[0032] See also Figure 1B , the key-value pair key|value corresponding to the left or right stream data can be written into the key-value separation storage system.
[0033] If the key-value pair is greater than the key-value separation threshold, the key-value pair (key, value) can be separated, and an identifier can be assigned to the separated value data value. After that, (key, v-id) can be stored in the key storage area, and (v-id, value) can be stored in the value storage area.
[0034] If the key-value pair is smaller than the key-value separation threshold, the key-value pair (key, value) can be stored in the key storage area LSM-Tree.
[0035] When performing a query, first query the key storage area to see if the key value matches. If it matches, the value data can be obtained directly from the key storage area, or from the value storage area based on the vid.
[0036] Since the key storage area LSM-Tree is generally a hierarchical structure, when querying the key storage area, it is generally necessary to query layer by layer until the required data is obtained. Therefore, the resources consumed by the query operation on the key storage area are proportional to the size of the key storage area. The smaller the key-value separation threshold and the larger the key storage area, the more resources are consumed by querying the key storage area.
[0037] The value data is generally not stored in a hierarchical manner in the value storage area, and can be located directly according to the value address or value identifier stored in the key storage area. Therefore, the resources consumed by each query operation in the value storage area are relatively fixed and are not affected by the size of the value storage area. However, the resources consumed by a query are greater than the resources consumed by a query in the key storage area.
[0038] When the data to be joined is different, the probability of successful key data matching is also different, resulting in a large difference in query efficiency when querying key-value separated data. If the probability of successful key data matching is high, the number of times the value data needs to be queried is also high. If most of the value data is stored in the value storage area, the query process will consume more resources; if the probability of successful key data matching is low, the number of times the value data needs to be queried is low. If there is more data in the key storage area, the query process will consume more resources.
[0039] However, the fixed key-value separation condition makes the key-value separation storage solution unable to adapt to different data, and may even cause performance regression.
[0040] To this end, the present application proposes a separation threshold adjustment method.
[0041] Figure 2A , 2B A schematic diagram of a separation threshold adjustment method provided in an embodiment of the present application.
[0042] See also Figure 2A , the solution provided in this embodiment can be executed by a key-value separation storage decision maker.
[0043] The key-value separation decider is responsible for deciding each<key,value> Whether key-value pairs can be separated. Figure 2A As shown, the key-value separation decider can determine a<key,value> Whether key-value separation is performed. If key-value separation is performed, the separated value data can be stored in the value storage space BlobStore, specifically, it can be stored as a value storage file BlobFile.
[0044] The key-value separation decider can store the unseparated key-value pairs or the remaining key data and value addresses after separation in the value storage area LSM-tree.
[0045] The key-value separation decider will collect statistics on the separation status information within a period of time, and then dynamically adjust the key-value separation conditions based on the statistics, thereby achieving adaptive key-value separation. The key-value separation status information mainly includes the current key-value separation data ratio, the average size of the value where the key-value separation occurs, the request ratio of accessing the separated value in all query requests, etc.
[0046] The specific adjustment method is explained in detail through the following steps.
[0047] Specifically, if Figure 2B As shown, the method may include:
[0048] S201, obtaining separation status information in the current key-value separation storage process.
[0049] The separation status information includes size information of unseparated value data in the key storage area and a first query frequency of separated value data in the value storage area, wherein the separated value data is key-value pairs greater than a separation threshold that are obtained by key-value separation, and the first query frequency is determined based on the number of queries for the separated value data and the total number of queries for the value data.
[0050] S201 : Adjust the separation threshold according to size information of unseparated value data and the first query frequency to adjust the size of unseparated value data.
[0051] The resources consumed by querying key-value pairs are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data, and the first query frequency is inversely proportional to the separation threshold and proportional to the query frequency of the value data.
[0052] In this embodiment, the resources consumed by querying the key-value pair may specifically be consumed memory resources, etc., which is not limited in this embodiment.
[0053] According to the solution provided in the embodiment of the present application, since the first query frequency is inversely proportional to the separation ratio and directly proportional to the probability of the value data being queried, the resources consumed by querying the key-value pair are directly proportional to the first query frequency and inversely proportional to the size information of the unseparated value data. Therefore, by obtaining the size information of the unseparated value data and the first query frequency of the unseparated value data corresponding to the current key-value separation storage process, and adjusting the separation threshold according to the information, the separation threshold is matched with the probability of the value data being queried, and then the first query frequency is matched with the probability of the value data being queried, and further the resources consumed by a single query of the key-value pair are matched with the queried data, so that the key-value storage separation storage solution provided in this embodiment can be applied to a variety of data with differences.
[0054] The above solution is illustrated below by taking a specific scenario as an example.
[0055] In the stream computing scenario, the data characteristics of different jobs (value size, access frequency of keys and values, etc.) are different; the data characteristics of the same job in different time periods may also change periodically.
[0056] For example, the left and right side stream data (ie, the left information stream and the right information stream) can be continuously stored in a key-value separation storage system, and the Join node can continuously read data from the key-value separation storage system to perform a join operation.
[0057] In the time period t1, the data characteristics of the left and right streams are: the value data is small, and the proportion of key-value pairs for key-value separation storage can be 30%. That is, in the time period t1, the value data in 30% of the key-value pairs are separated and stored in the value storage area, and the remaining 70% of the key-value pairs are stored in the key storage area.
[0058] If at this time, the probability of successful key matching of the key data of the left and right stream data is 10%, then the first query frequency of the separated value data in the value storage area is 3%, and the query frequency is relatively small. At this time, the separation threshold can be lowered to reduce the size of the unseparated value data, thereby reducing the size of the key storage area, and the first query frequency increases accordingly, but the increased first query frequency is still relatively small. When the size of the key storage area and the first query frequency are relatively small, fewer resources are consumed in querying key-value pairs in the key-value storage system.
[0059] In the time period t2, the data characteristics of the left and right streams are as follows: the value data is still small, and the proportion of key-value pairs for key-value separation storage can be 30%. That is, in the time period t1, the value data in 30% of the key-value pairs are separated and stored in the value storage area, and the remaining 70% of the key-value pairs are stored in the key storage area.
[0060] If at this time, the probability of successful key matching of the key data of the left and right stream data is 50%, then the first query frequency of separating the value data in the value storage area is 35%, and the query frequency is relatively large. At this time, the separation threshold can be increased to increase the size of the unseparated value data, thereby reducing the first query frequency to reduce the number of times the value storage area is accessed during the query process, thereby ensuring that fewer resources are consumed in querying key-value pairs in the key-value storage system.
[0061] In this embodiment, the optimization of adaptive KV separation (i.e., the process of adjusting the separation threshold mentioned above) is added to the key-value separation storage system, so that different jobs / different time periods can automatically adapt to different KV separation thresholds, so that key-value separation can give full play to its advantages. Adaptive KV separation can adjust the proportion of KV separation of data by adopting a dynamic separation threshold. We set the separation threshold to Vt, that is, KV separation will only be triggered when the value size exceeds Vt. For scenarios where it is not suitable to enable KV separation, the separation threshold Vt can be automatically adjusted to a larger value, which is equivalent to completely closing KV separation; for scenarios where kv separation is applicable (value is large and the access frequency is low), the separation threshold Vt can be automatically adjusted to a smaller value to try to separate the infrequently accessed value data value to the value storage area BlobStore, and keep the frequently accessed value data value in the key storage area LSM-tree as much as possible.
[0062] In addition, in any embodiment of this application, see Figure 2A When key-value separation occurs, the separated value data will have a certain amount of space enlargement, and the disk space will be relatively large. In scenarios where disk space is limited, the use of key-value separation may be limited. To solve this problem, the value storage space can support the function of storage and computing separation.
[0063] Specifically, according to the hotspot degree corresponding to each data in the value storage area, data with a higher hotspot degree can be stored in the local storage space, and data with a lower hotspot degree can be stored in the cloud storage system, wherein the hotspot degree is used to characterize the probability of data being queried.
[0064] Specifically, when the local disk space is insufficient, the value storage area blobStore will temporarily upload part of the blobFile to the distributed file system (DFS).
[0065] Specifically:
[0066] 1. The value storage area blobStore will count the disk space usage of all value storage files blobFile. When the total size of the disk files exceeds the preset threshold, the local files can be uploaded to DFS.
[0067] 2. By recording the access frequency of the value storage file blobFile used to store value data over a period of time, the popularity of the value storage file can be obtained. When it is necessary to upload some local value storage files blobFile to DFS, you can select the value storage file blobFile with lower popularity as the upload object; after the value storage file blobFile is uploaded, the local copy can be deleted to free up disk space;
[0068] 3. If the value storage file blobFile required to read the value data is on DFS, it can be downloaded locally first; if the popularity of the value storage file blobFile downloaded locally is greater than that of other value storage files, the value storage file blobFile can be cached locally, and other value storage files blobFile with lower popularity can be uploaded to DFS.
[0069] In addition, in any embodiment of this application, see Figure 2A For scenarios where there are hotspots in value access after enabling kv separation (key-value separation), the value storage area BlobStore can provide a cache BlobCache function to cache the most frequently accessed blobs (separated values). The working principle of BlobCache is similar to RocksDB BlockCache, which uses the LRU cache strategy to cache the most frequently accessed blobs.
[0070] For ease of description, we call the LSM-tree data storage area MainStore. A portion of the memory in MainStore is used as BlockCache, and we also designed BlobCache in BlobStore to optimize read performance. It is worth mentioning that these two caches in GeminiStore are organized in a shared memory manner, which allows more efficient use of memory in the KV separation scenario.
[0071] In detail, when Gemini turns on KV separation, the amount of data entering the MainStore will be relatively small. In some cases, BlockCache may not be fully loaded (or some relatively cold data may be loaded). This scenario can reflect the advantages of shared memory. This part of the memory that is not fully utilized by BlockCache can be temporarily used by BlobCache.
[0072] If the data in MainStore becomes large, the data in BlockCache and BlobCache will compete for this part of the shared memory with the LRU strategy. Considering that the frequency of accessing values in BlobStore is generally low after KV separation (regulated by the adaptive KV separation strategy), the data in BlobCache will generally be kicked out of the shared memory first. However, if there is a data access hotspot in BlobStore, some cold data in BlockCache will be kicked out of the shared memory.
[0073] Therefore, in the shared memory mode, when there is no hot spot in BlobStore, the shared memory is mainly used by BlockCache; when there is a data hot spot in BlobStore access or BlockCache is not full, BlobStore can compete for part of the memory for BlobCache to use.
[0074] In addition, for scenarios where key-value separation exists and value access has hotspots, blobStore provides the blobBlockCache function to cache the most frequently accessed blobs (separated values). The working principle of BlobBlockCache is similar to RocksDB BlockCache, which uses the LRU cache strategy to cache the most frequently accessed blobs.
[0075] The storage rules of this solution are as follows:
[0076] 1. The memory ratio used by BlobBlockCache is relatively small, and the total memory size occupied will be strictly controlled;
[0077] 2. When a blob needs to be read from blobStore, first check whether it exists in blobBuffer. If not, then check whether it exists in BlobBlockCache. If not, then check in blobFile.
[0078] 3. When a blob is read from blobFile, the heat of the blob will increase. If the heat of the current blob is greater than that of other blobs in BlobBlockCache, the current blob will be put into BlobBlockCache. Correspondingly, blobs with relatively low heat in BlobBlockCache will be removed from the cache.
[0079] Figure 3 A flow chart of a method for adjusting a separation threshold provided in an embodiment of the present application is shown in the figure, which includes:
[0080] S301. Obtain size information of separation value data, and obtain a third query frequency of the separation value data.
[0081] The size information of the separated value data is inversely proportional to the size information of the unseparated value data; and the third query frequency is inversely proportional to the first query frequency.
[0082] Compared with the query situation of observing value data from the key storage space, the situation where value data is queried in the observed value storage space is easier to observe. Therefore, in this embodiment, the size information of the separated value data is obtained, which is inversely proportional to the size information of the unseparated value data, and the third query frequency is obtained.
[0083] For example, in this embodiment, the request ratio Qt of accessing the separated value in the current query request can be obtained. The request ratio Qt is used to characterize the third query frequency. The request ratio Qt is determined by the total number of times the value data is queried and the number of times the value data in the value storage space is queried.
[0084] S302: Obtain a query frequency threshold range Rt corresponding to the size information of the separation value data.
[0085] In this embodiment, size ranges corresponding to size information of multiple separation value data may be preset, and each size range may correspond to a query frequency threshold range Rt. After obtaining the size information of the separation value data, the corresponding query frequency threshold range Rt may be determined according to the range to which it belongs.
[0086] Optionally, in an embodiment of the present application, the size information of the separation value data may specifically be the average size of the separation value data. Then, obtaining the query frequency threshold range corresponding to the size information of the separation value data includes: determining a preset data size range to which the average size of the separation value data belongs; obtaining the query frequency threshold range corresponding to the preset data size range, wherein the upper limit of the query frequency threshold range is proportional to the data size information of the value data.
[0087] S303: If the third query frequency does not match the query frequency threshold range, adjust the separation threshold to adjust the proportion of key-value pairs for key-value separation storage.
[0088] The ratio of key-value pairs stored in key-value separation is proportional to the third query frequency.
[0089] For example, in an embodiment of the present application, if it is determined that the request ratio Qt for accessing separated values in the current query request is less than the lower limit of the target ratio range Rt, it is necessary to reduce the threshold value Vt of key-value separation so that the data ratio Pt for key-value separation becomes larger; if it is determined that the request ratio Qt for accessing separated values in the current query request is greater than the upper limit of the target ratio range Rt, it is necessary to increase the threshold value Vt of key-value separation so that the data ratio Pt for key-value separation becomes smaller.
[0090] The magnitude of each adjustment is determined by the difference between the current requested ratio and the upper or lower limit of the target ratio range Rt. The larger the difference, the greater the magnitude of the adjustment.
[0091] If the proportion of requests for accessing separated values in the current query request is within the target proportion range, the key-value separation condition is not adjusted.
[0092] The specific adjustment plan is described below. The method for dynamically adjusting the key-value separation conditions is as follows:
[0093] 1. Set key-value pairs<key,value> The size of value is L, then<key,value> The condition for key-value separation is: L is greater than the separation threshold Vt of key-value separation,
[0094] That is, key-value separation will occur only when the value is larger than the separation threshold Vt. If the value is smaller than or equal to Vt, key-value separation will not occur. Vt can be dynamically adjusted by the key-value separation decider.
[0095] The rules for dynamic adjustment of Vt are described as follows:
[0096] (1) When the threshold of key-value separation is Vt, the proportion of data that undergoes key-value separation is Pt, the average size of the value that undergoes key-value separation (i.e., the value data stored in the value storage area) is St, and the proportion of requests to access separated values in all query requests for query value data is Qt;
[0097] In this embodiment, a target ratio range Rt of access separation value is preset, and the upper limit value of Rt is proportional to the average size St of the value where key-value separation occurs, which can be specifically expressed as
[0098]
[0099] Kb (kilobyte) refers to the size unit of data stored in computer data memory, 1KB=1024B.
[0100] When the average size of the key-value separated value is in the range of (0,4kB], the target ratio range Rt is (8%~12%); when the average size of the key-value separated value is in the range of (4kB,12kB], the target ratio range Rt is (18%~22%); when the average size of the key-value separated value is greater than 12kB, the target ratio range Rt is (0%~100%).
[0101] Of course, the specific value ranges of Rt and St mentioned above are only used for illustration and are not intended to be limiting of the present application.
[0102] When making specific adjustments, if it is determined that the request ratio Qt of accessing separated values in the current query request is less than the lower limit of the target ratio range Rt, the threshold value Vt of key-value separation needs to be adjusted down so that the data ratio Pt of key-value separation becomes larger; if it is determined that the request ratio Qt of accessing separated values in the current query request is greater than the upper limit of the target ratio range Rt, the threshold value Vt of key-value separation needs to be adjusted up so that the data ratio Pt of key-value separation becomes smaller. If the request ratio of accessing separated values in the current query request is within the target ratio range, the condition of key-value separation is not adjusted.
[0103] The separation threshold adjustment method of this embodiment can be executed by any appropriate electronic device with data processing capability, including but not limited to: a server, a mobile terminal (such as a mobile phone, a PAD, etc.) and a PC, etc.
[0104] Figure 4A A flow chart of another separation threshold adjustment method provided in an embodiment of the present application is shown in the figure, which includes:
[0105] S401. Obtain separation status information of the current key-value separation storage process.
[0106] Among them, the separation status information includes size information of the unseparated value data and a first query frequency of the unseparated value data, wherein the key-value pairs greater than the separation threshold are key-value separated, and the first query frequency is determined based on the number of queries for the value data in the key storage area and the total number of queries.
[0107] The specific implementation method of this step can refer to the above embodiment and will not be repeated here.
[0108] S402: Calculate a threshold adjustment ratio according to size information of the unseparated value data, the first query frequency, and resources consumed for performing a single key-value pair query in the value storage area.
[0109] Among them, the first query frequency is inversely proportional to the separation ratio and proportional to the probability of the value data being queried, and the resources consumed by a single query of a key-value pair are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data.
[0110] Specifically, in this embodiment, the first query frequency is determined by: determining the second query frequency of the query value data, and determining the third query frequency of the separation value data in the query value storage area; determining the first query frequency based on the difference between the second query frequency and the third query frequency.
[0111] See also Figure 4B When the value data size valuesize in the key-value pair exceeds the separation threshold t, the value data value in the key-value pair will be separated and stored in the value storage area BlobStore, and the key data key and value address will be stored in the key storage area Main Store.
[0112] Then, the number of key data key stored in the key storage area can be set as Kc, the total size of key data stored in the key storage area can be set as Ks, the number of value data valuecount stored in the key storage area can be set as Vc, and the total size of value data stored in the key storage area can be set as Vs. The proportion of query requests for querying value data in the value storage area to all access requests for querying key-value pairs is a.
[0113] For the key storage area, we enter the LSM-tree (i.e. MainStore). We assume that the cost of a request is proportional to the total size of the MainStore data, that is:
[0114] Em=β·(Ks+Vs), where β is a constant and Em is the expected cost of accessing the key storage area once.
[0115] For the value storage area into the Blobtore, the access cost is independent of the data size. Assume that the expected cost of accessing the value storage area once is constant:
[0116] Eb=M, where M is a constant and Eb is the expected cost of accessing a value storage area.
[0117] Based on the above assumptions, the expected cost of a query request is:
[0118] E=Em+aEb=β·(Ks+Vs)+aM, where α is the ratio of the value storage area being accessed.
[0119] In addition, assuming that the size of the value data is evenly distributed and the key data is randomly accessed, the following proportional relationship exists in the key-value storage system:
[0120] Vc~t
[0121] Vs~Vc·t
[0122] a~Kc-Vc, where the parameters before and after “~” are proportional.
[0123] Assuming that the adjusted target separation threshold is t', after the separation threshold is adjusted to the target separation threshold, the expected cost of a query can be:
[0124]
[0125] According to the above formula, E is a quadratic function about t', and it opens upward and has a minimum value. After taking the derivative of the above formula and obtaining the minimum value, it can be obtained that when E takes the minimum value, the value of t' is:
[0126]
[0127] Assume that the current data ratio of KV separation is q, then
[0128]
[0129] Substituting q into the above value of t', we can obtain:
[0130]
[0131] Since the parameter α of the value storage area is easier to observe than Kc and Vc, the above formula can be transformed to obtain:
[0132] Wherein, M is the resource consumed for a single query in the value storage area, β is a constant value, p is the second query frequency, a is the third query frequency, pa is the first query frequency, and Vs is the total size of the unseparated value data.
[0133] S403: Determine a target separation threshold as an adjustment target according to the threshold adjustment ratio and the current separation threshold.
[0134] In this embodiment, t in the above formula is the current separation threshold, and t' is the target separation threshold.
[0135] Of course, there are multiple formulas for t and t' mentioned above, and those skilled in the art can select an appropriate formula according to needs to adjust the separation threshold, which are all within the protection scope of the present application.
[0136] S404: Adjust the current separation threshold to the target separation threshold.
[0137] In this embodiment, if the target separation threshold is calculated, the adjusted separation threshold can be set to the target separation threshold. Specifically, the solution provided in this embodiment can be repeatedly executed at preset time intervals.
[0138] For example, see Figure 4C In this embodiment, the following may be specifically included:
[0139] Monitoring steps: You can monitor the separation status information during the current key-value separation storage process.
[0140] Calculation steps: Calculate the target separation threshold of KV separation based on the above formula, and determine whether separation threshold adjustment operation is required based on the calculated target separation threshold.
[0141] Specifically, whether to perform the separation threshold adjustment operation may be determined based on the difference between the expected consumption corresponding to the target separation threshold and the actual consumption of the current access.
[0142] If the separation threshold adjustment operation is not performed, the process returns to the monitoring step and continues to execute. If the separation threshold adjustment operation is performed, the adjustment step can be executed.
[0143] Adjustment step: adjust the separation threshold to the target separation threshold through the key-value separation decider.
[0144] After adjusting, cool down for n seconds and then return to the monitoring step.
[0145] Figure 5 A flow chart of another separation threshold adjustment method provided in an embodiment of the present application is shown in the figure, which includes:
[0146] S501. Obtain separation status information of the current key-value separation storage process.
[0147] The separation state information includes size information of the unseparated value data and a first query frequency of the unseparated value data, wherein the key-value pairs greater than the separation threshold are subjected to key-value separation, and the first query frequency is determined according to the number of queries for the value data in the key storage area and the total number of queries;
[0148] S502: Determine a target separation threshold according to size information of the unseparated value data and the first query frequency to adjust the size of the unseparated value data.
[0149] The first query frequency is inversely proportional to the separation ratio and is proportional to the probability of the value data being queried, and the resources consumed by a single query of a key-value pair are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data;
[0150] S503: Display resources consumed by a single query of key-value pairs after storing key-value pairs through the current key-value separation storage process, and resources consumed by a single query of key-value pairs corresponding to the target separation threshold.
[0151] When specifically displaying, the amount of resources that can be omitted after adjustment, the separation status information obtained in the above steps, etc. can also be displayed.
[0152] The user can determine whether to adjust the separation threshold based on the displayed content. If determined to adjust, the user can enter the threshold adjustment operation.
[0153] S504: In response to the threshold adjustment operation, the separation threshold is adjusted to the target separation threshold.
[0154] Reference Figure 6 , shows a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0155] like Figure 6 As shown, the electronic device may include: a processor (processor) 602 , a communication interface (Communications Interface) 604 , a memory (memory) 606 , and a communication bus 608 .
[0156] in:
[0157] The processor 602 , the communication interface 604 , and the memory 606 communicate with each other via a communication bus 608 .
[0158] The communication interface 604 is used to communicate with other electronic devices or servers.
[0159] The processor 602 is used to execute the program 610, and specifically can execute the relevant steps in the above separation threshold adjustment method embodiment.
[0160] Specifically, the program 610 may include program codes, which include computer operation instructions.
[0161] The processor 602 may be a processor CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0162] The memory 606 is used to store the program 610. The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0163] The specific implementation of each step in program 610 can refer to the corresponding description of the corresponding steps and units in the above separation threshold adjustment method embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, which will not be repeated here.
[0164] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any key-value separation storage in the above-mentioned multiple method embodiments.
[0165] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0166] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the separation threshold adjustment method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the separation threshold adjustment method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the separation threshold adjustment method shown herein.
[0167] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0168] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A separation threshold adjustment method, comprising: Acquire separation state information in the current key-value separation storage process, wherein the separation state information includes size information of unseparated value data in the key storage area and a first query frequency of separated value data in the value storage area, wherein the separated value data is obtained by performing key-value separation on key-value pairs greater than a separation threshold, and the first query frequency is determined according to the number of queries for the separated value data and the total number of queries for the value data; According to the size information of the unseparated value data and the first query frequency, the separation threshold is adjusted to adjust the size of the unseparated value data, wherein the resources consumed by querying key-value pairs are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data, and the first query frequency is inversely proportional to the separation threshold and proportional to the frequency at which the value data is queried.
2. The method according to claim 1, wherein: The adjusting the separation threshold according to the size information of the unseparated value data and the first query frequency includes: Calculate the threshold adjustment ratio according to the size information of the unseparated value data, the first query frequency, and the resources consumed by performing a single key-value pair query in the value storage area; Determine a target separation threshold as an adjustment target according to the threshold adjustment ratio and the current separation threshold; The current separation threshold is adjusted to the target separation threshold.
3. The method according to claim 2, wherein: The first query frequency is determined by: determining a second query frequency for query value data, and determining a third query frequency for separation value data in the query value storage area; The first query frequency is determined according to a difference between the second query frequency and the third query frequency.
4. The method according to claim 3, wherein: The target separation threshold is determined by the following formula: Wherein, M is the resource consumed for a single query in the value storage area, β is a constant value, p is the second query frequency, a is the third query frequency, pa is the first query frequency, and Vs is the total size of the unseparated value data.
5. The method according to claim 1, wherein: The step of obtaining the separation status information of the current key-value separation storage process includes: Acquire size information of the separated value data, wherein the size information of the separated value data is inversely proportional to the size information of the unseparated value data; Acquire a third query frequency of the separation value data, wherein the third query frequency is inversely proportional to the first query frequency; The adjusting the separation threshold according to the size information of the unseparated value data and the first query frequency includes: Acquire a query frequency threshold range corresponding to the size information of the separation value data; If the third query frequency does not match the query frequency threshold range, the separation threshold is adjusted to adjust the proportion of key-value pairs stored with key-value separation, wherein the proportion of key-value pairs stored with key-value separation is proportional to the third query frequency.
6. The method according to claim 5, wherein: The size information of the separation value data includes: the average size of the separation value data; The obtaining of the query frequency threshold range corresponding to the size information of the separation value data includes: Determine a preset data size range to which the average size of the separation value data belongs; A query frequency threshold range corresponding to a preset data size range is obtained, wherein an upper limit of the query frequency threshold range is proportional to the data size information of the value data.
7. The method according to claim 1, wherein: The method further includes: the key storage area and the value storage area share a shared cache space, and the method further includes: The shared cache space is dynamically allocated to the key storage area and the value storage area according to the hotspot degree and data size of each data in the key storage area and the value storage area, wherein the hotspot degree is used to characterize the probability of data being queried.
8. The method according to claim 1, wherein: The method further comprises: According to the hotspot degree corresponding to each data in the value storage area, the data with a higher hotspot degree is stored in the local storage space, and the data with a lower hotspot degree is stored in the cloud storage system, wherein the hotspot degree is used to characterize the probability of the data being queried.
9. A separation threshold adjustment method, comprising: Acquire separation state information of the current key-value separation storage process, wherein the separation state information includes size information of unseparated value data in the key storage area and a first query frequency of the separated value data in the value storage area, wherein the separated value data is obtained by performing key-value separation on key-value pairs greater than a separation threshold, and the first query frequency is determined according to the number of queries for the separated value data and the total number of queries for the value data; Determining a target separation threshold according to the size information of the unseparated value data and the first query frequency to adjust the size of the unseparated value data, wherein resources consumed by querying key-value pairs are proportional to the first query frequency and inversely proportional to the size information of the unseparated value data, and the first query frequency is inversely proportional to the separation threshold and proportional to the query frequency of the value data; Display the resources consumed by querying key-value pairs after key-value separation storage is performed according to the current separation threshold, and the resources estimated to be consumed by querying key-value pairs after key-value separation storage is performed according to the target separation threshold; In response to the threshold adjustment operation, the separation threshold is adjusted to a target separation threshold.
10. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the separation threshold adjustment method according to any one of claims 1 to 9 is implemented.
11. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the separation threshold adjustment method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Dynamic hybrid indexing method for non-relational database
CN110069500A
Strategy for controlling FM stereo separation and frequency response in noisy reception environments
US5671286A
