Resource allocation method, device, computer equipment and storage medium

By calculating the target resource adequacy index value and allocating resources according to its threshold, the problem of low computing efficiency caused by unreasonable resource allocation in storage technology is solved, and the rational allocation of resources and the improvement of computing efficiency is achieved.

CN118245215BActive Publication Date: 2025-02-14SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410336747.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-22
Publication Date
2025-02-14
Estimated Expiration
2044-03-22

AI Technical Summary

Technical Problem

In the field of storage technology, unreasonable resource allocation leads to low computing efficiency, especially in the erasure coding algorithm, when storage resources are allocated to the original data block and the verification data block, it is easy to lead to oversupply or insufficient resources.

Method used

By obtaining the specific requirements of the target task to be repaired and the actual configuration of the storage resources, the first pressure index value and the second pressure index value are calculated, and the target resource adequacy index value is determined. When the index value reaches the preset threshold, the storage resources and computing resources are allocated to ensure the reasonable allocation of resources and the improvement of computing efficiency.

Benefits of technology

It realizes dynamic adjustment of resource allocation methods according to the needs of different tasks to be repaired to ensure that resource adequacy meets preset standards, thereby improving computing efficiency and avoiding the problem of low resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118245215B_ABST
    Figure CN118245215B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of storage technology, and discloses a resource allocation method, device, computer equipment and storage medium, including: obtaining a data block length corresponding to a target file, a first length and a first width of a preset erasure matrix; obtaining a second length and a second width, the total number of functional areas, and a first initial quantity value; determining a first pressure index value according to the data block length and the second length; determining a second pressure index value according to the first length, the first width, the second length and the second width; determining a target resource sufficiency index value according to the total number of functional areas, the first initial quantity value, the first pressure index value and the second pressure index value; when the target resource sufficiency index value is greater than or equal to a first preset threshold value, allocating resources of a non-volatile memory according to the total number of functional areas and the first initial quantity value. The present invention can reasonably allocate resources according to the needs of the task to be repaired, and can further improve computing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of storage technology, in order to ensure the correctness of stored data, an erasure code algorithm is generally used to generate a check data block based on the original data block (data to be stored) and a preset erasure matrix, so that when a certain original data block fails, the original state of the failed original data block can be restored based on the check data block, the preset erasure matrix and other surviving original data blocks.

[0003] The hardware resources of non-volatile memory can be divided into computing resources and storage resources. Generally, when allocating resources, the storage resources are equally divided into two parts, one of which is used to fill in the original data block and / or the check data block, and the other is used to fill in the preset erasure matrix.

[0004] However, simply dividing resources equally will result in excess resources on one side and insufficient resources on the other side, resulting in reduced computing efficiency. Summary of the invention

[0005] In view of this, the present invention provides a resource allocation method, apparatus, computer equipment, storage medium and program product to solve the problem of low computing efficiency caused by unreasonable resource allocation.

[0006] In a first aspect, the present invention provides a resource allocation method, the method is applied to a non-volatile memory, the hardware resources of the non-volatile memory include computing resources and storage resources, the method comprises:

[0007] Get the target task to be repaired;

[0008] Extracting a data block length corresponding to a target file and a first length and a first width of a preset erasure matrix corresponding to the target file from the target task to be repaired, wherein the first length is a row size of the preset matrix and the first width is a column size of the preset matrix;

[0009] Acquire a second length and a second width preset for dividing the storage resource, a total number of functional areas that can be obtained after dividing the storage resource, and a first initial number value;

[0010] Determining a first pressure indicator value according to the data block length and the second length;

[0011] determining a second pressure index value according to the first length, the first width, the second length, and the second width;

[0012] Determining a target resource sufficiency index value according to the total number of the functional areas, the first initial number value, the first pressure index value, and the second pressure index value;

[0013] When it is determined that the target resource sufficiency index value is greater than or equal to a first preset threshold, storage resources and computing resources of the non-volatile memory are allocated respectively according to the total number of the functional areas and the first initial number value.

[0014] The resource allocation method provided by the present invention has the following advantages:

[0015] According to the specific requirements of the target task to be repaired (data block length, size of the preset erasure matrix) and the actual configuration of storage resources (second length, second width), the first pressure index value and the second pressure index value can be accurately calculated, and then the target resource sufficiency index value can be determined. When the target resource sufficiency index value meets the preset conditions, storage resources and computing resources are allocated according to the calculated first pressure index value and second pressure index value. In this way, different resource allocation methods can be used for different tasks to be repaired, which can ensure that the allocated resources meet the needs of the actual tasks, and further improve the computing efficiency.

[0016] In an optional implementation, determining the target resource sufficiency index value according to the total number of the functional areas, the first initial number value, the first pressure index value, and the second pressure index value includes:

[0017] Determining a second initial quantity value according to the total quantity of the functional areas and the first initial quantity value;

[0018] Determining a first resource sufficiency index value according to the first initial quantity value and the first pressure index value;

[0019] Determining a second resource sufficiency index value according to the second initial quantity value and the second pressure index value;

[0020] The target resource sufficiency index value is determined according to the first resource sufficiency index value and the second resource sufficiency index value.

[0021] Specifically, by respectively calculating the first resource sufficiency index value and the second resource sufficiency index value, the rationality of storage resource allocation can be evaluated more finely.

[0022] In an optional implementation, when it is determined that the target resource sufficiency index value is greater than or equal to a first preset threshold, the storage resources and computing resources of the non-volatile memory are allocated respectively according to the total number of the functional areas and the first initial number value, including:

[0023] According to the total number of the functional areas, the storage resource is equally divided to obtain a number of unit storage resources equal to the total number of the functional areas;

[0024] Determine a first type of functional area according to the first initial quantity value and a plurality of the unit storage resources, wherein the first type of functional area is used to fill in original data blocks and / or verification data blocks;

[0025] Determine a second type of functional area according to the second initial quantity value and a plurality of the unit storage resources, wherein the second type of functional area is used to fill in the preset erasure matrix and perform calculation;

[0026] The computing resources are allocated to the second type of functional area.

[0027] Specifically, by dividing the storage resources into multiple unit storage resources equal to the total number of functional areas, resource allocation is made clearer and more refined. The original data blocks and check data blocks are stored in a dedicated first-class functional area, while the preset erasure matrix is ​​stored in the second-class functional area, which is conducive to the management and optimization of resources.

[0028] In an optional implementation, when it is determined that the target resource sufficiency index value is less than the first preset threshold, the method further includes:

[0029] According to a preset adjustment value, the first initial quantity value is adjusted to obtain a first adjusted quantity value;

[0030] Obtaining a second adjustment quantity value according to the total quantity of the functional areas and the first adjustment quantity value;

[0031] re-determining a resource sufficiency index value according to the first adjusted quantity value, the second adjusted quantity value, the first pressure index value, and the second pressure index value;

