A command processing method, system, hard disk and storage medium for solid state hard disk
By calculating the average time interval and fitting curve and adjusting the length of the SSD management link list, the problem of increasing traversal time caused by excessive management link list is solved, and the system efficiency and command processing speed is improved.
Patent Information
- Application Number
- CN202411224258.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-09-03
AI Technical Summary
When the existing solid-state drive command processing methods manage the linked list too long, the time to traverse the linked list increases, affecting the system efficiency, and failing to effectively solve this problem.
By obtaining the execution information of the target command, calculating the average time interval, and adjusting the length of the management linked list when the preset threshold is exceeded, calculating the correction coefficient by fitting the curve and timeout ratio, correcting the length of the management linked list to avoid the increase in traversal time caused by too long linked lists. .
It effectively reduces the traversal time caused by excessive management link lists, improves the overall efficiency of the system, reduces cache failure and memory access delay, and improves the speed of command processing.
Smart Images

Figure CN118732959B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a command processing method, system, hard disk and storage medium of a solid state hard disk. Background Art
[0002] Solid State Disk (Solid State Drive, SSD for short), also known as solid-state drive, is a hard disk made of a solid-state electronic storage chip array. Compared with traditional mechanical hard disks, solid-state drives have no rotating parts, faster data reading speeds, better shock resistance, lower power consumption, smaller size, and longer life.
[0003] For SSDs, lower read latency is very important. Lower read latency means that data can be extracted from the storage medium to the system memory faster, which significantly improves the startup of the operating system, the loading of applications, and the execution of data-intensive tasks. Especially in scenarios where a large number of small files need to be accessed quickly, lower read latency can significantly reduce waiting time and improve work efficiency.
[0004] In a Chinese patent with patent announcement number CN117055820B, a command processing method for a solid-state drive, a solid-state drive, and a storage medium are disclosed. The scheme mainly includes obtaining and parsing the command to be processed, adding the command to the management list of the corresponding channel according to the parsed result, and marking it as a pending state, and executing the command from the head of the management list. However, the scheme ignores the situation that the management list may be too long, and a long management list will lead to a longer actual time to traverse the list, which will increase the delay and affect the overall efficiency of the system. Summary of the invention
[0005] The purpose of the present invention is to provide a command processing method, system, hard disk and storage medium for a solid state hard disk to solve the above technical problems.
[0006] The purpose of the present invention can be achieved through the following technical solutions:
[0007] A command processing method for a solid state drive comprises the following steps:
[0008] S1: within a preset evaluation period T, obtaining execution information of a target command, wherein the target command is a command to be processed corresponding to each node in the management linked list, and the execution information includes the time when the target command is inserted into the management linked list and the time when the execution of the target command begins;
[0009] Determine the time interval S a =t a+1 -t a , t aIndicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold;
[0010] S2: Sort the time intervals in the order of the time axis, and use the sorting position as the horizontal axis and the time interval as the vertical axis to generate data points, fit the data points to obtain a fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval;
[0011] Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys;
[0012] The process of determining the value range specifically includes:
[0013] Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval;
[0014] S3: Calculate the correction coefficient K through a formula, and modify the length of the management chain table according to the correction coefficient.
[0015] As a further solution of the present invention: in the step S3, the process of correcting the length of the management chain table according to the correction coefficient specifically includes:
[0016] The formula for calculating the correction coefficient K is specifically:
[0017] ;
[0018] Wherein, ε represents the preset correction coefficient;
[0019] Calculate the corrected length , L represents the length of the preset management chain list, It means that L*K is rounded down, and when the length of the management chain list reaches the correction length L', a new management chain list is generated.
[0020] As a further solution of the present invention: when the correction length L'≤Lys, an early warning message is sent to remind the staff, and Lys represents a preset correction length threshold.
[0021] As a further solution of the present invention: in the step S1, when the average time interval S'≥2Sys, the subsequent steps are not executed, and the correction length L'=Lys.
[0022] As a further solution of the present invention: the step S1 further includes the following steps:
[0023] Calculate the time ratio D a =T a / S a , T a Indicates the actual execution time of the target command when it is executed for the ath time. When the time ratio D a ≥0.75, let S a =D a *S a As a further solution of the present invention: in the step S1, the process of calculating the average time interval further includes the following steps:
[0024] The difference between the time interval j and the average time interval is calculated, and when the difference is greater than or equal to a preset difference threshold, the time interval j is removed, and the average time interval is calculated again.
[0025] A command processing system for a solid state hard disk, comprising:
[0026] The judgment module obtains the execution information of the target command within the preset evaluation period T, wherein the target command is the command to be processed corresponding to each node in the management chain table, and the execution information includes the time when the target command is inserted into the management chain table and the time when the target command is started to be executed;
[0027] Determine the time interval S a =t a+1 -t a , t a Indicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold;
[0028] Optimization module: sort the time intervals in the order of the time axis, and use the sorting position as the horizontal coordinate and the time interval as the vertical coordinate to generate data points, fit the data points to obtain the fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval;
[0029] Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys;
[0030] The process of determining the value range specifically includes:
[0031] Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval;
[0032] Correction module: calculates the correction coefficient K through a formula, and corrects the length of the management chain list according to the correction coefficient.
[0033] A hard disk for command processing of a solid-state hard disk comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a method for command processing of a solid-state hard disk when executing the computer program.
[0034] A storage medium for command processing of a solid state hard disk, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the processor executes the steps of a command processing method for a solid state hard disk.
[0035] Beneficial effects of the present invention: In the present invention, first, the execution information of the target command within the evaluation period is obtained, which is the basis for subsequent processing; then the time interval is determined, that is, the time interval between two adjacent executions of the target command, and the average time interval is calculated, and when the average time interval is greater than a preset time interval threshold, it is marked as an adjustment state, that is, the subsequent steps of adjusting the length of the management linked list are started; it is worth noting that when the length of the linked list is longer, the time required to traverse the entire linked list will become longer, and each time a target command is processed, it is necessary to traverse from the head to the tail of the linked list, which will consume more processing time, so when the average time interval is greater than the preset time interval threshold, the length of the management linked list needs to be adjusted; then the fitting curve is determined according to the time interval and the timeout degree is determined, and the timeout ratio is determined according to the preset value range, that is, the quantified time interval is greater than the preset time interval The threshold situation is used as the basis for the subsequent calculation of the correction coefficient; it is worth noting that the value interval is used to determine which time intervals in the evaluation period are greater than the preset time interval threshold, thereby reducing the amount of data processed subsequently and improving the efficiency of correcting the length of the management chain table; finally, the correction coefficient is calculated, and the length of the management chain table is corrected according to the correction coefficient, so as to avoid the increase in traversal time caused by the excessive length of the management chain table; although the time complexity of a single long chain table and multiple short chain tables is the same, the actual traversal time may be longer due to some reasons, such as the data of the short chain table in the memory is more concentrated and more likely to be hit by the cache, and the data distribution of the long chain table is more dispersed, resulting in a higher probability of cache failure, thereby increasing the memory access time, and the short chain table can better utilize the CPU cache, thereby reducing the delay of cache failure and memory access, and improving the overall traversal speed. The present invention can adjust the maximum length of the management chain table according to the execution of the target command to avoid the decrease in work efficiency due to the excessive length of the management chain table. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The present invention will be further described below in conjunction with the accompanying drawings.
[0037] Figure 1 It is a flow chart of a command processing method for a solid state hard disk of the present invention. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] See also Figure 1 As shown, the present invention is a command processing method for a solid state hard disk, comprising the following steps:
[0040] S1: within a preset evaluation period T, obtaining execution information of a target command, wherein the target command is a command to be processed corresponding to each node in the management linked list, and the execution information includes the time when the target command is inserted into the management linked list and the time when the execution of the target command begins;
[0041] Determine the time interval S a =t a+1 -t a , t a Indicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold;
[0042] S2: Sort the time intervals in the order of the time axis, and use the sorting position as the horizontal axis and the time interval as the vertical axis to generate data points, fit the data points to obtain a fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval;
[0043] Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys;
[0044] The process of determining the value range specifically includes:
[0045] Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval;
[0046] S3: Calculate the correction coefficient K through a formula, and modify the length of the management chain table according to the correction coefficient.
[0047] It should be noted that first, the execution information of the target command within the evaluation period is obtained, which is the basis for subsequent processing; then the time interval is determined, that is, the time interval between two adjacent executions of the target command, and the average time interval is calculated, and when the average time interval is greater than the preset time interval threshold, it is marked as an adjustment state, that is, the subsequent steps of adjusting the length of the management linked list are started; it is worth noting that when the length of the linked list is longer, the time required to traverse the entire linked list will become longer. Each time a target command is processed, it is necessary to traverse from the head to the tail of the linked list, which will consume more processing time. Therefore, when the average time interval is greater than the preset time interval threshold, the length of the management linked list needs to be adjusted; then, the fitting curve is determined according to the time interval and the timeout degree is determined, and the timeout ratio is determined according to the preset value range, that is, the quantified time interval is greater than the preset time interval threshold. The situation is used as the basis for the subsequent calculation of the correction coefficient; it is worth noting that the value range is used to determine which time intervals in the evaluation period are greater than the preset time interval threshold, thereby reducing the amount of data processed subsequently and improving the efficiency of correcting the length of the management linked list; finally, the correction coefficient is calculated, and the length of the management linked list is corrected according to the correction coefficient, so as to avoid the increase in traversal time caused by the excessive length of the management linked list; although the time complexity of a single long linked list and multiple short linked lists is the same, the actual traversal time may be longer due to certain reasons, such as the data of the short linked list in the memory is more concentrated and more likely to be hit by the cache, and the data distribution of the long linked list is more dispersed, resulting in a higher probability of cache failure, thereby increasing the memory access time, and the short linked list can make better use of the CPU cache, thereby reducing the delay of cache failure and memory access, and improving the overall traversal speed.
[0048] In a preferred embodiment of the present invention, in step S3, the process of correcting the length of the management chain table according to the correction coefficient specifically includes:
[0049] The formula for calculating the correction coefficient K is specifically:
[0050] ;
[0051] Wherein, ε represents the preset correction coefficient;
[0052] Calculate the corrected length , L represents the length of the preset management chain list, It means that L*K is rounded down, and when the length of the management chain list reaches the correction length L', a new management chain list is generated.
[0053] It is worth noting that the larger the timeout ratio C is, the higher the proportion of time intervals greater than the time interval threshold in the value interval is. Therefore, the correction coefficient should be reduced to reduce the correction length, so that the long linked list becomes a short linked list. The relationship between the remaining parameters and the correction coefficient is determined by analogy with the above relationship. ε can be set by experience and will not be elaborated here.
[0054] In a preferred embodiment of the present invention, when the correction length L'≤Lys, an early warning message is sent to remind the staff, and Lys represents a preset correction length threshold.
[0055] It can be understood that when the correction length L'≤Lys, it can reflect that the current load situation has exceeded the normal range, and congestion and processing bottlenecks may have occurred. By sending early warning information and notifying the staff in time, they can be prompted to take necessary measures, such as increasing processing resources, optimizing algorithms or diverting tasks, to alleviate the pressure on the system and avoid further deterioration of performance; the specific value of Lys can be set by experience.
[0056] In a preferred embodiment of the present invention, in the step S1, when the average time interval S'≥2Sys, the subsequent steps are not executed, and the correction length L'=Lys.
[0057] It should be noted that when the average time interval S'≥2Sys, it means that the command has been waiting and processed in the queue for too long, and the system processing speed has slowed down. By directly setting the correction length L'=Lys, adjustments can be made quickly without the need to determine the correction length through complex calculations, thereby simplifying the processing flow and quickly responding to the current overload state.
[0058] In a preferred embodiment of the present invention, the step S1 further includes the following steps:
[0059] Calculate the time ratio D a =T a / S a , T a Indicates the actual execution time of the target command when it is executed for the ath time. When the time ratio D a ≥0.75, let S a =D a *S a .
[0060] It should be noted that when D a When ≥0.75, it means that the reason for the large time interval is not waiting for the target command to be executed, but the time interval is increased due to other reasons, such as the complexity of the target command. Specifically, when the time ratio D a≥0.75, indicating that in this execution cycle, the actual execution time T a occupies a larger proportion, resulting in the overall time interval S a Increase. At this time, if the unadjusted time interval is used directly for subsequent analysis, it may mislead the system optimization decision. The above method can effectively filter out the impact of increased execution time due to command complexity or other non-traversal factors, so that the system can be evaluated and optimized based on more real and accurate time interval data.
[0061] In a preferred embodiment of the present invention, in step S1, the process of calculating the average time interval further includes the following steps:
[0062] The difference between the time interval j and the average time interval is calculated, and when the difference is greater than or equal to a preset difference threshold, the time interval j is removed, and the average time interval is calculated again.
[0063] It can be understood that by removing the time interval j that differs too much from the average time interval, outliers can be excluded to obtain a more accurate and stable average time interval; ensuring that the calculated average time interval can more truly reflect the normal operating status of the system rather than being disturbed by a few outliers; by excluding outliers, the correction length of the linked list can be adjusted more accurately, thereby optimizing system performance.
[0064] A command processing system for a solid state hard disk, comprising:
[0065] The judgment module obtains the execution information of the target command within the preset evaluation period T, wherein the target command is the command to be processed corresponding to each node in the management chain table, and the execution information includes the time when the target command is inserted into the management chain table and the time when the target command is started to be executed;
[0066] Determine the time interval S a =t a+1 -t a , t a Indicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold;
[0067] Optimization module: sort the time intervals in the order of the time axis, and use the sorting position as the horizontal coordinate and the time interval as the vertical coordinate to generate data points, fit the data points to obtain the fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval;
[0068] Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys;
[0069] The process of determining the value range specifically includes:
[0070] Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval;
[0071] Correction module: calculates the correction coefficient K through a formula, and corrects the length of the management chain list according to the correction coefficient.
[0072] A hard disk for command processing of a solid-state hard disk comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a method for command processing of a solid-state hard disk when executing the computer program.
[0073] A storage medium for command processing of a solid state hard disk, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the processor executes the steps of a command processing method for a solid state hard disk.
[0074] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.
Claims
1. A command processing method for a solid state drive, characterized in that: The following steps are involved: S1: within a preset evaluation period T, obtaining execution information of a target command, wherein the target command is a command to be processed corresponding to each node in the management linked list, and the execution information includes the time when the target command is inserted into the management linked list and the time when the execution of the target command begins; Determine the time interval S a =t a+1 -t a , t a Indicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold; S2: Sort the time intervals in the order of the time axis, and use the sorting position as the horizontal axis and the time interval as the vertical axis to generate data points, fit the data points to obtain a fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval; Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys; The process of determining the value range specifically includes: Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval; S3: Calculate the correction coefficient K through a formula, and modify the length of the management chain table according to the correction coefficient; The process of correcting the length of the management chain table according to the correction coefficient specifically includes: The formula for calculating the correction coefficient K is specifically: ; Wherein, ε represents the preset correction coefficient; The correction length L'=⌊L*K⌋ is calculated, where L represents the length of the preset management chain list, and ⌊L*K⌋ represents rounding down L*K. When the length of the management chain list reaches the correction length L', a new management chain list is generated.
2. A command processing method for a solid state drive according to claim 1, characterized in that: When the correction length L'≤Lys, an early warning message is sent to remind the staff, and Lys represents a preset correction length threshold.
3. A command processing method for a solid state drive according to claim 2, characterized in that: In the step S1, when the average time interval S'≥2Sys, the subsequent steps are not performed, and the correction length L'=Lys.
4. The command processing method of a solid state drive according to claim 1, characterized in that: The step S1 further includes the following steps: Calculate the time ratio D a =T a / S a , T a Indicates the actual execution time of the target command when it is executed for the ath time. When the time ratio D a ≥0.75, let S a =D a *S a .
5. The command processing method of a solid state drive according to claim 1, characterized in that: In the step S1, the process of calculating the average time interval also includes the following steps: The difference between the time interval j and the average time interval is calculated, and when the difference is greater than or equal to a preset difference threshold, the time interval j is removed, and the average time interval is calculated again.
6. A command processing system for a solid state drive, characterized in that: include: The judgment module obtains the execution information of the target command within the preset evaluation period T, wherein the target command is the command to be processed corresponding to each node in the management chain table, and the execution information includes the time when the target command is inserted into the management chain table and the time when the target command is started to be executed; Determine the time interval S a =t a+1 -t a , t a Indicates the time when the target command is executed for the ath time, and calculates the average time interval , n represents the total number of target commands, when the average time interval S'>Sys, it is marked as an adjustment state, and Sys represents a preset time interval threshold; Optimization module: sort the time intervals in the order of the time axis, and use the sorting position as the horizontal coordinate and the time interval as the vertical coordinate to generate data points, fit the data points to obtain the fitting curve f(x), and calculate the degree of timeout , [A', B'] represents the preset value interval; Generate a target set SJH=(A', (A+1)', ..., B') corresponding to the value interval, and calculate the timeout ratio C=sum{b∈SJH|b≥Sys} / (B'-A'), where sum{b∈SJH|b≥Sys} represents the number of elements in the target set that are greater than or equal to Sys; The process of determining the value range specifically includes: Determine the first time interval A in the sorting that is greater than or equal to the time interval threshold, determine the sorting position A' where the time interval A is located, and use the sorting position A' as the lower limit of the value interval; determine the last time interval B in the sorting that is greater than or equal to the time interval threshold, determine the sorting position B' where the time interval B is located, and use the sorting position B' as the upper limit of the value interval; Correction module: calculates the correction coefficient K through a formula, and corrects the length of the management chain list according to the correction coefficient; The process of correcting the length of the management chain table according to the correction coefficient specifically includes: The formula for calculating the correction coefficient K is specifically: ; Wherein, ε represents the preset correction coefficient; The correction length L'=⌊L*K⌋ is calculated, where L represents the length of the preset management chain list, and ⌊L*K⌋ represents rounding down L*K. When the length of the management chain list reaches the correction length L', a new management chain list is generated.
7. A hard disk for processing commands of a solid state hard disk, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a command processing method for a solid state drive as described in any one of claims 1 to 5 when executing the computer program.
8. A storage medium for command processing of a solid state drive, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of a command processing method for a solid state drive as described in any one of claims 1 to 5.
Citation Information
Patent Citations
A command processing method for a solid state hard disk, a solid state hard disk and a storage medium
CN117055820B
Hardware-based solid state disk read command automatic integration method and system
CN114721590A
Data processing method, device and equipment, medium and solid state disk
CN116860170A
Command processing method of solid state disk, solid state disk and storage medium
CN117055820A
Apparatus and method for sorting disk commands on energy used by the disk commands
US20230009029A1
