Method and device for distributing write task
By optimizing the write task allocation processing and balancing write tasks according to the writing efficiency and writing capabilities of the multi-core SSD, the load imbalance problem is solved and the processing performance of the multi-core SSD is improved.
Patent Information
- Application Number
- CN202410493997.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2024-08-23
AI Technical Summary
The number of allocated write tasks in multi-core SSDs does not match the processing speed of each core, resulting in load imbalance and affecting processing performance.
By obtaining the target write task set of multiple cores, the write task optimization allocation process is performed, and the number of write tasks to be allocated to the target core is determined based on the write efficiency and write capabilities of each core to ensure a balanced distribution of write tasks.
It achieves load balancing between cores, improves resource utilization, solves the problem of load imbalance, and improves the writing efficiency of multi-core SSDs.
Smart Images

Figure CN118535322A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and in particular, to a method and device for allocating writing tasks. Background Art
[0002] Solid-state drives (SSDs) have the advantages of low power consumption, small size, and high reliability, and have been widely used in various large-scale data storage systems. The growing demand for storage has put forward higher requirements on the performance of solid-state drives. Among them, the evolution from single-core systems to multi-core systems is an obvious development trend shown by the solid-state storage industry.
[0003] SSDs, in which each core is responsible for reading, writing, and garbage collection, are generally considered to have higher processing performance. Due to the uneven distribution of read and write requests issued by the host and the heavy garbage collection tasks of some cores, the processing speed of write tasks gradually changes, and there are also certain differences between the cores. At this time, if the host randomly distributes read and write commands without considering the actual write processing speed of each core, it is very likely to cause load imbalance, that is, the number of write tasks assigned does not match the processing speed of each core. The load imbalance problem of the multi-core SSD system can lead to reduced write efficiency at the least, or block write tasks at the worst, seriously affecting the processing performance of the multi-core SSD.
[0004] There is currently no effective solution to the problem of load imbalance caused by the mismatch between the number of write tasks assigned to a multi-core solid-state drive and the processing speed of each core. Summary of the invention
[0005] The embodiments of the present application provide a method and device for allocating write tasks, so as to at least solve the problem of load imbalance caused by the mismatch between the number of write tasks allocated in a multi-core solid-state hard disk and the processing speed of each core in the related art.
[0006] According to an embodiment of the present application, a method for allocating write tasks is provided, comprising: acquiring target write tasks of multiple cores in a solid-state drive to obtain a target write task set, wherein the multiple cores include blocked cores and unblocked cores, and the target write task set includes: write tasks not processed by the blocked cores and / or write tasks to be allocated by the unblocked cores; performing write task optimization allocation processing on the target write task set, and determining the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid-state drive include the target core, and the write efficiency is the number of write tasks processed and completed by each core per unit time, and the write efficiency is obtained based on the weights of each core and the processing time of the write tasks in a historical time period; determining the target number of write tasks to be allocated to the target core according to the relationship between the write capacity of the target core and the number of the target write tasks to be allocated to the target core; and allocating the target number of target write tasks to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core and the time for processing a single task in a historical time period.
[0007] In an exemplary embodiment, write task optimization allocation processing is performed on the target write task set, including: performing write task optimization allocation processing on the target write task set N times until the target write task does not exist in each core of the solid-state hard disk of the target central processing unit set, where N is an integer greater than or equal to 1.
[0008] In an exemplary embodiment, the target write task set is subjected to the i-th write task optimization allocation processing in the following manner, where i is an integer greater than or equal to 1: obtaining the i-th target write task subset used to perform the i-th write task optimization allocation processing, wherein the target write task set includes the i-th target write task subset, and when i is equal to 1, the i-th target write task subset is equal to the target write task set, and when i is greater than 1, the i-th target write task subset includes the write tasks that are not processed by the blocked core and / or the write tasks to be allocated to the unblocked core after performing the i-1-th write task optimization allocation processing; obtaining the write efficiency of W cores when performing the i-th write task optimization allocation processing, wherein W is an integer greater than or equal to 1; and allocating the i-th target write task subset to the target core among the W cores according to the write efficiency of the W cores.
[0009] In an exemplary embodiment, the i-th target write task subset is allocated to a target core among the W cores according to the write efficiency of the W cores, including: obtaining the total number of target write tasks in the i-th target write task subset; determining the number of target write tasks allocated to each core among the W cores according to the write efficiency of each core, and obtaining a task allocation sequence, wherein the task allocation sequence includes multiple numerical values, each numerical value is the number of target write tasks allocated to the target core corresponding to the numerical value; and allocating the target write tasks to the target core according to the task allocation sequence.
[0010] In an exemplary embodiment, the determination of the target number of write tasks assigned to each of the W cores based on the write efficiency of each core includes: obtaining the target number of write tasks assigned to the j-th core of the W cores in the following manner, wherein j is an integer greater than or equal to 1 and less than or equal to N: determining the sum of the write efficiencies of the other cores of the W cores except the blocked core and the core with zero assigned write tasks as the target sum; determining the ratio of the total number of the target write tasks to the target sum as the target ratio; determining the product of the target ratio and the write efficiency of the j-th core as the target number M of write tasks assigned to the j-th core. j , where M j Greater than or equal to 0.
[0011] In an exemplary embodiment, the product of the target ratio and the write efficiency of the j-th core is determined as the target number M of write tasks assigned to the j-th core. j Afterwards, the method further comprises: j When M is a non-integer j Perform rounding operation to obtain In M j is an integer greater than or equal to 1, the jth core is determined as the target core, and the M j Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; j When is zero, the j-th core is deleted from the W cores, wherein the cores not deleted from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0012] In an exemplary embodiment, in the pair M j After performing the rounding operation, the method further includes: is an integer greater than or equal to 1, the jth core is determined as the target core, and the Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; When is zero, the j-th core is deleted from the W cores, wherein the undeleted cores from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0013] In an exemplary embodiment, allocating the target writing task to the target core according to the task allocation sequence includes: obtaining the number M of target writing tasks allocated to the kth core in the task allocation sequence. k , wherein the M k is an integer greater than or equal to 1; the write capacity of the kth core is determined according to the perception data of the kth core, wherein the write capacity is the number of write tasks that the kth core can still receive without blocking S k , where k is an integer greater than or equal to 1; according to the write capability S of the kth core k With the M k The target write task is allocated to the target core based on the size relationship of .
[0014] In an exemplary embodiment, according to the write capability of the kth core and the M k The target writing task is allocated to the target core in a relationship of size, including: k Greater than the M k In the case of, assigning the M to the kth core k the target writing task, and if there is an i+1th writing task, determining the kth core as the core that performs the i+1th writing task optimization allocation processing; in the S k Less than or equal to the M k In the case of, assign S to the kth core k The target write task is executed, and the kth core is deleted from the W cores, and the cores not deleted from the W cores are used to execute the i+1th write task optimization allocation processing.
[0015] In an exemplary embodiment, determining the write capability of the kth core according to the perception data of the kth core includes: obtaining the number N of write tasks processed and completed by the kth core in the first historical time period. w , the number of read tasks N r and the number of wiping tasks N e ; Parameters a0, a1, a2 and a3 obtained by fitting the previous time period of the first historical time period, and the N w 、N r 、N eThe total duration T is estimated; and the write capability of the k-th core is determined according to the total duration.
[0016] In an exemplary embodiment, the parameters a0, a1, a2 and a3 obtained by fitting the previous time period of the first historical time period, and the N w 、N r 、N e The estimated total duration T includes:
[0017] The total duration T is obtained by the following formula:
[0018] T=a0+a1N w +a2N r +a3N e .
[0019] In an exemplary embodiment, determining the write capability of the kth core according to the total duration includes: determining the write capability S of the kth core according to the following formula: k :
[0020]
[0021] Among them, T ob is a preset blocking time threshold, and a1 is a parameter obtained by fitting the previous time period of the first historical time period.
[0022] In an exemplary embodiment, the product of the target ratio and the write efficiency of the j-th core is determined as the target number M of write tasks assigned to the j-th core. j Before, the method further includes: obtaining the processing time t of the r write tasks of the j-th core in the second historical time period r , where r is an integer greater than or equal to 1; obtaining the weight values of the r write tasks to obtain r weight values, wherein the closer the time of completion of the processing is to the current time, the greater the weight value of the write task; obtaining the write efficiency of the j-th core through the weight values of the r write tasks and the processing time of the r write tasks.
[0023] In an exemplary embodiment, the write efficiency of the j-th core is obtained by the weight values of the r write tasks and the processing time of the r write tasks, including: obtaining the write efficiency v of the j-th core by the following formula: j :
[0024]
[0025] Among them, q c is the weight value of the cth writing task among the r writing tasks, t c is the processing time of the cth write task.
[0026] In an exemplary embodiment, the M is assigned to the kth core. k The target writing task comprises: randomly assigning M to the kth core k Alternatively, the M target writing tasks are allocated to the target core in the order of the processing completion time of each target writing task. k the target write task; assigning S to the kth core k The target writing task comprises: randomly assigning S to the kth core k Alternatively, the S is allocated to the target core according to the order of completion time of the processing of each target writing task. k Write the task for the target.
[0027] In an exemplary embodiment, target write tasks of multiple cores in a solid-state drive are obtained to obtain a target write task set, including: when a blocked core exists in the solid-state drive of a target central processing unit set, unprocessed write tasks of the blocked core are determined as target write tasks to obtain the target write task set, wherein a write task in the multiple cores of the solid-state drive whose processing time has exceeded a preset time threshold is a blocked core; or, when there is no blocked core in the solid-state drive of the target central processing unit set and there are write tasks to be allocated to the multiple cores of the solid-state drive, the write tasks to be allocated to the multiple cores of the solid-state drive are determined as the target write tasks to obtain the target write task set; or, when the blocked core exists in the solid-state drive of the target central processing unit set and there are write tasks to be allocated to the multiple cores of the solid-state drive, the unprocessed write tasks of the blocked core are determined as target write tasks and the write tasks to be allocated to the multiple cores of the solid-state drive are determined as the target write tasks to obtain the target write task set.
[0028] According to another embodiment of the present application, a device for allocating write tasks is also provided, including: an acquisition module, used to acquire target write tasks of multiple cores in a solid-state hard disk, and obtain a target write task set, wherein the solid-state hard disk includes multiple cores, and the multiple cores include blocked cores and unblocked cores, and the target write task set includes: write tasks not processed by the blocked cores and / or write tasks to be allocated by the unblocked cores; a processing module, used to perform write task optimization allocation processing on the target write task set, and determine the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid-state hard disk include the target core, and the write efficiency is the number of write tasks processed and completed by each core per unit time, and the write efficiency is obtained based on the weight of each core in a historical time period and the processing time of the write task; according to the relationship between the write capacity of the target core and the number of target write tasks to be allocated to the target core, determine the target number of target write tasks to be allocated to the target core; allocate the target number of target write tasks to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core in a historical time period.
[0029] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0030] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0031] Through this application, by obtaining the target write tasks of multiple cores in a solid-state hard disk, a target write task set is obtained, wherein the target write task set includes: unprocessed write tasks of a blocked core and / or write tasks to be assigned to an unblocked core; write task optimization allocation processing is performed on the target write task set, and the number of target write tasks to be assigned to the target core is determined according to the write efficiency of each core, and the write efficiency is the number of write tasks completed by each core in a unit time, and the write efficiency is obtained based on the weight of each core in a historical time period and the processing time of the write task; according to the relationship between the write capacity of the target core and the number of target write tasks to be assigned to the target core, the target number of target write tasks to be assigned to the target core is determined; the target number of target write tasks is assigned to the target core, and the write capacity is obtained based on the number of various tasks processed by the target core in a historical time period and the processing time of a single task. Since this application takes into account the actual write efficiency and write capacity of each core, the purpose of more balanced write tasks assigned to each core can be achieved. Therefore, the problem of load imbalance caused by the mismatch between the number of write task assignments and the processing speed of each core in a multi-core solid-state hard disk in the related art can be solved, and the load balancing between multiple cores of the hard disk can be achieved, and the effect of improving resource utilization can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a hardware structure block diagram of a server device according to a method for allocating write tasks according to an embodiment of the present application;
[0033] Figure 2 is a flowchart of a method for allocating writing tasks according to an embodiment of the present application;
[0034] Figure 3 is a flowchart of a writing task optimization allocation module according to an embodiment of the present application;
[0035] Figure 4 is a flowchart of the execution of the task optimization allocation algorithm according to an embodiment of the present application;
[0036] Figure 5 is a flow chart of a writing capability perception method according to an embodiment of the present application;
[0037] Figure 6 is a flow chart of a method for collecting data of a writing capability perception module according to an embodiment of the present application;
[0038] Figure 7 is a flowchart of the operation of the real-time perception module of write efficiency according to an embodiment of the present application;
[0039] Figure 8 is a flowchart of write efficiency perception data space and weight space according to an embodiment of the present application;
[0040] Fig. 9is a flow chart of a method for adaptive balancing of a multi-core SSD system based on load perception according to an embodiment of the present application;
[0041] Fig.10 This is an architecture diagram of a load-aware multi-core SSD system adaptive balancing method according to an embodiment of the present application;
[0042] Fig.11 is a diagram of an SSD system architecture according to a load-aware adaptive balancing method according to an embodiment of the present application;
[0043] Fig.12 is a hardware composition diagram of a write capability perception module according to an embodiment of the present application;
[0044] Fig.13 is a hardware composition diagram of a write efficiency perception module according to an embodiment of the present application;
[0045] Fig.14 is a device structure diagram of a load-aware adaptive balancing method according to an embodiment of the present application;
[0046] Fig.15 It is a structural block diagram of a device for allocating writing tasks according to an embodiment of the present application. DETAILED DESCRIPTION
[0047] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0048] Abbreviations and key terms are defined below:
[0049] GC (Garbage Collection): garbage collection;
[0050] SSD (Solid State Disk): solid state drive;
[0051] FTL (Flash Translation Layer): Flash translation layer.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0053] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for allocating write tasks in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a microprocessor NCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0054] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for allocating write tasks in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server 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.
[0055] The transmission device 106 is used to receive or send data via a network. The above-mentioned specific examples of the network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network INterface CoNtroller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0056] In this embodiment, a method for allocating writing tasks is provided. Figure 2 is a flowchart of a method for allocating write tasks according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0057] Step S202, obtaining target write tasks of multiple cores in the solid state drive to obtain a target write task set, wherein the multiple cores include blocked cores and unblocked cores, and the target write task set includes: unprocessed write tasks of the blocked cores and / or write tasks to be allocated to the unblocked cores;
[0058] Step S204, performing write task optimization allocation processing on the target write task set, and determining the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid-state drive include the target core, and the write efficiency is the number of write tasks processed by each core per unit time, and the write efficiency is obtained based on the weight of each core in a historical time period and the processing time of the write task;
[0059] Step S206, determining the target number of target write tasks to be allocated to the target core based on the relationship between the write capacity of the target core and the number of target write tasks to be allocated to the target core; and allocating the target number of target write tasks to the target core, wherein the write capacity is based on the number of various tasks processed by the target core in a historical time period and the duration of processing a single task.
[0060] Through the above steps, since the present application takes into account the actual writing efficiency and writing capacity of each core, the purpose of allocating more balanced writing tasks to each core can be achieved. Therefore, the problem of load imbalance caused by the mismatch between the number of writing tasks allocated in a multi-core solid-state hard disk and the processing speed of each core in the related art can be solved, and the effect of load balancing between multiple cores of the hard disk can be achieved.
[0061] The execution subject of the above steps may be a server, a terminal, etc., or a write task optimization allocation module set in the server, but is not limited thereto.
[0062] The task optimization allocation processing mechanism can be applied to the following situations:
[0063] Case 1: When there is a blocked core in the solid-state hard disk of the target central processing unit set, the write tasks not processed by the blocked core are determined as target write tasks, and the target write task set is obtained, wherein the processing time of the write tasks in multiple cores of the solid-state hard disk has exceeded a preset time threshold and is a blocked core.
[0064] Specifically, there is a blocked core in the solid-state hard disk (may be one or more) of the target central processing unit set (may include multiple central processing units CPU), and the basis for determining whether there is a blocked core is that the processing time of a write task in a certain core has exceeded a preset time threshold T ob If there is a blocked core, the write task of the blocked core can be optimized and allocated first, and the newly arrived write tasks of the front end can be temporarily suspended. The write tasks not processed by the blocked core are determined as target write tasks, and the above target write task set is obtained.
[0065] Case 2: When there is no blocked core in the solid-state hard disk of the target central processing unit set, and there are write tasks to be allocated to multiple cores of the solid-state hard disk, the write tasks to be allocated to the multiple cores of the solid-state hard disk are determined as the target write tasks, and the target write task set is obtained.
[0066] Specifically, the write tasks to be allocated to the unblocked cores (newly arrived write tasks) can be optimized for allocation. The essential difference from the write tasks of the blocked cores is that the target write tasks are new tasks (write tasks to be allocated to the unblocked cores). In this case, the target write task set is the write tasks to be allocated to the unblocked cores. Both are developed based on the idea of load perception and can share a set of task optimization allocation methods.
[0067] Case three: When the blocked core exists in the solid-state hard disk of the target central processing unit set and there are write tasks to be allocated to multiple cores of the solid-state hard disk, the unprocessed write tasks of the blocked core are determined as target write tasks, and the write tasks to be allocated to multiple cores of the solid-state hard disk are determined as the target write tasks to obtain the target write task set.
[0068] Specifically, the optimized allocation of write tasks can be used for both the blocked core and the unblocked core. The essential difference from the above-mentioned case 1 and case 2 is that the target write tasks include blocked tasks (unprocessed write tasks of unblocked cores) and newly arrived tasks (write tasks to be allocated to unblocked cores). In this case, the above-mentioned set of tasks to be migrated includes unprocessed write tasks of unblocked cores and write tasks to be allocated to unblocked cores.
[0069] like Figure 3 This is a workflow diagram for the write task optimization allocation module, including: receiving relevant information of each core among W cores, including the write processing efficiency, processing capacity and blocking status of each core; determining whether there is a blocked core, obtaining the unfinished write tasks of the blocked core if there is a blocked core, or collecting the write tasks to be allocated by the front end if there is no blocking, and obtaining the target write task set (including the write tasks that the blocked core has not completed processing and / or the write tasks to be allocated by the blocked core). Start the algorithm for task optimization allocation, calculate and store the task allocation sequence. Configure the task allocation sequence as a message and send it to each core. The key input parameters of the task optimization allocation module are the current write capability, write efficiency and target number of write tasks N of each core. task .
[0070] In the above step S204, the target write task set may be subjected to N write task optimization allocation processes until the target write task does not exist in each core of the solid state drive of the target central processing unit set, where N is an integer greater than or equal to 1.
[0071] Taking the i-th write task optimization allocation process performed on the target write task set, where i is an integer greater than or equal to 1, as an example, the following steps are included:
[0072] Step S301, obtaining the i-th target write task subset used for executing the i-th write task optimization allocation processing, wherein the target write task set includes the i-th target write task subset, when i is equal to 1, the i-th target write task subset is equal to the target write task set, and when i is greater than 1, the i-th target write task subset includes the write tasks that are not processed by the blocked core and / or the write tasks to be allocated to the unblocked core after executing the i-1-th write task optimization allocation processing;
[0073] Step S302, obtaining the write efficiency of W cores when performing the i-th write task optimization allocation process, where W is an integer greater than or equal to 1;
[0074] Step S303 : allocating the i th target write task subset to a target core among the W cores according to the write efficiency of the W cores.
[0075] In the above step S303, the write tasks in the i-th target write task subset may be allocated to the target cores in the W cores by the following steps:
[0076] Step S401, obtaining the total number of target write tasks in the i-th target write task subset, wherein, for the above situation one, when the i-th target write task subset only contains write tasks to be processed by blocked cores, the number of unprocessed write tasks by blocked cores is determined as the total number of target write tasks in the i-th target write task subset; for the above situation two, when the i-th target write task subset only contains write tasks to be allocated by unblocked cores, the number of write tasks to be allocated by unblocked cores is determined as the total number of target write tasks in the i-th target write task subset; for the above situation three, when the i-th target write task subset contains both write tasks to be processed by blocked cores and write tasks to be allocated by unblocked cores, the sum of the number of write tasks to be processed by blocked cores and the number of write tasks to be allocated by unblocked cores is determined as the total number of target write tasks in the i-th target write task subset.
[0077] Step S402: Determine the number of target write tasks assigned to each of the W cores based on the write efficiency of each core to obtain a task assignment sequence, wherein the task assignment sequence includes multiple numerical values, each numerical value is the number of target write tasks assigned to the target core corresponding to the numerical value; assign the target write task to the target core according to the task assignment sequence.
[0078] For example, in the above step S402, the number of target write tasks allocated to the j-th core among the W cores may be obtained in the following manner, where j is an integer greater than or equal to 1 and less than or equal to N:
[0079] The sum of the write efficiencies of the other cores among the W cores except the blocked core and the core with zero assigned write tasks is determined as the target sum; the ratio of the total number of target write tasks to the target sum is determined as the target ratio; the product of the target ratio and the write efficiency of the j-th core is determined as the number M of target write tasks assigned to the j-th core j , where M j Greater than or equal to 0.
[0080] Specifically, the formula is as follows:
[0081]
[0082] Among them, v j is the write efficiency of the jth core, The sum of the write efficiencies of all cores except the blocked core and the core with zero assigned write tasks is determined as the target sum, M j is the number of target write tasks assigned to the jth core, N task is the total number of target writing tasks in the i-th target writing task subset.
[0083] The following derivation of the above formula (1) adopts the barrel theory:
[0084] The total number of target writing tasks in the i-th target writing task subset is N task , assuming that the target number of write tasks expected to be allocated to the jth core is M j , the write efficiency of the jth core is V j , the target number of write tasks expected to be allocated to the kth core is M k , the write efficiency V of the kth core k :
[0085] Then the jth core completes M j The processing time of a task is:
[0086] Then the kth core completes M k The processing time of a task is: There is a "barrel effect" when multi-core systems process write tasks, that is, the completion time of a write task depends on the core that completes the task last. In order to minimize the processing time, it is necessary to minimize the maximum value of the processing time t, that is:
[0087]
[0088] Among them, A is the target CPU set, and all target write tasks can be composed of CPU numbers. It can be proved by contradiction that the above optimization equation is equivalent to:
[0089] t j =t k
[0090] That is, the jth core completes M j The processing time of a task is related to the time it takes the kth core to complete M k The processing time of each task is equal.
[0091] Assume a distribution method: the target number of write tasks expected to be allocated to the kth core is M k , the target number of write tasks expected to be allocated to the jth core is M j ,satisfy:
[0092]
[0093] Another allocation method does not satisfy formula (2). The target number of write tasks expected to be allocated to the kth core is M k 'In this case, M k ′ and M k Must not be equal.
[0094] Assume that there is M k Greater than M k ',but In this case, the maximum value of the corresponding time series must be greater than C. Assume that there is M k Less than M k ′, due to N task If it does not change, then it must exist In this case, the corresponding maximum value of the time series must be greater than C.
[0095] Therefore, only t j =t k In the case of , the target writing task processing time in the i-th target writing task subset is the shortest. In this way, it can be deduced that the above formula (1) is used to calculate the number of tasks to be migrated allocated to each core.
[0096] The number of target write tasks M assigned to the jth core obtained by the above formula (1) is j It may be a decimal number. In general, it is not possible to split a write task to be processed by multiple cores.
[0097] In M j When M is a non-integer j Perform rounding operation to obtain The specific rounding method may be rounding. is an integer greater than or equal to 1, the jth core is determined as the target core, and the Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; When is zero, the j-th core is deleted from the W cores, wherein the cores that are not deleted from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0098] In M j is an integer greater than or equal to 1, the jth core is determined as the target core, and the M j Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks allocated to the j-th core;
[0099] In the M j When is zero, the j-th core is deleted from the W cores, wherein the cores not deleted from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0100] like Figure 4 In the flowchart shown, it is possible that the number of target write tasks assigned to a core is close to zero (less than 1). In this case, the target write task should not be assigned to the core, and the core should be deleted from the N cores and W cores, and then the number of tasks of other cores should be recalculated according to formula (4). The deleted cores among the N cores and W cores are used for the next task optimization allocation process.
[0101] Execute the task optimization algorithm and calculate the number of tasks assigned to each core. Determine the size of the number of tasks assigned to each core. If there is a core with a number of tasks less than 1, discard the zero-task core (the core with the number of assigned target write tasks less than zero) and delete it from the W cores, and set its number of assigned tasks to zero. Output and store the task allocation sequence. The main purpose of storage here is to let the balancing layer know the task allocation status of all cores, so that when a core is blocked, it can quickly obtain the task allocation status of the core and save the communication overhead between layers.
[0102] When assigning target write tasks to target cores, the write capacity of the sum of the targets needs to be considered. The write capacity refers to the number of write tasks that a core can receive without blocking. If the load of a core is on the edge of blocking and non-blocking, its write capacity is zero; if a core is blocked, its write capacity is negative; in the non-blocking case, the write capacity of the core is positive.
[0103] Specifically, allocating the target writing task to the target core according to the task allocation sequence, taking the target core as the kth core as an example, includes the following steps:
[0104] Step S401, obtaining the number M of target write tasks allocated to the kth core in the task allocation sequence k , wherein the M k is an integer greater than or equal to 1, M k It can be the value obtained after the decimal is rounded, or it can be the integer value without rounding.
[0105] Step S402: Determine the write capability of the kth core according to the sensing data of the kth core, wherein the write capability is the number S of write tasks that the kth core can still receive without blocking. k , where k is an integer greater than or equal to 1;
[0106] Step S403: Based on the write capability S of the kth core k With the M k The target write task is allocated to the target core based on the size relationship of .
[0107] like Figure 5 The flowchart of the write capability perception method shown in the figure includes the following steps: collecting perception data, including the number and running time of the three types of writing, reading and erasing tasks run by each core FTL layer; updating the capability model, which refers to the time consumed by each core to run various tasks without intervals. Clearing the perception data space for the next collection of capability perception data.
[0108] In the above step S403, according to the writing capability of the kth core and the M k The target writing task is allocated to the target core in a relationship of size, including: k Greater than the M k In the case of, assigning the M to the kth core k the target writing task, and in the case where there is an i+1th writing task, the kth core is determined as the core that performs the i+1th writing task optimization allocation processing; in the S k Less than or equal to the M k In the case of, assign S to the kth core k The target write task is executed, and the j-th core is deleted from the N cores and the W cores, and the cores not deleted from the N cores and the W cores are used to execute the i+1-th write task optimization allocation processing.
[0109] Allocate the M to the kth core k The target writing task comprises: randomly assigning M to the kth corek Alternatively, the M target writing tasks are allocated to the target core in the order of the processing completion time of each target writing task. k Write tasks for the stated goals;
[0110] Allocate S to the kth core k The target writing task comprises: randomly assigning S to the kth core k Alternatively, the S is allocated to the target core according to the order of completion time of the processing of each target writing task. k Write the task for the target.
[0111] In the above step S402, the number N of write tasks processed and completed by the kth core in the first historical time period is obtained. w , the number of read tasks N r and the number of wiping tasks N e ; Parameters a0, a1, a2 and a3 obtained by fitting the previous time period of the first historical time period, and the N w 、N r 、N e The total duration T is estimated; and the write capability of the k-th core is determined according to the total duration.
[0112] The total duration T is obtained by the following formula:
[0113] T=a0+a1N w +a2N r +a3N e
[0114] The above formula is called the writing capability model. w 、N r and N e They represent the number of write tasks, read tasks, and erase tasks completed in the historical time period, respectively. i (i=0, 1, 2, 3) represents the processing capacity model coefficient. Among them, a1 to a3 are approximately equal to the time loss of each core processing a single write task, read task and erase task; a0 is a constant term, which absorbs the processing time loss caused by CPU processing time, message transmission time, other algorithm running time and various unconsidered complex factors. The capacity prediction model can be obtained by the measurement adjustment method, that is, the number of write, read, erase and other tasks completed by each core in a period of time is collected multiple times. w 、N r and N e And the total time T taken to process these tasks.
[0115] According to the processing capability model, R measurement data can be sorted out. The observation matrix A and the observation vector t are as follows:
[0116]
[0117] t=(T0 T1 … T R ) T
[0118] In the equation, R represents the number of observations collected during the historical period. Since the capability model has four coefficients, the number of observations should be at least four to ensure that the observation matrix A is full rank and the reliability of the capability model solution. It is hoped that the error vector of the observation model A is minimized, and then the optimization equation and its least squares solution are obtained, as follows:
[0119]
[0120] x=(A T A) -1 A T t
[0121] After obtaining the capacity model coefficient, the number of tasks backlogged on each core is input into the capacity model, and then compared with the set blocking time threshold T ob Subtracting them will give the remaining non-blocking time Δt of the current core. unob , compared with the write task coefficient a1, we can get the maximum number of write tasks that the current core can accept, that is, the write capacity S k ,as follows:
[0122]
[0123] That is, the write capability of the kth core can be determined by the following formula:
[0124]
[0125] Among them, T ob is the preset blocking time threshold, and a1 is the parameter obtained by the above fitting.
[0126] The above capability model has four coefficients that are dynamically fitted. The four coefficients of the capability model are fitted by the observation matrix A and the observation vector t within each preset time period. The capability model obtained by the four coefficients obtained by each fitting is used to predict the write capability of each core in the next time period.
[0127] Figure 6 The flowchart of the data collection method for the writing capability perception module includes the following steps: To set the monitoring parameters, the monitoring parameters refer to the lower limit R of the number of perception data that need to be collected. min . Clear the perception data space: used to receive new perception data. Store a piece of perception data, which includes the number of tasks such as writing, reading, and erasing N.w 、N r 、N e . Determine whether the perception data space has collected R min If yes, calculate the total running time T of the perception data; if not, continue to store a new perception data.
[0128] The write efficiency of each core refers to the number of write tasks that a core can receive without blocking. If the load of a core is on the edge of blocking and non-blocking, its write capacity is zero; if a core is blocked, its write capacity is negative; in the non-blocking case, the write capacity of the core is positive.
[0129] It can be calculated by the processing time of each core writing task in the historical time period. Specifically, it can include the following steps:
[0130] Step S501, obtaining the processing time t of the r write tasks of the jth core in the second historical time period r , where r is an integer greater than or equal to 1;
[0131] Step S502, obtaining the weight values of the r writing tasks, and obtaining r weight values, wherein the weight value of the writing task that is closer to the current time when the processing is completed is larger;
[0132] Step S503: Obtain the write efficiency of the j-th core through the weight values of the r write tasks and the processing durations of the r write tasks.
[0133] Specifically, the write efficiency v of the j-th core can be obtained by the following formula: j :
[0134]
[0135] Among them, q c is the weight value of the cth writing task among the r writing tasks, t c is the processing time of the cth write task.
[0136] Figure 7 The flowchart for the real-time perception module of write efficiency includes: perception data collection step and write efficiency calculation step. Set monitoring parameters. The monitoring parameters here refer to the upper limit of the number of efficiency perception data that need to be collected R max , depends on the size of the efficiency perception data space. Receive new perception data, each perception data includes the core sequence number r and the write processing time t r . Determine whether the data volume has reached the upper limit of the perceived data volume R max, if yes, then remove the old data, that is, remove the first piece of data collected in the perception data space; if no, save the latest received perception data; the average write efficiency is calculated.
[0137] Figure 8 The write efficiency perception data space and weight space are displayed. According to the perception data collection process, the perception data space can be organized into the form of a queue, and the latest collected data enters the queue at the head of the queue, and the earliest collected data is removed from the queue at the tail of the queue. When perceiving the write efficiency, if only the latest perception data is collected as the input value of the efficiency algorithm, the sample space is small and the estimated value of the efficiency is unstable, so it is necessary to collect perception data at multiple times. In addition, it is generally believed that the perception data at the latest moment can best reflect the efficiency at the next moment. The less timely the perception data, the smaller the impact on the estimated value of the write efficiency at the next moment. Therefore, the present invention sets a weight queue in parallel with the perception data queue to satisfy q0>q1>…>q Rmax-1 >0.
[0138] The load balancing method of the present application can be simply summarized as "more distribution to fast cores and fewer distribution to slow cores." However, existing load balancing methods focus on the design of command distribution mechanisms, do not provide a mathematical basis for the optimization objectives and design paths of the balancing methods, and lack a mathematical model and theoretical analysis for deriving the balancing methods. The prior art focuses on the description of the balancing methods, lacks an overall architectural design of the balancing methods, and rarely mentions the compatibility of the balancing methods with the logical architecture of the multi-core SSD system, which includes the logical level of the balancing methods, the interaction content with the FTL layer and the front end, and so on. In addition, some balancing methods require designers to provide the values of key a priori parameters, which is not conducive to the adaptive operation of the balancing methods.
[0139] In order to solve the load imbalance problem of multi-core SSDs and improve write efficiency, this application proposes an adaptive balancing method for multi-core SSD systems based on load perception. This method innovatively establishes a balancing layer and a perception layer at the logical architecture level, and improves the existing FTL layer of the SSD, realizing a real-time monitoring mechanism for the processing efficiency of multi-core SSDs and a dynamic measurement mechanism for processing capabilities. Based on the two major indicators of processing efficiency and processing capabilities, this application proposes a mathematical optimization model for a multi-core SSD load balancing method, and derives a distribution mechanism for write tasks based on this. The balancing method proposed in this application does not contain any priori parameters, and can automatically run between the proposed balancing layer, perception layer, and improved FTL layer, realizing adaptive load balancing of a multi-core SSD system.
[0140] Fig. 9This is a flow chart of the adaptive balancing method for a multi-core SSD system based on load perception. The method includes the following steps: Perceiving the write efficiency and write capacity of the multi-cores, which is used to obtain the speed at which each core currently processes write tasks and the upper limit of the number of write tasks that can be received without blocking. Multi-core task optimization allocation, which is used to obtain the write tasks that are not processed by the blocked core or to obtain the write tasks to be allocated without blocking, and then calculate the number of write tasks distributed to each core based on the write efficiency and capacity of each core. Write processing and statistics of each core, which is to perform write processing and statistics on the perceived data of write efficiency and write capacity at the FTL layer. Perceiving the write efficiency and write capacity, and updating the write efficiency and write capacity of each core based on the statistical perception data.
[0141] In this embodiment, a system for allocating write tasks is also provided, including a statistical layer (which can be set in the flash conversion layer of the SSD), which is used to count the number and processing time of write tasks, the number and processing time of read tasks, and the number and processing time of erase tasks of each core in the solid-state drive, wherein the solid-state drive includes multiple cores, and the multiple cores include blocked cores and unblocked cores; a perception layer, which is used to receive the number and processing time of write tasks, the number and processing time of read tasks, and the number and processing time of erase tasks of each core in the solid-state drive from the flash conversion layer, and determine the write capacity, write efficiency and congestion information of each core; a balancing layer, which is used to receive the write capacity, write efficiency and congestion information of each core from the perception layer for storage, and allocate each target write task in the target write task set to the target core among the multiple cores based on the write capacity, write efficiency and congestion information.
[0142] like Fig.10 The architecture diagram of the adaptive balancing method of a multi-core SSD system based on load perception. The logical architecture includes the balancing layer, the perception layer, and the FTL layer. The balancing layer includes a multi-core processing information collection module and a write task optimization allocation module. The former is used to collect information such as the write efficiency, write capacity, and blocking conditions of each core, and the latter is used to achieve the optimized allocation of host write tasks or blocked write tasks. The perception layer includes a write capacity perception module, a write efficiency perception module, and a blocking perception module, which are respectively used to perceive the write capacity, write efficiency, and blocking conditions of each core. An FTL layer statistics module is added to the traditional FTL layer, which is mainly used to count the number of read, write, and erase tasks executed by the FTL layer of this core and the processing time of each task.
[0143] Fig.11 The following is an architecture diagram of the SSD system based on the load-aware adaptive balancing method. The balancing layer and the perception layer innovatively established by the balancing method are located between the front end and the FTL layer of the SSD. The arrows indicate the communication direction between the layers. The FTL layer transmits the perception data statistics to the perception layer, and the perception layer transmits the write efficiency, write capacity, and blocking status of each core to the balancing layer. The front end sends the write task initiated by the host to the balancing layer. The balancing layer transmits the optimized allocated task sequence to the FTL layer.
[0144] Fig.12 The hardware structure diagram of the write capability sensing module is shown in Figure 1. The write capability sensing module is mainly composed of a register group, a matrix multiplication unit, a matrix inversion unit, an adder and a divider.
[0145] Fig.13 The hardware structure diagram of the write efficiency perception module is shown in Figure 1. The write efficiency perception module is mainly composed of a register group, a multiplier, an adder, and a divider.
[0146] Specifically, the steps of the load-aware multi-core SSD system adaptive balancing method proposed in the present invention are as follows:
[0147] Step S101: Collect multi-core write processing information. The multi-core processing information collected in this step includes the write processing efficiency, write processing capacity and blocking status of each core, which are fed back by the write efficiency perception module, write capacity perception module and blocking monitoring module arranged in the perception layer.
[0148] Step S102: Optimizing the allocation of multi-core tasks. The process of optimizing the allocation of multi-core tasks can be simply divided into two steps.
[0149] Step 11: Get the target write task. First, it is necessary to determine whether there is a blocked core. The basic criterion for this step is that the processing time of a write task on a core has exceeded the preset time threshold T ob If there is a blocking core, the blocking task allocation mechanism must be executed first to temporarily suspend the newly arrived write task at the front end; otherwise, the optimization allocation mechanism for the newly arrived write task (the write task to be allocated) is directly executed. It should be noted that the essential difference between the optimization allocation mechanism for blocking write tasks and front-end write tasks is whether the write task to be allocated is a blocking task or a newly arrived task. Both are developed based on the idea of load perception and share a set of task optimization allocation methods.
[0150] Step 12: Execute the task optimization allocation algorithm. First, you need to determine the multiple cores of the SSD of the target CPU set that participate in the task allocation. In the case of a blocked core, the blocked core number needs to be removed from the core set. Then execute the task optimization allocation algorithm to calculate the number of target write tasks that need to be allocated to each core. If there is a core with a task number n i If it is less than zero, the number of tasks assigned to the core is set to n. i =0, and remove the number of the core from the entire core set, and re-execute the optimization algorithm until the number of all assigned tasks is zero.
[0151] Step 13: Send the task optimization allocation results to each core.
[0152] Step S103: Each core writes processing and statistics.
[0153] After receiving the write task optimization allocation results, each core FTL layer starts to perform write processing, including front-end data movement, FTL layer message configuration, back-end data movement, and flash programming (program) operations. From the perspective of the flash array layer, the FTL layer receives all host requests and the FTL layer-specific algorithms are converted into the three basic operations of writing, reading, and erasing the flash array. Based on this fact, the FTL layer needs to count two types of data: first, all write, read, and erase tasks of the FTL layer and their running time, which are used to build a write capability model; second, the running time of the write tasks assigned by the front end, which is used to perceive the write efficiency in real time.
[0154] The statistical results of the FTL layer need to be fed back to the perception layer in real time. Among them, the feedback timing of the host write task statistical information is when the FTL layer receives the information sent by the flash array that the programming operation is completed. The destination of this information is the write efficiency perception module and the blocking perception module of the perception layer. The feedback frequency of write, read, and erase data can be slower than the feedback frequency of write task statistical information. This is because each piece of perception data needs to contain as many write, read, and erase commands as possible to ensure the stability and accuracy of the write capacity model estimation, so the waiting time is longer. Their feedback time can be when the FTL layer receives the information sent by the flash array that an erase command is completed.
[0155] Step S104: Perception of write efficiency, write capacity, and blocking conditions of each core.
[0156] The perception layer continuously receives feedback information from the FTL layer and ensures the timeliness of the perception data by removing old information or clearing the data space. If the blocking monitoring module fails to receive the statistical message of a certain write task, it is determined that the core where the write task is located is blocked. The write efficiency perception module starts the calculation of the write efficiency every time it receives a new perception data. The perception data space of the write capacity perception module satisfies R min When a write capacity model is calculated, the write capacity model calculation is started. It can be seen that the write capacity model calculation frequency is much lower than the write efficiency calculation frequency. This is because the write capacity model counts the running status of almost all tasks in each CPU and shows a certain stability in the long term; while the write efficiency will be affected by other tasks and will fluctuate in the short term. In addition, the calculation of the write capacity model involves matrix operations, which is relatively complex. Fewer model calculations can save CPU resources.
[0157] Each time the write efficiency, write capacity and blocking situation are updated, the perception layer will feed back the corresponding information to the multi-core information collection module of the balancing layer and start executing step S101 again.
[0158] Fig.14The device structure diagram of the load-aware adaptive balancing method provided by the present invention is an instantiation of the balancing method architecture diagram. It mainly includes:
[0159] Multi-core processing information collection module: including a write capability information storage unit, a write efficiency information storage unit and a blocking information storage unit, which are used to store the write processing capability, write processing efficiency and blocking status of each core from the perception layer respectively;
[0160] Write task optimization allocation module: includes a blocking trigger unit, a task allocation storage unit and a task optimization allocation unit. The blocking trigger unit is mainly used to determine whether each core is blocked. The task allocation storage unit is used to store the optimization allocation of write tasks in each core. The task optimization allocation unit is used to execute the task optimization algorithm. In the case of blocking, its input is the unfinished write task of the blocking core, and in the case of non-blocking, its input is the write task sent by the front end.
[0161] Write capability perception module: includes a perception data collection unit and a processing capability calculation unit. The perception data collection unit is used to comprehensively collect the write, read, and erase commands forwarded by the FTL layer to the backend and their running time. The processing capability calculation unit is used to calculate the upper limit of the number of write tasks that each core can accept without blocking.
[0162] Write efficiency perception module: includes a perception data collection unit and a processing efficiency calculation unit. The perception data collection unit is used to collect the completed write tasks and their processing time of each core in real time, which is implemented using the queue data structure, such as Fig.10 The processing efficiency calculation unit is used to calculate the write processing efficiency of each core in real time.
[0163] Blockage monitoring module: includes a timer and a judge. The timer is used to sense the processing time of each write task. When the processing time of a write task exceeds the tolerance limit, the judge outputs that the core is blocked; otherwise, the core is not blocked.
[0164] FTL layer statistics module: including write task statistics unit, read task statistics unit and erase task statistics unit. Among them, the write task statistics unit is used to count the number and processing time of host write tasks, the number and processing time of write tasks caused by FTL layer GC and other algorithms; the read task statistics unit and erase task statistics unit are used to count the number and processing time of various read tasks and erase tasks occurring in the FTL layer.
[0165] Write processing module: traditional FTL layer, used to process write tasks.
[0166] Existing multi-core SSD load balancing methods pay little attention to mathematical models and theoretical analysis, lack the overall architectural design of balancing methods, and some methods require fixed assignment of a priori parameters and have poor adaptability. In response to the above problems, the present application is based on a load-aware multi-core SSD adaptive balancing method to solve the load imbalance problem of multi-core SSD and improve write efficiency. The balancing method can perceive the write processing efficiency and blocking situation of each core of the SSD in real time, and dynamically perceive the write capacity of each core. Based on the two indicators of write efficiency and write capacity, the present invention takes the processing time of the write task as the optimization objective function, and derives the optimization allocation algorithm of the write task, which effectively reduces the processing time of the write task while ensuring the load balancing of the multi-core SSD. The key parameters of the present invention can be automatically updated, and the proposed balancing method can adaptively run between the newly established balancing layer, perception layer and improved FTL layer, and has strong adaptability.
[0167] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as RON / RAN, a disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0168] In the present embodiment, a device for distributing writing tasks is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof 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 contemplated.
[0169] Figure 1 5 is a structural block diagram of a device for allocating writing tasks according to an embodiment of the present application, such as Figure 15, the device includes: an acquisition module 1502, used to acquire target write tasks of multiple cores in a solid state drive, and obtain a target write task set, wherein the solid state drive includes multiple cores, the multiple cores include blocked cores and unblocked cores, and the target write task set includes: write tasks not processed by the blocked cores and / or write tasks to be allocated by the unblocked cores; a processing module 1504, used to perform write task optimization allocation processing on the target write task set, and determine the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid state drive include the target core, the write efficiency is the number of write tasks processed and completed by each core per unit time, and the write efficiency is obtained based on the weight of each core in a historical time period and the processing time of the write task; according to the relationship between the write capacity of the target core and the number of target write tasks to be allocated to the target core, determine the target number of target write tasks to be allocated to the target core; and allocate the target number of target write tasks to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core in the historical time period and the processing time of a single task.
[0170] In an exemplary embodiment, the above-mentioned device is also used to perform N write task optimization allocation processing on the target write task set until the target write task does not exist in each core of the solid state drive of the target central processor set, where N is an integer greater than or equal to 1.
[0171] In an exemplary embodiment, the above-mentioned device is also used to obtain the i-th target write task subset used to perform the i-th write task optimization allocation processing, wherein the target write task set includes the i-th target write task subset, when i is equal to 1, the i-th target write task subset is equal to the target write task set, and when i is greater than 1, the i-th target write task subset includes the write tasks that are not processed by the blocked core and / or the write tasks to be allocated to the unblocked core after performing the i-1-th write task optimization allocation processing; obtain the write efficiency of W cores when performing the i-th write task optimization allocation processing, wherein W is an integer greater than or equal to 1; and allocate the i-th target write task subset to the target core among the W cores according to the write efficiency of the W cores.
[0172] In an exemplary embodiment, the above-mentioned device is also used to obtain the total number of target write tasks in the i-th target write task subset; determine the number of target write tasks allocated to each of the W cores according to the write efficiency of each core, and obtain a task allocation sequence, wherein the task allocation sequence includes multiple numerical values, each numerical value is the number of target write tasks allocated to the target core corresponding to the numerical value; allocate the target write tasks to the target core according to the task allocation sequence.
[0173] In an exemplary embodiment, the above-mentioned device is also used to obtain the target number of write tasks assigned to the j-th core among the W cores in the following manner, where j is an integer greater than or equal to 1 and less than or equal to N: the sum of the write efficiencies of the other cores among the W cores except the blocked core and the core with zero assigned write tasks is determined as the target sum; the ratio of the total number of the target write tasks to the target sum is determined as the target ratio; the product of the target ratio and the write efficiency of the j-th core is determined as the number M of target write tasks assigned to the j-th core. j , where M j Greater than or equal to 0.
[0174] In an exemplary embodiment, the above-mentioned device is also used to determine the product of the target ratio and the write efficiency of the j-th core as the number M of target write tasks allocated to the j-th core. j Afterwards, in M j When M is a non-integer j Perform rounding operation to obtain In M j is an integer greater than or equal to 1, the jth core is determined as the target core, and the M j Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; j When is zero, the j-th core is deleted from the W cores, wherein the cores not deleted from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0175] In an exemplary embodiment, the above device is also used in the pair M j After the rounding operation, is an integer greater than or equal to 1, the jth core is determined as the target core, and the Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; In the case of uniform zeroing, the j-th core is deleted from the W cores, wherein the undeleted cores from the W cores are used to perform the i+1-th write task optimization allocation processing.
[0176] In an exemplary embodiment, the above-mentioned apparatus is also used to obtain the number M of target write tasks allocated to the kth core in the task allocation sequence: k , wherein the M kis an integer greater than or equal to 1; the write capacity of the kth core is determined according to the perception data of the kth core, wherein the write capacity is the number of write tasks that the kth core can still receive without blocking S k , where k is an integer greater than or equal to 1; according to the write capability S of the kth core k With the M k The target write task is allocated to the target core based on the size relationship of .
[0177] In an exemplary embodiment, the above device is also used in the S k Greater than the M k In the case of, assigning the M to the kth core k the target writing task, and if there is an i+1th writing task, determining the kth core as the core that performs the i+1th writing task optimization allocation processing; in the S k Less than or equal to the M k In the case of, assign S to the kth core k The target write task is executed, and the kth core is deleted from the W cores, and the cores not deleted from the W cores are used to execute the i+1th write task optimization allocation processing.
[0178] In an exemplary embodiment, the above device is also used to obtain the number N of write tasks processed and completed by the k-th core in the first historical time period. w , the number of read tasks N r and the number of wiping tasks N e ; Parameters a0, a1, a2 and a3 obtained by fitting the previous time period of the first historical time period, and the N w 、N r 、N e The total duration T is estimated; and the write capability of the k-th core is determined according to the total duration.
[0179] In an exemplary embodiment, the above device is further used to obtain the total duration T by the following formula:
[0180] T=a0+a1N w +a2N r +a3N e
[0182] In an exemplary embodiment, the above device is also used to determine the write capability S of the kth core by the following formula: k :
[0183]
[0184] Among them, T obis a preset blocking time threshold, and a1 is a parameter obtained by fitting the previous time period of the first historical time period.
[0185] In an exemplary embodiment, the above-mentioned device is further used to determine the product of the target ratio and the write efficiency of the j-th core as the target number M of write tasks allocated to the j-th core. j Before, obtain the processing time t of the r write tasks of the j-th core in the second historical time period r , where r is an integer greater than or equal to 1; obtaining the weight values of the r write tasks to obtain r weight values, wherein the closer the time of completion of the processing is to the current time, the greater the weight value of the write task; obtaining the write efficiency of the j-th core through the weight values of the r write tasks and the processing time of the r write tasks.
[0186] In an exemplary embodiment, the above device is also used to obtain the write efficiency v of the j-th core by the following formula: j :
[0187]
[0188] Among them, q c is the weight value of the cth writing task among the r writing tasks, t c is the processing time of the cth write task.
[0189] In an exemplary embodiment, the above device is also used to randomly assign M to the kth core. k Alternatively, the M target writing tasks are allocated to the target core in the order of the processing completion time of each target writing task. k the target write task; assigning S to the kth core k The target writing task comprises: randomly assigning S to the kth core k Alternatively, the S is allocated to the target core according to the order of completion time of the processing of each target writing task. k Write the task for the target.
[0190] In an exemplary embodiment, the above-mentioned device is also used to, when there is a blocked core in the solid-state hard disk of the target central processing unit set, determine the write tasks that are not processed by the blocked core as target write tasks, and obtain the target write task set, wherein the write tasks in the multiple cores of the solid-state hard disk whose processing time has exceeded a preset time threshold are blocked cores; or, when there is no blocked core in the solid-state hard disk of the target central processing unit set and there are write tasks to be allocated to the multiple cores of the solid-state hard disk, determine the write tasks to be allocated to the multiple cores of the solid-state hard disk as the target write tasks, and obtain the target write task set; or, when there is a blocked core in the solid-state hard disk of the target central processing unit set and there are write tasks to be allocated to the multiple cores of the solid-state hard disk, determine the write tasks that are not processed by the blocked core as target write tasks and the write tasks to be allocated to the multiple cores of the solid-state hard disk as the target write tasks, and obtain the target write task set.
[0191] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0192] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0193] In an exemplary embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (RON), a random access memory (RAN), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0194] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0195] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0196] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0197] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0198] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for allocating writing tasks, characterized in that: include: Acquire target write tasks of multiple cores in the solid-state drive to obtain a target write task set, wherein the multiple cores include blocked cores and unblocked cores, and the target write task set includes: unprocessed write tasks of the blocked cores and / or write tasks to be allocated to the unblocked cores; Performing write task optimization allocation processing on the target write task set, and determining the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid-state drive include the target core, and the write efficiency is the number of write tasks processed by each core per unit time, and the write efficiency is obtained based on the weight of each core in a historical time period and the processing time of the write task; Determining a target number of tasks to be allocated to the target core according to a relationship between the write capability of the target core and the number of the target write tasks to be allocated to the target core; A target number of target write tasks are allocated to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core and the duration of processing a single task in a historical time period.
2. The method according to claim 1, characterized in that Performing write task optimization allocation processing on the target write task set includes: The target write task set is processed for N times in an optimized allocation of write tasks until the target write tasks do not exist in the cores of the solid-state hard disks of the target central processing unit set, where N is an integer greater than or equal to 1.
3. The method according to claim 2, characterized in that Performing an i-th write task optimization allocation process on the target write task set in the following manner, where i is an integer greater than or equal to 1, including: Obtaining the i-th target write task subset used for executing the i-th write task optimization allocation processing, wherein the target write task set includes the i-th target write task subset, when i is equal to 1, the i-th target write task subset is equal to the target write task set, and when i is greater than 1, the i-th target write task subset includes the write tasks that are not processed by the blocked core and / or the write tasks to be allocated to the unblocked core after executing the i-1-th write task optimization allocation processing; Obtaining the write efficiency of W cores when performing the i-th write task optimization allocation process, where W is an integer greater than or equal to 1; The i-th target write task subset is allocated to a target core among the W cores according to the write efficiency of the W cores.
4. The method according to claim 3, characterized in that Allocating the i-th target write task subset to a target core among the W cores according to the write efficiency of the W cores, comprising: Obtain the total number of target writing tasks in the i-th target writing task subset; Determine the number of target write tasks allocated to each of the W cores according to the write efficiency of each core, and obtain a task allocation sequence, wherein the task allocation sequence includes a plurality of values, each value being the number of target write tasks allocated to the target core corresponding to the value; The target writing task is allocated to the target core according to the task allocation sequence.
5. The method according to claim 4, characterized in that The determining, according to the write efficiency of each core, the number of target write tasks allocated to each core in the W cores includes: The number of target write tasks allocated to the j-th core among the W cores is obtained in the following manner, where j is an integer greater than or equal to 1 and less than or equal to N: Determine the sum of the write efficiencies of the other cores among the W cores except the blocked core and the core to which the number of allocated write tasks is zero as the target sum; Determine the ratio of the total number of the target writing tasks to the sum of the targets as a target ratio; The product of the target ratio and the write efficiency of the j-th core is determined as the number M of target write tasks allocated to the j-th core. j , where M j Greater than or equal to 0.
6. The method according to claim 5, characterized in that The product of the target ratio and the write efficiency of the j-th core is determined as the number M of target write tasks allocated to the j-th core. j Afterwards, the method further comprises: In M j When M is a non-integer j Perform rounding operation to obtain In M j is an integer greater than or equal to 1, the jth core is determined as the target core, and the M j Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks allocated to the j-th core; In the M j When is zero, the j-th core is deleted from the W cores, wherein the cores not deleted from the W cores are used to perform the i+1-th write task optimization allocation processing.
7. The method according to claim 6, characterized in that In the M j After performing the rounding operation, the method further includes: In the is an integer greater than or equal to 1, the jth core is determined as the target core, and the Recorded at the jth position in the task allocation sequence, wherein the jth position recorded is the number of target write tasks assigned to the j-th core; When is zero, the j-th core is deleted from the W cores, wherein the undeleted cores from the W cores are used to perform the i+1-th write task optimization allocation processing.
8. The method according to claim 4, characterized in that Allocating the target writing task to the target core according to the task allocation sequence includes: Obtain the number M of target write tasks assigned to the kth core in the task assignment sequence k , wherein the M k is an integer greater than or equal to 1; The write capability of the kth core is determined according to the perception data of the kth core, wherein the write capability is the number S of write tasks that the kth core can still receive without blocking. k , where k is an integer greater than or equal to 1; According to the write capability S of the kth core k With the M k The target write task is allocated to the target core based on the size relationship of .
9. The method according to claim 8, characterized in that According to the write capability S of the kth core k With the M k The target writing task is allocated to the target core according to the size relationship of , including: In the S k Greater than the M k In the case of, assigning the M to the kth core k the target write task, and if there is an i+1th write task, determining the kth core as the core that performs the i+1th write task optimization allocation processing; In the S k Less than or equal to the M k In the case of, assign S to the kth core k The target write task is executed, and the kth core is deleted from the W cores, and the cores not deleted from the W cores are used to execute the i+1th write task optimization allocation processing.
10. The method according to claim 8, characterized in that Determining the write capability of the kth core according to the perception data of the kth core includes: Get the number N of write tasks processed and completed by the kth core in the first historical time period w , the number of read tasks N r and the number of wiping tasks N e ; The parameters a0, a1, a2 and a3 obtained by fitting the time period before the first historical time period, and N w 、N r 、N e The total duration T is estimated; The writing capability of the k-th core is determined by the total duration.
11. The method according to claim 10, characterized in that The parameters a0, a1, a2 and a3 obtained by fitting the time period before the first historical time period, and N w 、N r 、N e The estimated total duration T includes: The total duration T is obtained by the following formula: T=a0+a1N w +a2N r +a3N e 。 12. The method according to claim 10, characterized in that Determining the write capability of the k-th core according to the total duration includes: The write capability S of the kth core is determined by the following formula: k : Among them, T ob is a preset blocking time threshold, and a1 is a parameter obtained by fitting the previous time period of the first historical time period.
13. The method according to claim 5, characterized in that The product of the target ratio and the write efficiency of the j-th core is determined as the target number M of write tasks assigned to the j-th core. j Previously, the method also included: Get the processing time t of the r write tasks of the jth core in the second historical time period r , where r is an integer greater than or equal to 1; Obtaining the weight values of the r writing tasks to obtain r weight values, wherein the weight value of a writing task that is closer to the current time when the processing is completed is greater; The write efficiency of the j-th core is obtained through the weight values of the r write tasks and the processing durations of the r write tasks.
14. The method according to claim 13, characterized in that The write efficiency of the j-th core is obtained by using the weight values of the r write tasks and the processing duration of the r write tasks, including: The write efficiency v of the j-th core is obtained by the following formula: j : Among them, q c is the weight value of the cth writing task among the r writing tasks, t c is the processing time of the cth write task.
15. The method according to claim 9, characterized in that Allocate the M to the kth core k The target writing task comprises: randomly assigning M to the kth core k Alternatively, the M target writing tasks are allocated to the target core in the order of the processing completion time of each target writing task. k Write tasks for the stated goals; Allocate S to the kth core k The target writing task comprises: randomly assigning S to the kth core k Alternatively, the S is allocated to the target core according to the order of completion time of the processing of each target writing task. k Write the task for the target.
16. The method according to claim 1, characterized in that Get the target write tasks of multiple cores in the solid-state drive and get a target write task set, including: In the case where there is a blocked core in the solid-state hard disk of the target central processing unit set, the write tasks not processed by the blocked core are determined as target write tasks to obtain the target write task set, wherein the write tasks in the multiple cores of the solid-state hard disk whose processing time has exceeded a preset time threshold are blocked cores; or In the case where there is no blocked core in the solid state drive of the target central processing unit set and there are write tasks to be allocated to multiple cores of the solid state drive, the write tasks to be allocated to the multiple cores of the solid state drive are determined as the target write tasks to obtain the target write task set; or, When the blocked core exists in the solid-state hard disk of the target central processing unit set and there are write tasks to be allocated to multiple cores of the solid-state hard disk, the unprocessed write tasks of the blocked core are determined as target write tasks, and the write tasks to be allocated to multiple cores of the solid-state hard disk are determined as the target write tasks to obtain the target write task set.
17. A device for allocating writing tasks, characterized in that: The method as claimed in any one of claims 1 to 16, comprising: An acquisition module is used to acquire target write tasks of multiple cores in a solid-state drive to obtain a target write task set, wherein the solid-state drive includes multiple cores, the multiple cores include blocked cores and unblocked cores, and the target write task set includes: unprocessed write tasks of the blocked cores and / or write tasks to be allocated by the unblocked cores; A processing module, used to perform write task optimization allocation processing on the target write task set, and determine the number of target write tasks to be allocated to the target core according to the write efficiency of each core, wherein the multiple cores in the solid-state hard disk include the target core, and the write efficiency is the number of write tasks processed by each core per unit time, and the write efficiency is obtained based on the weight of each core and the processing time of the write task in a historical time period; according to the relationship between the write capacity of the target core and the number of target write tasks to be allocated to the target core, determine the target number of target write tasks to be allocated to the target core; and allocate the target number of target write tasks to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core in the historical time period.
18. A system for allocating writing tasks, characterized in that: The method as claimed in any one of claims 1 to 16, comprising: A statistical layer, used to count the number and processing time of write tasks, the number and processing time of read tasks, and the number and processing time of erase tasks of each core in the solid-state hard disk, wherein the solid-state hard disk includes multiple cores, and the multiple cores include blocked cores and unblocked cores; A perception layer, used to receive the number and processing time of write tasks, the number and processing time of read tasks, and the number and processing time of erase tasks of each core in the solid-state hard disk from the flash conversion layer, and determine the write capacity, write efficiency and congestion information of each core; The balancing layer is used to receive the write capability, write efficiency and congestion information of each core from the perception layer for storage, and allocate each target write task in the target write task set to the target core among the multiple cores based on the write capability, write efficiency and congestion information.
19. The system according to claim 18, characterized in that The balancing layer comprises: An information storage unit, used to store the write capability, write efficiency and congestion information of multiple cores in the solid-state hard disk, wherein the congestion information includes the sequence number of each target write task in a target write task set, and the target write task set includes: the write tasks not processed by the blocked core and / or the write tasks to be allocated by the unblocked core; A task optimization allocation module is used to determine the number of target write tasks allocated to a target core among the multiple cores according to the write efficiency of each core, wherein the multiple cores in the solid-state drive include the target core, and the write efficiency is the number of write tasks processed and completed by each core per unit time, and the write efficiency is obtained based on the weights of each core and the processing time of the write tasks in a historical time period; determine the target number of target write tasks to be allocated to the target core according to the relationship between the write capacity of the target core and the number of target write tasks to be allocated to the target core; and allocate the target number of target write tasks to the target core, wherein the write capacity is obtained based on the number of various tasks processed by the target core and the time for processing a single task in a historical time period.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 16 when executed by a processor.
21. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 16 are implemented.
22. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 16 is implemented.