[0032] When the re-determined resource adequacy index value is still less than the first preset threshold, continue to adjust the first adjustment quantity value and the second adjustment quantity value respectively, and re-determine the resource adequacy index value until the re-determined resource adequacy index value is greater than or equal to the first preset threshold, stop adjusting, and allocate the storage resources and computing resources of the non-volatile memory respectively according to the two adjustment quantity values ​​obtained from the last adjustment.

[0033] Specifically, by repeatedly adjusting the first initial number value and the second initial number value, both parties (data blocks and matrices) can have reasonable use of storage resources under the premise of meeting the requirements of the task to be repaired, and the problem of low resource utilization caused by equally dividing storage resources can be avoided, that is, resource utilization can be improved, and computing efficiency can be further improved.

[0034] In an optional implementation, before obtaining the target task to be repaired, the method further includes:

[0035] When it is determined that there is at least one task to be repaired, the total number of tasks to be repaired and the task receiving time of each task to be repaired are obtained;

[0036] Determine the target executable task quantity according to the total number of tasks and a second preset threshold;

[0037] The target task to be repaired is selected from at least one task to be repaired according to the target executable task quantity, the current time, and the task receiving time of each task to be repaired.

[0038] Specifically, this solution takes into account the impact of the number of check data blocks (m) and the impact of the task receiving time, that is, it can ensure that the tasks to be repaired with a smaller m can be processed in time, and can avoid the problem that the tasks to be repaired with a larger m cannot be processed in time when the task receiving time is early. The urgency calculated by this solution is more in line with actual needs, and can avoid the problem that some tasks to be repaired cannot be processed in time, resulting in the inability to recover data.

[0039] In an optional implementation, selecting the target task to be repaired from at least one task to be repaired according to the number of target executable tasks, the current time, and the task receiving time of each task to be repaired includes:

[0040] Sort each task to be repaired according to the task receiving time of each task to be repaired, and obtain the sorting result of each task to be repaired;

[0041] According to the ranking result of each task to be repaired and the target number of executable tasks, selecting tasks to be repaired whose number is equal to the target number of executable tasks from at least one task to be repaired;

[0042] According to the selected tasks to be repaired, a target task set is formed;

[0043] For each task to be repaired in the target task set, obtaining the number of verification data blocks corresponding to the task to be repaired;

[0044] Determine the urgency of the task to be repaired according to the current time, the task receiving time of the task to be repaired, and the number of verification data blocks corresponding to all the tasks to be repaired in the target task set;

[0045] When the urgency of each task to be repaired in the target task set is determined, the target task to be repaired is selected according to the urgency corresponding to each task to be repaired in the target task set.

[0046] Specifically, this solution takes into account the impact of the number of check data blocks (m) and the impact of the task receiving time, that is, it can ensure that the tasks to be repaired with a smaller m can be processed in time, and can avoid the problem that the tasks to be repaired with a larger m cannot be processed in time when the task receiving time is early. The urgency calculated by this solution is more in line with actual needs, and can avoid the problem that some tasks to be repaired cannot be processed in time, resulting in the inability to recover data.

[0047] In an optional embodiment, the method further includes:

[0048] Extracting the number of faulty original data blocks from the target task to be repaired;

[0049] Determining whether the type of the target task to be repaired is a single-fault task according to the number of the faulty original data blocks;

[0050] When the type of the target repair task is a single-fault task, the storage resource is divided into a plurality of unit storage resources equal in number to the total number of the functional areas according to the total number of the functional areas;

[0051] Determine each of the unit storage resources as a third-type functional area, wherein the third-type functional area is used to fill in original data blocks and / or verification data blocks and perform calculations;

[0052] The computing resources are allocated to the third type of functional areas.

[0053] Specifically, in the field of blockchain storage technology, most of the tasks to be repaired are single-fault tasks. If each single-fault task needs to be repaired through a preset error correction matrix, it will occupy more storage resources and computing resources. However, through this solution, as long as it is a single-fault task, there is no need to use a preset error correction matrix, which can not only avoid the processor resources occupied by the inverse operation of the preset check matrix, but also improve the data repair efficiency (computational efficiency).

[0054] In a second aspect, the present invention provides a resource allocation device, the device is applied to a non-volatile memory, the hardware resources of the non-volatile memory include computing resources and storage resources, and the device includes:

[0055] The acquisition module is used to obtain the target task to be repaired;

[0056] an extraction module, configured to extract, from the target task to be repaired, a data block length corresponding to a target file, and a first length and a first width of a preset erasure matrix corresponding to the target file, wherein the first length is a row size of the preset matrix, and the first width is a column size of the preset matrix;

[0057] The acquisition module is further used to acquire a second length and a second width preset for dividing the storage resource, a total number of functional areas that can be obtained after dividing the storage resource, and a first initial number value;

[0058] a determination module, configured to determine a first pressure index value according to the data block length and the second length; determine a second pressure index value according to the first length, the first width, the second length, and the second width; and determine a target resource sufficiency index value according to the total number of the functional areas, the first initial number value, the first pressure index value, and the second pressure index value;

[0059] An allocation module is used to allocate storage resources and computing resources of the non-volatile memory respectively according to the total number of functional areas and the first initial number value when it is determined that the target resource sufficiency index value is greater than or equal to a first preset threshold value.

[0060] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the resource allocation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0061] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the resource allocation method of the first aspect or any corresponding embodiment thereof.

[0062] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the resource allocation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0064] Figure 1 is a schematic diagram of a flow chart of a resource allocation method according to an embodiment of the present invention;

[0065] Figure 2 is a flow chart of another resource allocation method according to an embodiment of the present invention;

[0066] Figure 3 is a flowchart of a method for selecting a target task to be repaired according to an embodiment of the present invention;

[0067] Figure 4 is a flow chart of a data repair method according to an embodiment of the present invention;

[0068] Figure 5 is a flow chart of another data repair method according to an embodiment of the present invention;

[0069] Figure 6 is a structural block diagram of a resource allocation device according to an embodiment of the present invention;

[0070] Figure 7 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0072] This solution can be applied to a computer device or a computer device cluster. The computer device can be a server. The computer device cluster can be a collection of computer devices, a distributed storage cluster, a cloud platform, etc.

[0073] In blockchain storage, in order to ensure the correctness of stored data, an erasure code algorithm is required to generate redundant data (i.e., check data blocks) to improve data reliability. The erasure code algorithm involves two processes. One is to generate a check data block based on the original data block (Stripe) and the preset check matrix. The other is to restore the original data block after the original data block fails based on the check data block, the surviving original data block and the preset erasure matrix. The preset erasure matrix is ​​the inverse matrix of the preset check matrix. There are two important parameters k and m in the erasure code algorithm, where k represents the number of original data blocks into which the file is divided, and m represents the number of check data blocks generated.

