Data tiering storage method, device and electronic equipment
By selecting target storage resources with lower latency for data storage in the distributed storage system, the problem of long storage process delays caused by long latency of individual storage resources is solved, and the success rate and performance of data storage are improved.
Patent Information
- Application Number
- CN202311147427.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-09-06
AI Technical Summary
In a distributed storage system, the long delay of individual storage resources leads to a long delay in the entire storage process, which in turn causes storage business blockage and affects the success rate and performance of data storage.
By obtaining the delay data of all initial storage resources in the distributed storage system, the target delay level is determined, and based on the erasure code algorithm, the target storage resources with lower delay are selected for data storage, reducing the impact of the longer delay of individual resources on the entire storage process.
It reduces storage delay, improves data storage success rate and storage performance, and avoids storage service congestion.
Smart Images

Figure CN119576208B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and in particular to a data hierarchical storage method, device and electronic equipment. BACKGROUND
[0002] In a distributed storage system, a cluster is generally composed of multiple storage nodes, each storage node is composed of multiple disks or other non-transient storage media, each disk serves as a resource provider to provide storage space for the to-be-stored data. The storage process generally adopts an erasure code algorithm for storage, that is, the to-be-stored data is divided into k data blocks, and m check blocks are calculated according to the erasure code algorithm, the data blocks and the check blocks are stored in the corresponding storage resources respectively, and k+m storage resources are determined as the storage resource sequence corresponding to the to-be-stored data, wherein each storage resource is in a different storage node.
[0003] However, when storage is performed according to the erasure code algorithm, the to-be-stored data is only considered to be stored successfully if all the blocks corresponding to the to-be-stored data are successfully stored. If some storage resources have a slow read-write speed, the storage resources are performing data migration, the storage resources are performing data repair, or the storage service is in a service peak period, etc., causing the time delay of the storage resources to exceed the timeout, the entire to-be-stored data storage will be timed out, and the front-end service corresponding to the to-be-stored data will be blocked. SUMMARY
[0004] The present application provides a data hierarchical storage method, device and electronic equipment to solve the defect that the entire storage process has a long time delay due to the long time delay of individual storage resources in the prior art, reduce the storage time delay, and improve the success rate and storage performance of data storage.
[0005] The present application provides a data hierarchical storage method, comprising:
[0006] Obtaining the time delay data corresponding to all initial storage resources in the distributed storage system and the to-be-stored data respectively;
[0007] Based on all the time delay data, determining a target time delay level, the target time delay level being used to represent the proportion of timeout data in all the time delay data;
[0008] Based on the target time delay level and the storage resource sequence corresponding to the to-be-stored data, determining a target storage resource, and based on the erasure code algorithm, the to-be-stored data and the target storage resource, determining the target storage data corresponding to the target storage resource, the storage resource sequence including at least two storage resources corresponding to the to-be-stored data;
[0009] Storing the target storage data to the target storage resource.
[0010] According to the data hierarchical storage method provided by the present invention, determining the target storage resource based on the target latency level and the storage resource sequence corresponding to the data to be stored includes:
[0011] When the target delay level is the first delay level, all storage resources in the storage resource sequence corresponding to the data to be stored are determined as the target storage resources.
[0012] According to the data hierarchical storage method provided by the present invention, determining the target storage resource based on the target latency level and the storage resource sequence corresponding to the data to be stored includes:
[0013] When the target delay level is any one of the second delay level to the (m+1)th delay level, determining the target storage resource based on the delay data corresponding to each storage resource in the storage resource sequence;
[0014] Here, m represents the number of check blocks of the data to be stored determined based on the erasure code algorithm, and the timeout data ratios corresponding to the second delay level to the (m+1)th delay level increase successively.
[0015] According to the data hierarchical storage method provided by the present invention, determining the target storage resource based on the delay data corresponding to each storage resource in the storage resource sequence includes:
[0016] When the target delay level is the i-th delay level, the delay data corresponding to each storage resource in the storage resource sequence are sorted to determine the top i-1 first delay data; i is an integer greater than 1 and less than or equal to m+1;
[0017] Determine the storage resource corresponding to the first delay data greater than the first preset threshold as a first non-storage resource;
[0018] All storage resources except the first non-storage resource in the storage resource sequence are determined as the target storage resources.
[0019] According to the data hierarchical storage method provided by the present invention, determining the target storage resource based on the target latency level and the storage resource sequence corresponding to the data to be stored includes:
[0020] In a case where the target latency level is an (m+2)th latency level, the target storage resource is determined based on target resource data corresponding to each storage resource in the sequence of storage resources; the target resource data includes latency data corresponding to the storage resource, or the latency data and a resource utilization rate, and m represents a number of check blocks determined based on the erasure code algorithm.
[0021] According to the data hierarchical storage method provided in the application, the target storage resource is determined based on target resource data corresponding to each storage resource in the sequence of storage resources, and the method comprises the following steps.
[0022] In a case where the target latency level is an (m+2)th latency level, latency data corresponding to each storage resource in the sequence of storage resources is sorted to determine m second latency data with the highest ranking.
[0023] The a storage resources corresponding to the second latency data greater than the first preset threshold value are determined as a second non-storage resource; a is an integer greater than or equal to 0 and less than or equal to m.
[0024] The m-a third non-storage resources are determined based on the resource utilization rate of each storage resource.
[0025] The other storage resources in the sequence of storage resources except the a second non-storage resources and the m-a third non-storage resources are determined as the target storage resource.
[0026] According to the data hierarchical storage method provided in the application, the method further comprises the following steps.
[0027] In a case where the target latency level is any latency level from a second latency level to an (m+2)th latency level, at least one timeout storage resource is determined based on the sequence of storage resources and the target storage resource.
[0028] For each timeout storage resource, a storage duration interval corresponding to the timeout storage resource is determined based on a current time and a last write time of the timeout storage resource.
[0029] In a case where the storage duration interval is greater than or equal to a detection period threshold value, the timeout storage resource is detected, and after determining a detection result, latency data of the timeout storage resource is set to 0, and the target latency level is re-determined based on the set latency data.
[0030] According to the data hierarchical storage method provided in the application, the timeout storage resource is detected, and the method comprises the following steps.
[0031] in a case where the delay data of the timeout storage resource is greater than or equal to a second preset threshold, updating the detection period threshold corresponding to the timeout storage resource based on the delay data of the timeout storage resource, and detecting the timeout storage resource based on the timeout cumulative number of the timeout storage resource;
[0032] in a case where the delay data of the timeout storage resource is greater than or equal to the first preset threshold and less than the second preset threshold, setting the timeout cumulative number of the timeout storage resource to 0, and updating the detection period threshold to an initial value;
[0033] in a case where the delay data of the timeout storage resource is less than the first preset threshold, setting the timeout cumulative number of the timeout storage resource to 0.
[0034] According to the data hierarchical storage method provided by the application, the method further comprises:
[0035] in a case where the storage resource sequence does not have invalid storage resources and the delay data of each fourth non-storage resource in the storage resource sequence is less than the first preset threshold, performing data reconstruction based on the mapping relationship between other storage data in the to-be-stored data and the fourth non-storage resource, the fourth non-storage resource being a storage resource in the storage resource sequence except the target storage resource, and the invalid storage resource being a timeout storage resource with a timeout cumulative number greater than or equal to a third preset threshold;
[0036] in a case where the storage resource sequence has invalid storage resources and the number of the invalid storage resources is less than or equal to m, determining a remapping storage resource based on all initial storage resources in the storage node corresponding to the invalid storage resource in the distributed storage system, and updating the corresponding invalid storage resource based on the remapping storage resource to perform data reconstruction.
[0037] The application further provides a data hierarchical storage device, comprising:
[0038] an acquisition module configured to acquire to-be-stored data and delay data corresponding to all initial storage resources in a distributed storage system;
[0039] a first determination module configured to determine a target delay level based on all delay data, the target delay level being used to represent a proportion of timeout data in all delay data;
[0040] A second determining module is configured to determine a target storage resource based on the target delay level and a storage resource sequence corresponding to the data to be stored, and determine target storage data corresponding to the target storage resource based on an erasure code algorithm, the data to be stored and the target storage resource, wherein the storage resource sequence includes at least two storage resources corresponding to the data to be stored;
[0041] A storing module is configured to store the target storage data to the target storage resource.
[0042] The application further provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the data hierarchical storage method according to any one of the above embodiments when executing the program.
[0043] The data hierarchical storage method, device and electronic device provided by the application determine the proportion of timeout data through all initial storage data corresponding to delay data in a distributed storage system, further determine a target delay level, determine a target storage resource with lower delay and capable of writing data according to the target delay level and a storage resource sequence corresponding to the data to be stored, divide the data to be stored according to an erasure code algorithm, determine target storage data capable of being written to each target storage resource according to the target storage resource, and store the target storage data to each target storage resource, thereby reducing storage delay, avoiding long delay of the whole storage process caused by long delay of individual resources, further avoiding storage service blocking, and improving the success rate of data storage and storage performance. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0045] Figure 1 is a determination schematic diagram of the storage resource sequence provided by the prior art;
[0046] Figure 2 is one of the flow schematic diagrams of the data hierarchical storage method provided by the embodiments of the present application;
[0047] Figure 3 is the second flow schematic diagram of the data hierarchical storage method provided by the embodiments of the present application;
[0048] Figure 4 is one of the example schematic diagrams of data reconstruction provided by the embodiments of the present application;
[0049] Figure 5 is an example schematic diagram of data reconstruction provided by an embodiment of the present application;
[0050] Figure 6 is a structural schematic diagram of a data tiered storage device provided by an embodiment of the present application;
[0051] Figure 7 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0053] When the erasure code algorithm is used for storage in the distributed storage system, first, the to-be-stored data is divided into k data blocks, and m check blocks are calculated based on the k data blocks according to the erasure code algorithm, and the k+m blocks are respectively stored in different storage resources of different storage nodes. Among the k+m blocks, there are m redundant blocks, which can be data blocks and / or check blocks, to ensure that any k blocks are effectively stored, that is, the entire to-be-stored data can be recovered through the k blocks, and the k blocks can be k data blocks or k data blocks and check blocks.
[0054] For the to-be-stored data divided into k+m blocks, a storage resource sequence including k+m storage resources is mapped from different storage nodes of the distributed storage system, and the k+m blocks of the to-be-stored data and the k+m storage resources have a one-to-one mapping relationship. Figure 1 is a determination schematic diagram of a storage resource sequence provided by the prior art, as shown in Figure 1 The solid rectangular box represents different storage nodes, and the round dots ai-fi represent different storage resources included in different storage nodes. Taking 4+2 as an example of k+m blocks, that is, k=4 and m=2, there are four data blocks and two check blocks after the to-be-stored data is divided, i=1, 2, …, 6, and N to-be-stored data correspond to N storage resource sequences PG. The determined storage resource sequence can be: PG1:{a1,a2,a3,a4,a5,a6}, PG2:{a1,b2,c3,b4,c5,a6}, …, and PGN:{a4,f3,c1,a6,b2,c5}, which ensures that the storage resources in each storage resource sequence PG are located in different storage nodes, and each PG has two redundant storage resources.
[0055] When the erasure pool in the erasure code algorithm stores the to-be-stored data, only when all the chunks of the to-be-stored data are successfully stored, the entire to-be-stored data is considered to be successfully stored. If a storage resource is slow in response due to data repair, its own disk problem or high peak period, the to-be-stored data will be waiting for the storage resource to return the storage information, thereby causing the storage delay of the entire to-be-stored data to be particularly long. When the response time of the write operation exceeds the threshold time, the process corresponding to the storage resource will stop. Due to the stop of the resource, other PGs in the repair logic can not respond. Taking 4+2 as an example, one storage resource sequence PG1 is {1, 2, 3, 4, 5, 6}, and storage resources 5 and 6 are offline due to disk failure. That is, there are only four storage resources in PG1, and the PG1 is in a non-redundant state. At this time, if the storage resource 4 in another normal PG2 {1, 3, 7, 9, 8, 4} is offline due to a response timeout, a total of three storage resources in PG1 are offline, and the number of offline storage resources that PG1 can receive is two. Therefore, the to-be-stored data cannot be recovered, and the data storage fails.
[0056] To solve the above problems, an embodiment of the present application provides a data hierarchical storage method, Figure 2 is one of the flowcharts of the data hierarchical storage method provided by the embodiment of the present application, as Figure 2 shown, the method comprises:
[0057] Step 210, obtaining to-be-stored data and delay data corresponding to all initial storage resources in a distributed storage system.
[0058] Optionally, there are a plurality of storage nodes in the distributed storage system, and each storage node comprises a plurality of initial storage resources. The related information corresponding to each IO operation of each initial storage resource in each storage node is recorded in a log. The delay data of each initial storage resource can be obtained from the log. The delay data is preferably the delay data of the last write operation, that is, the delay data of the last write operation of each initial storage resource. The IO operation can include a read operation or a write operation, and the storage of the to-be-stored data is to write the to-be-stored data into the corresponding initial storage resource. Therefore, the IO operation referred to below is a write operation.
[0059] Step 220, determining a target delay level based on all the delay data, the target delay level being used to represent the proportion of timeout data in all the delay data.
[0060] Specifically, after determining all the delay data, each delay data is compared with a first preset threshold value. The larger the delay data, the larger the load corresponding to the initial storage resource or the heavier the IO task. In a distributed storage system, the more initial storage resources with larger delay data, the larger the storage load of the entire distributed storage system, and the peak period of business processing. For example, in video surveillance applications such as face and motor vehicle corresponding capture services, the three time periods of 7-9 o'clock, 11-13 o'clock and 17-20 o'clock during the day are generally business peak periods, while the trough period, such as late at night, is basically no business. Therefore, in an embodiment of the present invention, delay data greater than the first preset threshold value is determined as target delay data, and based on the ratio of the target delay data to all delay data, the timeout data ratio corresponding to the target delay data is determined. Based on the ratio range of the timeout data ratio, the target delay level is determined. The target delay level is used to characterize the current business load level in the entire distributed storage system, so as to control the IO operation of the initial storage resource according to the business load level.
[0061] Optionally, the first preset threshold can be set according to actual conditions. For storage services with high real-time requirements, a smaller value can be set. For example, in video surveillance applications, the first preset threshold for the corresponding captured data of faces and motor vehicles can be set to 100ms.
[0062] Optionally, the ratio range of the above-mentioned timeout data ratio is the ratio range corresponding to the target delay level. In an embodiment of the present invention, the ratio range corresponding to different levels can be determined according to the delay ratio control threshold p corresponding to the user, that is, the range is divided with p / m as the step size, that is, 0, (0, p / m], (p / m, 2p / m], ..., ((j-1)p / m, j·p / m], ..., ((m-1)p / m, p] and (p, 1] are determined to have a total of m+2 ratio ranges, and each ratio range corresponds to a level, wherein j = 1, 2, ..., m, m represents the ratio of the data to be stored based on the erasure code algorithm The number of check blocks that cannot be determined by the method, or the number of redundant blocks after the data to be stored is divided based on the erasure coding algorithm. Each ratio range is a percentage interval, where 0 indicates that there are no initial storage resources in the entire distributed storage system with delayed data greater than the first preset threshold. 0 corresponds to the first delay level, and (p, 1] corresponds to the m+2th delay level. The timeout data ratio corresponding to the first delay level to the m+2th delay level increases successively, and a higher timeout data ratio indicates a greater business load on the distributed storage system.
[0063] For example, when k+m is 4+2 and the delay ratio control threshold p is 5%, the divided ratio ranges are 0%, 0%-2.5%, 2.5%-5% and greater than 5%, wherein 0% corresponds to the first delay level, 0%-2.5% corresponds to the second delay level, 2.5%-5% corresponds to the third delay level, and greater than 5% corresponds to the fourth delay level. If the timeout data ratio is 0%, the target delay level is determined as the first delay level; if the timeout data ratio is within 0%-2.5%, the target delay level is determined as the second delay level; if the timeout data ratio is within 2.5%-5%, the target delay level is determined as the third delay level; and if the timeout data ratio is greater than 5%, the target delay level is determined as the fourth delay level.
[0064] In step 230, the target storage resource is determined based on the target delay level and the storage resource sequence corresponding to the to-be-stored data, and the target storage data corresponding to the target storage resource is determined based on the erasure code algorithm, the to-be-stored data and the target storage resource. The storage resource sequence includes at least two storage resources corresponding to the to-be-stored data.
[0065] Specifically, after the target delay level is determined, the target storage resource with lower delay and executable IO operation is determined from the at least two storage resources included in the storage resource sequence corresponding to the to-be-stored data according to different target delay levels, and the to-be-stored data is further blocked according to the erasure code algorithm, and then the target storage data corresponding to each target storage resource is determined according to the target storage resource, that is, the target storage data written into the corresponding target storage resource with lower delay is determined, and the redundant block is stored as little as possible or even not stored, thereby reducing the storage delay of the entire to-be-stored data and improving the data storage success rate and storage performance.
[0066] It should be noted that the data hierarchical storage method provided by the embodiment of the present application does not consider the case of heterogeneous storage, that is, the number, space and hardware conditions of the storage resources on each storage node are consistent in the embodiment of the present application, and the storage resources in the storage resource sequence of each to-be-stored data are in an online state.
[0067] Optionally, when the to-be-stored data is blocked according to the erasure code algorithm, the to-be-stored data is first aligned in strips, and when the size is not full, invalid data can be filled in the initial storage, for example, 0 is filled until alignment; in the case of overwrite storage, a pre-reading operation can be performed. Then the data is divided into k data blocks according to the strip block size, and m check blocks are calculated according to the erasure code algorithm, and are written into k+m storage resources in k+m storage nodes, and each storage resource is distributed in one storage node.
[0068] Further, the target storage resource is determined based on the target delay level and the storage resource sequence corresponding to the to-be-stored data, and the target storage resource comprises:
[0069] In a case where the target delay level is the first delay level, all storage resources in the storage resource sequence corresponding to the to-be-stored data are determined as the target storage resource.
[0070] Specifically, if the target delay level is the first delay level, it indicates that the proportion of timeout data corresponding to the distributed storage system is 0%, that is, there is no initial storage resource with delay data greater than the first preset threshold in the distributed storage system, which indicates that it is in a business low period at this time, at this time, all storage resources in the storage resource sequence can be determined as the target storage resource, that is, after the to-be-stored data is divided into k data blocks and m check blocks based on the erasure code algorithm, the k data blocks and the m check blocks are respectively written into the corresponding target storage resource, at this time, the number of target storage resources is k+m.
[0071] Further, the target storage resource is determined based on the target delay level and the storage resource sequence corresponding to the to-be-stored data, and the target storage resource comprises:
[0072] In a case where the target delay level is any one of the second delay level to the m+1 delay level, the target storage resource is determined based on the delay data corresponding to each storage resource in the storage resource sequence;
[0073] Wherein, m represents the number of check blocks determined by the to-be-stored data based on the erasure code algorithm, and the timeout data proportions corresponding to the second delay level to the m+1 delay level are sequentially increased.
[0074] Specifically, if the target delay level is any one of the second delay level to the m+1 delay level, it indicates that there is an initial storage resource with delay data greater than the first preset threshold in the distributed storage system, at this time, the delay data corresponding to each storage resource in the storage resource sequence can be compared with the first preset threshold respectively, the storage resource with delay data less than or equal to the first preset threshold is determined as the target storage resource, and the IO operation of the storage resource with delay data greater than the first preset threshold is stopped. By reducing the IO operation of the storage resource with higher delay, it is ensured that the target storage data can be normally written into the target storage resource under the condition that the delay of the target storage resource is low, the number of target storage data is equal to the number of target storage resources, and the number of target storage resources is greater than or equal to k.
[0075] Further, the target storage resource is determined based on the delay data corresponding to each storage resource in the storage resource sequence, and the target storage resource comprises:
[0076] In a case where the target latency level is an i-th latency level, latency data corresponding to each storage resource in the sequence of storage resources is sorted to determine i-1 first latency data in the front of the sorting; i is an integer greater than 1 and less than or equal to m+1;
[0077] The storage resource corresponding to the first latency data greater than the first preset threshold is determined as a first non-storage resource.
[0078] The other storage resources in the sequence of storage resources except the first non-storage resource are all determined as the target storage resources.
[0079] Specifically, in a case where the target latency level is an i-th latency level in a second latency level to an m+1-th latency level, i is an integer greater than 1 and less than or equal to m+1, i-1 first latency data in the front of the sorting is determined according to the sorting result of the latency data corresponding to each storage resource, if there is data greater than the first preset threshold in the i-1 first latency data in the front of the sorting, the storage resource corresponding to the first latency data is determined as a first non-storage resource, the IO operation corresponding to the first non-storage resource is stopped, and the other storage resources in the sequence of storage resources except the first non-storage resource are determined as target storage resources, so as to write the target storage data into the corresponding target storage resources.
[0080] Further, the target storage resource is determined based on the target latency level and the sequence of storage resources corresponding to the to-be-stored data, and the target storage resource includes:
[0081] In a case where the target latency level is an m+2-th latency level, the target storage resource is determined based on the target resource data corresponding to each storage resource in the sequence of storage resources; the target resource data includes latency data corresponding to the storage resource, or the latency data and resource utilization, and m represents the number of check blocks determined based on the erasure code algorithm.
[0082] Specifically, if the target latency level is an m+2-th latency level, it indicates that the distributed storage system is in a business peak period, then k target storage resources are determined from the sequence of storage resources according to the latency data or the latency data and the resource utilization, and the target storage data is normally written into the k target storage resources, and the remaining m storage resources for writing redundant blocks stop performing IO operations, further reducing the number of IO operations corresponding to the to-be-stored data, avoiding the problem that the entire storage process is delayed for a long time due to the long latency of individual resources, and further avoiding storage business blocking, improving the success rate of data storage and storage performance.
[0083] It should be noted that the timeout data proportion corresponding to each of the first latency level to the m+2-th latency level is sequentially increased.
[0084] Further, the target storage resource is determined based on target resource data corresponding to each storage resource in the storage resource sequence.
[0085] In a case where the target latency level is an m+2th latency level, latency data corresponding to each storage resource in the storage resource sequence is sorted to determine m second latency data with the highest ranks.
[0086] The a storage resources corresponding to the second latency data greater than the first preset threshold value are determined as a second non-storage resource; a is an integer greater than or equal to 0 and less than or equal to m.
[0087] The m-a third non-storage resources are determined based on the resource utilization of each storage resource.
[0088] The other storage resources in the storage resource sequence except the a second non-storage resources and the m-a third non-storage resources are determined as the target storage resource.
[0089] Specifically, if the target latency level is in the m+2th latency level, m second latency data with the highest ranks are determined according to the sorting result of the latency data corresponding to each storage resource, and a second latency data greater than a first preset threshold value is determined from the m second latency data with the highest ranks, a is an integer greater than or equal to 0 and less than or equal to m, and the storage resource corresponding to the a second latency data is determined as a second non-storage resource. At this time, if a=m, the IO operation corresponding to the second non-storage resource is stopped, and the other storage resources in the storage resource sequence except the second non-storage resource are determined as the target storage resource, so as to write the target storage data into the corresponding target storage resource. If 0≤a
[0090] It should be noted that the non-storage resource in the first non-storage resource, the second non-storage resource and the third non-storage resource can be understood as a storage resource without writing the target storage data.
[0091] Optionally, the resource utilization can include a database usage and a metadata usage. Generally, the storage resource with high usage has large latency data. In addition, the third non-storage resource determined according to the resource utilization can reduce the imbalance between the storage resources.
[0092] Optionally, when the target delay level is any one of the second delay level to the m+2th delay level, a non-written block not written into the target storage resource is determined, the non-written block being a partial redundant block or a full redundant block, a mapping table is determined according to a mapping relationship between the non-written block and a corresponding storage resource, and the mapping table is stored in the database. The record format corresponding to the mapping table can be expressed as: [storage resource sequence ID, to-be-stored data name, storage resource ID1, storage resource corresponding block position, storage resource ID2, storage resource corresponding block position], or [storage resource sequence ID, storage resource sequence ID, storage resource ID1, storage resource corresponding block position], wherein the storage resource corresponding block position indicates which non-written block is stored in the storage resource.
[0093] For example, when k+m is 4+2, the first preset threshold is 100 ms, and the delay ratio control threshold p is 5%, the divided ratio ranges are 0%, 0%-2.5%, 2.5%-5%, and greater than 5% respectively, 0% corresponds to the first delay level, 0%-2.5% corresponds to the second delay level, 2.5%-5% corresponds to the third delay level, and greater than 5% corresponds to the fourth delay level.
[0094] 1) If the timeout data ratio is 0%, the target delay level can be determined as the first delay level, that is, there is no initial storage resource with a delay data greater than 100 ms in the entire distributed storage system, indicating that it can be in a business low period, and no additional processing is required, and the storage can be performed according to the original process. That is, write operations are performed on all online storage resources in the storage resource sequence of each to-be-stored data, the number of online target storage resources in the storage resource sequence of each to-be-stored data is 4+2, and the 4 data blocks and 2 check blocks can be written into the 4+2 target storage resources.
[0095] 2) If the timeout data proportion is within 0%-2.5%, the target latency level can be determined as the second latency level, indicating that only a small part of the initial storage resources has large latency data, and only reducing the write operation of the storage resource with large latency data to the redundant block can reduce the write operation times and further reduce the storage latency of the entire to-be-stored data. Specifically, the online storage resources in the storage resource sequence of the to-be-stored data are 4+2, the latency data corresponding to the 4+2 storage resources are sorted, the first latency data is determined, and if the first latency data is greater than 100 ms, the IO operation of the first non-storage resource corresponding to the first latency data is stopped, and the IO operation is performed on the remaining 4+1 target storage resources in the storage resource sequence, that is, the corresponding 4+1 blocks are written into the remaining 4+1 target storage resources; if the first latency data is less than or equal to 100 ms, the 4+2 storage resources in the storage resource sequence are all determined as target storage resources, and the 4+2 blocks are written into the corresponding 4+2 target storage resources.
[0096] 3) If the timeout data proportion is within 2.5%-5%, the target latency level can be determined as the third latency level, indicating that the business volume of the distributed storage system is relatively large, and a large part of the initial storage resources has large latency data, and it is necessary to further reduce the write operation of the storage resource with large latency data to the redundant block, so as to further reduce the IO times. Specifically, the online storage resources in the storage resource sequence of the to-be-stored data are 4+2, the latency data corresponding to the 4+2 storage resources are sorted, the two first latency data in the front of the sequence are determined, that is, the maximum latency data and the second latency data less than the maximum latency data are determined, and further, the two first latency data are compared with 100 ms respectively, if both of the two first latency data are greater than 100 ms, the IO operation of the first non-storage resource corresponding to the two first latency data is stopped, and the IO operation is performed on the remaining 4 target storage resources in the storage resource sequence; if only one of the two first latency data is greater than 100 ms, the IO operation of the first non-storage resource corresponding to the first latency data greater than 100 ms is stopped, and the IO operation is performed on the remaining 4+1 target storage resources in the storage resource sequence; if both of the two first latency data are less than or equal to 100 ms, the IO operation is performed on the 4+2 target storage resources in the storage resource sequence.
[0097] 4) If the proportion of timeout data is greater than 5%, the target delay level can be determined as the fourth delay level, indicating that it may be in the peak period of business, and the business volume is very large, so the IO operation of the storage resource corresponding to the m redundant blocks in the storage resource sequence is stopped to further reduce the number of IO operations. Specifically, the online storage resources in the storage resource sequence of the data to be stored are 4+2, the delay data corresponding to the 4+2 storage resources are sorted, the two second delay data in the front of the sorting are determined, that is, the maximum delay data and the second delay data less than the maximum delay data are determined, and further, the two second delay data are compared with 100ms respectively. If both of the two second delay data are greater than 100ms, the IO operation corresponding to the second non-storage resource corresponding to the two second delay data is stopped, and only the IO operation of the remaining 4 target storage resources in the storage resource sequence is performed. If only one of the two second delay data is greater than 100ms, the IO operation corresponding to the second non-storage resource corresponding to the second delay data greater than 100ms is stopped, and the third non-storage resource with the highest database usage rate is determined from the remaining 4+1 storage resources in the storage resource sequence, the IO operation corresponding to the third non-storage resource is stopped, and only the IO operation of the remaining 4 target storage resources in the storage resource sequence is performed. If both of the two first delay data are less than or equal to 100ms, the metadata usage rates corresponding to the 4+2 storage resources in the storage resource sequence are sorted, the two third non-storage resources in the front of the sorting are obtained, that is, the storage resource with the highest metadata usage rate and the storage resource less than the highest metadata usage rate are determined, the IO operation of the two third non-storage resources is stopped, and only the IO operation of the remaining 4 target storage resources in the storage resource sequence is performed.
[0098] Further, in actual application, there may be a situation that a certain storage resource has not performed write operation for a long time because the delay data is too large in a short time, for example, the delay data of some storage resources in the peak period of business is too large, which will cause the storage resource to be unable to perform write operation for a long time when it is greater than the first preset threshold. To avoid this situation, the method further comprises:
[0099] In the case where the target delay level is any one of the second delay level to the m+2 delay level, at least one timeout storage resource is determined based on the storage resource sequence and the target storage resource;
[0100] For each of the timeout storage resources, a storage duration interval corresponding to the timeout storage resource is determined based on the current time and the last write time of the timeout storage resource;
[0101] In a case where the storage duration interval is greater than or equal to the detection period threshold timeout_reset, the timeout storage resource is detected, and after determining the detection result, the delay data of the timeout storage resource is set to 0, and based on the set 0 delay data, the target delay level is re-determined.
[0102] Specifically, in a case where the target delay level is any one of the second delay level to the m+2th delay level, there is at least one timeout storage resource that does not perform a write operation, and by the current time and the last write time corresponding to each timeout storage resource, the storage duration interval corresponding to each timeout storage resource is determined, the write operation of each timeout storage resource is periodically detected, and the timeout storage resource that does not perform a write operation in a detection period is reset in delay, that is, the delay data corresponding to each timeout storage resource is reset to 0, so that subsequent write operations can continue, that is, based on the set 0 delay data, the target delay level is re-determined.
[0103] Further, Figure 3 is a flowchart of a data hierarchical storage method provided by an embodiment of the application, as shown in Figure 3 The detection of the timeout storage resource includes:
[0104] In a case where the delay data of the timeout storage resource is greater than or equal to a second preset threshold timeout_op, the detection period threshold timeout_reset corresponding to the timeout storage resource is updated based on the delay data of the timeout storage resource, and the timeout storage resource is detected based on the timeout count timeout_cnt of the timeout storage resource.
[0105] In a case where the delay data of the timeout storage resource is greater than or equal to the first preset threshold and less than the second preset threshold timeout_op, the timeout count timeout_cnt of the timeout storage resource is set to 0, and the detection period threshold timeout_reset is updated to an initial value.
[0106] In a case where the delay data of the timeout storage resource is less than the first preset threshold, the timeout count timeout_cnt of the timeout storage resource is set to 0.
[0107] Further, as shown in Figure 3 The detection of the timeout storage resource based on the timeout count timeout_cnt of the timeout storage resource includes:
[0108] In a case where the timeout count of the timeout storage resource is greater than or equal to a third preset threshold, the timeout storage resource is determined as an invalid storage resource.
[0109] In a case where the timeout count of the timeout storage resource is less than the third preset threshold, the timeout count is updated.
[0110] Specifically, for any timeout storage resource, when the timeout storage resource is detected, the timeout count of the timeout storage resource is updated in a detection period,
[0111] 1) If the delay data of the timeout storage resource is greater than or equal to a second preset threshold timeout_op, the detection period threshold of the timeout storage resource is updated according to the delay data of the timeout storage resource, for example, the detection period threshold of the timeout storage resource is updated to twice the delay data, the detection period of the timeout storage resource is prolonged, the opportunity of the write operation of the timeout storage resource is reduced, and the storage delay of the storage process is reduced. Then, the timeout count of the timeout storage resource is further compared, if the timeout count is greater than or equal to a third preset threshold, the timeout storage resource is determined as an invalid storage resource, and the delay data of the timeout storage resource is set to 0, if the timeout count is less than the third preset threshold, the timeout count of the timeout storage resource is updated, that is, the timeout count of the timeout storage resource is increased by 1, and the delay data of the timeout storage resource is set to 0.
[0112] 2) If the delay data of the timeout storage resource is greater than or equal to a first preset threshold and less than the second preset threshold timeout_op, the timeout count and the delay data of the timeout storage resource are both set to 0, the detection period threshold timeout_reset is maintained as the initial value, and the next detection period is waited.
[0113] 3) If the delay data of the timeout storage resource is less than the first preset threshold, the timeout count and the delay data of the timeout storage resource are both set to 0.
[0114] Optionally, after the invalid storage resource is determined, if the time interval of the invalid storage resource without writing data is greater than or equal to the detection period threshold timeout_reset, the write operation of the invalid storage resource is stopped, the opportunity of the invalid storage resource to perform the write operation is reduced, and the storage delay of the storage process is reduced. Taking m=2 as an example, if there are more than 2, 1, or 0 invalid storage resources in the storage resource sequence of k+2, k+1, or k online storage resources, the delay data is sorted, and the write operation is still performed on the k target storage resources. For the invalid storage resource, if the delay data of the invalid storage resource is less than or equal to the second preset threshold timeout_op, the invalid mark of the invalid storage resource is cancelled, the timeout count timeout_cnt is set to 0, and the detection period threshold timeout_reset corresponding to the invalid storage resource is updated to the initial value. If the delay data of the invalid storage resource is greater than the second preset threshold timeout_op, the invalid storage resource remains unchanged.
[0115] It should be noted that the second preset threshold timeout_op is greater than the first preset threshold, and when the first preset threshold is 100 ms, the second preset threshold timeout_op is greater than 100 ms.
[0116] Further, the method further comprises:
[0117] In a case where there is no invalid storage resource in the storage resource sequence and the delay data of each fourth non-storage resource in the storage resource sequence is less than the first preset threshold, data reconstruction is performed based on the mapping relationship between the other storage data in the to-be-stored data and the target storage data and the fourth non-storage resource corresponding to the fourth non-storage resource; the fourth non-storage resource is a storage resource in the storage resource sequence except the target storage resource; and the invalid storage resource is a timeout storage resource with the timeout count greater than or equal to a third preset threshold.
[0118] In a case where there is an invalid storage resource in the storage resource sequence and the number of the invalid storage resources is less than or equal to m, all initial storage resources in the storage node corresponding to the invalid storage resource in the distributed storage system are determined as remapping storage resources, and the corresponding invalid storage resource is updated based on the remapping storage resource to perform data reconstruction.
[0119] Specifically, when the write operation is performed on the to-be-stored data, due to a large delay, the data in the non-written chunk is not written into the corresponding storage resource, in order to ensure the integrity of the data, the data corresponding to the non-written chunk is taken as the to-be-reconstructed data, and the k+m erasure code algorithm is used to reconstruct the data.
[0120] 1) When there is no invalid storage resource in the storage resource sequence, and the delay data of the fourth non-storage resource in the storage resource sequence is less than the first preset threshold except the target storage resource, the data can be reconstructed and recovered according to the mapping table, that is, the data is reconstructed and recovered according to the mapping relationship between the non-written chunk and the fourth non-storage resource.
[0121] 2) When there is an invalid storage resource in the storage resource sequence and the number of invalid storage resources is less than or equal to m, that is, there is an invalid storage resource in the storage resource sequence, and the number of target storage resources in the storage resource sequence except the invalid storage resource is greater than or equal to k, the invalid storage resource can be taken offline, and the storage resource sequence corresponding to the to-be-reconstructed data is remapped, the remapped storage resource can be determined from the storage node where the invalid storage resource is located in the distributed storage system, the remapped storage resource is used to replace the invalid storage resource, and the data is reconstructed based on the erasure code algorithm.
[0122] For example, k+m is 4+2, Figure 4 is one of the example schematic diagrams of data reconstruction provided by the embodiment of the application, as shown in Figure 4 The storage resource sequence PG1 includes 6 storage resources, and the storage resource sequence PG2 includes 5 storage resources, wherein the storage resource sequence PG1 and the storage resource sequence PG2 both include a common invalid storage resource a1. Based on the 4+2 erasure code algorithm, the number of the other storage resources of PG1 and PG2 is greater than or equal to 4 except the invalid storage resource a1, the invalid storage resource a1 can be taken offline, the storage resource sequence corresponding to the to-be-reconstructed data is remapped to a new storage resource b1, and the reconstructed chunk is written into the new storage resource b1.
[0123] In addition, Figure 5 is the second example schematic diagram of data reconstruction provided by the embodiment of the application, as shown in Figure 5As shown, the storage resource sequence PG3 includes 6 storage resources, and the storage resource sequence PG4 includes 4 storage resources, and the storage resource sequence PG3 and the storage resource sequence PG4 include a common invalid storage resource a1. Based on the 4+2 erasure code algorithm, the number of other storage resources of the storage resource sequence PG4 is 3, which is less than 4, except for the invalid storage resource a1. If the storage resource a1 is offline, the data of the storage resource sequence PG4 cannot be recovered. Therefore, when the number of other storage resources in the storage resource sequence corresponding to the to-be-reconstructed data, except for the invalid storage resource, is less than k, other to-be-reconstructed data in the storage resource sequence corresponding to the to-be-reconstructed data and containing the same invalid storage resource are not reconstructed.
[0124] Step 240, storing the target storage data to the target storage resource.
[0125] Specifically, after the target storage data and the target storage resource are determined, each target storage data can be stored to the corresponding target storage resource.
[0126] The data hierarchical storage method provided by the embodiment of the application determines the proportion of timeout data through the respective delay data of all initial storage data in the distributed storage system, further determines the target delay level, determines the target storage resource with lower delay and capable of writing data according to the target delay level and the storage resource sequence corresponding to the to-be-stored data, divides the to-be-stored data according to the erasure code algorithm, determines the target storage data capable of being written to each target storage resource according to the target storage resource, and stores the target storage data to each target storage resource, thereby reducing the storage delay, avoiding the problem that the entire storage process has a long delay due to the long delay of individual resources, further avoiding the storage service blocking, and improving the success rate of data storage and the storage performance.
[0127] The data hierarchical storage device provided by the application is described below, and the data hierarchical storage device described below can be correspondingly referred to the data hierarchical storage method described above.
[0128] The embodiment of the application further provides a data hierarchical storage device, Figure 6 is a structural schematic diagram of the data hierarchical storage device provided by the embodiment of the application, as Figure 6 shown, the data hierarchical storage device 600 includes an acquisition module 610, a first determination module 620, a second determination module 630, and a storage module 640, wherein:
[0129] The acquisition module 610 is used to acquire the to-be-stored data and the respective delay data of all initial storage resources in the distributed storage system.
[0130] The first determining module 620 is configured to determine a target delay level based on all delay data, the target delay level being used to represent a proportion of timeout data in the all delay data.
[0131] The second determining module 630 is configured to determine a target storage resource based on the target delay level and a storage resource sequence corresponding to the to-be-stored data, and determine target storage data corresponding to the target storage resource based on an erasure code algorithm, the to-be-stored data and the target storage resource, the storage resource sequence including at least two storage resources corresponding to the to-be-stored data.
[0132] The storage module 640 is configured to store the target storage data to the target storage resource.
[0133] The data hierarchical storage device provided by the embodiment of the application determines a proportion of timeout data based on delay data corresponding to all initial storage data in a distributed storage system, and further determines a target delay level, determines a target storage resource with lower delay and writable data based on the target delay level and a storage resource sequence corresponding to the to-be-stored data, divides the to-be-stored data into blocks based on an erasure code algorithm, determines target storage data writable to each target storage resource based on the target storage resource, and stores the target storage data to each target storage resource, thereby reducing storage delay, avoiding a problem of long delay of the entire storage process caused by long delay of individual resources, further avoiding storage service blocking, and improving success rate of data storage and storage performance.
[0134] Optionally, the second determining module 630 is specifically configured to:
[0135] In a case where the target delay level is a first delay level, all storage resources in the storage resource sequence corresponding to the to-be-stored data are determined as the target storage resource.
[0136] Optionally, the second determining module 630 is specifically configured to:
[0137] In a case where the target delay level is any one of a second delay level to an m+1th delay level, the target storage resource is determined based on delay data corresponding to each storage resource in the storage resource sequence.
[0138] wherein m represents a number of check blocks of the to-be-stored data determined based on the erasure code algorithm, and the proportion of timeout data corresponding to the second delay level to the m+1th delay level increases in turn.
[0139] Optionally, the second determining module 630 is specifically configured to:
[0140] In a case where the target latency level is an i-th latency level, sorting the latency data corresponding to each of the storage resources in the sequence of storage resources to determine i-1 first latency data in a front rank; i is an integer greater than 1 and less than or equal to m+1;
[0141] The storage resource corresponding to the first latency data greater than the first preset threshold is determined as a first non-storage resource.
[0142] The storage resources other than the first non-storage resource in the sequence of storage resources are all determined as the target storage resources.
[0143] Optionally, the second determining module 630 is specifically configured to:
[0144] In a case where the target latency level is an m+2-th latency level, determining the target storage resources based on the target resource data corresponding to each of the storage resources in the sequence of storage resources; the target resource data includes the latency data corresponding to the storage resources, or the latency data and the resource utilization rate, and m represents the number of check blocks of the to-be-stored data determined based on the erasure code algorithm.
[0145] Optionally, the second determining module 630 is specifically configured to:
[0146] In a case where the target latency level is an m+2-th latency level, sorting the latency data corresponding to each of the storage resources in the sequence of storage resources to determine m second latency data in a front rank;
[0147] The a storage resources corresponding to the second latency data greater than the first preset threshold are determined as a second non-storage resource; a is an integer greater than or equal to 0 and less than or equal to m.
[0148] Based on the resource utilization rate of each of the storage resources, m-a third non-storage resources are determined.
[0149] The storage resources other than the a second non-storage resources and the m-a third non-storage resources in the sequence of storage resources are all determined as the target storage resources.
[0150] Optionally, the data hierarchical storage device 600 further includes a detection module, which is specifically configured to:
[0151] In a case where the target latency level is any latency level in a second latency level to an m+2-th latency level, at least one timeout storage resource is determined based on the sequence of storage resources and the target storage resources.
[0152] For each of the timeout storage resources, based on the current time and the last write time of the timeout storage resource, a storage duration interval corresponding to the timeout storage resource is determined.
[0153] In a case where the storage duration interval is greater than or equal to a detection period threshold timeout_reset, the timeout storage resource is detected, and after determining the detection result, the delay data of the timeout storage resource is set to 0, and based on the set delay data, the target delay level is re-determined.
[0154] Optionally, the detection module is specifically configured to:
[0155] In a case where the delay data of the timeout storage resource is greater than or equal to a second preset threshold timeout_op, the detection period threshold timeout_reset corresponding to the timeout storage resource is updated based on the delay data of the timeout storage resource, and the timeout storage resource is detected based on the timeout cumulative number timeout_cnt of the timeout storage resource;
[0156] In a case where the delay data of the timeout storage resource is greater than or equal to the first preset threshold and less than the second preset threshold timeout_op, the timeout cumulative number timeout_cnt of the timeout storage resource is set to 0, and the detection period threshold timeout_reset is updated to an initial value;
[0157] In a case where the delay data of the timeout storage resource is less than the first preset threshold, the timeout cumulative number timeout_cnt of the timeout storage resource is set to 0.
[0158] Optionally, the data hierarchical storage device 600 further comprises a reconstruction module, which is specifically configured to:
[0159] In a case where the storage resource sequence does not exist invalid storage resources and the delay data of each fourth non-storage resource in the storage resource sequence is less than the first preset threshold, data reconstruction is performed based on the mapping relationship between the other storage data in the to-be-stored data and the target storage data and the fourth non-storage resource; the fourth non-storage resource is a storage resource in the storage resource sequence except the target storage resource; the invalid storage resource is a timeout storage resource whose timeout cumulative number is greater than or equal to a third preset threshold.
[0160] In the case that there are invalid storage resources in the storage resource sequence and the number of the invalid storage resources is less than or equal to m, the remapped storage resources are determined based on all initial storage resources in the storage nodes corresponding to the invalid storage resources in the distributed storage system, and the corresponding invalid storage resources are updated based on the remapped storage resources to perform data reconstruction.
[0161] Figure 7 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call logic instructions in the memory 730 to execute a data hierarchical storage method, which includes:
[0162] Obtaining the delay data corresponding to the data to be stored and all initial storage resources in the distributed storage system;
[0163] Determine a target delay level based on all delay data, where the target delay level is used to characterize the proportion of timeout data in all delay data;
[0164] Determining a target storage resource based on the target latency level and a sequence of storage resources corresponding to the data to be stored, and determining target storage data corresponding to the target storage resource based on an erasure coding algorithm, the data to be stored, and the target storage resource, wherein the sequence of storage resources includes at least two storage resources corresponding to the data to be stored;
[0165] The target storage data is stored in the target storage resource.
[0166] Further, the logic instructions in the memory 730 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0167] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute the data hierarchical storage method provided by the above-mentioned methods, and the method comprises:
[0168] obtaining to-be-stored data and delay data corresponding to all initial storage resources in a distributed storage system respectively;
[0169] determining a target delay level based on all the delay data, the target delay level being used to represent a proportion of timeout data in all the delay data;
[0170] determining a target storage resource based on the target delay level and a storage resource sequence corresponding to the to-be-stored data, and determining target storage data corresponding to the target storage resource based on an erasure code algorithm, the to-be-stored data and the target storage resource, the storage resource sequence comprising at least two storage resources corresponding to the to-be-stored data;
[0171] storing the target storage data to the target storage resource.
[0172] In yet another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, the computer program is executed by a processor to implement a data hierarchical storage method provided by the above-mentioned methods, and the method comprises:
[0173] obtaining to-be-stored data and delay data corresponding to all initial storage resources in a distributed storage system respectively;
[0174] determining a target delay level based on all the delay data, the target delay level being used to represent a proportion of timeout data in all the delay data;
[0175] determine a target storage resource based on the target latency level and a storage resource sequence corresponding to the to-be-stored data, and determine target storage data corresponding to the target storage resource based on an erasure code algorithm, the to-be-stored data and the target storage resource, the storage resource sequence including at least two storage resources corresponding to the to-be-stored data;
[0176] store the target storage data to the target storage resource.
[0177] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0178] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and necessary universal hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0179] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data hierarchical storage method, characterized in that: include: Obtaining the delay data corresponding to the data to be stored and all initial storage resources in the distributed storage system; Determine a target delay level based on all delay data, where the target delay level is used to characterize the proportion of timeout data in all delay data; Determining a target storage resource based on the target latency level and a sequence of storage resources corresponding to the data to be stored, and determining target storage data corresponding to the target storage resource based on an erasure coding algorithm, the data to be stored, and the target storage resource, wherein the sequence of storage resources includes at least two storage resources corresponding to the data to be stored; The target storage data is stored in the target storage resource.
2. The data hierarchical storage method according to claim 1, wherein: The determining of target storage resources based on the target latency level and a sequence of storage resources corresponding to the data to be stored includes: When the target delay level is the first delay level, all storage resources in the storage resource sequence corresponding to the data to be stored are determined as the target storage resources.
3. The data hierarchical storage method according to claim 1, wherein: The determining of target storage resources based on the target latency level and a sequence of storage resources corresponding to the data to be stored includes: When the target delay level is any one of the second delay level to the (m+1)th delay level, determining the target storage resource based on the delay data corresponding to each storage resource in the storage resource sequence; Here, m represents the number of check blocks of the data to be stored determined based on the erasure code algorithm, and the timeout data ratios corresponding to the second delay level to the (m+1)th delay level increase successively.
4. The data hierarchical storage method according to claim 3, wherein: The determining the target storage resource based on the delay data corresponding to each storage resource in the storage resource sequence includes: When the target delay level is the i-th delay level, the delay data corresponding to each storage resource in the storage resource sequence are sorted to determine the top i-1 first delay data; i is an integer greater than 1 and less than or equal to m+1; Determine the storage resource corresponding to the first delay data greater than the first preset threshold as a first non-storage resource; All storage resources except the first non-storage resource in the storage resource sequence are determined as the target storage resources.
5. The data hierarchical storage method according to claim 1, wherein: The determining of target storage resources based on the target latency level and a sequence of storage resources corresponding to the data to be stored includes: When the target delay level is the m+2th delay level, the target storage resource is determined based on the target resource data corresponding to each storage resource in the storage resource sequence; the target resource data includes the delay data corresponding to the storage resource, or the delay data and resource utilization, and m represents the number of check blocks determined by the erasure code algorithm for the data to be stored.
6. The data hierarchical storage method according to claim 5, characterized in that: The determining the target storage resource based on the target resource data corresponding to each storage resource in the storage resource sequence includes: When the target delay level is the (m+2)th delay level, sorting the delay data corresponding to each of the storage resources in the storage resource sequence to determine m pieces of second delay data that are ranked first; Determine a storage resources corresponding to the second delay data greater than the first preset threshold as a second non-storage resources; a is an integer greater than or equal to 0 and less than or equal to m; Determining ma third non-storage resources based on the resource utilization of each of the storage resources; All storage resources in the storage resource sequence except a number of the second non-storage resources and ma number of the third non-storage resources are determined as the target storage resources.
7. The data hierarchical storage method according to claim 4 or 6, characterized in that: The method further comprises: When the target delay level is any delay level from the second delay level to the (m+2)th delay level, determining at least one timed-out storage resource based on the storage resource sequence and the target storage resource; For each of the timeout storage resources, determining a storage duration interval corresponding to the timeout storage resource based on a current time and a last write time of the timeout storage resource; When the storage time interval is greater than or equal to the detection cycle threshold, the timed storage resource is detected, and after determining the detection result, the delay data of the timed storage resource is set to 0, and based on the delay data after being set to 0, the target delay level is re-determined.
8. The data hierarchical storage method according to claim 7, characterized in that: The detecting the timed storage resource includes: When the delay data of the timeout storage resource is greater than or equal to a second preset threshold, updating the detection period threshold corresponding to the timeout storage resource based on the delay data of the timeout storage resource, and detecting the timeout storage resource based on the cumulative number of timeouts of the timeout storage resource; When the delay data of the timeout storage resource is greater than or equal to the first preset threshold and less than the second preset threshold, the cumulative number of timeouts of the timeout storage resource is set to 0, and the detection period threshold is updated to the initial value; When the delay data of the timed-out storage resource is less than the first preset threshold, the accumulated number of timeouts of the timed-out storage resource is set to 0.
9. The data hierarchical storage method according to claim 8, characterized in that: The method further comprises: In the case where there are no invalid storage resources in the storage resource sequence and the delay data of each fourth non-storage resource in the storage resource sequence is less than the first preset threshold, data reconstruction is performed based on the mapping relationship between other storage data in the data to be stored except the target storage data and the fourth non-storage resources; the fourth non-storage resources are storage resources in the storage resource sequence except the target storage resource; the invalid storage resources are timed-out storage resources whose cumulative number of timeouts is greater than or equal to the third preset threshold; In the case that there are invalid storage resources in the storage resource sequence and the number of the invalid storage resources is less than or equal to m, the remapped storage resources are determined based on all initial storage resources in the storage nodes corresponding to the invalid storage resources in the distributed storage system, and the corresponding invalid storage resources are updated based on the remapped storage resources to perform data reconstruction.
10. A data hierarchical storage device, characterized in that: include: An acquisition module is used to obtain the delay data corresponding to the data to be stored and all initial storage resources in the distributed storage system; A first determining module is configured to determine a target delay level based on all delay data, where the target delay level is used to represent a proportion of timeout data in all delay data; a second determining module, configured to determine a target storage resource based on the target latency level and a storage resource sequence corresponding to the data to be stored, and determine target storage data corresponding to the target storage resource based on an erasure coding algorithm, the data to be stored, and the target storage resource, wherein the storage resource sequence includes at least two storage resources corresponding to the data to be stored; A storage module is used to store the target storage data in the target storage resource.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data hierarchical storage method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Data reading method, device and equipment
CN109815048A
Resource allocation method and device and cluster system
CN110830391A