Method and system for balancing dynamic wear of solid state disk based on data popularity
By monitoring data page access characteristics and channel wear in real time within the solid-state drive (SSD) and employing a dynamic data exchange strategy, the problem of uneven wear between channels under the RAID architecture is solved, achieving proactive balancing of wear and load, and improving the lifespan and performance of the hard drive.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-04-03
AI Technical Summary
In RAID architecture, there is an uneven wear problem between channels of solid-state drives. Existing balancing algorithms cannot actively intervene in the distribution of static data or parity blocks, resulting in the wear rate of the channel where the parity block is located being much higher than that of other channels, and the mapping relationship cannot be adjusted in a targeted manner.
By tracking the access characteristics of data pages through page-level counters, channel wear and load are monitored in real time. Dynamic data exchange is performed based on data popularity and wear imbalance. Three exchange modes are adopted: zero overhead, low overhead, and controllable overhead. Logical mapping table and channel status are optimized, and tolerance coefficient is dynamically adjusted to achieve wear and load balancing.
It effectively reduces additional system overhead, improves the lifespan of solid-state drives and overall I/O response performance, actively intervenes in the mapping relationship between parity blocks and data blocks, and solves the problem of uneven wear between channels.
Smart Images

Figure CN121785524A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of solid-state drive technology, and in particular to a method and system for dynamic wear leveling of solid-state drives based on data heat. Background Technology
[0002] With the widespread application of solid-state drives (SSDs) in the storage field, their high read / write speeds and low power consumption have significantly improved data processing efficiency. To further enhance data reliability, SSDs based on RAID (Redundant Array of Independent Disks) architecture are widely adopted, achieving data redundancy protection by evenly distributing parity blocks across multiple channels. However, in practical applications, due to significant differences in the update frequency of different data blocks (hot data blocks are frequently written, while cold data blocks remain idle for long periods), parity blocks in the same band need to be updated synchronously with any data block update. This results in some channels containing parity blocks having a much higher update frequency than other channels, causing uneven wear across channels. Therefore, achieving wear balancing and load balancing between SSD channels under a RAID architecture has become a key challenge for improving its reliability and performance.
[0003] Existing solid-state drive balancing algorithms mainly monitor the access frequency of data blocks and map frequently written hot data blocks to physical storage areas with fewer erase cycles, while mapping infrequently accessed cold data blocks to areas with more erase cycles, thereby balancing the wear and tear of each channel through dynamic data mapping.
[0004] Regarding the aforementioned technologies, the load balancing algorithm is only triggered when data is updated and cannot actively intervene in the distribution of static data or parity blocks. In a RAID architecture, parity blocks need to be updated synchronously with data blocks, causing the wear rate of the channel in which the parity block resides to be much higher than that of other channels. Furthermore, it is impossible to specifically adjust the mapping relationship between parity blocks and data blocks, exacerbating the wear differences between channels.
[0005] Based on this, this application provides a method and system for dynamic wear leveling of solid-state drives based on data popularity. Summary of the Invention
[0006] To address the issue that wear leveling algorithms only trigger when data is updated, failing to proactively intervene in the distribution of static data or parity blocks, and considering that in RAID architectures, parity blocks need to be updated synchronously with data blocks, causing the wear rate of the channel containing them to be much higher than other channels, and the inability to specifically adjust the mapping relationship between parity blocks and data blocks exacerbates the wear difference between channels, this application provides a dynamic wear leveling method and system for solid-state drives based on data heat.
[0007] Firstly, this application provides a dynamic wear leveling method for solid-state drives based on data popularity, employing the following technical solution: including:
[0008] The access characteristics of each data page in the solid-state drive are tracked by a page-level counter. The access characteristics include write operation frequency, modification cycle and survival time. Based on a preset threshold, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat level labels are marked.
[0009] Real-time data collection of cumulative write counts and I / O request queue lengths for each channel of the solid-state drive, and calculation of wear unevenness and load unevenness;
[0010] Based on the heat level labels, wear unevenness, and load unevenness, data exchange is performed according to the preset exchange mode priority.
[0011] Update the logical mapping table and channel status parameters, calculate the balance between revenue and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio.
[0012] Preferably, the step of tracking the access characteristics of each data page in the solid-state drive using a page-level counter, wherein the access characteristics include write operation frequency, modification cycle, and lifespan, and dynamically classifying data pages into high-hot data, medium-hot data, or cold data based on a preset threshold, and marking corresponding popularity stratification labels, includes:
[0013] Each data page in the solid-state drive is assigned an independent page-level counter, which includes: a write operation counter, which records the number of times the data page is written; a most recently modified timestamp, which records the system time when the data page was last updated; and a creation timestamp, which records the system time when the data page was first written to the solid-state drive.
[0014] Scan the page-level counters of each data page at preset intervals to calculate access characteristic parameters, write operation frequency, modification cycle, and lifespan.
[0015] The write operation frequency is calculated based on the value of the write operation counter and the statistical period. The modification period is the difference between the current system time and the most recent modification timestamp. The survival time is the difference between the current system time and the creation timestamp.
[0016] Based on the write operation frequency, the modification cycle, and the survival time, a preset threshold is compared to perform a layering judgment on the data page to determine the popularity layering tag of the data page;
[0017] The heat index label is updated according to a preset interval or when a data page triggers a write operation. If the heat index label of a data page changes, it is synchronously updated in the logical mapping table of the solid-state drive.
[0018] Preferably, the real-time acquisition of the cumulative write count and I / O request queue length of each channel of the solid-state drive, and the calculation of wear imbalance and load imbalance, includes:
[0019] Scan all channels of the solid-state drive according to a preset cycle and collect channel parameters, including: cumulative write count, I / O request queue length, and read / write request split statistics; cumulative write count refers to the total number of writes from initialization to the current time for each channel; I / O request queue length refers to the sum of the number of read requests and write requests currently waiting to be processed for each channel; read / write request split statistics are obtained by splitting the requests in the I / O request queue into the number of read requests and the number of write requests, where the weight of the write request number is 10 times that of the read request number;
[0020] The average cumulative number of writes for all channels is calculated by summing the cumulative number of writes for each channel and dividing by the total number of channels. For each channel, the absolute value of the difference between its cumulative number of writes and the average cumulative number of writes is used to calculate the channel wear deviation. The wear deviation of all channels is summed and divided by the total number of channels to obtain the wear unevenness, which characterizes the overall wear unevenness.
[0021] Calculate the equivalent load of each channel based on the number of write requests and read requests; sum the equivalent loads of each channel and divide by the total number of channels to calculate the average equivalent load of all channels; for each channel, take the absolute value of the difference between its equivalent load and the average equivalent load to calculate the channel load deviation; sum the load deviations of all channels and divide by the total number of channels to obtain the calculated load imbalance degree, which characterizes the overall load imbalance.
[0022] If the wear unevenness is greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the step of "data exchange based on the heat layering label, wear unevenness and load unevenness" is triggered.
[0023] Preferably, the data exchange based on the heat stratification label, wear unevenness, and load unevenness, according to a preset exchange mode priority, includes:
[0024] When the wear unevenness is determined to be greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the data exchange process is initiated. The exchange mode priority is from high to low as follows: zero-overhead exchange, low-overhead exchange, and controllable-overhead exchange. The exchange trigger conditions are judged in this order according to the priority. If the exchange conditions are met, the corresponding exchange mode is executed and the judgment is terminated. Otherwise, the next mode is judged.
[0025] Zero-overhead swapping means that when there are hot parity blocks and cold data blocks in the current stripe, the original update request is reused to swap their logical mapping addresses without generating additional I / O.
[0026] Low-overhead switching means that if zero-overhead switching is not satisfied, other cold data blocks in the same stripe are traversed, the cold data blocks are moved to the channel where the hot parity block is located, and the parity block is moved to the original channel of the cold data block, generating an additional read request and a write request.
[0027] Controllable overhead swapping means that if zero-overhead swapping and low-overhead swapping are not satisfied, and there is a significant difference in Ut / Vt between the channels containing hot and cold data blocks in the same stripe, then the logical addresses of the two data blocks will be swapped, resulting in two additional read requests and two additional write requests.
[0028] Preferably, after initiating the data exchange process when it is determined that the wear unevenness is greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the process further includes:
[0029] For the target stripe involved in the current write request, the following conditions are checked for zero-overhead switching: the current data block in the current stripe is labeled as cold data; the parity block in the target stripe is labeled as hot data; the cumulative number of writes in the channel where the current data block is located is lower than the cumulative number of writes in the channel where the parity block is located; and the load imbalance in the channel where the parity block is located is higher than the load imbalance in the channel where the current data block is located.
[0030] The predicted wear imbalance and predicted load imbalance of the system after the switch are pre-calculated. The predicted wear imbalance is the sum of the absolute values of the wear deviation of all channels after the switch divided by the total number of channels. The predicted load imbalance is the sum of the absolute values of the load deviation of all channels after the switch divided by the total number of channels. The predicted wear imbalance is less than the wear imbalance and the predicted load imbalance is less than the load imbalance.
[0031] If all conditions for zero-overhead swapping are met, the I / O path of the current write request is reused, and the logical mapping addresses of the current data block and the parity block are directly swapped. No additional read / write requests are generated, and only the address mapping relationship between the two in the logical mapping table is updated.
[0032] If the condition for zero-overhead swapping is not met, then the condition for low-overhead swapping is executed. The other data blocks in the current stripe, excluding the current data block, are traversed to select candidate data blocks that meet the conditions for low-overhead swapping: the heat stratification label of the candidate data block is cold data; the wear level of the channel where the candidate data block is located is lower than the wear level of the channel where the check block is located.
[0033] Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping candidate data blocks with check blocks;
[0034] If there is a candidate data block that meets the low-overhead switching criteria, select the candidate data block with the largest wear deviation and perform the switching: read the contents of the candidate data block and write them to the free physical page of the channel where the check block is located; read the contents of the check block and write them to the free physical page of the channel where the candidate data block was originally located; update the address mapping relationship between the candidate data block and the check block in the logical mapping table. This process generates an additional read request and a write request.
[0035] If the low-overhead swap condition is not met, the controllable-overhead swap condition is checked. All other data blocks in the current stripe are traversed, and the target data block that meets the controllable-overhead swap condition is selected: the target data block's heat stratification label is high-heat data or medium-heat data; the absolute value of the difference between the wear level of the current data block's channel and the wear level of the target data block's channel is greater than half of the wear tolerance coefficient; the absolute value of the difference between the load imbalance of the current data block's channel and the load imbalance of the target data block's channel is greater than half of the load tolerance coefficient.
[0036] Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping the current data block with the target data block;
[0037] If a target data block exists that meets the conditions for controllable overhead exchange, perform the following operations: read the content of the current data block and write it to the free physical page of the channel where the target data block is located; read the content of the target data block and write it to the free physical page of the channel where the current data block was originally located; update the address mapping relationship between the current data block and the target data block in the logical mapping table. This process generates two additional read requests and two additional write requests.
[0038] Preferably, the step of updating the logical mapping table and channel status parameters, calculating the balancing revenue and system overhead, and dynamically adjusting the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio includes:
[0039] Modify the address mapping relationship of the swapped data blocks in the logical mapping table and record the new physical page address; at the same time, update the hotness stratification label field of the data block and synchronize the label of the swapped data block to the corresponding entry in the mapping table.
[0040] For the channels involved in the swap, update their cumulative write count, clear the processed swap-related requests in the I / O request queue of the channel after the swap, and update the waiting priority of the remaining requests.
[0041] Reset the page-level counters of the swapped data blocks. After the cold data block is swapped with the hot data block, the write operation counter of the cold data block is cleared and starts accumulating again, and the last modified timestamp of the hot data block is updated to the current system time.
[0042] The wear leveling benefit is determined based on the difference between the current wear unevenness and the wear unevenness after replacement.
[0043] The difference between the current load imbalance and the load imbalance after the swap determines the load balancing benefit;
[0044] Based on the preset allocation weights, the wear and tear balancing revenue and the load balancing revenue are weighted and summed to obtain the total balancing revenue.
[0045] Based on the type of switching mode executed, the sum of the number of additional read requests and the number of additional write requests generated during the switching process is counted to obtain the additional I / O overhead;
[0046] The memory overhead is calculated by summing the temporary cache space used when updating the statistical logical mapping table with the computational resources used when resetting the page-level counter.
[0047] Based on a preset weight allocation, the additional I / O overhead and memory overhead are weighted and summed to obtain the total system overhead;
[0048] The revenue-cost ratio, which characterizes the balance optimization effect per unit cost, is obtained by dividing the total balance benefit by the total system cost. The tolerance coefficient based on the current load type is then dynamically adjusted based on the revenue-cost ratio.
[0049] Preferably, after obtaining the benefit-cost ratio characterizing the equilibrium optimization effect per unit cost by dividing the total equilibrium benefit by the total system cost, the method further includes:
[0050] When the benefit-to-expense ratio is higher than the first preset threshold, the current exchange mode is determined to be significantly beneficial, and the wear tolerance coefficient and load tolerance coefficient are reduced by the first preset ratio to improve the sensitivity of subsequent exchange triggering.
[0051] When the revenue-to-expense ratio is between the first preset threshold and the second preset threshold, it is determined that revenue and expense are balanced, and the current wear tolerance coefficient and load tolerance coefficient remain unchanged.
[0052] When the cost-benefit ratio is lower than the second preset threshold, the current switching mode is deemed to be too expensive. The wear tolerance coefficient and load tolerance coefficient are increased by the second preset ratio to reduce the probability of triggering unnecessary subsequent switching. The first preset threshold is greater than the second preset threshold, and the first and second preset ratios are adjustment ratios preset based on system requirements. The corrected wear tolerance coefficient and load tolerance coefficient must be limited to the preset boundary range based on the current load type.
[0053] Secondly, this application discloses a dynamic wear leveling device for solid-state drives based on data heat, which adopts the following technical solution, including:
[0054] The heat stratification module is used to track the access characteristics of each data page in the solid-state drive through a page-level counter. The access characteristics include write operation frequency, modification cycle and survival time. Based on a preset threshold, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat stratification tags are marked.
[0055] The load balancing module is used to collect the cumulative write count and I / O request queue length of each channel of the solid-state drive in real time, and to calculate the wear imbalance and load imbalance.
[0056] The data exchange module is used to exchange data based on the heat level label, wear unevenness, and load unevenness, according to the preset exchange mode priority.
[0057] The data iteration module is used to update the logical mapping table and channel status parameters, calculate the balance between revenue and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio.
[0058] Thirdly, this application also provides a control device, the device comprising:
[0059] It includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed, such as the above-described data heat-based dynamic wear leveling method for solid-state drives.
[0060] Fourthly, this application also provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed as described above regarding the dynamic wear leveling method for solid-state drives based on data heat.
[0061] In summary, this application first performs heat-based stratification on data blocks (distinguishing between cold and hot data), monitors the wear level (cumulative write count) and load status (I / O request queue) of each channel in real time, and calculates the wear imbalance and load imbalance. When the imbalance exceeds the tolerance coefficient based on the current load type (random write / sequential write), three data exchange modes are triggered according to priority: Mode 1 exchanges the current data block with the parity block, with zero additional I / O overhead, suitable for scenarios where the wear and load of the channels containing cold data blocks and high-hot parity blocks differ significantly; Mode 2 exchanges other data blocks with the parity block, with low additional overhead, suitable for scenarios where there are other cold data blocks in the same stripe; Mode 3 exchanges the current data block with other data blocks, with controllable overhead, suitable for scenarios where the load of the channels containing hot data blocks needs to be balanced. After the exchange, the logical mapping table is updated to record the new physical page address, heat label, and channel status parameters, and the balancing benefits and system overhead are calculated. The tolerance coefficient is dynamically adjusted by the benefit-to-overhead ratio to achieve adaptive optimization. By employing an active data exchange strategy, it overcomes the passive limitations of traditional dynamic wear leveling, proactively intervenes in the distribution of static data or parity blocks, and adjusts the mapping relationship between parity blocks and data blocks accordingly. This balances channel wear, reduces load concentration, and minimizes additional system overhead, effectively improving the lifespan of solid-state drives and overall I / O response performance. Attached Figure Description
[0062] Figure 1 This is a flowchart illustrating a dynamic wear leveling method for solid-state drives based on data heat.
[0063] Figure 2 This is a structural block diagram of a dynamic wear leveling device for solid-state drives based on data heat. Detailed Implementation
[0064] The following combination Figure 1 - Figure 2 This application will be described in further detail.
[0065] Traditional dynamic wear leveling is only passively triggered when data is updated, and only maps and adjusts the dynamic data that needs to be updated. It cannot actively intervene in the distribution of static data or parity blocks. As a result, in RAID architecture, parity blocks need to be written frequently as data blocks are updated, and the wear rate of the channel where the parity block is located is much higher than that of other channels. Dynamic algorithms cannot specifically adjust the mapping relationship between parity blocks and data blocks.
[0066] This application proactively monitors and triggers data exchange by collecting real-time data on the wear level (cumulative write count), load status (I / O request queue), and data block popularity (cold / hot data tags) of each channel. It calculates wear imbalance and load imbalance, and proactively initiates the data exchange process when both exceed the tolerance coefficient based on the current load type (random write / sequential write). Therefore, the system proactively determines whether to trigger exchange and selects the optimal mode based on preset conditions (such as data block popularity, channel wear level, and load intensity), rather than passively waiting for data updates. This overcomes the limitations of traditional dynamic wear leveling, which relies solely on data update triggers and cannot proactively intervene in the distribution of check blocks and static data, achieving proactive and precise control over channel wear and load.
[0067] Reference Figure 1 The embodiments of this application include at least steps S10 to S40.
[0068] S10 tracks the access characteristics of each data page in the solid-state drive through a page-level counter. The access characteristics include write operation frequency, modification cycle and survival time. Based on a preset threshold, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat level labels are marked.
[0069] S20 collects the cumulative write count and I / O request queue length of each channel of the solid-state drive in real time, and calculates the wear imbalance and load imbalance.
[0070] S30 exchanges data based on heat-level labels, wear unevenness, and load unevenness, according to the preset exchange mode priority.
[0071] S40, update the logical mapping table and channel status parameters, calculate the balance benefit and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the benefit-to-overhead ratio.
[0072] Specifically, the system first performs heat-based stratification of data blocks, monitors the wear and load of each channel in real time, and calculates wear and load imbalance. When the imbalance exceeds the tolerance coefficient based on the current load type (random write / sequential write), three data exchange modes are triggered according to priority. After the exchange, the logical mapping table is updated to record the new physical page address, heat label, and channel status parameters. The balancing benefits and system overhead are calculated, and the tolerance coefficient is dynamically adjusted based on the benefit-to-overhead ratio to achieve adaptive optimization. This proactive data exchange strategy overcomes the passive limitations of traditional dynamic wear balancing, actively intervenes in the distribution of static data or parity blocks, and specifically adjusts the mapping relationship between parity blocks and data blocks. While balancing channel wear and reducing load concentration, it also reduces additional system overhead, effectively improving the lifespan of the SSD and overall I / O response performance.
[0073] In some embodiments, step S10 specifically includes the following steps: allocating an independent page-level counter for each data page in the solid-state drive (SSD), the page-level counter including: a write operation counter, recording the number of times the data page is written; a last modified timestamp, recording the system time when the data page was last updated; and a creation timestamp, recording the system time when the data page was first written to the SSD; scanning the page-level counters of each data page according to a preset interval, calculating access characteristic parameters, write operation frequency, modification period, and lifetime; the write operation frequency is calculated based on the value of the write operation counter and the statistical period, the modification period is the difference between the current system time and the last modified timestamp, and the lifetime is the difference between the current system time and the creation timestamp; comparing the write operation frequency, modification period, and lifetime with a preset threshold, performing a stratification judgment on the data pages, and determining the hotness stratification label of the data pages; updating the hotness stratification label according to a preset interval or when a data page triggers a write operation, and if the hotness stratification label of the data page changes, synchronously updating it to the logical mapping table of the SSD.
[0074] Specifically, page-level counters are assigned to data pages. Write operation counters record the number of writes, the most recent modification timestamp, and the creation timestamp to record the access sequence. The counters are periodically scanned to calculate access characteristic parameters, where write operation frequency reflects data update intensity (number of writes / statistical period), modification period reflects recent activity (current time - most recent modification time), and survival time characterizes the data lifecycle (current time - creation time). These parameters are compared with preset thresholds to achieve heat stratification (e.g., high frequency, short cycle, short survival time indicate hot data, and vice versa for cold data). Tags are dynamically updated at preset intervals or based on write operations, and changes are synchronized to the logical mapping table. By quantifying data page access characteristics, precise heat stratification is achieved, providing a basis for proactive data exchange, ensuring that wear and load balancing strategies are triggered as needed, and improving the targeting and dynamic adaptability of the optimization mechanism.
[0075] In some embodiments, step S20 specifically includes the following steps: scanning all channels of the solid-state drive according to a preset period, collecting channel parameters, including: cumulative write count, I / O request queue length, and read / write request split statistics; cumulative write count refers to the total number of writes from initialization to the current moment for each channel; I / O request queue length refers to the sum of the number of read requests and the number of write requests currently waiting to be processed for each channel; read / write request split statistics are obtained by splitting the requests in the I / O request queue into the number of read requests and the number of write requests, where the weight of the write request number is 10 times that of the read request number; summing the cumulative write counts of each channel and dividing by the total number of channels to calculate the average cumulative write count of all channels; for each channel, taking the absolute value of the difference between its cumulative write count and the average cumulative write count. Calculate the wear deviation of each channel; sum the wear deviations of all channels and divide by the total number of channels to obtain the wear imbalance degree, which characterizes the overall wear imbalance; calculate the equivalent load of each channel based on the number of write requests and read requests; sum the equivalent loads of each channel and divide by the total number of channels to calculate the average equivalent load of all channels; for each channel, take the absolute value of the difference between its equivalent load and the average equivalent load to calculate the channel load deviation; sum the load deviations of all channels and divide by the total number of channels to obtain the calculated load imbalance degree, which characterizes the overall load imbalance; if the wear imbalance degree is greater than the wear tolerance coefficient or the load imbalance degree is greater than the load tolerance coefficient, the step of "data exchange based on heat level label, wear imbalance degree and load imbalance degree" is triggered.
[0076] Traditional data exchange operations generate two additional read requests and two additional write requests, significantly increasing optimization costs and reducing optimization effectiveness. This application addresses the issue of wear and load imbalance through data exchange operations to improve the overall performance of the solid-state drive. To reduce the additional costs associated with data exchange, this application establishes a mathematical model that comprehensively considers the hotness of the data itself and the wear and load conditions between channels. This model evaluates the balance of wear and I / O workload across channels. The model guides this mechanism to achieve maximum system benefits with minimal exchange costs, and more accurately selects suitable data exchange objects and exchange modes. Specifically:
[0077] Channel wear level (total number of writes): ;
[0078] Channel I / O load level (read / write request equivalent load): ;
[0079] in, Here, is the channel number, N is the total number of channels, s is the stripe number, and P is the total number of stripes. =1 / 10, meaning the weight of a read operation is 1 / 10 of that of a write operation. The number of times a stripe is written indicates the number of times the stripe is written. The cumulative number of writes to the s-th data block of the channel. Strip read count, number The cumulative number of reads of the s-th data block in the channel.
[0080] To quantify the differences in wear status across channels, the average cumulative write count for all channels is calculated, and the deviation of the cumulative write count of a single channel from the average value is used as the wear deviation. The overall wear unevenness is then obtained using the following formula:
[0081] ;
[0082] in, Let N be the cumulative number of writes to the i-th channel, and N be the total number of channels on the SSD. This represents the average cumulative number of writes.
[0083] Channel wear deviation: ;
[0084] .
[0085] The write request weight is set to 10 times that of the read request weight, and the load imbalance is calculated based on the deviation of the equivalent load. The corresponding processing steps are as follows:
[0086] Equivalent load: ;
[0087] in, Let be the current number of read requests for the i-th channel. This represents the current write request count for the i-th channel.
[0088] Average equivalent load: ;
[0089] Channel load deviation:
[0090] .
[0091] The above calculation formula quantifies the wear and load imbalance of solid-state drives, providing a mathematical basis for data exchange operations.
[0092] Specifically, the system scans all channels of the SSD at preset intervals, collecting cumulative write counts, I / O request queue lengths, and read / write request split statistics. The cumulative write count is the total number of writes from initialization to the current state for each channel. The I / O request queue length is the sum of waiting read and write requests. In the read / write split statistics, the weight of the write request count is 10 times that of the read request count. The average cumulative write count for all channels is calculated. The absolute difference between the cumulative write count for each channel and the average is the channel wear deviation. The sum of all wear deviations divided by the total number of channels yields the wear imbalance degree, which characterizes the overall wear unevenness. Based on the read / write request counts and weights, the equivalent load for each channel is calculated. After calculating the average equivalent load, the absolute difference between the equivalent load for each channel and the average is calculated as the load deviation. The sum of all load deviations divided by the total number of channels yields the load imbalance degree. If the wear imbalance degree exceeds the wear tolerance coefficient or the load imbalance degree exceeds the load tolerance coefficient, data exchange is triggered. This quantifies the unevenness of channel wear and load, enabling proactive and precise triggering of data exchange. This provides a decision-making basis for wear and load balancing optimization, ensuring that balancing strategies are activated as needed to improve SSD lifespan and performance.
[0093] In some embodiments, step S30 specifically includes the following steps: when it is determined that the wear imbalance is greater than the wear tolerance coefficient or the load imbalance is greater than the load tolerance coefficient, the data exchange process is started. The exchange mode priority from high to low is: zero-overhead exchange, low-overhead exchange, and controllable-overhead exchange. The exchange conditions are determined in order of priority. If the exchange conditions are met, the corresponding exchange mode is executed and the determination is terminated. Otherwise, the next mode is determined. Zero-overhead exchange means that when there are hot parity blocks and cold data blocks in the current stripe, the original update request is reused to exchange the logical mapping addresses of the two without generating additional I / O. Low-overhead exchange means that if zero-overhead exchange is not met, other cold data blocks in the same stripe are traversed, and the cold data blocks are moved to the channel where the hot parity blocks are located. At the same time, the parity blocks are moved to the original channel of the cold data blocks, generating 1 additional read request and 1 additional write request. Controllable-overhead exchange means that if neither zero-overhead exchange nor low-overhead exchange is met, and there is a significant difference in Ut / Vt between the channels where the hot and cold data blocks are located in the same stripe, the logical addresses of the two data blocks are exchanged, generating 2 additional read requests and 2 additional write requests.
[0094] Specifically, when wear or load imbalance exceeds the tolerance coefficient, the data exchange process is initiated. The trigger conditions are prioritized according to zero overhead, low overhead, and controllable overhead. If the conditions are met, the corresponding mode is executed and the process terminates. Zero-overhead exchange refers to the exchange of logical mapping addresses between a hot parity block and a cold data block in the current stripe, reusing the original update request without generating additional I / O. Low-overhead exchange refers to the process of traversing other cold data blocks in the same stripe, migrating the cold data block to the channel where the hot parity block is located, and simultaneously migrating the parity block to the original channel of the cold data block, generating one additional read request and one write request. Controllable overhead exchange refers to the exchange of logical addresses between the two data blocks when neither of the first two modes is met and the Ut / Vt difference between the channels containing hot and cold data blocks in the same stripe is significant, generating two additional read requests and two additional write requests. Thus, by prioritizing exchange modes with different overhead, the system actively balances channel wear and load while precisely controlling additional I / O overhead, ensuring the efficiency of the optimization mechanism and a balance between system performance.
[0095] Furthermore, the three switching modes are described in detail, and the corresponding processing steps are as follows: For the target stripe involved in the current write request, the following conditions are determined for zero-overhead switching: the current data block in the current stripe is labeled as cold data; the parity block in the target stripe is labeled as hot data; the cumulative write count of the channel where the current data block is located is lower than the cumulative write count of the channel where the parity block is located; the load imbalance of the channel where the parity block is located is higher than the load imbalance of the channel where the current data block is located; the predicted wear imbalance and predicted load imbalance of the system after switching are pre-calculated, where the predicted wear imbalance is the sum of the absolute values of the wear deviations of all channels after switching divided by the total number of channels, and the predicted load imbalance is the sum of the absolute values of the wear deviations of all channels after switching. The sum of the absolute values of the load deviations divided by the total number of channels, and the predicted wear imbalance is less than the wear imbalance and the predicted load imbalance is less than the load imbalance; if all conditions for zero-overhead switching are met, the I / O path of the current write request is reused, and the logical mapping addresses of the current data block and the parity block are directly swapped without generating additional read / write requests, only updating the address mapping relationship between the two in the logical mapping table; if the conditions for zero-overhead switching are not met, low-overhead switching is performed, traversing other data blocks in the current stripe except for the current data block, and selecting candidate data blocks that meet the conditions for low-overhead switching: the heat stratification label of the candidate data block is cold data; the wear degree of the channel where the candidate data block is located is lower than the wear degree of the channel where the parity block is located. Degree; Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping candidate data blocks with check blocks; If there are candidate data blocks that meet the low-overhead swap judgment conditions, select the candidate data block with the largest wear deviation to perform the swap: read the content of the candidate data block and write it to the free physical page of the channel where the check block is located; read the content of the check block and write it to the free physical page of the channel where the candidate data block was originally located; update the address mapping relationship between the candidate data block and the check block in the logical mapping table, which generates an additional read request and a write request; If the low-overhead swap judgment conditions are not met, perform the controllable overhead swap condition judgment, traverse all other data blocks in the current stripe, and filter out the target data block that meets the controllable overhead swap condition: target data The heat level label for each block is either high-heat or medium-heat data; the absolute value of the difference between the wear level of the current data block's channel and the wear level of the target data block's channel is greater than half of the wear tolerance coefficient; the absolute value of the difference between the load imbalance of the current data block's channel and the load imbalance of the target data block's channel is greater than half of the load tolerance coefficient; pre-calculate the predicted wear imbalance and predicted load imbalance after swapping the current data block with the target data block; if a target data block exists that meets the controllable overhead swap conditions, perform the following operations: read the contents of the current data block and write them to the free physical page of the target data block's channel; read the contents of the target data block and write them to the free physical page of the current data block's original channel;Updating the address mapping between the current data block and the target data block in the logical mapping table generates two additional read requests and two write requests.
[0096] Specifically, for the target stripe, the zero-overhead, low-overhead, and controllable-overhead swap conditions are determined sequentially. Zero-overhead requires the current data block to be cold data and the parity block to be hot data. The current channel's cumulative write count is lower than the parity block channel, and the parity block channel has a higher load imbalance. If both the predicted wear and load imbalance decrease after the pre-calculated swap, the original I / O requests are reused, and the logical addresses of the two blocks are swapped without generating additional read / write requests; only the mapping table is updated. If zero-overhead is not met, low-overhead swapping is performed, traversing other cold data blocks in the same stripe to select candidate blocks. The candidate blocks must have a lower wear in their respective channels than the parity block channel. After the swap, the predicted imbalance decreases. The candidate block with the largest wear deviation is selected and migrated to the parity block channel. Simultaneously, the parity block is migrated to the candidate block's original channel, generating one additional read request and one additional write request, and updating the mapping table. If neither of the first two conditions is met, controllable-overhead swapping is performed, selecting hot or medium-hot target data blocks in the same stripe. The absolute value of the wear and load difference between the current and target channels must exceed half the tolerance coefficient. After the swap, the predicted imbalance decreases. The logical addresses of the two data blocks are swapped, generating two additional read requests and two additional write requests, and updating the mapping table. By classifying and judging different overhead exchange modes, data exchange is precisely triggered according to priority. This actively balances channel wear and load while controlling additional I / O overhead, ensuring the efficiency of the optimization mechanism and the balance of system performance.
[0097] In some embodiments, step S40 specifically includes the following steps: modifying the address mapping relationship of the swapped data blocks in the logical mapping table and recording the new physical page address; simultaneously updating the hotness layering label field of the data block and synchronizing the label of the swapped data block to the corresponding entry in the mapping table; for the channels involved in the swap, updating their cumulative write count, clearing the processed swap-related requests in the I / O request queue of the swapped channel, and updating the waiting priority of the remaining requests; resetting the page-level counter of the swapped data block, wherein after the cold data block and the hot data block are swapped, the write operation counter of the cold data block is cleared to zero and starts accumulating again, and the most recently modified timestamp of the hot data block is updated to the current system time. Wear leveling revenue is determined based on the difference between the current wear imbalance and the wear imbalance after swapping; load leveling revenue is determined based on the difference between the current load imbalance and the load imbalance after swapping; the wear leveling revenue and load leveling revenue are weighted and summed based on preset allocation weights to obtain the total leveling revenue; additional I / O overhead is obtained by summing the number of extra read requests and extra write requests generated during the swapping process, based on the type of swapping mode executed; memory overhead is obtained by summing the temporary cache space occupied when updating the logical mapping table and the computing resources occupied when resetting the page-level counter; additional I / O overhead and memory overhead are weighted and summed based on preset weight allocation to obtain the total system overhead; the revenue-overhead ratio, which characterizes the leveling optimization effect per unit overhead, is obtained by dividing the total leveling revenue by the total system overhead, and the tolerance coefficient based on the current load type is dynamically adjusted based on the revenue-overhead ratio.
[0098] In practice, to evaluate the cost-effectiveness of the balancing strategy, this application defines the "benefit-to-cost ratio" as the basis for dynamically adjusting the tolerance coefficient. Its core is the ratio of balancing benefits to system overhead, where benefits include wear balancing benefits and load balancing benefits, and overhead includes additional I / O overhead and memory overhead. The corresponding processing steps are as follows:
[0099] Total equilibrium payoff: ;
[0100] in, , These represent the wear unevenness before and after the replacement. Don't worry about the load imbalance before and after the swap. , To preset weights, .
[0101] Total system overhead: ;
[0102] in, This is for additional I / O overhead (the sum of additional read requests and write requests during the switching process). This is the memory overhead (the sum of cache usage for logical mapping table updates and computational resource usage for counter resets). , Preset weights.
[0103] Revenue-to-expense ratio: .
[0104] Furthermore, considering the adjustment of the tolerance coefficient, the corresponding processing steps are as follows: When the benefit-to-cost ratio is higher than the first preset threshold, it is determined that the current exchange mode is significantly beneficial, and the wear tolerance coefficient and load tolerance coefficient are reduced by the first preset ratio to improve the sensitivity of subsequent exchange triggering; when the benefit-to-cost ratio is between the first preset threshold and the second preset threshold, it is determined that the benefit and cost are balanced, and the current wear tolerance coefficient and load tolerance coefficient remain unchanged; when the benefit-to-cost ratio is lower than the second preset threshold, it is determined that the current exchange mode is too costly, and the wear tolerance coefficient and load tolerance coefficient are increased by the second preset ratio to reduce the probability of triggering subsequent unnecessary exchanges; wherein, the first preset threshold is greater than the second preset threshold, and the first preset ratio and the second preset ratio are adjustment ratios preset based on system requirements; the corrected wear tolerance coefficient and load tolerance coefficient must be limited within the preset boundary range based on the current load type.
[0105] In practice, based on the cost-benefit ratio, this application dynamically adjusts the wear tolerance coefficient using the following formula. and load tolerance factor To adapt to different load scenarios:
[0106] when ( When the first preset threshold is reached, ;
[0107] when hour,( (For the second preset threshold) ;
[0108] when hour, .
[0109] in, The first preset ratio, The second preset ratio, after correction , Need to meet , These are preset boundary values based on the load type.
[0110] Specifically, the address mapping relationship of the swapped data blocks in the logical mapping table is modified to record the new physical page address. Simultaneously, the data block hotness layering label is updated and synchronized to the corresponding entry in the mapping table. The cumulative write count for the channels involved in the swap is updated. The processed swap-related requests in the I / O request queue are cleared. The page-level counter of the swapped data blocks is reset, the write operation counter for cold data blocks is cleared, and the most recently modified timestamp of hot data blocks is re-accumulated and updated to the current system time. The wear imbalance difference between the current and swapped values is calculated, the wear balancing benefit is calculated, the load imbalance difference is calculated, and the load balancing benefit is calculated. The two are weighted and summed according to preset weights to obtain the total balancing benefit. The sum of the number of additional read requests and additional write requests generated by the swap is the additional I / O overhead. The sum of the temporary cache space and page-level counter reset in the logical mapping table is the memory overhead. The two are weighted and summed according to preset weights to obtain the total system overhead. The total balancing benefit divided by the total system overhead is the benefit-overhead ratio. The tolerance coefficient is dynamically adjusted based on the ratio. When the ratio is higher than the first preset threshold, the wear and load tolerance coefficients are reduced, and the trigger sensitivity is increased. When the ratio is between the first and second preset thresholds, it remains unchanged. When the ratio is lower than the second preset threshold, the tolerance coefficient is increased, and the trigger probability is reduced. The adjustment value is limited to preset boundaries. By updating the mapping relationship and counter, data consistency is ensured, and the benefits and system overhead are quantified and balanced. The tolerance coefficient is dynamically adjusted based on the benefit-to-overhead ratio to achieve adaptive optimization of trigger conditions, balance benefits and overhead, and improve the long-term stability and efficiency of the system.
[0111] The implementation principle of a dynamic wear leveling method for solid-state drives based on data popularity in this application embodiment is as follows: First, data blocks are layered by popularity (distinguishing between cold and hot data). The wear level (cumulative write count) and load status (I / O request queue) of each channel are monitored in real time, and the wear imbalance and load imbalance are calculated. When the imbalance exceeds the tolerance coefficient based on the current load type (random write / sequential write), three data exchange modes are triggered according to priority: Mode 1 is the exchange of the current data block with the parity block, with zero additional I / O overhead, suitable for scenarios where the wear and load of the channels containing cold data blocks and high-hot parity blocks are significantly different; Mode 2 is the exchange of other data blocks with the parity block, with low additional overhead, suitable for scenarios where there are other cold data blocks in the same stripe; Mode 3 is the exchange of the current data block with other data blocks, with controllable overhead, suitable for scenarios where the load of the channels containing hot data blocks needs to be balanced. After the exchange, the logical mapping table is updated to record the new physical page address, popularity label, and channel status parameters, and the balancing benefits and system overhead are calculated. The tolerance coefficient is dynamically adjusted by the benefit-to-overhead ratio to achieve adaptive optimization. By employing an active data exchange strategy, it overcomes the passive limitations of traditional dynamic wear leveling, proactively intervenes in the distribution of static data or parity blocks, and adjusts the mapping relationship between parity blocks and data blocks accordingly. This balances channel wear, reduces load concentration, and minimizes additional system overhead, effectively improving the lifespan of solid-state drives and overall I / O response performance.
[0112] Figure 1 This is a flowchart illustrating a dynamic wear leveling method for solid-state drives based on data popularity in one embodiment. It should be understood that, although... Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows; unless explicitly stated otherwise, there is no strict order requirement for the execution of these steps, and they can be executed in other orders; and Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0113] Based on the same technical concept, referring to Figure 2 This application also provides a dynamic wear leveling device for solid-state drives based on data popularity, which adopts the following technical solution: The device includes:
[0114] The heat stratification module is used to track the access characteristics of each data page in the solid-state drive through page-level counters. The access characteristics include write operation frequency, modification cycle and survival time. Based on preset thresholds, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat stratification labels are marked.
[0115] The load balancing module is used to collect the cumulative write count and I / O request queue length of each channel of the solid-state drive in real time, and to calculate the wear imbalance and load imbalance.
[0116] The data exchange module is used to exchange data based on heat level labels, wear unevenness, and load unevenness, according to the priority of preset exchange modes.
[0117] The data iteration module is used to update the logical mapping table and channel status parameters, calculate the balance between revenue and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio.
[0118] In some embodiments, the heat stratification module is specifically used to assign an independent page-level counter to each data page in the solid-state drive. The page-level counter includes: a write operation counter, which records the number of times the data page is written; a recent modification timestamp, which records the system time when the data page was last updated; and a creation timestamp, which records the system time when the data page was first written to the solid-state drive.
[0119] Scan the page-level counters of each data page at preset intervals to calculate access characteristic parameters, write operation frequency, modification cycle, and lifespan.
[0120] The write operation frequency is calculated based on the value of the write operation counter and the statistical period. The modification period is the difference between the current system time and the most recent modification timestamp, and the lifespan is the difference between the current system time and the creation timestamp.
[0121] Based on the write operation frequency, modification cycle, and lifespan, the data pages are compared with preset thresholds to perform stratification judgment and determine the popularity stratification tags of the data pages.
[0122] The heat index label is updated according to the preset interval or when a data page triggers a write operation. If the heat index label of a data page changes, it is synchronously updated in the logical mapping table of the solid-state drive.
[0123] In some embodiments, the load balancing module is specifically used to scan all channels of the solid-state drive according to a preset period and collect channel parameters, including: cumulative write count, I / O request queue length, and read / write request split statistics; the cumulative write count refers to the total number of writes from initialization to the current time for each channel; the I / O request queue length refers to the sum of the number of read requests and the number of write requests currently waiting to be processed for each channel; the read / write request split statistics are to split the requests in the I / O request queue into the number of read requests and the number of write requests, wherein the weight of the write request number is 10 times that of the read request number;
[0124] The average cumulative number of writes for all channels is calculated by summing the cumulative number of writes for each channel and dividing by the total number of channels. For each channel, the absolute value of the difference between its cumulative number of writes and the average cumulative number of writes is used to calculate the channel wear deviation. The wear deviation of all channels is summed and divided by the total number of channels to obtain the wear unevenness, which characterizes the overall wear unevenness.
[0125] Calculate the equivalent load of each channel based on the number of write requests and read requests; sum the equivalent loads of each channel and divide by the total number of channels to calculate the average equivalent load of all channels; for each channel, take the absolute value of the difference between its equivalent load and the average equivalent load to calculate the channel load deviation; sum the load deviations of all channels and divide by the total number of channels to obtain the calculated load imbalance degree, which characterizes the overall load imbalance.
[0126] If the wear unevenness exceeds the wear tolerance coefficient or the load unevenness exceeds the load tolerance coefficient, the step of "data exchange based on heat layering labels, wear unevenness and load unevenness" is triggered.
[0127] In some embodiments, the data exchange module is specifically used to initiate a data exchange process when it is determined that the wear imbalance is greater than the wear tolerance coefficient or the load imbalance is greater than the load tolerance coefficient. The exchange mode priority is from high to low as follows: zero-overhead exchange, low-overhead exchange and controllable-overhead exchange. The system judges whether the trigger exchange condition is met in this order. If the exchange condition is met, the corresponding exchange mode is executed and the judgment is terminated. Otherwise, the system continues to judge the next mode.
[0128] Zero-overhead swapping means that when there are hot parity blocks and cold data blocks in the current stripe, the original update request is reused to swap their logical mapping addresses without generating additional I / O.
[0129] Low-overhead switching means that if zero-overhead switching is not satisfied, other cold data blocks in the same stripe are traversed, the cold data blocks are moved to the channel where the hot parity block is located, and the parity block is moved to the original channel of the cold data block, generating an additional read request and a write request.
[0130] Controllable overhead swapping means that if zero-overhead swapping and low-overhead swapping are not satisfied, and there is a significant difference in Ut / Vt between the channels containing hot and cold data blocks in the same stripe, then the logical addresses of the two data blocks will be swapped, resulting in two additional read requests and two additional write requests.
[0131] In some embodiments, the data exchange module is specifically used to perform zero-overhead exchange condition judgments for the target stripe involved in the current write request: the current data block in the current stripe is labeled as cold data; the parity block in the target stripe is labeled as hot data; the cumulative number of writes in the channel where the current data block is located is lower than the cumulative number of writes in the channel where the parity block is located; and the load imbalance in the channel where the parity block is located is higher than the load imbalance in the channel where the current data block is located.
[0132] The predicted wear imbalance and predicted load imbalance of the system after the switch are pre-calculated. The predicted wear imbalance is the sum of the absolute values of the wear deviation of all channels after the switch divided by the total number of channels. The predicted load imbalance is the sum of the absolute values of the load deviation of all channels after the switch divided by the total number of channels. The predicted wear imbalance is less than the wear imbalance and the predicted load imbalance is less than the load imbalance.
[0133] If all conditions for zero-overhead swapping are met, the I / O path of the current write request is reused, and the logical mapping addresses of the current data block and the parity block are directly swapped. No additional read / write requests are generated, and only the address mapping relationship between the two in the logical mapping table is updated.
[0134] If the condition for zero-overhead swapping is not met, then the condition for low-overhead swapping is executed. The other data blocks in the current stripe, excluding the current data block, are traversed to select candidate data blocks that meet the conditions for low-overhead swapping: the heat stratification label of the candidate data block is cold data; the wear level of the channel where the candidate data block is located is lower than the wear level of the channel where the check block is located.
[0135] Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping candidate data blocks with check blocks;
[0136] If there is a candidate data block that meets the low-overhead switching criteria, select the candidate data block with the largest wear deviation and perform the switching: read the contents of the candidate data block and write them to the free physical page of the channel where the check block is located; read the contents of the check block and write them to the free physical page of the channel where the candidate data block was originally located; update the address mapping relationship between the candidate data block and the check block in the logical mapping table. This process generates an additional read request and a write request.
[0137] If the low-overhead swap condition is not met, the controllable-overhead swap condition is checked. All other data blocks in the current stripe are traversed, and the target data block that meets the controllable-overhead swap condition is selected: the target data block's heat stratification label is high-heat data or medium-heat data; the absolute value of the difference between the wear level of the current data block's channel and the wear level of the target data block's channel is greater than half of the wear tolerance coefficient; the absolute value of the difference between the load imbalance of the current data block's channel and the load imbalance of the target data block's channel is greater than half of the load tolerance coefficient.
[0138] Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping the current data block with the target data block;
[0139] If a target data block exists that meets the conditions for controllable overhead exchange, perform the following operations: read the content of the current data block and write it to the free physical page of the channel where the target data block is located; read the content of the target data block and write it to the free physical page of the channel where the current data block was originally located; update the address mapping relationship between the current data block and the target data block in the logical mapping table. This process generates two additional read requests and two additional write requests.
[0140] In some embodiments, the data iteration module is specifically used to modify the address mapping relationship of the swapped data blocks in the logical mapping table, record the new physical page address, and update the hotness layering label field of the data block to synchronize the label of the swapped data block to the corresponding entry in the mapping table.
[0141] For the channels involved in the swap, update their cumulative write count, clear the processed swap-related requests in the I / O request queue of the channel after the swap, and update the waiting priority of the remaining requests.
[0142] Reset the page-level counters of the swapped data blocks. After the cold data block is swapped with the hot data block, the write operation counter of the cold data block is cleared and starts accumulating again, and the last modified timestamp of the hot data block is updated to the current system time.
[0143] The wear leveling benefit is determined based on the difference between the current wear unevenness and the wear unevenness after replacement.
[0144] The difference between the current load imbalance and the load imbalance after the swap determines the load balancing benefit;
[0145] Based on the preset allocation weights, the wear and tear balancing revenue and the load balancing revenue are weighted and summed to obtain the total balancing revenue.
[0146] Based on the type of switching mode executed, the sum of the number of additional read requests and the number of additional write requests generated during the switching process is counted to obtain the additional I / O overhead;
[0147] The memory overhead is calculated by summing the temporary cache space used when updating the statistical logical mapping table with the computational resources used when resetting the page-level counter.
[0148] Based on a preset weight allocation, the additional I / O overhead and memory overhead are weighted and summed to obtain the total system overhead;
[0149] The revenue-cost ratio, which characterizes the balance optimization effect per unit cost, is obtained by dividing the total balance benefit by the total system cost. The tolerance coefficient based on the current load type is then dynamically adjusted based on the revenue-cost ratio.
[0150] In some embodiments, the data iteration module is further configured to determine that the current exchange mode is significantly profitable when the benefit-to-cost ratio is higher than a first preset threshold, and reduce the wear tolerance coefficient and load tolerance coefficient by a first preset ratio to improve the sensitivity of subsequent exchange triggering.
[0151] When the revenue-to-expense ratio is between the first preset threshold and the second preset threshold, it is determined that revenue and expense are balanced, and the current wear tolerance coefficient and load tolerance coefficient remain unchanged.
[0152] When the cost-benefit ratio is lower than the second preset threshold, the current switching mode is deemed to be too expensive. The wear tolerance coefficient and load tolerance coefficient are increased by the second preset ratio to reduce the probability of triggering unnecessary subsequent switching. The first preset threshold is greater than the second preset threshold, and the first and second preset ratios are adjustment ratios preset based on system requirements. The corrected wear tolerance coefficient and load tolerance coefficient must be limited to the preset boundary range based on the current load type.
[0153] This application also discloses a control device.
[0154] Specifically, the control device includes a memory and a processor, with the memory storing a computer program that can be loaded by the processor and executed to perform the aforementioned data heat-based dynamic wear leveling method for solid-state drives.
[0155] This application also discloses a computer-readable storage medium.
[0156] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and executed, such as the aforementioned data heat-based solid-state drive dynamic wear leveling method. The computer-readable storage medium includes, for example, various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0157] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for dynamic wear leveling of solid-state drives based on data heat, characterized in that, include: The access characteristics of each data page in the solid-state drive are tracked by a page-level counter. The access characteristics include write operation frequency, modification cycle and survival time. Based on a preset threshold, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat level labels are marked. Real-time data collection of cumulative write counts and I / O request queue lengths for each channel of the solid-state drive, and calculation of wear unevenness and load unevenness; Based on the heat level labels, wear unevenness, and load unevenness, data exchange is performed according to the preset exchange mode priority. Update the logical mapping table and channel status parameters, calculate the balance between revenue and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio.
2. The method for dynamic wear leveling of solid-state drives based on data heat according to claim 1, characterized in that, The method involves tracking the access characteristics of each data page in the solid-state drive using a page-level counter. These access characteristics include write operation frequency, modification cycle, and lifespan. Based on a preset threshold, data pages are dynamically categorized into high-hot, medium-hot, or cold data, and corresponding popularity tier labels are assigned. Each data page in the solid-state drive is assigned an independent page-level counter, which includes: a write operation counter, which records the number of times the data page is written; a most recently modified timestamp, which records the system time when the data page was last updated; and a creation timestamp, which records the system time when the data page was first written to the solid-state drive. Scan the page-level counters of each data page at preset intervals to calculate access characteristic parameters, write operation frequency, modification cycle, and lifespan. The write operation frequency is calculated based on the value of the write operation counter and the statistical period. The modification period is the difference between the current system time and the most recent modification timestamp. The survival time is the difference between the current system time and the creation timestamp. Based on the write operation frequency, the modification cycle, and the survival time, a preset threshold is compared to perform a layering judgment on the data page to determine the popularity layering tag of the data page; The heat index label is updated according to a preset interval or when a data page triggers a write operation. If the heat index label of a data page changes, it is synchronously updated in the logical mapping table of the solid-state drive.
3. The method for dynamic wear leveling of solid-state drives based on data heat according to claim 1, characterized in that, The real-time acquisition of the cumulative write count and I / O request queue length of each channel of the solid-state drive, and the calculation of wear imbalance and load imbalance, include: Scan all channels of the solid-state drive according to a preset cycle and collect channel parameters, including: cumulative write count, I / O request queue length, and read / write request split statistics; cumulative write count refers to the total number of writes from initialization to the current time for each channel; I / O request queue length refers to the sum of the number of read requests and write requests currently waiting to be processed for each channel; read / write request split statistics are obtained by splitting the requests in the I / O request queue into the number of read requests and the number of write requests, where the weight of the write request number is 10 times that of the read request number; The average cumulative number of writes for all channels is calculated by summing the cumulative number of writes for each channel and dividing by the total number of channels. For each channel, the absolute value of the difference between its cumulative number of writes and the average cumulative number of writes is used to calculate the channel wear deviation. The wear deviation of all channels is summed and divided by the total number of channels to obtain the wear unevenness, which characterizes the overall wear unevenness. Calculate the equivalent load of each channel based on the number of write requests and read requests; sum the equivalent loads of each channel and divide by the total number of channels to calculate the average equivalent load of all channels; for each channel, take the absolute value of the difference between its equivalent load and the average equivalent load to calculate the channel load deviation; sum the load deviations of all channels and divide by the total number of channels to obtain the calculated load imbalance degree, which characterizes the overall load imbalance. If the wear unevenness is greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the step of "data exchange based on the heat layering label, wear unevenness and load unevenness" is triggered.
4. The method for dynamic wear leveling of solid-state drives based on data heat according to claim 1, characterized in that, The data exchange based on the heat stratification tags, wear unevenness, and load unevenness, according to a preset exchange mode priority, includes: When the wear unevenness is determined to be greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the data exchange process is initiated. The exchange mode priority is from high to low as follows: zero-overhead exchange, low-overhead exchange, and controllable-overhead exchange. The exchange trigger conditions are judged in this order according to the priority. If the exchange conditions are met, the corresponding exchange mode is executed and the judgment is terminated. Otherwise, the next mode is judged. Zero-overhead swapping means that when there are hot parity blocks and cold data blocks in the current stripe, the original update request is reused to swap their logical mapping addresses without generating additional I / O. Low-overhead switching means that if zero-overhead switching is not satisfied, other cold data blocks in the same stripe are traversed, the cold data blocks are moved to the channel where the hot parity block is located, and the parity block is moved to the original channel of the cold data block, generating an additional read request and a write request. Controllable overhead swapping means that if zero-overhead swapping and low-overhead swapping are not satisfied, and there is a significant difference in Ut / Vt between the channels containing hot and cold data blocks in the same stripe, then the logical addresses of the two data blocks will be swapped, resulting in two additional read requests and two additional write requests.
5. The method for dynamic wear leveling of solid-state drives based on data heat according to claim 4, characterized in that, After initiating the data exchange process when the wear unevenness is determined to be greater than the wear tolerance coefficient or the load unevenness is greater than the load tolerance coefficient, the process further includes: For the target stripe involved in the current write request, the following conditions are checked for zero-overhead switching: the current data block in the current stripe is labeled as cold data; the parity block in the target stripe is labeled as hot data; the cumulative number of writes in the channel where the current data block is located is lower than the cumulative number of writes in the channel where the parity block is located; and the load imbalance in the channel where the parity block is located is higher than the load imbalance in the channel where the current data block is located. The predicted wear imbalance and predicted load imbalance of the system after the switch are pre-calculated. The predicted wear imbalance is the sum of the absolute values of the wear deviation of all channels after the switch divided by the total number of channels. The predicted load imbalance is the sum of the absolute values of the load deviation of all channels after the switch divided by the total number of channels. The predicted wear imbalance is less than the wear imbalance and the predicted load imbalance is less than the load imbalance. If all conditions for zero-overhead swapping are met, the I / O path of the current write request is reused, and the logical mapping addresses of the current data block and the parity block are directly swapped. No additional read / write requests are generated, and only the address mapping relationship between the two in the logical mapping table is updated. If the condition for zero-overhead swapping is not met, then the condition for low-overhead swapping is executed. The other data blocks in the current stripe, excluding the current data block, are traversed to select candidate data blocks that meet the conditions for low-overhead swapping: the heat stratification label of the candidate data block is cold data; the wear level of the channel where the candidate data block is located is lower than the wear level of the channel where the check block is located. Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping candidate data blocks with check blocks; If there is a candidate data block that meets the low-overhead switching criteria, select the candidate data block with the largest wear deviation and perform the switching: read the contents of the candidate data block and write them to the free physical page of the channel where the check block is located; read the contents of the check block and write them to the free physical page of the channel where the candidate data block was originally located; update the address mapping relationship between the candidate data block and the check block in the logical mapping table. This process generates an additional read request and a write request. If the low-overhead swap condition is not met, the controllable-overhead swap condition is checked. All other data blocks in the current stripe are traversed, and the target data block that meets the controllable-overhead swap condition is selected: the target data block's heat stratification label is high-heat data or medium-heat data; the absolute value of the difference between the wear level of the current data block's channel and the wear level of the target data block's channel is greater than half of the wear tolerance coefficient; the absolute value of the difference between the load imbalance of the current data block's channel and the load imbalance of the target data block's channel is greater than half of the load tolerance coefficient. Pre-calculate the predicted wear imbalance and predicted load imbalance after swapping the current data block with the target data block; If a target data block exists that meets the conditions for controllable overhead exchange, perform the following operations: read the content of the current data block and write it to the free physical page of the channel where the target data block is located; read the content of the target data block and write it to the free physical page of the channel where the current data block was originally located; update the address mapping relationship between the current data block and the target data block in the logical mapping table. This process generates two additional read requests and two additional write requests.
6. The method for dynamic wear leveling of solid-state drives based on data heat according to claim 5, characterized in that, The update logic mapping table and channel status parameters are used to calculate the balanced revenue and system overhead, and the tolerance coefficient based on the current load type is dynamically adjusted according to the revenue-to-overhead ratio, including: Modify the address mapping relationship of the swapped data blocks in the logical mapping table and record the new physical page address; at the same time, update the hotness stratification label field of the data block and synchronize the label of the swapped data block to the corresponding entry in the mapping table. For the channels involved in the swap, update their cumulative write count, clear the processed swap-related requests in the I / O request queue of the channel after the swap, and update the waiting priority of the remaining requests. Reset the page-level counters of the swapped data blocks. After the cold data block is swapped with the hot data block, the write operation counter of the cold data block is cleared and starts accumulating again, and the last modified timestamp of the hot data block is updated to the current system time. The wear leveling benefit is determined based on the difference between the current wear unevenness and the wear unevenness after replacement. The difference between the current load imbalance and the load imbalance after the swap determines the load balancing benefit; Based on the preset allocation weights, the wear and tear balancing revenue and the load balancing revenue are weighted and summed to obtain the total balancing revenue. Based on the type of switching mode executed, the sum of the number of additional read requests and the number of additional write requests generated during the switching process is counted to obtain the additional I / O overhead; The memory overhead is calculated by summing the temporary cache space used when updating the statistical logical mapping table with the computational resources used when resetting the page-level counter. Based on a preset weight allocation, the additional I / O overhead and memory overhead are weighted and summed to obtain the total system overhead; The revenue-cost ratio, which characterizes the balance optimization effect per unit cost, is obtained by dividing the total balance benefit by the total system cost. The tolerance coefficient based on the current load type is then dynamically adjusted based on the revenue-cost ratio.
7. A method for dynamic wear leveling of solid-state drives based on data heat according to claim 6, characterized in that, After obtaining the benefit-cost ratio, which characterizes the equilibrium optimization effect per unit cost, by dividing the total equilibrium benefit by the total system cost, the method further includes: When the benefit-to-expense ratio is higher than the first preset threshold, the current exchange mode is determined to be significantly beneficial, and the wear tolerance coefficient and load tolerance coefficient are reduced by the first preset ratio to improve the sensitivity of subsequent exchange triggering. When the revenue-to-expense ratio is between the first preset threshold and the second preset threshold, it is determined that revenue and expense are balanced, and the current wear tolerance coefficient and load tolerance coefficient remain unchanged. When the cost-benefit ratio is lower than the second preset threshold, the current switching mode is deemed to be too expensive. The wear tolerance coefficient and load tolerance coefficient are increased by the second preset ratio to reduce the probability of triggering unnecessary subsequent switching. The first preset threshold is greater than the second preset threshold, and the first and second preset ratios are adjustment ratios preset based on system requirements. The corrected wear tolerance coefficient and load tolerance coefficient must be limited to the preset boundary range based on the current load type.
8. A dynamic wear leveling device for solid-state drives based on data heat, characterized in that, The device includes: The heat stratification module is used to track the access characteristics of each data page in the solid-state drive through a page-level counter. The access characteristics include write operation frequency, modification cycle and survival time. Based on a preset threshold, the data pages are dynamically divided into high-hot data, medium-hot data or cold data, and the corresponding heat stratification tags are marked. The load balancing module is used to collect the cumulative write count and I / O request queue length of each channel of the solid-state drive in real time, and to calculate the wear imbalance and load imbalance. The data exchange module is used to exchange data based on the heat level label, wear unevenness, and load unevenness, according to the preset exchange mode priority. The data iteration module is used to update the logical mapping table and channel status parameters, calculate the balance between revenue and system overhead, and dynamically adjust the tolerance coefficient based on the current load type according to the revenue-to-overhead ratio.
9. A control device, characterized in that, The device includes: It includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer program is stored that can be loaded by a processor and executed as described in any one of claims 1 to 7.
Citation Information
Cited By
Solid state disk service life prediction method and device based on predictive wear leveling
CN122024807A