[0074] In addition, in the current market, non-volatile memory has received more and more attention, such as Ferroelectric Random Access Memory (FeRAM), Magnetic Random Access Memory (MRAM), Phase Change Memory (PCM) and Resistive Random Access Memory (RRAM). Compared with traditional memory technology, non-volatile memory has faster read and write speed and higher storage density, and also has the advantages of low power consumption and long life. Non-volatile memory can simulate digital computing and improve computing efficiency.

[0075] Based on the above background, the relevant technologies and their shortcomings are introduced in detail:

[0076] First, the hardware resources of the non-volatile memory are divided into storage resources and computing resources. In a related technology, when repairing a failed original data block, the storage resources are equally divided into two parts, one of which is used to store the original data block and / or the check data block, and the other is used to store the preset erasure matrix. The computing resources are used to perform the calculation process according to the original data block and / or the check data block, and the preset erasure matrix. In actual application, different repair tasks correspond to different erasure code parameters (i.e., the above-mentioned k and m), which means that the storage pressure of the original data blocks and the preset erasure matrix of different repair tasks is different, and the computing pressure of different repair tasks is also different. Therefore, if each repair task divides the storage resources equally to the original data block and the preset erasure matrix, then the storage resource allocation is unbalanced, resulting in low computing efficiency.

[0077] Second, in another related technology, the non-volatile memory can only perform calculations on one original data block in each round of processing. If the original data block is small, it will result in low resource utilization. If the original data block is large, the related technology cannot be processed.

[0078] Third, in the case of a single-fault task, since the pre-acquired matrix is ​​a preset check matrix, the preset erasure matrix is ​​used during data recovery. Therefore, the processor of the computer device needs to be occupied to perform an inverse operation on the preset check matrix.

[0079] The embodiment of the present invention provides a resource allocation method, which allocates resources of a non-volatile memory in a computer device according to the characteristics of a task to be repaired, thereby improving computing efficiency.

[0080] According to an embodiment of the present invention, a resource allocation method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0081] Example 1

[0082] In this embodiment, a resource allocation method is provided, which can be executed by a computer device, which can be a server. Figure 1 is a flow chart of a resource allocation method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0083] Step S101, obtaining a target task to be repaired.

[0084] Specifically, after the computer device detects that one or more original data blocks have failed (hereinafter referred to as failed original data blocks), it generates a target task to be repaired based on the relevant information of the failed original data blocks and the relevant information of the target file to which the failed original data blocks belong. The relevant information of the failed original data blocks may be the location information and number of the failed original data blocks. The relevant information of the target file may include the corresponding data block length, the first length and the second length of the preset erasure matrix, and other information.

[0085] Step S102: extracting the data block length corresponding to the target file, and the first length and the first width of the preset erasure correction matrix corresponding to the target file from the target task to be repaired.

[0086] The first length may be a row size of a preset erasure matrix, and the first width may be a column size of a preset erasure matrix.

[0087] Specifically, the computer device can parse the target task to be repaired, and extract information such as the length of the data block corresponding to the target file, and the first length and the first width of the preset erasure matrix corresponding to the target file.

[0088] Step S103, obtaining the second length and second width preset for dividing the storage resources, the total number of functional areas that can be obtained after dividing the storage resources, and the first initial number value.

[0089] The second length is used to indicate the row size of the function area, and the second width is used to indicate the column size of the function area.

[0090] Specifically, the technician can pre-set the second length and the second width, and pre-calculate the total number of available functional areas and the preset first initial number value according to the preset length and preset width corresponding to the storage resource. For example, the first initial number value may be 8. The computer device can directly obtain this information after obtaining the target task to be repaired. In this way, it is not necessary to calculate the total number of functional areas every time the target task to be repaired is received, which can save processor resources.

[0091] Step S104: determining a first pressure indicator value according to the data block length and the second length.

[0092] Specifically, the computer device may determine whether the data block length is less than or equal to the second length. If so, the following expression may be used:

[0093]

[0094] If not, then the following expression can be used:

[0095]

[0096] Among them, P is the first pressure index value, row size is the second length, stripe size The length of the data block.

[0097] Step S105, determining a second pressure index value according to the first length, the first width, the second length, and the second width.

[0098] Specifically, the computer device may first determine the length relationship between the first length and the second length, and the width relationship between the first width and the second width, and then obtain the target expression according to the length relationship and the width relationship. Finally, the first length, the second length, the first width and the second width (or the first length and the second length, or the first width and the second width) are input into the target expression to obtain the second pressure index value.

[0099] For different length and width size relationships, the target expression can be as follows:

[0100] First, when it is determined that the first length is less than or equal to the second length and the first width is less than or equal to the second width, the following expression is used:

[0101]

[0102] Second, when it is determined that the first length is less than or equal to the second length and the first width is greater than the second width, the following expression is used:

[0103]

[0104] Third, when it is determined that the first length is greater than the second length and the first width is less than or equal to the second width, the following expression is used:

[0105]

[0106] Fourth, when it is determined that the first length is greater than or equal to the second length and the first width is greater than the second width, the following expression is used:

[0107]

[0108] Among them, Q is the second pressure index value, RowOfMatrix size is the first length, ColumnOfMatrix size For the first width, Column size The second width.

[0109] Step S106, determining a target resource sufficiency index value according to the total number of functional areas, the first initial number value, the first pressure index value, and the second pressure index value.

[0110] Specifically, the computer device may first determine the absolute value of the difference between the total number of functional areas and the first initial number value as the second initial number value. Then, the product of the first initial number value and the first pressure index value is determined as the first resource sufficiency index value, and the product of the second initial number value and the second pressure index value is determined as the second resource sufficiency index value. Finally, the computer device may determine the difference between the first resource sufficiency index value and the second resource sufficiency index value as the target resource sufficiency index value.

[0111] Step S107, when it is determined that the target resource sufficiency index value is greater than or equal to the first preset threshold, the storage resources and computing resources of the non-volatile memory are respectively allocated according to the total number of functional areas and the first initial number value.

[0112] Among them, the first preset threshold can be 0.

[0113] Specifically, the storage resources of the non-volatile memory may be pre-divided into a plurality of functional areas, each of which has corresponding identification information. When the computer device determines that the target resource sufficiency index value is less than a first preset threshold, a first initial number of functional areas among the plurality of functional areas may be marked as first-class functions, the remaining functional areas may be marked as second-class functional areas, and computing resources may be allocated to the second-class functional areas.

[0114] The resource allocation method provided in this embodiment can accurately calculate the first pressure index value and the second pressure index value according to the specific requirements of the target task to be repaired (data block length, size of the preset erasure matrix) and the actual configuration of the storage resources (second length, second width), and then determine the target resource sufficiency index value. When the target resource sufficiency index value meets the preset conditions, the storage resources and computing resources are allocated according to the calculated first pressure index value and second pressure index value. In this way, different resource allocation methods can be used for different tasks to be repaired, which can ensure that the allocated resources meet the requirements of the actual tasks, and further, the computing efficiency can be improved.

[0115] Example 2

