Differential management method and device for SSD cache, electronic equipment and storage medium
By constructing an interval prediction model and a dynamic cache flushing strategy, SSD cache management was optimized, solving the problem of invalid data being flushed to disk, extending the lifespan of SSDs, and improving system performance.
Patent Information
- Application Number
- CN202511288065.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2026-01-09
AI Technical Summary
Existing SSD caching management strategies cannot intelligently adjust to the actual write behavior of customers when facing rewrite scenarios, resulting in frequent invalid data being written to disk, increasing system power consumption and wear, and reducing the lifespan and performance of SSDs.
By acquiring historical write behavior data, an interval prediction model is constructed. Combined with feature engineering and machine learning algorithms, a rewrite time tier table is generated, and the cache flushing strategy is dynamically adjusted to prioritize the retention of high-priority data and reduce the flushing of invalid data.
It significantly reduces write amplification, extends the lifespan of SSDs, improves system performance and cache space utilization, and adapts to data management needs under complex load scenarios.
Smart Images

Figure CN121300697A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer storage, and particularly relates to a differential management method and device of SSD cache, electronic equipment and storage medium. BACKGROUND
[0002] With the rapid development of big data, cloud computing and artificial intelligence technology, the application scenarios of enterprise-level and industrial-level solid state disks (SSD) are increasingly widespread, and the requirements for storage performance and data reliability are increasingly stringent.
[0003] However, in the existing SSD storage system, a common problem is the write amplification phenomenon, which is mainly caused by the DDR cache mechanism equipped by the SSD disk. When the host performs a write operation on the SSD, the data is first written into the DDR cache to improve performance, and then flushed to the disk at an appropriate time. However, the problem is that if the data is just flushed to the disk, the host sends a write command of the same address or covering data, and the previously written data will become invalid, causing unnecessary disk write operations, i.e. write amplification.
[0004] The traditional SSD cache management strategy often uses a non-discriminatory cache flushing method when facing such rewriting scenarios, and cannot intelligently adjust according to the actual write behavior of the customer. This strategy in the application scenario of high rewriting rate will cause frequent invalid data to be flushed to the disk, aggravating the write amplification effect, not only reducing the service life of the SSD, but also increasing the power consumption and wear of the system.
[0005] Therefore, there is an urgent need for a differential management method of SSD cache that can realize differential management of cache data, reduce invalid data flushing to the disk, reduce write amplification, improve performance, and significantly prolong the service life. SUMMARY
[0006] Embodiments of the present application provide a differential management method of SSD cache to solve the problem that the prior art mostly uses static cache management strategy, which cannot adapt to complex business scenarios, resulting in large performance fluctuations, unreasonable space allocation, and low data management efficiency. The technical solution is as follows:
[0007] According to one aspect of the present application, a differential management method of SSD cache, the method comprises: obtaining historical write behavior data to construct a training set, using a machine learning algorithm to train a model based on the training set, and generating an interval prediction model combined with feature engineering; the historical write behavior data comprises address LBA, data length, and timestamp; obtaining a predicted rewrite time through the interval prediction model, calculating a rewrite interval according to the predicted rewrite time using a statistical method, dividing the rewrite interval according to a preset number of gears to generate a rewrite time gear table; when the usage rate of the SSD cache reaches a set threshold, generating a differential flushing strategy according to the rewrite time gear table and real-time business parameters, and processing data in the SSD cache according to the flushing strategy; the business parameters include IOPS and delay data; when the space of the SSD cache is insufficient, sorting the data in the SSD cache according to the priority in the rewrite time gear table, and sorting according to the interval length of the data to be rewritten when the priority is the same, to generate a data management scheme.
[0008] In one embodiment, obtaining historical write behavior data to construct a training set, using a machine learning algorithm to train a model based on the training set, and generating an interval prediction model through the following steps: recording the LBA, data length, and nanosecond-level timestamp of each write operation in real time, filtering out cold data that is single written and not rewritten, and retaining hot data samples with a repeated write count of ≥3 times; extracting the spatiotemporal features of the LBA, constructing time series features combined with time interval sequences, training a regression model using the LightGBM algorithm, and generating an interval prediction model by minimizing the absolute error between the predicted interval and the true interval; the spatiotemporal features include address clustering and write frequency.
[0009] In one embodiment, obtaining a predicted rewrite time through the interval prediction model through the following steps: obtaining a predicted rewrite time for each write command through the interval prediction model, forming a structured data set according to the write command and the predicted rewrite time, and sorting the structured data set according to the predicted rewrite time.
[0010] In one embodiment, calculating a rewrite interval according to the predicted rewrite time using a statistical method through the following steps: counting the frequency distribution of the structured data set, setting a minimum frequency threshold, filtering low-frequency data according to the minimum frequency threshold, calculating the 95% quantile, removing extreme long-tail data greater than the quantile, calculating the arithmetic mean of the predicted rewrite time according to the processed structured data set, and obtaining the rewrite interval.
[0011] In one of the embodiments, generating the copy time bin table by dividing the copy interval into preset number of bins is achieved by the following steps: arranging the copy interval in ascending order, dividing the initial bin boundary table into preset number of bins at equal frequency, and adjusting the time range of the initial bin in combination with the service pressure; when the service pressure is high, compressing the interval time of the bins ranked in the front 30%, and generating the copy time bin table adapted to the real-time scenario; the service pressure includes IOPS high and low.
[0012] In one of the embodiments, generating the differential underflush strategy according to the copy time bin table and real-time service parameters, and processing the data in the SSD cache according to the underflush strategy is achieved by the following steps: prioritizing the data in the SSD cache according to the copy time bin table, obtaining real-time service parameters, calculating the service pressure index according to the real-time service parameters, and monitoring the real-time service parameters in the underflush process; when the service pressure index exceeds the set range, retaining the data in the bins ranked in the front 30%, when the service pressure index is within the set range, retaining the data in the bins ranked in the front 60%, and when the service pressure index does not reach the set range, retaining the data in the bins ranked in the front 90%.
[0013] In one of the embodiments, sorting the data in the SSD cache according to the priority in the copy time bin table, and sorting according to the interval length of the data to be copied when the priority is the same, and generating the data management scheme is achieved by the following steps: sorting the data in the SSD cache according to the copy time bin table, marking the data in the SSD cache exceeding the underflush threshold of the SSD cache as the conflict area; for the conflict area, preferentially underflushing the data of low priority bins according to the copy time bin table, and if the priority is the same, sorting according to the interval length of the data to be copied, and preferentially underflushing the data whose interval length to be copied is greater than the set value.
[0014] According to one aspect of the present application, a differential management device of an SSD cache comprises: a behavior prediction module configured to obtain historical write behavior data to construct a training set, to train a model based on the training set using a machine learning algorithm, and to generate an interval prediction model in combination with feature engineering; the historical write behavior data comprises an address LBA, a data length, and a timestamp; a gear division module configured to obtain a predicted rewrite time by the interval prediction model, to calculate a rewrite interval according to the predicted rewrite time using a statistical method, and to generate a rewrite time gear table by dividing the rewrite interval according to a preset number of gears; a differential flushing module configured to generate a differential flushing strategy according to the rewrite time gear table and real-time service parameters when a usage rate of the SSD cache reaches a set threshold, and to process data in the SSD cache according to the flushing strategy; the service parameters comprise IOPS and delay data; and a dynamic flushing module configured to sort data in the SSD cache according to a priority in the rewrite time gear table when a space of the SSD cache is insufficient, and to sort the data according to an interval length when the data is to be rewritten when the priority is the same, and to generate a data management scheme.
[0015] According to one aspect of the present application, an electronic device comprises at least one processor and at least one memory, wherein the memory stores computer readable instructions; the computer readable instructions are executed by one or more processors, so that the electronic device implements the differential management method of the SSD cache as described above.
[0016] According to one aspect of the present application, a storage medium stores computer readable instructions, which are executed by one or more processors to implement the differential management method of the SSD cache as described above.
[0017] The technical scheme provided by the present application has the beneficial effects that:
[0018] In the technical solution, the historical write behavior data (containing LBA, data length, and timestamp) is first acquired, and a prediction model is generated by feature engineering and LightGBM algorithm training to accurately predict the rewrite time of the write command. Then, statistical methods are used to filter the frequency and truncate the long tail of the prediction results, and the arithmetic mean is calculated to obtain the rewrite interval. Based on the equal frequency classification and business pressure (IOPS, delay), a rewrite time rating table is dynamically generated to realize data priority layering. When the cache usage or space is insufficient, the system calculates the pressure index based on real-time business parameters (IOPS, delay), and differentiates to generate a flushing strategy: when the pressure is high, the high-priority rating (such as the top 30%) data is preferentially retained, and when the pressure is low, the retention range is expanded (such as the top 90%), ensuring that critical business data is preferentially retained in the cache. This method realizes accurate balance of cache space allocation and business performance through model prediction, statistical optimization, and real-time parameter fusion, significantly improves data management efficiency in complex load scenarios, effectively solves the performance fluctuations and space waste problems caused by the static nature of traditional cache strategies, and significantly reduces the frequency of repeated data writing through intelligent data deduplication and dynamic flushing mechanism, avoiding the wear and tear of SSD life caused by write amplification effect. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0020] Figure 1 is a flow chart of a differential management method of an SSD cache according to an exemplary embodiment;
[0021] Figure 2 is a block diagram of a differential management device of an SSD cache according to an exemplary embodiment;
[0022] Figure 3 is a hardware structure diagram of an electronic device according to an exemplary embodiment;
[0023] Figure 4 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0024] The embodiments of the present application will be described in detail below, and examples of the embodiments are shown in the drawings, wherein the same or similar reference signs represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present application, and cannot be interpreted as a limitation on the present application.
[0025] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a," "an," and "the" as used herein are intended to include plural forms as well. It should be further understood that the terms "comprising," "including," "containing," "characterized by," and the like, when used in the specification, specify the presence of stated features, integers, steps, operations, elements, and / or components but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements can also be present. In addition, the word "connected" or "coupled" as used herein can include wirelessly connected or wirelessly coupled. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0026] The application provides a differential management method of SSD cache, which realizes accurate balance of SSD cache space and service performance by constructing interval prediction model and dynamic overwrite gear table, combining real-time service parameter differentiation to formulate cache flushing and retention strategy, effectively solves the problems of large performance fluctuation and low space utilization rate of traditional management method in complex scenarios, and the differential management method of SSD cache is suitable for a differential management device of SSD cache, which can be an electronic device. The differential management method of SSD cache in the embodiment of the application can be applied to various scenes, such as management of SSD cache temporary folder and the like.
[0027] Please refer to Figure 1 The embodiment of the application provides a differential management method of SSD cache, which is suitable for an electronic device.
[0028] In the following method embodiment, in order to facilitate description, the execution subject of each step of the method is taken as an example for description, but this does not constitute a specific limitation.
[0029] As Figure 1 indicated, the method can include the following steps:
[0030] In step 110, historical write behavior data is acquired to construct a training set, a machine learning algorithm is used to train a model based on the training set, and an interval prediction model is generated in combination with feature engineering.
[0031] In a possible implementation, the LBA, data length and nanosecond-level timestamp of each write operation are recorded in real time, cold data with single write and no rewriting is filtered out, and hot data samples with repeated writing times greater than or equal to 3 are retained; the spatiotemporal features of the LBA are extracted, the timing sequence is constructed in combination with the time interval sequence, a regression model is trained by using the LightGBM algorithm, and an interval prediction model is generated by minimizing the absolute error of the predicted interval and the real interval.
[0032] The spatiotemporal features include address clustering and writing frequency, and the historical writing behavior data includes address LBA, data length, timestamp, etc., which are not limited herein.
[0033] Specifically, the LBA, data length and nanosecond-level timestamp of each write operation are recorded in real time, cold data with single write and no rewriting is filtered out, and hot data samples with repeated writing times greater than or equal to 3 are retained, and the spatiotemporal features (such as address clustering and writing frequency) of the LBA are extracted, and the timing sequence is constructed in combination with the time interval sequence.
[0034] The historical writing behavior data can be obtained by artificial intelligence, and other behavior prediction methods (such as statistical rules and rule engines) can also be applicable, which are not limited herein.
[0035] Further, the regression model is trained by using the LightGBM algorithm, and the interval prediction model is generated by minimizing the absolute error of the predicted interval and the real interval. The hot data samples are focused, the invalid calculation is reduced, the model prediction accuracy is improved, the spatiotemporal features are extracted in combination with the timing analysis, and the capture ability of the rewriting rules is enhanced.
[0036] In the above process, the model can accurately predict the rewriting time by focusing on the hot data and optimizing the feature engineering, providing a high-reliability prediction basis and realizing dynamic perception of the user rewriting behavior.
[0037] In step 120, the predicted rewriting time is obtained by the interval prediction model, the rewriting interval is calculated according to the predicted rewriting time by using a statistical method, and the rewriting interval is divided into rewriting time interval tables according to a preset number of intervals.
[0038] In a possible implementation, the predicted rewriting time of each write command is obtained by the interval prediction model, a structured data set is formed according to the write command and the predicted rewriting time, and the structured data set is sorted according to the predicted rewriting time.
[0039] In a possible implementation, the frequency distribution of the structured data set is counted, a minimum frequency threshold is set, low-frequency data is filtered according to the minimum frequency threshold, the 95% quantile is calculated, extreme long-tail data greater than the quantile is removed, the arithmetic mean of the predicted rewriting time is calculated according to the processed structured data set, and the rewriting interval is obtained.
[0040] In a possible implementation, the rewrite intervals are arranged in ascending order, an initial gear boundary table is generated by equal-frequency division according to a preset number of gears, and the time range of the initial gears is adjusted in combination with service pressure; when the service pressure is high, the interval time of gears ranked in the front 30% is compressed to generate a rewrite time gear table adapted to the real-time scene.
[0041] The service pressure includes IOPS high and low, delay data, and the like, which are not limited herein.
[0042] Specifically, the time range of gears is adjusted in combination with real-time service pressure (IOPS high and low, delay); when the pressure is high, the interval time of gears ranked in the front 30% is compressed. Statistical filtering and quantile truncation eliminate abnormal value interference and improve the rationality of gear division. Dynamic gear adjustment adapts to the real-time service scene and enhances the flexibility of the strategy.
[0043] In the above process, the embodiment of the application enables the rewrite time gear table to accurately match the service load by statistical optimization and dynamic gear adjustment, provides a differentiated data management basis, and realizes efficient allocation of cache resources.
[0044] Step 130, when the usage rate of the SSD cache reaches a set threshold, a differential flushing strategy is generated according to the rewrite time gear table and real-time service parameters, and the data in the SSD cache is processed according to the flushing strategy.
[0045] In a possible implementation, the data in the SSD cache is prioritized according to the rewrite time gear table, real-time service parameters are obtained, the service pressure index is calculated according to the real-time service parameters, and the real-time service parameters in the flushing process are monitored; when the service pressure index exceeds a set range, the data in gears ranked in the front 30% is retained, when the service pressure index is in the set range, the data in gears ranked in the front 60% is retained, and when the service pressure index does not reach the set range, the data in gears ranked in the front 90% is retained.
[0046] Specifically, the cache data is prioritized according to the rewrite time gear table, and the service pressure index is calculated in combination with real-time IOPS and delay data. When the pressure is high, the data in gears ranked in the front 30% is retained, when the pressure is medium, the data in gears ranked in the front 60% is retained, and when the pressure is low, the data in gears ranked in the front 90% is retained; the service parameters are continuously monitored during the flushing process, and the retention ratio is dynamically adjusted. The service pressure index is quantitatively evaluated to avoid subjective threshold setting errors. The hierarchical retention strategy balances performance and service life and reduces invalid data flushing.
[0047] In the above process, the embodiment of the application realizes the dynamic adaptation of the underbrush strategy to the load change by the service pressure quantification and the hierarchical reservation, provides the double guarantee of performance and life, and maximizes the cache utilization rate.
[0048] In step 140, when the space of the SSD cache is insufficient, the data in the SSD cache is sorted according to the priority in the rewrite time gear table, and the data is sorted according to the interval length of the data to be rewritten when the priority is the same, and a data management scheme is generated.
[0049] In one possible implementation, the data in the SSD cache is sorted according to the rewrite time gear table, and if there is data exceeding the underbrush threshold of the SSD cache in the same gear, it is marked as a conflict area; for the conflict area, the data in the low priority gear is preferentially underbrushed according to the rewrite time gear table, and if the priority is the same, the data is sorted according to the interval length of the data to be rewritten, and the data whose interval length of being rewritten is greater than a set value is preferentially underbrushed, that is, the data that is rewritten faster after the time point of starting prediction is reserved.
[0050] Specifically, the data exceeding the cache underbrush threshold in the SSD cache is marked as a conflict area, and the low priority gear data is preferentially underbrushed; when the priority is the same, the data is sorted according to the interval length of the data to be rewritten, and the data whose interval length of being rewritten is greater than a set value is preferentially underbrushed, to ensure that the key business data is preferentially resident in the cache. The granularity is dynamically adjusted in proportion to improve the space utilization.
[0051] In the above process, the embodiment of the application realizes the dynamic adaptation of the underbrush strategy to the load change by the service pressure quantification and the hierarchical reservation, provides the double guarantee of performance and life, and maximizes the cache utilization rate.
[0052] Through the above process, the application realizes the fine differential management of the SSD cache by constructing an interval prediction model, dynamically generating a rewrite time gear table, formulating a differentiated underbrush strategy combined with the service pressure, and optimizing the cache space allocation. This method effectively solves the problems of large performance fluctuation (blindly underbrushing hot data, triggering frequent wear leveling tasks (internal data migration) of the SSD, and causing performance to drop sharply) and serious space waste of the traditional static strategy. The application reduces invalid operations and avoids performance fluctuations by dynamically reserving a proportion, significantly improves the life and data management efficiency of the SSD, and provides reliable technical support for high-load enterprise-level applications.
[0053] In an application scenario, the database storage system of a certain large e-commerce platform uses enterprise-level SSD as a cache layer to bear high-concurrency order writing and query requests. The SSD cache differential management method proposed by the embodiment of the application optimizes the performance and life by differential management.
[0054] Specifically, the following steps can be included:
[0055] Step one: constructing an interval prediction model.
[0056] Specifically, first, a data collection module is deployed in the SSD controller to record the LBA (logical block address), data length (such as 4KB), and nanosecond-level timestamp of each write operation in real time. Cold data (such as initialization writing) with single writing and without rewriting is filtered, and only hot data samples (such as order table frequently updated records) with repeated writing times ≥ 3 times within 30 days are retained. The proportion of hot data samples is increased from 45% to 82%, the model training efficiency is improved by 2 times, the high-frequency rewriting data can be focused, and the invalid calculation resource consumption is reduced.
[0057] Further, the spatiotemporal features of LBA are extracted: adjacent addresses are clustered in 16KB granularity, and the writing frequency (such as 10 times per second) within a unit time is counted. Time interval sequence is combined to construct time sequence features (such as the time difference between the previous writing and the current writing), a regression model is trained using the LightGBM algorithm, and the objective function is to minimize the absolute error (MAE) between the predicted interval and the real interval. The rewriting rule is captured through feature engineering to improve the prediction accuracy. The model prediction error rate is reduced from 28% to 9%, and the rewriting time prediction accuracy rate reaches 91%.
[0058] In the above process, the embodiment of the application focuses on hot data and feature engineering optimization, so that the model can accurately predict the rewriting time, provides a high-reliability prediction basis, and realizes dynamic perception of user rewriting behavior.
[0059] Step two: generating a rewriting time gear table.
[0060] Specifically, the frequency distribution of 500,000 pieces of predicted rewriting time data is counted, and low-frequency data (such as occasional batch import) with a frequency < 5 times is filtered. The 95th percentile (such as 120 seconds) is calculated, and extreme tail data (such as backup tasks) with > 120 seconds is removed. The initial boundary table is generated by dividing it into 5 gears according to equal frequency: gear 1 (0-10 seconds), gear 2 (10-30 seconds), gear 3 (30-60 seconds), gear 4 (60-90 seconds), and gear 5 (90-120 seconds). The abnormal value interference is eliminated to ensure that the gear covers the main rewriting scenarios, so that the gear coverage rate is increased from 75% to 98%, and the extreme data proportion is reduced from 15% to 2%.
[0061] Specifically, real-time monitoring of IOPS (input / output per second) is performed, and when write IOPS > 5000, high pressure is determined, and the interval time of the top 3 / 5 gears in the compression gear ranking is the interval time of gears 1-3. When the pressure is low (IOPS < 2000), the default gear range is restored. Adapt to real-time business load to avoid forced flushing of key data under high pressure, so that the key data retention rate under high pressure scenario is increased from 65% to 92%, and the write amplification is reduced by 40%.
[0062] In the above process, the embodiment of the application optimizes and dynamically adjusts the gears by statistics, so that the rewrite time gear table can accurately match the business load, provides differentiated data management basis, and realizes efficient allocation of cache resources.
[0063] Step three: generate differentiated flushing strategy.
[0064] Specifically, the cache data is sorted according to the gear table, gear 1 (highest priority) to gear 5 (lowest priority). Calculate the business pressure index: pressure index = 0.6 x IOPS normalized value + 0.4 x delay normalized value (normalized to 0-1). Quantify the business load to provide an objective basis for flushing decisions. The pressure index calculation delay < 1ms, real-time performance meets high concurrency requirements.
[0065] Further, when the pressure is high (pressure index > 0.8), only gears 1-3 data is retained, and gears 4-5 are flushed; when the pressure is medium (0.5 < pressure index ≤ 0.8), gears 1-4 are retained, and gear 5 is flushed; when the pressure is low (pressure index ≤ 0.5), all data is retained. Balance performance and life, reduce invalid flushing, so that the invalid flushing ratio is reduced from 35% to 8%, and the SSD life is extended by 22%.
[0066] In the above process, the embodiment of the application quantifies and classifies the business pressure to make the flushing strategy dynamically adapt to load changes, providing dual protection of performance and life, and maximizing cache utilization.
[0067] Step four: optimize cache space allocation.
[0068] Specifically, when the total amount of data in the cache exceeds the cache flushing threshold, the part exceeding the cache flushing threshold is marked as a conflict area. Preferentially flush gear 5 data, if it still exceeds the cache flushing threshold, then flush gear 4 data, and so on; if the priority is the same, further filtering is performed according to the interval length of the data to be rewritten. Avoid forced flushing that causes key data loss, so that the data loss rate in the conflict scenario is reduced from 18% to 0.3%.
[0069] Specifically, when the amount of all data in the cache exceeds the cache flushing threshold, the excess part is marked as a conflict area. For this conflict area, first, the rewrite time gear table is called, and the cache data is sorted in layers according to the preset priority - all data in the lowest priority gear 5 is flushed first; if there are multiple data belonging to gear 5 or further filtering is needed, the data is sorted according to the interval length to be rewritten, and the data with a larger interval length to be rewritten than the set value is flushed first (i.e. the data to be rewritten the fastest is retained). Through the double-dimensional strategy of "priority layering + accurate filtering of rewrite interval length", the space is efficiently released in the conflict scenario, while the high-value data is maximally retained.
[0070] In the above process, the embodiment of the application realizes the cooperative optimization of SSD life and performance by accurately matching the cache space allocation to the business demand through conflict area management and dynamic proportion adjustment, and provides a high-reliability data management scheme.
[0071] Through the above process, the embodiment of the application optimizes the SSD disk management through technical means: using an AI engine to predict user rewrite behavior, dividing the rewrite time interval into gears, and dynamically adjusting the Cache flushing strategy combined with business pressure. After implementation, invalid data is reduced, write amplification effect is reduced, SSD medium wear rate is reduced by 35%, and life is significantly prolonged; at the same time, power consumption is reduced, system performance is improved, database query delay is stabilized at <2ms, and high-concurrency business is supported. This scheme effectively balances the performance and life requirements, and reduces the customer hardware replacement cost.
[0072] The following is an embodiment of the device of the application, which can be used to execute the differential management method of the SSD cache involved in the application. For details not disclosed in the device embodiment of the application, please refer to the method embodiment of the differential management method of the SSD cache involved in the application.
[0073] Please refer to Figure 2 In the embodiment of the application, a differential management device 800 of an SSD cache is provided.
[0074] The differential management device 800 of the SSD cache includes but is not limited to: a behavior prediction module 810, a gear division module 830, a differential flushing module 850, and a dynamic flushing module 870.
[0075] The behavior prediction module 810 is configured to obtain historical write behavior data to construct a training set, use a machine learning algorithm to train a model based on the training set, and generate an interval prediction model combined with feature engineering; the historical write behavior data includes address LBA, data length, and timestamp.
[0076] The gear division module 830 is configured to obtain a predicted rewrite time by using the interval prediction model, calculate a rewrite interval according to the predicted rewrite time by using a statistical method, divide the rewrite interval according to a preset number of gears, and generate a rewrite time gear table.
[0077] The differential garbage collection module 850 is configured to generate a differential garbage collection strategy according to the rewrite time gear table and real-time service parameters when a usage rate of the SSD cache reaches a set threshold, and process data in the SSD cache according to the garbage collection strategy; the service parameters include IOPS and delay data.
[0078] The dynamic garbage collection module 870 is configured to sort data in the SSD cache according to a priority in the rewrite time gear table when a space of the SSD cache is insufficient, sort the data according to an interval length at which the data is to be rewritten when the priority is the same, and generate a data management scheme.
[0079] It should be noted that, in the differential management of the SSD cache provided in the above embodiments, only the division of the above functional modules is used as an example for description, and in actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the differential management device of the SSD cache is divided into different functional modules to complete all or part of the functions described above.
[0080] In addition, the differential management device of the SSD cache and the differential management method of the SSD cache provided in the above embodiments belong to the same concept, and the specific manner in which each module performs operations has been described in detail in the method embodiments, which will not be described here again.
[0081] Figure 3 A structure diagram of an electronic device according to an example embodiment is shown.
[0082] It should be noted that the electronic device is only an example adapted to the present application, and should not be considered as providing any limitation on the use range of the present application. The electronic device should also not be interpreted as needing to depend on or must have Figure 3 One or more components in the example electronic device 2000 shown.
[0083] The hardware structure of the electronic device 2000 can have great differences due to different configurations or performances, such as Figure 3 As shown, the electronic device 2000 includes a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0084] Specifically, the power supply 210 is configured to provide working voltage for each hardware device on the electronic device 2000.
[0085] The interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in the remaining examples of the application, the interface 230 can further include at least one serial and parallel conversion interface 233, at least one input and output interface 235, at least one USB interface 237, etc., as shown, which are not specifically limited herein. Figure 3
[0086] The memory 250, as a carrier for storing resources, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon include an operating system 251, an application program 253 and data 255, etc., and the storage mode can be temporary storage or permanent storage.
[0087] The operating system 251 is used to manage and control each hardware device on the electronic device 2000 and the application program 253, so as to realize the operation and processing of the central processing unit 270 on the mass data 255 in the memory 250, and can be Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0088] The application program 253 is computer readable instructions for completing at least one specific work based on the operating system 251, which can include at least one module (not shown), and each module can respectively contain computer readable instructions for the electronic device 2000. For example, the SSD cache differential management device can be regarded as an application program 253 deployed in the electronic device 2000. Figure 3
[0089] The data 255 can be signal information, etc., stored in the memory 250.
[0090] The central processing unit 270 can include one or more processors, and is arranged to communicate with the memory 250 through at least one communication bus, so as to read the computer readable instructions stored in the memory 250, and then realize the operation and processing of the mass data 255 in the memory 250. For example, the SSD cache differential management method is completed in the form of reading a series of computer readable instructions stored in the memory 250 by the central processing unit 270.
[0091] In addition, the application can also be realized by hardware circuit or hardware circuit combined with software, and therefore, the realization of the application is not limited to any specific hardware circuit, software and combination of the two.
[0092] Please refer to Figure 4 In the embodiment of the application, an electronic device 4000 is provided, which can include a desktop computer, a notebook computer, a server, etc. with sensor identification capability.
[0093] In Figure 4 The electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0094] Data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. The communication bus 4002 can include a channel for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 can be a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 In
[0095] Optionally, the electronic device 4000 can also include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception, etc. It should be noted that the transceiver 4004 is not limited to one in actual application, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0096] The processor 4001 can be a CPU (Central Processing Unit, Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor, Digital Signal Processor), an ASIC (Application Specific Integrated Circuit, Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array, Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the present disclosure. The processor 4001 can also be a combination of computing functions, such as one or more microprocessor combinations, combinations of DSP and microprocessor, etc.
[0097] The memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, a magnetic disk storage or other magnetic storage devices, or any other medium capable of storing desired program instructions or code in the form of instructions or data structures and that can be accessed by the electronic device 4000, but is not limited thereto.
[0098] The memory 4003 stores computer readable instructions, and the processor 4001 can read the computer readable instructions stored in the memory 4003 through the communication bus 4002.
[0099] The computer readable instructions are executed by the one or more processors 4001 to implement the SSD cache differential management method in the above embodiments.
[0100] In addition, the present embodiment provides a storage medium, and the storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to implement the SSD cache differential management method as described above.
[0101] The present embodiment provides a computer program product, and the computer program product includes computer readable instructions stored in a storage medium, and one or more processors of an electronic device read the computer readable instructions from the storage medium, load and execute the computer readable instructions, so that the electronic device implements the SSD cache differential management method as described above.
[0102] Compared with the related art, the present application has the following beneficial effects:
[0103] 1. The present application can reduce invalid data writing, reduce write amplification effect; by predicting customer rewrite command behavior, the data in the cache is differentially flushed, avoiding repeated writing leading to media wear and performance degradation.
[0104] 2. The application has the effect of prolonging the service life of SSD medium and hard disk; by reducing the frequent flushing of invalid data, the number of NAND flash erase-write is reduced, thereby prolonging the service life of the hard disk.
[0105] It should be understood that, although each step in the flowchart of the accompanying drawings is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless explicitly stated herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other sequences. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be alternately or alternately executed with at least part of other steps or other steps, sub-steps or stages.
[0106] The above only describes some embodiments of the present application, and it should be pointed out that, for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A method for differentially managing an SSD cache, the method comprising: The method comprises: obtaining historical write behavior data to construct a training set, training a model based on the training set by using a machine learning algorithm, and generating an interval prediction model in combination with feature engineering; the historical write behavior data comprises an address LBA, data length, and a timestamp; obtaining a predicted rewrite time through the interval prediction model, calculating a rewrite interval according to the predicted rewrite time by using a statistical method, and generating a rewrite time bin table by dividing the rewrite interval according to a preset number of bins; when the usage rate of an SSD cache reaches a set threshold, generating a differential flushing strategy according to the rewrite time bin table and real-time business parameters, and processing data in the SSD cache according to the flushing strategy; the business parameters comprise IOPS and delay data; when the space of the SSD cache is insufficient, sorting data in the SSD cache according to the priority in the rewrite time bin table, sorting according to the interval length of data to be rewritten when the priority is the same, and generating a data management scheme.
2. The method of claim 1, wherein the SSD cache is managed differently based on whether the data is stored in the SSD cache or the HDD cache. The method comprises: real-time recording of the LBA, data length, and nanosecond-level timestamp of each write operation, filtering out cold data that is not rewritten after single writing, and retaining hot data samples with a repeated writing frequency of greater than or equal to 3 times; extracting spatiotemporal features of the LBA, constructing a time series feature in combination with a time interval sequence, training a regression model by using a LightGBM algorithm, and generating an interval prediction model by minimizing the absolute error between the predicted interval and the actual interval; the spatiotemporal features comprise address clustering and writing frequency.
3. The method of claim 1, wherein the SSD cache is managed differently based on whether the data is stored in the SSD cache or the HDD cache. The method comprises: obtaining a predicted rewrite time of each write command through the interval prediction model, forming a structured data set according to the write command and the predicted rewrite time, and sorting the structured data set according to the predicted rewrite time.
4. The method of claim 3, wherein the SSD cache is managed differently based on whether the data is stored in the SSD cache or the HDD cache. The method comprises: statistically analyzing the frequency distribution of the structured data set, setting a minimum frequency threshold, filtering low-frequency data according to the minimum frequency threshold, calculating a 95% quantile, removing extreme long-tail data greater than the quantile, calculating the arithmetic mean of the predicted rewrite time according to the processed structured data set, and obtaining a rewrite interval.
5. The method of claim 1, wherein the SSD cache is managed differently based on whether the SSD cache is used for a read cache or a write cache. The method comprises: arranging the rewrite interval in ascending order, dividing the rewrite interval into initial bin boundaries at equal frequencies according to a preset number of bins, and adjusting the time range of the initial bin in combination with business pressure; when the business pressure is high, compressing the interval time of the bins ranked in the front 30%, and generating a rewrite time bin table adapted to the real-time scenario; the business pressure comprises IOPS and delay data.
6. The method of claim 1, wherein the SSD cache is managed differently based on whether the SSD is a flash-based SSD or a phase-change memory-based SSD. The method comprises: According to the copy time level table, the data in the SSD cache is prioritized, real-time service parameters are obtained, a service pressure index is calculated according to the real-time service parameters, and real-time service parameters in the process of the next flush are monitored; When the service pressure index exceeds a set range, data in the top 30% of the levels in the level ranking is retained, when the service pressure index is in the set range, data in the top 60% of the levels in the level ranking is retained, and when the service pressure index does not reach the set range, data in the top 90% of the levels in the level ranking is retained.
7. The method of claim 1, wherein the SSD cache is managed differently based on whether the SSD is a flash-based SSD or a phase-change memory-based SSD. According to the priority in the copy time level table, the data in the SSD cache is sorted, and when the priorities are the same, the data is sorted according to the interval length of the data to be copied next, and a data management scheme is generated, including: According to the copy time level table, the data in the SSD cache is sorted, and the data in the SSD cache that exceeds the SSD cache flush threshold is marked as a conflict area; For the conflict area, the data in the low-priority level is preferentially flushed according to the copy time level table, and if the priorities are the same, the data is sorted according to the interval length of the data to be copied next, and the data with an interval length greater than a set value is preferentially flushed.
8. A differential management apparatus of an SSD cache, characterized by, The device comprises: A behavior prediction module for obtaining historical write behavior data to construct a training set, using a machine learning algorithm to train a model based on the training set, and combining feature engineering to generate an interval prediction model; the historical write behavior data includes address LBA, data length, and timestamp; A level division module for obtaining a predicted copy time through the interval prediction model, calculating a copy interval according to the predicted copy time using a statistical method, and dividing the copy interval to generate a copy time level table according to a preset number of levels; A differential flush module for generating a differential flush strategy according to the copy time level table and real-time service parameters when the usage rate of the SSD cache reaches a set threshold, and processing the data in the SSD cache according to the flush strategy; the service parameters include IOPS and delay data; A dynamic flush module for sorting the data in the SSD cache according to the priority in the copy time level table when the space of the SSD cache is insufficient, and sorting the data according to the interval length of the data to be copied next when the priorities are the same, to generate a data management scheme.
9. An electronic device, comprising: Comprise: At least one processor and at least one memory, wherein The memory has computer readable instructions stored thereon; The computer readable instructions are executed by one or more processors to enable the electronic device to implement the differential management method of the SSD cache according to any one of claims 1 to 7.
10. A storage medium having stored thereon computer readable instructions, characterized in that, The computer readable instructions are executed by one or more processors to implement the differential management method of the SSD cache according to any one of claims 1 to 7.
Citation Information
Patent Citations
SSD life prediction method and system based on Prophet model, terminal and storage medium
CN111176575A
Memory cache storage system oriented to big data flow
CN119917425A
RAID card static cache management method and device based on data popularity
CN120335719A
Duplication decision-making method and device, readable storage medium and electronic equipment
CN120428925A
Workload detection and media cache management
US20170255556A1