[0116] In this embodiment, a resource allocation method is provided, which can be executed by the above-mentioned computer device. Figure 2 is a flow chart of a resource allocation method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0117] Step S201, obtaining a target task to be repaired.

[0118] Step S202: extracting the data block length corresponding to the target file, and the first length and the first width of the preset erasure matrix corresponding to the target file from the target task to be repaired.

[0119] The first length may be a row size of a preset erasure matrix, and the first width may be a column size of a preset erasure matrix.

[0120] Step S203, obtaining the second length and second width preset for dividing the storage resources, the total number of functional areas that can be obtained after dividing the storage resources, and the first initial number value.

[0121] The second length is used to indicate the row size of the function area, and the second width is used to indicate the column size of the function area.

[0122] Step S204: determining a first pressure indicator value according to the data block length and the second length.

[0123] Step S205, determining a second pressure index value according to the first length, the first width, the second length, and the second width.

[0124] The specific processing of step S201 to step S205 is similar to the specific processing of step S101 to step S105, and will not be repeated here.

[0125] Step S206, determining a target resource sufficiency index value according to the total number of functional areas, the first initial number value, the first pressure index value, and the second pressure index value.

[0126] Specifically, the above step S206 includes:

[0127] Step S2061, determining a second initial quantity value according to the total quantity of the functional areas and the first initial quantity value.

[0128] Specifically, the computer device may determine the absolute value of the difference between the total number of functional areas and the first initial number value as the second initial number value.

[0129] Step S2062: Determine a first resource sufficiency index value according to the first initial quantity value and the first pressure index value.

[0130] Specifically, the computer device may determine the product of the first initial quantity value and the first pressure index value as the first resource sufficiency index value.

[0131] Step S2063: Determine a second resource sufficiency index value according to the second initial quantity value and the second pressure index value.

[0132] Specifically, the computer device may determine the product of the second initial quantity value and the second pressure index value as the second resource sufficiency index value.

[0133] Step S2064: Determine a target resource sufficiency index value according to the first resource sufficiency index value and the second resource sufficiency index value.

[0134] Specifically, the computer device may determine the difference between the first resource sufficiency index value and the second resource sufficiency index value as the target resource sufficiency index value.

[0135] The above process can be expressed by the following expression:

[0136] Target=P*CacheXbars-Q*CompXbars (7)

[0137] Among them, Target is the target resource sufficiency index value, CacheXbars is the first initial quantity value, CompXbars is the second initial quantity value, P*CacheXbars can be the first resource sufficiency index value, and Q*CompXbars can be the second resource sufficiency index value.

[0138] Step S207: when it is determined that the target resource sufficiency index value is greater than or equal to the first preset threshold, the storage resources and computing resources of the non-volatile memory are allocated respectively according to the total number of functional areas and the first initial number value.

[0139] Specifically, the above step S207 includes:

[0140] Step S2071, dividing the storage resources equally according to the total number of functional areas to obtain a number of unit storage resources that is equal to the total number of functional areas.

[0141] Specifically, the computer device can determine whether the target resource sufficiency index value is less than a first preset threshold value. If so, it can be explained that it is more reasonable to allocate the storage resources and computing resources of the non-volatile memory separately according to the total number of functional areas and the first initial number value.

[0142] For example, the storage resource size of the non-volatile memory is x bytes, the total number of functional areas is s, and the size of each unit storage resource is x / s.

[0143] Step S2072: determining a first type of functional area according to the first initial quantity value and the plurality of unit storage resources.

[0144] The first type of functional area may be used to fill in original data blocks and / or verification data blocks.

[0145] Specifically, the computer device may mark all unit storage resources of the plurality of unit storage resources having a number equal to the first initial quantity value as a first type of functional area, and the first type of functional area may specifically be a temporary storage area.

[0146] Step S2073: Determine a second type of functional area according to the second initial quantity value and a plurality of unit storage resources.

[0147] Among them, the second type of functional area can be used to fill in the preset erasure matrix and perform calculations.

[0148] Specifically, the computer device may mark all unit storage resources of the plurality of unit storage resources having a number equal to the second initial quantity value as second-type functional areas, and the second-type functional areas may specifically be execution areas.

[0149] Step S2074, allocating computing resources to the second type of functional area.

[0150] Specifically, the computer device may set the usage permission of the computing resources of the non-volatile memory to be used in the second type of functional area.

[0151] In some optional implementations, when it is determined that the target resource sufficiency index value is less than the first preset threshold, the first initial quantity value and the second initial quantity value need to be adjusted, and the specific adjustment method may be as follows:

[0152] Step a1: adjusting the first initial quantity value according to a preset adjustment value to obtain a first adjusted quantity value.

[0153] The first preset threshold may be 0, and the preset adjustment value may be 1.

[0154] Specifically, the computer device can determine whether the target resource sufficiency index value is greater than or equal to a first preset threshold value. If not, it means that the first initial quantity value is small (that is, the number of first-type functional areas is small), the storage resource allocation is unreasonable, and adjustment is required. The first initial quantity value can be adjusted by determining the sum of the first initial quantity value and the preset adjustment value as the first adjustment quantity value.

[0155] Step a2, obtaining a second adjustment quantity value according to the total quantity of the functional areas and the first adjustment quantity value.

[0156] Specifically, the computer device may determine the difference between the total number of functional areas and the first adjustment number value as the second adjustment number value.

[0157] Step a3: re-determine the resource sufficiency index value according to the first adjustment quantity value, the second adjustment quantity value, the first pressure index value and the second pressure index value.

[0158] Specifically, the computer device may replace the first initial quantity value in step S2061 to step S2064 with the first adjusted quantity value, and replace the second initial quantity value with the second adjusted quantity value, and recalculate a resource sufficiency indicator value.

[0159] Step a4, when the re-determined resource adequacy index value is still less than the first preset threshold value, continue to adjust the first adjustment quantity value and the second adjustment quantity value respectively, and re-determine the resource adequacy index value until the re-determined resource adequacy index value is greater than or equal to the first preset threshold value, stop adjusting, and allocate the storage resources and computing resources of the non-volatile memory respectively according to the two adjustment quantity values ​​obtained by the last adjustment.

[0160] The resource allocation method provided in this embodiment, first, by respectively calculating the first resource sufficiency index value and the second resource sufficiency index value, can more finely evaluate the rationality of storage resource allocation. Second, by equally dividing the storage resources into a number of unit storage resources equal to the total number of functional areas, the resource allocation is made clearer and more refined. The original data blocks and the verification data blocks have a dedicated first-class functional area for storage, while the preset erasure matrix is ​​stored in the second-class functional area, which is conducive to the management and optimization of resources. Third, by repeatedly adjusting the first initial quantity value and the second initial quantity value, both parties (data blocks and matrices) can have reasonable storage resource use under the premise of meeting the requirements of the task to be repaired, which can avoid the problem of low resource utilization caused by equally dividing the storage resources, that is, it can improve resource utilization, and further improve computing efficiency.

[0161] Example 3

[0162] In some optional implementations, each element of the target row in the preset check matrix may be one, and the number of target rows is determined according to the number of check data blocks and the number of original data blocks corresponding to the target file, and may be specifically expressed as follows: w=min(k,m), where w is the number of target rows. For example, the preset check matrix may be as follows:

[0163]

[0164] Accordingly, the computer device may first determine the number of faulty original data blocks extracted from the target task to be repaired. Further, if the number of faulty original data blocks is not 1, the above-mentioned Figure 1 or Figure 2 If the number of faulty original data blocks is 1, the target task to be repaired can be determined as a single-fault task, and resources can be allocated according to the following steps:

[0165] Step b1, according to the total number of functional areas, divide the storage resources into a number of unit storage resources that is equal to the total number of functional areas.

[0166] Step b2: determine each unit storage resource as a third-category functional area.

[0167] The third type of functional area is used to fill in the original data block and / or the verification data block and perform calculations. The third type of functional area can also be called an execution area.

[0168] Step b3, allocating computing resources to the third type of functional area.

[0169] The specific processing of steps b1 to b3 may refer to step S107 or the specific processing of step S107, which will not be repeated here.

[0170] The resource allocation method provided in this embodiment is that in the field of blockchain storage technology, most of the tasks to be repaired are single-fault tasks. If each single-fault task needs to be repaired through a preset error correction matrix, it will occupy more storage resources and computing resources. However, through this solution, as long as it is a single-fault task, there is no need to use a preset error correction matrix, which can not only avoid the processor resources occupied by the inverse operation of the preset check matrix, but also improve the data repair efficiency (computational efficiency).

[0171] Example 4

[0172] In the field of storage technology, the m in the erasure code parameter is used to indicate that a maximum of m original data blocks and / or check data blocks can be tolerated for failure. Therefore, the smaller the m corresponding to the task to be repaired is, the more urgent the task to be repaired is. However, if the urgency of all tasks to be repaired is determined according to m, then the tasks to be repaired with larger m values ​​will never be completed. Therefore, in this embodiment, a method for selecting a target task to be repaired is provided, which determines the urgency of the task to be repaired by combining m and the task reception time of the task to be repaired. This method can be executed by the above-mentioned computer device, Figure 3 is a flowchart of selecting a target task to be repaired according to an embodiment of the present invention, such as Figure 3 As shown, the process includes the following steps:

[0173] Step S301, when it is determined that there is at least one task to be repaired, the total number of tasks to be repaired and the task receiving time of each task to be repaired are obtained.

[0174] Specifically, the computer device maintains a receiving area and an adjustment area. Each time the computer device receives a task to be repaired, the computer device can record the receiving time of the task to be repaired. All tasks to be repaired received by the computer device can be temporarily stored in the receiving area.

[0175] The computer device may start the first round of processing upon receiving a preset trigger instruction, or may start the current round of processing after completing the previous round of processing. At the beginning of each round of processing, it may be determined whether there are tasks to be repaired in the receiving area. If so, the total number of tasks to be repaired and the task receiving time of each task to be repaired may be obtained. If not, subsequent processing may not be performed, and processing may be started when it is detected that there are tasks to be repaired in the receiving area.

[0176] Step S302: determining the target executable task quantity according to the total task quantity and a second preset threshold.

[0177] Specifically, the computer device can use the following expression:

[0178] α=min(β,task num ) (8)

[0179] Among them, α is the number of target executable tasks, β is the second preset threshold, task num is the total number of tasks, for example, the second preset threshold may be 13.

[0180] Step S303 , selecting a target task to be repaired from at least one task to be repaired according to the number of target executable tasks, the current time, and the task receiving time of each task to be repaired.

[0181] Specifically, the above step S303 may include:

[0182] Step S3031, sorting each task to be repaired according to the task receiving time of each task to be repaired, and obtaining the sorting result of each task to be repaired.

[0183] Specifically, the computer device may sort the tasks to be repaired in the receiving area from early to late according to the task receiving time, and obtain the sorting result of each task to be repaired. Alternatively, the computer device may sort the tasks to be repaired in the receiving area from late to early according to the task receiving time, and obtain the sorting result of each task to be repaired.

[0184] Step S3032: According to the sorting result of each task to be repaired and the target number of executable tasks, select tasks to be repaired whose number is equal to the target number of executable tasks from at least one task to be repaired.

[0185] Step S3033: construct a target task set based on the selected tasks to be repaired.

[0186] Specifically, in the case of sorting tasks from early to late by task receiving time, the computer device can migrate the number of target executable tasks to be repaired that are ranked higher to the adjustment area. Alternatively, in the case of sorting tasks from late to early by task receiving time, the computer device can migrate the number of target executable tasks to be repaired that are ranked lower to the adjustment area. The tasks to be repaired that are migrated to the adjustment area constitute the target task set.

[0187] Step S3034: for each task to be repaired in the target task set, obtain the number of verification data blocks corresponding to the task to be repaired.

[0188] Specifically, for each task to be repaired that is migrated to the adjustment area, the computer device may extract the corresponding number of check data blocks from the task to be repaired, that is, m in the erasure code parameter.

[0189] Step S3035, determining the urgency of the task to be repaired according to the current time, the task receiving time of the task to be repaired, and the number of verification data blocks corresponding to all the tasks to be repaired in the target task set.

[0190] Specifically, for each task to be repaired, the computer device can determine the received time of the task to be repaired according to the current time and the task receiving time of the task to be repaired. And determine the ratio corresponding to the task to be repaired according to the number of check data blocks of the task to be repaired and the sum of the number of check data blocks corresponding to all the tasks to be repaired in the adjustment area. Then, determine the urgency of the task to be repaired according to the received time of the task to be repaired and the ratio.

[0191] For example, the following expression can be used:

[0192]

[0193] Among them, ζ is the urgency, Time arrive is the task receiving time, m i is the number of check data blocks for the i-th task to be repaired.

[0194] Step S3036, when the urgency of each task to be repaired in the target task set is determined, a target task to be repaired is selected according to the urgency corresponding to each task to be repaired in the target task set.

[0195] Specifically, the computer device determines the task to be repaired with the greatest urgency in the adjustment area as the target task to be repaired.

[0196] The method for selecting the target task to be repaired provided in this embodiment takes into account the influence of the number of verification data blocks and the influence of the task receiving time, that is, it can ensure that the task to be repaired with a smaller m can be processed in time, and can avoid the problem that the task receiving time is early but the task to be repaired with a larger m cannot be processed in time. The urgency calculated by this solution is more in line with actual needs, and can avoid the problem that some tasks to be repaired cannot be processed in time, resulting in the inability to recover data.

[0197] Example 5

[0198] After completing the above resource allocation work, the computer device can divide the original data blocks and the preset erasure matrix corresponding to the target file, and fill them into the corresponding functional areas, and the non-volatile memory performs the repair work of the faulty original data blocks. The data repair method is different for different numbers of faulty original data blocks.

[0199] In this embodiment, a data repair method is provided, which is applied to a single fault task scenario. It should be noted that in this embodiment, the preset check matrix needs to meet certain conditions, that is, each element in the target row is 1, and the number of target rows is determined based on the number of check data blocks and the number of original data blocks corresponding to the target file. Specifically, the following expression can be used: w = min (k, m), where w is the number of target rows. This method can be executed by the above-mentioned computer device, Figure 4 is a flow chart of a data repair method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:

[0200] Step S401, obtaining a target check block according to the number of target rows.

[0201] Specifically, since the target task to be repaired does not carry the target file itself, but only the location information of the target file, the computer device needs to first obtain the original data block and the check data block corresponding to the target file from the disk. The computer device can determine the location information of the target check block according to the number of target rows, and further, can obtain the target check block according to the location information of the target check block.

[0202] The specific process of determining the position information of the target check block according to the number of target rows may be:

[0203] The wth check data block in the check data blocks corresponding to the target file is determined as the target check block, and further, the position information of the target check block is extracted from the target task to be repaired.

[0204] Step S402: extracting location information of a plurality of original data blocks corresponding to a target file and a size of the target file from the target task to be repaired.

[0205] Step S403: Acquire multiple original data blocks corresponding to the target task to be repaired according to the location information of multiple original data blocks corresponding to the target file.

[0206] Specifically, the computer device also needs to extract the location information of the original data blocks corresponding to the target file and the size of the target file from the target task to be repaired, and extract the original data blocks corresponding to the target file from the disk according to the location information of the original data blocks.

[0207] Step S404: Replace the faulty original data block among the multiple original data blocks with the target check block to obtain multiple replaced data blocks.

[0208] Specifically, since each element of the target row of the preset check matrix is ​​1, that is, when the target file is initially stored, the wth check data block among the check data blocks calculated by the computer device according to the original data blocks corresponding to the target file and the preset check matrix has information of all the original data blocks of the target file. Therefore, the computer device can replace the faulty original data block with the target check block to obtain multiple replaced data blocks, and the multiple replaced data blocks contain all the information of the target file. The original state of the faulty original data block can be restored by performing operations on the multiple replaced data blocks.

[0209] Step S405, determining the number of original data blocks corresponding to the target file according to the size of the target file and the length of the data blocks.

[0210] The size of the target file and the length of the database can both be expressed in bytes.

[0211] Specifically, the computer device may determine the ratio of the size of the target file to the length of the database as the number of original data blocks corresponding to the target file, and the corresponding expression may be as follows:

[0212]

[0213] Among them, Totalstripe num is the number of original data blocks corresponding to the target file, Data size The size of the target file.

[0214] In some optional implementations, the number of original data blocks corresponding to the target file may also be directly extracted from the target task to be repaired.

[0215] Step S406: determining a first data processing amount according to the first pressure index value and the total number of functional areas.

[0216] Specifically, the computer device may determine the amount of data that can be processed by the non-volatile memory in one round, that is, the first data processing amount, according to the first pressure value and the total number of functional areas. Specifically, the following expression may be used:

[0217] FastRepair num =floor(P*TotalXbars) (11)

[0218] Among them, FastRepair num is the first data processing volume, and TotalXbars is the total number of functional areas (that is, the number of the first type of functional areas in the above single-fault task case).

[0219] Step S407, determining the number of processing rounds according to the number of original data blocks corresponding to the target file and the first data processing amount.

[0220] Specifically, the computer device may further determine how many rounds the non-volatile memory needs to process to repair the faulty original data block, and specifically may use the following expression:

[0221]

[0222] Among them, FastGroup num is the number of processing rounds.

[0223] Step S408, obtaining a target repair data block according to the number of processing rounds, the first data processing amount and the multiple replaced data blocks.

[0224] Specifically, the computer device can determine in each processing round whether the current processing round is less than or equal to the number of processing rounds. If so, the original data blocks of the replaced multiple data blocks that are equal to the first data processing amount can be filled into the first type of functional area. The non-volatile memory can use all its computing resources to perform an XOR operation on the filled original data blocks and the target check blocks. After completing all rounds of processing, all original data blocks corresponding to the target file can be obtained, that is, the data recovery process of the target file is completed.

[0225] The method for selecting the target task to be repaired provided in this embodiment fully utilizes the storage resources in each processing round, so that the non-volatile memory can restore data quickly. In addition, there is no need to allocate storage resources for the preset erasure matrix, nor is there any need to use the preset erasure matrix to perform calculations. In summary, this solution can improve computing efficiency.

[0226] Example 6

[0227] In this embodiment, a data repair method is provided, which is applied to a non-single-failure task scenario. The method can be executed by the above-mentioned computer device. Figure 5 is a flow chart of a data repair method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:

[0228] Step S501: extracting location information of a plurality of original data blocks corresponding to a target file and the size of the target file from a target task to be repaired.

[0229] Step 502: Acquire multiple original data blocks corresponding to the target task to be repaired according to the location information of multiple original data blocks corresponding to the target file.

[0230] The multiple original data blocks include failed original data blocks and surviving original data blocks.

[0231] The specific processing from step S501 to step S502 is similar to the specific processing from step S402 to step S403, and will not be repeated here.

[0232] Step S503: determining the number of original data blocks corresponding to the target file according to the size of the target file and the length of the data blocks.

[0233] The size of the target file and the length of the database can both be expressed in bytes.

[0234] The specific processing of step S503 is similar to that of step S405 and will not be repeated here.

[0235] Step S504: determining a first data processing amount according to the first pressure index value and the number of first-type functional areas.

[0236] Specifically, the computer device can determine the amount of data that can be processed by the non-volatile memory in one round, that is, the first data processing amount, according to the first pressure value and the number of the first type of functional areas. Specifically, the following expression can be used:

[0237] stripe num =floor(P*CacheXbars) (13)

[0238] Among them, stripe num is the first data processing volume, and CacheXbars is the number of the first type of functional areas.

[0239] The number of the first type of functional areas can be determined based on the results of the above resource allocation.

[0240] Step S505: determining the number of processing rounds according to the number of original data blocks corresponding to the target file and the first data processing amount.

[0241] Specifically, the computer device may further determine how many rounds the non-volatile memory needs to process to repair the faulty original data block, and specifically may use the following expression:

[0242]

[0243] Among them, group num is the number of processing rounds.

[0244] Step S506: fill the preset erasure matrix into the second type functional area according to the first length, the second length, the first width, and the second width.

[0245] Specifically, when it is determined that the first length is less than or equal to the second length and the first width is less than or equal to the second width, according to the second pressure indicator value, Q preset erasure correction matrices are concatenated and filled into the second type functional area.

[0246] When it is determined that the first length is less than or equal to the second length and the first width is greater than the second width, the target matrix is ​​equally divided by columns according to the second pressure index value to obtain Q unit matrices, and the Q unit matrices are filled into the second type of functional area.

[0247] When it is determined that the first length is greater than the second length and the first width is less than or equal to the second width, the target matrix is ​​equally divided by row according to the second pressure index value to obtain Q unit matrices, and the Q unit matrices are filled into the second type of functional area.

[0248] When it is determined that the first length is greater than or equal to the second length and the first width is greater than the second width, the third length is determined based on the first length and the second length, and the third width is determined based on the first width and the second width, and the preset erasure matrix is ​​divided into Q unit matrices based on the third length and the third width.

[0249] Among them, the third length can be expressed as The third width can be expressed as

[0250] Step S507, obtaining a target repair data block according to the number of processing rounds, the first data processing amount, the surviving original data block and the preset erasure matrix.

[0251] Specifically, the computer device can determine in each processing round whether the current processing round is less than or equal to the number of processing rounds. If so, the surviving original data blocks equal to the first data processing amount can be filled into the first type of functional area and then input into the second type of functional area. The non-volatile memory can use all its computing resources to perform multiplication operations on the input surviving original data blocks and the preset erasure matrix. After completing all rounds of processing, all original data blocks corresponding to the target file can be obtained, that is, the data recovery process of the target file is completed.

[0252] The method for selecting the target task to be repaired provided in this embodiment is to split the data before filling it in when the data is relatively large, and to splice the data before filling it in when the data is relatively small. In this way, the storage resources are fully used in each processing round, so that the non-volatile memory can restore the data faster, that is, the computing efficiency can be improved.

[0253] Example 7

[0254] In some optional implementations, the check data block may fail. Therefore, in the process of repairing the check data block, resources may be allocated in the manner of Embodiment 1 and Embodiment 2. After completing the operation of allocating resources, the faulty check data block may be restored in the manner of Embodiment 6. It should be noted that the preset erasure matrix in Embodiment 1, Embodiment 2, and Embodiment 6 should be replaced with a preset check matrix for consideration. In this way, the check data block can be obtained again.

[0255] In this embodiment, a resource allocation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0256] This embodiment provides a resource allocation device, such as Figure 6 As shown, including:

[0257] An acquisition module 601 is used to acquire a target task to be repaired;

[0258] An extraction module 602 is used to extract the data block length corresponding to the target file and the first length and first width of the preset erasure matrix corresponding to the target file from the target task to be repaired, wherein the first length is the row size of the preset matrix and the first width is the column size of the preset matrix;

[0259] The acquisition module 601 is further used to acquire the second length and the second width preset for dividing the storage resource, the total number of functional areas that can be obtained after dividing the storage resource, and the first initial number value;

[0260] Determination module 603, used to determine the first pressure index value according to the data block length and the second length; determine the second pressure index value according to the first length, the first width, the second length and the second width; determine the target resource sufficiency index value according to the total number of functional areas, the first initial number value, the first pressure index value and the second pressure index value;

[0261] The allocation module 604 is used to allocate storage resources and computing resources of the non-volatile memory respectively according to the total number of functional areas and the first initial number value when it is determined that the target resource sufficiency index value is greater than or equal to the first preset threshold value.

[0262] In some optional implementations, the determination module 603 is configured to:

[0263] Determine a second initial quantity value according to the total quantity of the functional areas and the first initial quantity value;

[0264] Determining a first resource sufficiency index value according to the first initial quantity value and the first pressure index value;

[0265] Determine a second resource sufficiency index value according to the second initial quantity value and the second pressure index value;

[0266] A target resource sufficiency index value is determined according to the first resource sufficiency index value and the second resource sufficiency index value.

[0267] In some optional implementations, the allocation module 604 is configured to:

[0268] According to the total number of functional areas, the storage resources are equally divided to obtain a number of unit storage resources equal to the total number of functional areas;

[0269] Determine a first type of functional area according to the first initial quantity value and the plurality of unit storage resources, wherein the first type of functional area is used to fill in the original data block and / or the verification data block;

[0270] Determine a second type of functional area according to the second initial quantity value and the plurality of unit storage resources, wherein the second type of functional area is used to fill in a preset erasure matrix and perform calculations;

[0271] Allocate computing resources to the second type of functional area.

[0272] In some optional implementations, the allocation module 604 is further configured to:

[0273] When it is determined that the target resource sufficiency index value is less than a first preset threshold, adjusting the first initial quantity value according to a preset adjustment value to obtain a first adjusted quantity value;

[0274] Obtaining a second adjustment quantity value according to the total quantity of the functional areas and the first adjustment quantity value;

[0275] Re-determining the resource sufficiency index value according to the first adjustment quantity value, the second adjustment quantity value, the first pressure index value, and the second pressure index value;

[0276] When the re-determined resource adequacy index value is still less than the first preset threshold, continue to adjust the first adjustment quantity value and the second adjustment quantity value respectively, and re-determine the resource adequacy index value until the re-determined resource adequacy index value is greater than or equal to the first preset threshold, then stop adjusting, and allocate the storage resources and computing resources of the non-volatile memory respectively according to the two adjustment quantity values ​​obtained from the last adjustment.

[0277] In some optional implementations, the acquisition module 601 is further used to:

[0278] When it is determined that there is at least one task to be repaired, the total number of tasks to be repaired and the task receiving time of each task to be repaired are obtained;

[0279] Determine the target executable task quantity according to the total task quantity and the second preset threshold value;

[0280] A target task to be repaired is selected from at least one task to be repaired according to the number of target executable tasks, the current time, and the task receiving time of each task to be repaired.

[0281] In some optional implementations, the acquisition module 601 is used to:

[0282] Sort each task to be repaired according to the task receiving time of each task to be repaired, and obtain the sorting result of each task to be repaired;

[0283] According to the ranking result of each task to be repaired and the target number of executable tasks, selecting tasks to be repaired that are equal in number to the target number of executable tasks from at least one task to be repaired;

[0284] According to the selected tasks to be repaired, a target task set is formed;

[0285] For each task to be repaired in the target task set, obtain the number of verification data blocks corresponding to the task to be repaired;

[0286] Determine the urgency of the task to be repaired according to the current time, the task receiving time of the task to be repaired, and the number of verification data blocks corresponding to all the tasks to be repaired in the target task set;

[0287] When the urgency of each task to be repaired in the target task set is determined, a target task to be repaired is selected according to the urgency corresponding to each task to be repaired in the target task set.

[0288] In some optional implementations, the allocation module 604 is further configured to:

[0289] Extract the number of faulty original data blocks from the target task to be repaired;

[0290] According to the number of faulty original data blocks, determine whether the type of the target task to be repaired is a single-fault task;

[0291] When the target repair task is a single-fault task, the storage resources are divided into multiple unit storage resources equal to the total number of functional areas according to the total number of functional areas;

[0292] Determine each unit storage resource as a third-type functional area, wherein the third-type functional area is used to fill in original data blocks and / or verification data blocks and perform calculations;

[0293] Allocate computing resources to the third type of functional area.

[0294] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0295] The resource allocation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0296] The embodiment of the present invention also provides a computer device having the above Figure 6 The resource allocation device shown.

[0297] See also Figure 7 , Figure 7 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 7 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.

[0298] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0299] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0300] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0301] The memory 20 may include a volatile memory, such as a random access memory; the memory 20 may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0302] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0303] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0304] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0305] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A resource allocation method, characterized in that: The method is applied to a non-volatile memory, the hardware resources of the non-volatile memory include computing resources and storage resources, and the method includes: Get the target task to be repaired; Extracting a data block length corresponding to a target file, and a first length and a first width of a preset erasure matrix corresponding to the target file from the target task to be repaired, wherein the first length is a row size of the preset erasure matrix, and the first width is a column size of the preset erasure matrix; Acquire a second length and a second width preset for dividing the storage resource, a total number of functional areas that can be obtained after dividing the storage resource, and a first initial number value; Determining a first pressure indicator value according to the data block length and the second length; determining a second pressure index value according to the first length, the first width, the second length, and the second width; Determining a second initial quantity value according to the total quantity of the functional areas and the first initial quantity value; Determining a first resource sufficiency index value according to the first initial quantity value and the first pressure index value; Determining a second resource sufficiency index value according to the second initial quantity value and the second pressure index value; Determining a target resource sufficiency index value according to the first resource sufficiency index value and the second resource sufficiency index value; When it is determined that the target resource sufficiency index value is greater than or equal to a first preset threshold, the storage resource is equally divided according to the total number of the functional areas to obtain a plurality of unit storage resources of the same number as the total number of the functional areas; Determine a first type of functional area according to the first initial quantity value and a plurality of the unit storage resources, wherein the first type of functional area is used to fill in original data blocks and / or verification data blocks; Determine a second type of functional area according to the second initial quantity value and a plurality of the unit storage resources, wherein the second type of functional area is used to fill in the preset erasure matrix and perform calculation; The computing resources are allocated to the second type of functional area.

2. The method according to claim 1, characterized in that When it is determined that the target resource sufficiency index value is less than the first preset threshold, the method further includes: According to a preset adjustment value, the first initial quantity value is adjusted to obtain a first adjusted quantity value; Obtaining a second adjustment quantity value according to the total quantity of the functional areas and the first adjustment quantity value; re-determining a resource sufficiency index value according to the first adjusted quantity value, the second adjusted quantity value, the first pressure index value, and the second pressure index value; When the re-determined resource adequacy index value is still less than the first preset threshold, continue to adjust the first adjustment quantity value and the second adjustment quantity value respectively, and re-determine the resource adequacy index value until the re-determined resource adequacy index value is greater than or equal to the first preset threshold, stop adjusting, and allocate the storage resources and computing resources of the non-volatile memory respectively according to the two adjustment quantity values ​​obtained from the last adjustment.

3. The method according to claim 1, characterized in that Before obtaining the target task to be repaired, the method further includes: When it is determined that there is at least one task to be repaired, the total number of tasks to be repaired and the task receiving time of each of the tasks to be repaired are obtained; Determine the target executable task quantity according to the total number of tasks and a second preset threshold; The target task to be repaired is selected from at least one task to be repaired according to the target executable task quantity, the current time, and the task receiving time of each task to be repaired.

4. The method according to claim 3, characterized in that The step of selecting the target task to be repaired from at least one task to be repaired according to the number of target executable tasks, the current time, and the task receiving time of each task to be repaired includes: Sort each task to be repaired according to the task receiving time of each task to be repaired, and obtain the sorting result of each task to be repaired; According to the ranking result of each task to be repaired and the target number of executable tasks, selecting tasks to be repaired whose number is equal to the target number of executable tasks from at least one task to be repaired; According to the selected tasks to be repaired, a target task set is formed; For each task to be repaired in the target task set, obtaining the number of verification data blocks corresponding to the task to be repaired; Determine the urgency of the task to be repaired according to the current time, the task receiving time of the task to be repaired, and the number of verification data blocks respectively corresponding to all the tasks to be repaired in the target task set; When the urgency of each task to be repaired in the target task set is determined, the target task to be repaired is selected according to the urgency corresponding to each task to be repaired in the target task set.

5. The method according to claim 1, characterized in that The method further comprises: Extracting the number of faulty original data blocks from the target task to be repaired; Determining whether the type of the target task to be repaired is a single-fault task according to the number of the faulty original data blocks; When the type of the target repair task is a single-fault task, the storage resource is divided into a plurality of unit storage resources equal in number to the total number of the functional areas according to the total number of the functional areas; Determine each of the unit storage resources as a third-type functional area, wherein the third-type functional area is used to fill in original data blocks and / or verification data blocks and perform calculations; The computing resources are allocated to the third type of functional areas.

6. A resource allocation device, characterized in that: The device is applied to a non-volatile memory, the hardware resources of the non-volatile memory include computing resources and storage resources, and the device includes: The acquisition module is used to obtain the target task to be repaired; an extraction module, configured to extract, from the target task to be repaired, a data block length corresponding to a target file, and a first length and a first width of a preset erasure matrix corresponding to the target file, wherein the first length is a row size of the preset erasure matrix, and the first width is a column size of the preset erasure matrix; The acquisition module is further used to acquire a second length and a second width preset for dividing the storage resource, a total number of functional areas that can be obtained after dividing the storage resource, and a first initial number value; a determination module, configured to determine a first pressure index value according to the data block length and the second length; determine a second pressure index value according to the first length, the first width, the second length, and the second width; determine a second initial quantity value according to the total number of functional areas and the first initial quantity value; determine a first resource sufficiency index value according to the first initial quantity value and the first pressure index value; determine a second resource sufficiency index value according to the second initial quantity value and the second pressure index value; determine a target resource sufficiency index value according to the first resource sufficiency index value and the second resource sufficiency index value; An allocation module is used to, when it is determined that the target resource sufficiency index value is greater than or equal to a first preset threshold value, divide the storage resources equally according to the total number of the functional areas to obtain a number of unit storage resources equal to the total number of the functional areas; determine a first type of functional areas according to the first initial number value and the multiple unit storage resources, wherein the first type of functional areas are used to fill in original data blocks and / or check data blocks; determine a second type of functional areas according to the second initial number value and the multiple unit storage resources, wherein the second type of functional areas are used to fill in the preset erasure matrix and perform calculations; and allocate the calculation resources to the second type of functional areas.

7. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the resource allocation method according to any one of claims 1 to 5 by executing the computer instructions.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the resource allocation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Resource adjustment method based on hyper-converged architecture, Internet of Things server, and medium

    CN111245928A

  • Data storage method and device, server and medium

    CN112527760A