A solid state hard disk cache management method and device
By establishing a load feature model to calculate the optimal cache ratio of the solid-state drive and adjusting the cache space, the problem of performance degradation caused by limitations of the solid-state drive cache management solution in the prior art is solved, and the effect of improving the read and write performance of the solid-state drive is achieved.
Patent Information
- Application Number
- CN202410382721.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-30
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-03-30
AI Technical Summary
In the prior art, the solid-state drive cache management solution has high limitations, resulting in a degradation in the performance of the solid-state drive.
By establishing a load characteristic model of multiple load modes and the optimal cache ratio corresponding to the load mode, the solid-state drive calculates the current optimal cache ratio based on the current load characteristics, and adjusts the space of the cache mapping table and data cache area.
It effectively improves the hit rate of cache mapping tables and data cache memory space, and improves the read and write performance of solid-state drives.
Smart Images

Figure CN118259837B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of hard disk detection technology, and more particularly to a solid state hard disk cache management method and device, and also to an electronic device and a processor-readable storage medium. Background Art
[0002] Solid State Disk (SSD) is a new type of semiconductor storage device that is widely welcomed by the market. Compared with traditional mechanical hard disks, SSDs have the advantages of low latency, shock resistance, high reliability and wide operating temperature range. They are currently widely used in notebook computers and enterprise data centers. SSDs are composed of modules such as host interface logic, cache management layer, flash translation layer and NAND flash chip array. The cache management layer has two main functions: 1) store address mapping table. The flash translation layer stores frequently accessed address mappings in the cache to improve the system performance of the SSD; 2) store part of the data. The cache stores the most recently accessed and frequently accessed data to improve the storage performance of the hard disk. Related studies have shown that increasing the cache area can effectively reduce the request response time of the SSD and improve the performance of the SSD. However, increasing the cache area will lead to an increase in the memory of the SSD, which will lead to problems such as increased cost and increased power consumption of the SSD. Therefore, under the premise of limited SSD memory space, providing a high-performance SSD cache management method has become a problem that needs to be solved urgently. Summary of the invention
[0003] To this end, the present application provides a solid-state drive cache management method and device to solve the defect that the solid-state drive cache management solution in the prior art has high limitations, thereby causing the performance of the solid-state drive to decline.
[0004] In a first aspect, the present application provides a solid state drive cache management method, comprising:
[0005] When the solid-state hard disk to be managed completes a preset number of read and write operation requests, the load characteristic parameters currently corresponding to the solid-state hard disk are determined according to the attribute characteristics of the read and write operation requests, and the load characteristic parameters currently corresponding to the solid-state hard disk are statistically analyzed to determine the current load characteristics of the solid-state hard disk;
[0006] Based on the matching analysis between the current SSD load characteristics and a preset load characteristic model, the optimal cache ratio of the current SSD is determined; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio;
[0007] Determine a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid-state drive according to the current SSD cache optimal ratio and the memory space of the solid-state drive;
[0008] The current cache mapping table memory space and the current data cache memory space are adjusted respectively based on the first adjustment value and the second adjustment value, and an adjustment result is output.
[0009] Further, determining a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid-state drive according to the current solid-state drive cache optimal ratio and the memory space of the solid-state drive specifically includes:
[0010] Determining a reference cache mapping table memory space and a reference data cache memory space according to the current optimal ratio of the solid state drive cache and the memory space of the solid state drive;
[0011] Compare and analyze the reference cache mapping table memory space with the current cache mapping table memory space to obtain a first cache mapping table memory space adjustment value; compare and analyze the reference data cache memory space with the current data cache memory space to obtain a first data cache memory space adjustment value;
[0012] The first cache mapping table memory space adjustment value is compared and analyzed with the preset cache mapping table adjustment threshold, and the first data cache memory space adjustment value is compared and analyzed with the preset data cache adjustment threshold. When the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, the first adjustment value of the current cache mapping table memory space is determined according to the reference cache mapping table memory space, and the second adjustment value of the current data cache memory space is determined based on the reference data cache memory space.
[0013] Further, determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation request, and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current solid-state hard disk load characteristics specifically includes:
[0014] Determine the read / write operation type, read / write operation address and read / write operation size of the read / write operation request, compare and analyze the read / write operation type, read / write operation address and read / write operation size of the current read / write operation request with the read / write operation type, read / write operation address and read / write operation size of the previous read / write operation request, and determine the load characteristic parameters of the current read / write operation request; wherein the attribute characteristics of the read / write operation request include the read / write operation type, read / write operation address and read / write operation size of the read / write operation request; the load characteristic parameters of the current read / write operation request include the read / write operation type, read / write operation span and read / write operation size corresponding to the current read / write operation request; the read / write operation span is determined according to the difference between the read / write operation address of the current read / write operation request and the read / write operation address of the previous read / write operation request;
[0015] Based on two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics.
[0016] Further, based on the two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics, specifically including:
[0017] Determine the read / write operation type of the current operation request, and determine the target statistical array in the two two-dimensional statistical arrays according to the read / write operation type of the current operation request; wherein the current operation request includes a read operation request and a write operation request;
[0018] Determine a row index according to the read / write operation span of the current operation request;
[0019] Determine a column index according to the read / write operation size of the current operation request;
[0020] According to the read and write operation type of the current operation request, the row index and the column index, the corresponding target statistical arrays in the two two-dimensional statistical arrays are selected and voted for, and statistical analysis is performed, and the current solid state hard disk load characteristics are determined according to the statistical analysis results.
[0021] Further, the matching analysis based on the current SSD load characteristic and a preset load characteristic model is performed to determine the current SSD cache optimal ratio, specifically including:
[0022] The current SSD load characteristics are matched and analyzed with a preset load characteristic model to obtain a matching analysis result; a corresponding probability is determined according to the matching degree in the matching analysis result, and the current SSD cache optimal ratio is determined according to the size of the probability.
[0023] Furthermore, before determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read / write operation request and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk, the method further includes:
[0024] Determine at least one read load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the read load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the read load mode, and record the corresponding relationship between the read load mode and the optimal cache ratio; and, determine at least one write load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the write load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the write load mode, and record the corresponding relationship between the write load mode and the optimal cache ratio;
[0025] Based on the corresponding relationship between the read load pattern and the optimal cache ratio and the corresponding relationship between the write load pattern and the optimal cache ratio, the load characteristic model is constructed; wherein the load pattern includes the read load pattern and the write load pattern.
[0026] Further, adjusting the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and outputting the adjustment result specifically includes:
[0027] Based on the first adjustment value and the second adjustment value, adjustment notification information is sent to the data cache area and the flash translation layer in the solid-state drive respectively, and based on the adjustment notification information, the current cache mapping table memory space and the current data cache memory space in the flash translation layer are released or space is increased, and the adjustment result is output.
[0028] In a second aspect, the present application further provides a solid state drive cache management device, comprising:
[0029] A statistical unit, configured to determine, when the solid-state hard disk to be managed completes a preset number of read and write operation requests, a load characteristic parameter currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and to perform statistical analysis on the load characteristic parameter currently corresponding to the solid-state hard disk to determine the current load characteristics of the solid-state hard disk;
[0030] A calculation unit, configured to determine the optimal cache ratio of the current solid-state hard disk based on a matching analysis between the current solid-state hard disk load characteristics and a preset load characteristic model; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio;
[0031] A decision unit, configured to determine a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid-state drive according to the current optimal ratio of the solid-state drive cache and the memory space of the solid-state drive;
[0032] A notification unit is used to adjust the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and output an adjustment result.
[0033] Furthermore, the decision-making unit is specifically used to:
[0034] Determining a reference cache mapping table memory space and a reference data cache memory space according to the current optimal ratio of the solid state drive cache and the memory space of the solid state drive;
[0035] Compare and analyze the reference cache mapping table memory space with the current cache mapping table memory space to obtain a first cache mapping table memory space adjustment value; compare and analyze the reference data cache memory space with the current data cache memory space to obtain a first data cache memory space adjustment value;
[0036] The first cache mapping table memory space adjustment value is compared and analyzed with the preset cache mapping table adjustment threshold, and the first data cache memory space adjustment value is compared and analyzed with the preset data cache adjustment threshold. When the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, the first adjustment value of the current cache mapping table memory space is determined according to the reference cache mapping table memory space, and the second adjustment value of the current data cache memory space is determined based on the reference data cache memory space.
[0037] Furthermore, the statistical unit is specifically used for:
[0038] Determine the read / write operation type, read / write operation address and read / write operation size of the read / write operation request, compare and analyze the read / write operation type, read / write operation address and read / write operation size of the current read / write operation request with the read / write operation type, read / write operation address and read / write operation size of the previous read / write operation request, and determine the load characteristic parameters of the current read / write operation request; wherein the attribute characteristics of the read / write operation request include the read / write operation type, read / write operation address and read / write operation size of the read / write operation request; the load characteristic parameters of the current read / write operation request include the read / write operation type, read / write operation span and read / write operation size corresponding to the current read / write operation request; the read / write operation span is determined according to the difference between the read / write operation address of the current read / write operation request and the read / write operation address of the previous read / write operation request;
[0039] Based on two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics.
[0040] Further, based on the two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics, specifically including:
[0041] Determine the read / write operation type of the current operation request, and determine the target statistical array in the two two-dimensional statistical arrays according to the read / write operation type of the current operation request; wherein the current operation request includes a read operation request and a write operation request;
[0042] Determine a row index according to the read / write operation span of the current operation request;
[0043] Determine a column index according to the read / write operation size of the current operation request;
[0044] According to the read and write operation type of the current operation request, the row index and the column index, the corresponding target statistical arrays in the two two-dimensional statistical arrays are selected and voted for, and statistical analysis is performed, and the current solid state hard disk load characteristics are determined according to the statistical analysis results.
[0045] Furthermore, the computing unit is specifically used for:
[0046] The current SSD load characteristics are matched and analyzed with a preset load characteristic model to obtain a matching analysis result; a corresponding probability is determined according to the matching degree in the matching analysis result, and the current SSD cache optimal ratio is determined according to the size of the probability.
[0047] Furthermore, before determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read / write operation request and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk, the method further includes:
[0048] Load characteristic model acquisition unit, used for:
[0049] Determine at least one read load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the read load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the read load mode, and record the corresponding relationship between the read load mode and the optimal cache ratio; and, determine at least one write load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the write load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the write load mode, and record the corresponding relationship between the write load mode and the optimal cache ratio;
[0050] Based on the corresponding relationship between the read load pattern and the optimal cache ratio and the corresponding relationship between the write load pattern and the optimal cache ratio, the load characteristic model is constructed; wherein the load pattern includes the read load pattern and the write load pattern.
[0051] Furthermore, the notification unit is specifically used to:
[0052] Based on the first adjustment value and the second adjustment value, adjustment notification information is sent to the data cache area and the flash translation layer in the solid-state drive respectively, and based on the adjustment notification information, the current cache mapping table memory space and the current data cache memory space in the flash translation layer are released or space is increased, and the adjustment result is output.
[0053] In a third aspect, the present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the solid-state drive cache management method as described in any one of the above when executing the computer program.
[0054] In a fourth aspect, the present application further provides a processor-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the solid-state drive cache management method as described in any one of the above are implemented.
[0055] The solid-state hard disk cache management method provided in the present application pre-establishes a load characteristic model that includes multiple load modes and the optimal cache ratio corresponding to the load mode, so that the solid-state hard disk calculates the current solid-state hard disk cache optimal ratio based on the current solid-state hard disk load characteristics and the load characteristic model during operation, and then adjusts the current cache mapping table memory space and the current data cache memory space. It can effectively improve the hit rate of the current cache mapping table memory space and the data cache memory space, thereby improving the read and write performance of the solid-state hard disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0057] Figure 1 It is a flowchart of a solid state drive cache management method provided in an embodiment of the present application;
[0058] Figure 2 This is one of the structural diagrams of the solid state drive cache management device provided in the embodiment of the present application;
[0059] Figure 3 It is a complete structural diagram of the solid state drive cache management system provided by an embodiment of the present application;
[0060] Figure 4 This is the second structural diagram of the solid state drive cache management device provided in the embodiment of the present application;
[0061] Figure 5 It is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] At present, the adjustment scheme for the cache area of solid-state hard disks mainly focuses on designing high-performance data cache algorithms and address mapping algorithms. The basic idea of these algorithms is to temporarily store the data or mapping relationship of the recently accessed and frequently accessed requests in the cache area, and directly respond to the read and write operation requests in the cache area, thereby reducing the direct access of the flash memory to improve the read and write performance of the solid-state hard disk. Or focus on the strategy of selecting the cache data or address mapping relationship to be written back, which can achieve the purpose of reducing the read and write operations of the flash memory, but the space size of the data cache area and the address mapping cache area has different effects on the performance under different load conditions. Since the data cache area and the address mapping cache area of the flash conversion layer share the memory of the solid-state hard disk, there are relatively few studies on how to dynamically adjust the ratio of the two cache areas according to the load characteristics to improve the read and write performance of the solid-state hard disk. In view of the cache area management problem of the solid-state hard disk, the present invention proposes a cache area management method, which establishes multiple load modes and the optimal cache ratio corresponding to the load mode, so that the current optimal cache ratio of the solid-state hard disk is calculated based on the characteristics of the current load during the operation of the solid-state hard disk based on the preset load characteristic model, and then adjusts the space of the data cache area and the address mapping cache area to improve the hit rate of the two cache areas, thereby achieving the goal of improving the read and write performance of the solid-state hard disk. The memory of a solid-state drive has three main uses: storing cache data; storing address mapping relationships; and storing other metadata (check information, bitmaps, etc.). Among these three uses, the first two uses occupy the largest memory area, and the last use occupies less than 5% of the memory space. During the operation of the solid-state drive, the size of the cache address mapping table (i.e., address mapping cache area) and the data cache area directly affects the number of additional flash read and write operations, which in turn has a direct impact on the performance of the solid-state drive. The larger the cache address mapping table and the data cache area, the better the performance of the solid-state drive; on the contrary, when the cache address mapping table or the data cache area is too small, the performance of the solid-state drive will be affected. The number of other metadata is small and the size is fixed, occupying limited memory space, so the memory of the solid-state drive is mainly a contention between the cache address mapping table and the data cache area. The best situation when performing read and write operations on the solid-state drive is that the requested address mapping relationship has been stored in the cache address mapping table of the solid-state drive, the data exists in the memory data cache area of the solid-state drive, or there is still free area in the data cache area, because in this case, the response time of the request is the operation time of the memory. If the address mapping relationship or data of the read and write operation request to the solid-state hard disk does not hit the cache address mapping table and the data buffer, it will cause additional flash memory read and write operations. The present invention proposes a cache space management method, which establishes multiple load modes and optimal cache ratios, and then dynamically allocates the memory in the solid-state hard disk to the cache address mapping table and the data cache area according to the load characteristics, so as to achieve the optimal read and write performance of the solid-state hard disk.
[0064] First, based on the solid state drive cache management method described in this application, its embodiment is described in detail below. Figure 1 FIG. 1 is a flow chart of a solid state drive cache management method provided in an embodiment of the present application, and the specific implementation process includes the following steps:
[0065] Step 101: When the solid-state hard disk to be managed completes a preset number of read and write operation requests, determine the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and perform statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current solid-state hard disk load characteristics.
[0066] In an embodiment of the present invention, before executing this step, the server needs to obtain the SSD cache management request sent by the client. After obtaining the SSD cache management request sent by the client, when the SSD to be managed completes a preset number of read and write operation requests, the server first needs to determine the read and write operation type, read and write operation address and read and write operation size of the read and write operation request, and respectively compare and analyze the read and write operation type, read and write operation address and read and write operation size of the current read and write operation request with the read and write operation type, read and write operation address and read and write operation size of the previous read and write operation request to determine the load characteristic parameters of the current read and write operation request. Among them, the attribute characteristics of the read and write operation request include the read and write operation type, read and write operation address and read and write operation size of the read and write operation request. The load characteristic parameters of the current read and write operation request include the read and write operation type, read and write operation span and read and write operation size corresponding to the current read and write operation request. The read and write operation span is determined according to the difference between the read and write operation address of the current read and write operation request and the read and write operation address of the previous read and write operation request. Based on two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation request, respectively, to determine the current solid-state hard disk load characteristics. Wherein, based on the two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation request, respectively, to determine the current solid-state hard disk load characteristics, and the corresponding specific implementation process includes: judging the read and write operation type of the current operation request, and determining the target statistical array in the two two-dimensional statistical arrays according to the read and write operation type of the current operation request; wherein the current operation request includes a read operation request and a write operation request; determining the row index according to the read and write operation span of the current operation request; determining the column index according to the read and write operation size of the current operation request; and selecting and voting for the corresponding target statistical arrays in the two two-dimensional statistical arrays according to the read and write operation type of the current operation request, the row index and the column index, and performing statistical analysis, and determining the current solid-state hard disk load characteristics according to the statistical analysis results.
[0067] In this step, during the operation phase, when the solid state drive completes a preset number of read and write operation requests, the following sub-steps Step 1 to Step 4 are specifically executed:
[0068] Step 1: Save the type (i.e., read / write operation type, such as read or write), address (i.e., read / write operation address) and size (i.e., read / write operation size) of the request (i.e., read / write operation request).
[0069] Step 2: Compare the type, address, and size of this request with those of the previous read / write operation request, and calculate the load characteristic parameters of this request (i.e., the load characteristic parameters of the current read / write operation request). The load characteristic parameters of the current read / write operation request include the read / write operation type, span, and size. The specific calculation method is as follows:
[0070] Type = the read / write operation type of this request; Span = |the starting address of this request - the starting address of the previous request|; Size = the amount of data read / written by this request
[0071] Step 3: Set two two-dimensional statistical arrays: C_Read[M_Read][N_Read] and C_Write[M_Write][N_Write]. The C_Read array is used to count the records of read operations, where M_Read represents the number of spans and N_Read represents the number of sizes. The C_Write array is used to count the records of write operations, where M_Write represents the number of spans and N_Read represents the number of sizes. First, initialize all elements of the two statistical arrays to zero.
[0072] Step 4: For the most recent N read / write operation requests, perform statistics according to the load characteristic parameters, where N is a predetermined value (i.e., the preset quantity), and obtain two statistical histograms corresponding to the read / write operation requests respectively. The specific statistical method for each request is as follows:
[0073] Step 4.1 Determine the target statistical array by judging the type of the request load. If it is a read operation request, select the C_Read array; if it is a write operation, select the C_Write array.
[0074] Step 4.2 Determine the row index according to the span of the request load. Since the operation span of the load may not exactly equal D_Write_Base i or D_Read_Base i , it is necessary to process the span of the load.
[0075] For read operations, compare the span of the load with all read operation spans (D_Read i , 0 ≤ i < M_Read), and find two adjacent span values such that D_Read i ≤ the span of the load ≤ D_Read i+1 , and determine the row index according to the following method:
[0076]
[0077] For write operations, compare the span of the load with all write operation spans (D_Writei is compared with (where \(0\leq i < M\_Write\)) to find two adjacent span values such that \(D\_Write\) i \(\leq\) the span of the load \(\leq D\_Write\) i+1 , and the row index is determined as follows:
[0078]
[0079] Step4.3 Determine the column index according to the operation size of the load. Since the operation size of the load may not exactly equal \(S\_Write\_Base\) i or \(S\_Read\_Base\) i , it is necessary to process the size of the load.
[0080] For read operations, the size of the load is compared with the sizes of all read operations (\(S\_Read\) i , where \(0\leq i < N\_Read\)) to find two adjacent size values such that \(S\_Read\) i \(\leq\) the size of the load \(\leq S\_Read\) i+1 , and the column index is determined as follows:
[0081]
[0082] For write operations, the size of the load is compared with the sizes of all write operations (\(S\_Write\) i , where \(0\leq i < N\_Write\)) to find two adjacent size values such that \(S\_Write\) i \(\leq\) the size of the load \(\leq S\_Write\) i+1 , and the column index is determined as follows:
[0083]
[0084] Step4.4 Vote (i.e., perform an increment operation) on the corresponding cells of the two preset two-dimensional statistical arrays (i.e., the target statistical arrays) according to the type, row index, and column index of the requested load. It should be noted that the row index and column index correspond to the row coordinates and column coordinates of the statistical histogram obtained from the statistical analysis. After determining the row index and column index, the corresponding cell can be found based on the row index and column index for voting, that is, perform an increment operation on the cell. Among them, read operation requests and write operation requests each correspond to a statistical histogram.
[0085] In addition, before performing this step, a load characteristic model needs to be pre-constructed. Specifically, first, at least one read load pattern is determined, and the average access time of single read operation requests corresponding to different cache ratios of the read load pattern is compared and analyzed. The cache ratio corresponding to the read operation request with the minimum average access time of the single read operation request is used as the optimal cache ratio of the read load pattern, and the corresponding relationship between the read load pattern and the optimal cache ratio is recorded; and at least one write load pattern is determined, and the average access time of single read operation requests corresponding to different cache ratios of the write load pattern is compared and analyzed. The cache ratio corresponding to the read operation request with the minimum average access time of the single read operation request is used as the optimal cache ratio of the write load pattern, and the corresponding relationship between the write load pattern and the optimal cache ratio is recorded. Based on the corresponding relationship between the read load pattern and the optimal cache ratio and the corresponding relationship between the write load pattern and the optimal cache ratio, the load characteristic model is constructed. Wherein, the load pattern includes the read load pattern and the write load pattern.
[0086] The following is a detailed description. Multiple load patterns and their optimal cache ratios are measured in advance, the corresponding relationship between at least one load pattern (i.e., corresponding to the solid-state drive load characteristics) and its corresponding optimal cache ratio is established, and a load characteristic model is constructed. The construction process specifically includes the following Step1-Step6.
[0087] Step1: Establish multiple read load patterns. Establish M_Read×N_Read read load patterns, where M_Read is the number of set span numbers and N_Read is the number of set data volume numbers. For the convenience of recording, the present invention uses a two-dimensional index to indicate the read load pattern. The [i, j] (0≤i<M_Read, 0≤j<N_Read)th read load pattern is: starting from the starting address 0 in sequence, the starting address is incremented by D_Read_Base i , and each time S_Read_Base j -sized data is read until the starting address + span is greater than the capacity of the solid-state drive. Where D_Read i+1 >D_Read j and S_Read j+1 >S_Read j . In a specific example of the present invention, D_Read_Base is set to 8 and S_Read_Base is set to 2. The load pattern includes the read load pattern and the write load pattern.
[0088] Step2: Use the experimental method to measure the optimal cache ratio corresponding to the read load pattern. For the [i, j] (span is D_Read i and size is S_Read j)'s read load mode, the present invention measures the optimal cache ratio of this load model through an experimental method. The specific method is as follows:
[0089] Step2.1: Set the initial value of the cache ratio to 0.
[0090] Step2.2: For the specified cache ratio and the specified D_Read i and S_Read j , perform a read operation. The steps of the read operation are to set the initial read address to 0, read data of size S_Read j , then increase the starting address by D_Read i , continue to read data of size S_Read j , until the starting address + the read S_Read j exceeds the logical address range of the solid-state drive, record the access time of all requests and calculate the average access time of a single request.
[0091] Step2.3: Then gradually increase a preset value ΔR, and judge whether the cache ratio is greater than 1; if it is greater than 1, go to the next step; if not, repeat Step2.2.
[0092] Step2.4 Compare the average access time of a single request for different cache ratios, and use the cache ratio corresponding to the minimum average access time of a single request as the optimal cache ratio with a span of D_Read i and a size of S_Read j , denoted as Ratio_Read ij .
[0093] Step 3: Record the corresponding relationship between the read load mode and the optimal cache ratio, denoted as (D_Read i , S_Read j , Ratio_Read ij ). The i-th span is denoted as D_Read i , the j-th size is denoted as S_Read j , and the corresponding optimal cache ratio is denoted as Ratio_Read ij .
[0094] Step4: Establish multiple write load modes. Establish M_Write × N_Write write load modes, where M_Write is the number of spans set and N_Write is the number of data volume settings. For the convenience of recording, the present invention uses a two-dimensional index to indicate the read load mode. The [i, j] (0 ≤ i < M_Write, 0 ≤ j < N_Write)-th write load mode is: starting from the starting address 0 in sequence, the starting address is incremented by D_Write_Base successivelyi , each time S_Write_Base is read j The size of data, until the start address + span is greater than the capacity of the solid state drive. i+1 >D_Write j and S_Write j+1 >S_Write j In the specific example of the present invention, D_Write_Base is set to 8 and S_Write_Base is set to 2.
[0095] Step 5: Use the experimental method to measure the optimal cache ratio corresponding to the write load mode. i and size is S_Read j ) write load pattern and measure the optimal cache ratio of this pattern through experimental method.
[0096] Step 5 specifically includes Step 5.1-Step 5.4: Step 5.1 First, the initial value of the cache ratio is 0. Step 5.2 For the specified cache ratio and the specified D_Write i and S_Write j , allocate cache space, and then perform a write operation. The steps of the write operation are to set the initial read address to 0, read S_Write j The size of the data, and then increase the starting address by D_Write i , continue to read S_Write j Data of size, until the start address + read S_Write j If the access time exceeds the logical address range of the solid-state drive, record the access time of all requests and calculate the average access time of a single request (i.e., the average access time of a single read operation request). Step 5.3 Then gradually increase a preset value ΔR to determine whether the cache ratio is greater than 1; if it is greater than 1, proceed to the next step; if not, repeat Step 5.2. Step 5.4 Compare the average access time of a single request with different cache ratios, and take the cache ratio corresponding to the average access time of the smallest single request as the span D_Read i and size is S_Read j The optimal cache ratio is denoted as Ratio_Read ij That is, the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request is used as the optimal cache ratio of the write load mode.
[0097] Step 6: Record the span of the read load pattern, the size of the read load pattern and the corresponding relationship with the optimal cache ratio, recorded as (D_Write i , S_Writej , Ratio_Write ij )。
[0098] The present invention establishes a preset load characteristic model based on the foregoing tests. There are a total of M_Write × N_Write + M_Read × N_Read types of load characteristic models. There are a total of M_Read × N_Read types of read load characteristic models, denoted as (D_Read i , S_Read j , Ratio_Read ij ), where 0 ≤ i < M_Read and 0 ≤ j < N_Read; there are a total of M_Write × N_Write types of write load model characteristic models, denoted as (D_Write i , S_Write j , Ratio_Write ij ), where 0 ≤ i < M_Write and 0 ≤ j < N_Write. The so-called span refers to the absolute value of the difference between the addresses of two adjacent data accesses. It should be noted that the read load pattern corresponds to the read operation request. The write load pattern corresponds to the write operation request.
[0099] Step 102: Perform matching analysis based on the current solid-state drive load characteristics and the preset load characteristic model to determine the optimal cache ratio of the current solid-state drive; wherein, the load characteristic model includes the corresponding relationship between at least one preset load pattern and its optimal cache ratio.
[0100] In an embodiment of the present invention, the current solid-state drive load characteristics can be matched and analyzed with the preset load characteristic model to obtain a matching analysis result; according to the matching degree in the matching analysis result, the corresponding probability is determined, and the optimal cache ratio of the current solid-state drive is determined according to the magnitude of the probability. The cache ratio is the ratio of the memory space of the cache address mapping table (i.e., the address mapping buffer) to the memory space of the data cache area. The span (i.e., the read / write operation span) refers to the absolute value of the difference between the addresses of two adjacent data accesses. The optimal cache ratio is the cache ratio that can make the read performance of the solid-state drive optimal.
[0101] In an embodiment of the present invention, according to two statistical histograms (i.e., statistical analysis data), the probability of the current solid-state drive load characteristics and the predetermined load characteristic model can be calculated, and the optimal cache ratio of the current solid-state drive can be calculated. The calculation formula is as follows:
[0102]
[0103] Among them, Ratio_Cur is the optimal cache ratio of the current solid-state drive; is the probability corresponding to the read operation request, used to represent the corresponding weight size; It is the probability corresponding to the write operation request, which is used to indicate the corresponding weight.
[0104] In addition, Ratio_Read ij Indicates the optimal cache ratio of read operation requests determined by matching analysis based on the load characteristic model; Ratio_Write ij Indicates the optimal cache ratio for read operation requests determined by matching analysis based on the load characteristic model.
[0105] In an embodiment of the present invention, the matching analysis result can be obtained by matching and analyzing the current solid-state hard disk load characteristics with a preset load characteristic model, and the corresponding probability can be determined according to the matching degree in the matching analysis result, and then the current solid-state hard disk cache optimal ratio can be determined according to the size of the probability. It should be noted that in the calculation formula under the two-dimensional index, since two cache optimal ratios will be obtained by matching and analyzing the current solid-state hard disk load characteristics with a preset load characteristic model, that is, a read operation request will correspond to a cache optimal ratio, and a write operation request will also correspond to a cache optimal ratio. Therefore, in an embodiment of the present invention, the above calculation formula can be used to perform a weighted analysis on the two cache optimal ratios by weighted processing to calculate the current solid-state hard disk cache optimal ratio.
[0106] Step 103: Determine a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid state drive according to the current SSD cache optimal ratio and the memory space of the solid state drive.
[0107] In an embodiment of the present invention, a reference cache mapping table memory space and a reference data cache memory space are determined according to the current optimal ratio of the solid-state hard disk cache and the memory space of the solid-state hard disk. The reference cache mapping table memory space and the current cache mapping table memory space are compared and analyzed to obtain a first cache mapping table memory space adjustment value; the reference data cache memory space and the current data cache memory space are compared and analyzed to obtain a first data cache memory space adjustment value. The first cache mapping table memory space adjustment value is compared and analyzed with a preset cache mapping table adjustment threshold, and the first data cache memory space adjustment value is compared and analyzed with a preset data cache adjustment threshold. When the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, the first adjustment value of the current cache mapping table memory space is determined according to the reference cache mapping table memory space, and the second adjustment value of the current data cache memory space is determined based on the reference data cache memory space.
[0108] The specific implementation process of this step corresponds to Step 6-Step 9. Step 6: Calculate the reference cache mapping table memory space and the reference data cache memory space according to the current SSD cache optimal ratio and the SSD memory space. Step 7: Compare the reference cache mapping table memory space with the current cache mapping table memory space to obtain the first cache mapping table memory space adjustment value; compare the reference data cache memory space with the current data cache memory space to obtain the first data cache memory space adjustment value. Step 8: Compare the first cache mapping table memory space adjustment value with the preset cache mapping table adjustment threshold, and compare the first data cache memory space adjustment value with the preset data cache adjustment threshold. If the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, enter Step 9. Step 9: Calculate and update the values of the current cache mapping table memory space and the current data cache memory space, that is, determine the first adjustment value of the current cache mapping table memory space according to the reference cache mapping table memory space, and determine the second adjustment value of the current data cache memory space based on the reference data cache memory space. That is, the current cache mapping table memory space is made equal to the reference cache mapping table memory space; and the current data cache memory space is made equal to the reference data cache memory space.
[0109] Step 104: adjusting the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and outputting an adjustment result.
[0110] Specifically, based on the first adjustment value and the second adjustment value, adjustment notification information is sent to the data cache area and the flash translation layer in the solid state drive respectively, and based on the adjustment notification information, the current cache mapping table memory space and the current data cache memory space in the flash translation layer are released or increased, and the adjustment result is output. That is, after obtaining the first adjustment value and the second adjustment value, the corresponding preset address mapping algorithm and the preset data cache management algorithm can be notified to release or increase the space. The first cache mapping table memory space adjustment value (i.e., the first adjustment value) is determined. If it is necessary to reduce the cache mapping table memory space, when the cache mapping table occupies a space larger than the current cache mapping table memory space, the cache mapping table is traversed to select appropriate mapping items for elimination until the cache mapping table occupies a space smaller than or equal to the current cache mapping table memory space; otherwise, when the data cache area occupies a space larger than the current data cache memory space, the data cache area is traversed to select appropriate data for elimination until the data cache area occupies a space smaller than or equal to the current data cache memory space. After obtaining the adjustment result, the server returns the adjustment result to the client. It should be noted that in the embodiment of the present invention, the tuple is a basic concept in a relational database, and each row in a table is a tuple, which is also called a record. The connection is the most important query in a relational database, which combines the query results of two or more tables. The hash connection is a connection algorithm and is the most commonly used Join method in equivalued connections. The distributed database is a logically unified database composed of multiple physically dispersed database units connected by a computer network. Among them, each connected database unit is called a node, and the distributed database includes at least two nodes. The node can be a physical node distributed in different places, or it can be a logical node distributed in the same physical database. The RDMA (Remote Direct Memory Access) is remote direct memory access.
[0111] The solid-state hard disk cache management method described in the embodiment of the present application pre-establishes a load characteristic model that includes multiple load modes and the optimal cache ratio corresponding to the load mode, so that the solid-state hard disk calculates the current solid-state hard disk cache optimal ratio based on the current solid-state hard disk load characteristics and the load characteristic model during operation, and then adjusts the current cache mapping table memory space and the current data cache memory space, which can effectively improve the hit rate of the current cache mapping table memory space and the data cache memory space, and improve the read and write performance of the solid-state hard disk.
[0112] Corresponding to the solid state drive cache management method provided above, the present application also provides a solid state drive cache management device. Since the embodiment of the device is similar to the above method embodiment, the description is relatively simple. For relevant details, please refer to the description of the above method embodiment. The embodiment of the solid state drive cache management device described below is only illustrative. Please refer to Figure 2 As shown, it is a schematic diagram of the structure of a solid state drive cache management device provided by an embodiment of the present application. The solid state drive cache management device described in the present application includes the following parts:
[0113] The statistical unit 201 is used to determine the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests when the solid-state hard disk to be managed completes a preset number of read and write operation requests, and to perform statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current load characteristics of the solid-state hard disk;
[0114] The calculation unit 202 is used to perform matching analysis based on the current SSD load characteristics and a preset load characteristic model to determine the current SSD cache optimal ratio; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio;
[0115] A decision unit 203 is used to determine a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid state drive according to the current optimal ratio of the solid state drive cache and the memory space of the solid state drive;
[0116] The notification unit 204 is configured to adjust the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and output an adjustment result.
[0117] Furthermore, the decision-making unit is specifically used to:
[0118] Determining a reference cache mapping table memory space and a reference data cache memory space according to the current optimal ratio of the solid state drive cache and the memory space of the solid state drive;
[0119] Compare and analyze the reference cache mapping table memory space with the current cache mapping table memory space to obtain a first cache mapping table memory space adjustment value; compare and analyze the reference data cache memory space with the current data cache memory space to obtain a first data cache memory space adjustment value;
[0120] The first cache mapping table memory space adjustment value is compared and analyzed with the preset cache mapping table adjustment threshold, and the first data cache memory space adjustment value is compared and analyzed with the preset data cache adjustment threshold. When the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, the first adjustment value of the current cache mapping table memory space is determined according to the reference cache mapping table memory space, and the second adjustment value of the current data cache memory space is determined based on the reference data cache memory space.
[0121] Furthermore, the statistical unit is specifically used for:
[0122] Determine the read / write operation type, read / write operation address and read / write operation size of the read / write operation request, compare and analyze the read / write operation type, read / write operation address and read / write operation size of the current read / write operation request with the read / write operation type, read / write operation address and read / write operation size of the previous read / write operation request, and determine the load characteristic parameters of the current read / write operation request; wherein the attribute characteristics of the read / write operation request include the read / write operation type, read / write operation address and read / write operation size of the read / write operation request; the load characteristic parameters of the current read / write operation request include the read / write operation type, read / write operation span and read / write operation size corresponding to the current read / write operation request; the read / write operation span is determined according to the difference between the read / write operation address of the current read / write operation request and the read / write operation address of the previous read / write operation request;
[0123] Based on two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics.
[0124] Further, based on the two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics, specifically including:
[0125] Determine the read / write operation type of the current operation request, and determine the target statistical array in the two two-dimensional statistical arrays according to the read / write operation type of the current operation request; wherein the current operation request includes a read operation request and a write operation request;
[0126] Determine a row index according to the read / write operation span of the current operation request;
[0127] Determine a column index according to the read / write operation size of the current operation request;
[0128] According to the read and write operation type of the current operation request, the row index and the column index, the corresponding target statistical arrays in the two two-dimensional statistical arrays are selected and voted for, and statistical analysis is performed, and the current solid state hard disk load characteristics are determined according to the statistical analysis results.
[0129] Furthermore, the computing unit is specifically used for:
[0130] The current SSD load characteristics are matched and analyzed with a preset load characteristic model to obtain a matching analysis result; a corresponding probability is determined according to the matching degree in the matching analysis result, and the current SSD cache optimal ratio is determined according to the size of the probability.
[0131] Furthermore, before determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read / write operation request and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk, the method further includes:
[0132] Load characteristic model acquisition unit, used for:
[0133] Determine at least one read load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the read load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the read load mode, and record the corresponding relationship between the read load mode and the optimal cache ratio; and, determine at least one write load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the write load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the write load mode, and record the corresponding relationship between the write load mode and the optimal cache ratio;
[0134] Based on the corresponding relationship between the read load pattern and the optimal cache ratio and the corresponding relationship between the write load pattern and the optimal cache ratio, the load characteristic model is constructed; wherein the load pattern includes the read load pattern and the write load pattern.
[0135] Furthermore, the notification unit is specifically used to:
[0136] Based on the first adjustment value and the second adjustment value, adjustment notification information is sent to the data cache area and the flash translation layer in the solid-state drive respectively, and based on the adjustment notification information, the current cache mapping table memory space and the current data cache memory space in the flash translation layer are released or space is increased, and the adjustment result is output.
[0137] Specifically, Figure 3As shown, in order to implement an adaptive dynamic cache management algorithm in a solid-state drive, a dynamic memory partition adjustment unit is designed in combination with the characteristics of the solid-state drive itself and the characteristics of the load. The solid-state drive architecture designed by the present invention is shown in the figure above, including a host interface, a data cache area, a flash conversion layer (including an address mapping cache area), a dynamic memory partition adjustment unit, a flash interface and a flash array. The host interface is mainly responsible for receiving upper-layer application or file system I / O requests, and returning the result of the request to the upper-layer user, so as to achieve barrier-free communication between the solid-state drive and the host. The data cache area mainly stores valuable I / O requests in this area, and completes some user I / O requests in the cache area to reduce the read and write operations on the underlying flash memory chip to improve the access performance of the system. The flash conversion layer is the core functional module of the solid-state drive. It hides the characteristics of the solid-state drive upward, and mainly includes functional modules such as address mapping, garbage collection, wear leveling and bad block management. The dynamic memory partition adjustment unit mainly monitors the load characteristics of the solid-state drive, predicts the optimal cache ratio in real time, and notifies the data cache area and the flash conversion layer to adjust the cache size in time.
[0138] like Figure 4 As shown, the dynamic memory partition adjustment unit includes a statistical unit, a calculation unit, a decision unit and a notification unit. The statistical unit is mainly responsible for counting the load characteristics of the most recent N accesses and obtaining two statistical histograms (executing Step 1 to Step 4); the calculation unit calculates the probability of the current SSD load characteristics and the predetermined load characteristic model based on the statistical histograms, and calculates the current SSD cache optimal ratio (executing Step 5); the decision unit is responsible for deciding whether this round needs to be adjusted and the current cache mapping table memory space and the current data cache memory space value (Step 6 to Step 9); the notification unit is mainly responsible for notifying the data cache area and the flash conversion layer to adjust the space (Step 10). The flash memory interface refers to the communication interface between the flash memory array and the solid-state drive controller. The flash memory array includes multi-channel and multi-block flash memory chips, which actually store the data requested by the upper-level user I / O. When the host's read and write operation request reaches the solid-state drive, the data is first searched in the data cache area, and the data is immediately responded to if found; otherwise, the mapping table is searched, and the flash memory array is read and written according to the mapping information, and finally the read and write operation request is responded to. After each read or write operation request is completed, the dynamic memory partition adjustment unit dynamically predicts the current optimal cache ratio based on past load characteristics, and notifies the data cache area and flash translation layer to adjust the size ratio of the data cache area and the mapping relationship area in the memory based on the relationship between the adjustment value and the adjustment threshold, so as to improve the read and write performance of the solid-state drive.
[0139] The solid-state hard disk cache management device described in the embodiment of the present application pre-establishes a load characteristic model that includes multiple load modes and the optimal cache ratio corresponding to the load mode, so that the solid-state hard disk calculates the current solid-state hard disk cache optimal ratio based on the current solid-state hard disk load characteristics and the load characteristic model during operation, and then adjusts the current cache mapping table memory space and the current data cache memory space, which can effectively improve the hit rate of the current cache mapping table memory space and the data cache memory space, thereby improving the read and write performance of the solid-state hard disk.
[0140] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the solid-state hard disk cache management method, which includes: when the solid-state hard disk to be managed completes a preset number of read and write operation requests, determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current solid-state hard disk load characteristics; based on the matching analysis of the current solid-state hard disk load characteristics and a preset load characteristic model, determining the current solid-state hard disk cache optimal ratio; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio; according to the current solid-state hard disk cache optimal ratio and the memory space of the solid-state hard disk, determining a first adjustment value of the current cache mapping table memory space and a second adjustment value of the current data cache memory space in the solid-state hard disk; based on the first adjustment value and the second adjustment value, adjusting the current cache mapping table memory space and the current data cache memory space respectively, and outputting the adjustment result.
[0141] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0142] On the other hand, the present application also provides a computer program product, the computer program product includes a computer program stored on a computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a computer, the computer can execute the solid-state hard disk cache management method provided by the above methods, the method comprising: when the solid-state hard disk to be managed completes a preset number of read and write operation requests, determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current solid-state hard disk load characteristics; based on the matching analysis of the current solid-state hard disk load characteristics and a preset load characteristic model, determining the current solid-state hard disk cache optimal ratio; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio; according to the current solid-state hard disk cache optimal ratio and the memory space of the solid-state hard disk, determining a first adjustment value of the current cache mapping table memory space and a second adjustment value of the current data cache memory space in the solid-state hard disk; based on the first adjustment value and the second adjustment value, adjusting the current cache mapping table memory space and the current data cache memory space respectively, and outputting the adjustment result.
[0143] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes the solid-state hard disk cache management method provided above, the method comprising: when the solid-state hard disk to be managed completes a preset number of read and write operation requests, determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current solid-state hard disk load characteristics; performing matching analysis based on the current solid-state hard disk load characteristics and a preset load characteristic model to determine the current solid-state hard disk cache optimal ratio; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio; determining a first adjustment value of the current cache mapping table memory space and a second adjustment value of the current data cache memory space in the solid-state hard disk according to the current solid-state hard disk cache optimal ratio and the memory space of the solid-state hard disk; adjusting the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and outputting the adjustment result.
[0144] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A solid state drive cache management method, characterized in that: include: When the solid-state hard disk to be managed completes a preset number of read and write operation requests, the load characteristic parameters currently corresponding to the solid-state hard disk are determined according to the attribute characteristics of the read and write operation requests, and the load characteristic parameters currently corresponding to the solid-state hard disk are statistically analyzed to determine the current load characteristics of the solid-state hard disk; Based on the matching analysis between the current SSD load characteristics and a preset load characteristic model, the optimal cache ratio of the current SSD is determined; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio; According to the current optimal ratio of the solid-state hard disk cache and the memory space of the solid-state hard disk, determine a first adjustment value of the current cache mapping table memory space in the solid-state hard disk and a second adjustment value of the current data cache memory space; according to the current optimal ratio of the solid-state hard disk cache and the memory space of the solid-state hard disk, determine the first adjustment value of the current cache mapping table memory space in the solid-state hard disk and the second adjustment value of the current data cache memory space, specifically including: according to the current optimal ratio of the solid-state hard disk cache and the memory space of the solid-state hard disk, determine a reference cache mapping table memory space and a reference data cache memory space; compare and analyze the reference cache mapping table memory space with the current cache mapping table memory space to obtain a first cache mapping table memory space adjustment value; compare ... Compare and analyze the data cache memory space with the current data cache memory space to obtain a first data cache memory space adjustment value; compare and analyze the first cache mapping table memory space adjustment value with a preset cache mapping table adjustment threshold, and compare and analyze the first data cache memory space adjustment value with a preset data cache adjustment threshold, and when the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, determine the first adjustment value of the current cache mapping table memory space according to the reference cache mapping table memory space, and determine the second adjustment value of the current data cache memory space based on the reference data cache memory space; The current cache mapping table memory space and the current data cache memory space are adjusted respectively based on the first adjustment value and the second adjustment value, and an adjustment result is output.
2. The solid state drive cache management method according to claim 1, characterized in that: The step of determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read / write operation request, and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk to determine the current load characteristics of the solid-state hard disk specifically includes: Determine the read / write operation type, read / write operation address and read / write operation size of the read / write operation request, compare and analyze the read / write operation type, read / write operation address and read / write operation size of the current read / write operation request with the read / write operation type, read / write operation address and read / write operation size of the previous read / write operation request, and determine the load characteristic parameters of the current read / write operation request; wherein the attribute characteristics of the read / write operation request include the read / write operation type, read / write operation address and read / write operation size of the read / write operation request; the load characteristic parameters of the current read / write operation request include the read / write operation type, read / write operation span and read / write operation size corresponding to the current read / write operation request; the read / write operation span is determined according to the difference between the read / write operation address of the current read / write operation request and the read / write operation address of the previous read / write operation request; Based on two preset two-dimensional statistical arrays, statistical analysis is performed on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation requests to determine the current solid state hard disk load characteristics.
3. The solid state drive cache management method according to claim 2, characterized in that: The method of performing statistical analysis on the load characteristic parameters of the read operation request and the load characteristic parameters of the write operation request in the load characteristic parameters of the current read and write operation request based on the two preset two-dimensional statistical arrays to determine the current load characteristics of the solid state drive specifically includes: Determine the read / write operation type of the current operation request, and determine the target statistical array in the two two-dimensional statistical arrays according to the read / write operation type of the current operation request; wherein the current operation request includes a read operation request and a write operation request; Determine a row index according to the read / write operation span of the current operation request; Determine a column index according to the read / write operation size of the current operation request; According to the read and write operation type of the current operation request, the row index and the column index, the corresponding target statistical arrays in the two two-dimensional statistical arrays are selected and voted for, and statistical analysis is performed, and the current solid state hard disk load characteristics are determined according to the statistical analysis results.
4. The solid state drive cache management method according to claim 1, characterized in that: The matching analysis based on the current SSD load characteristic and the preset load characteristic model to determine the current SSD cache optimal ratio specifically includes: The current SSD load characteristics are matched and analyzed with a preset load characteristic model to obtain a matching analysis result; a corresponding probability is determined according to the matching degree in the matching analysis result, and the current SSD cache optimal ratio is determined according to the size of the probability.
5. The solid state drive cache management method according to claim 1, characterized in that: Before determining the load characteristic parameters currently corresponding to the solid-state hard disk according to the attribute characteristics of the read / write operation request and performing statistical analysis on the load characteristic parameters currently corresponding to the solid-state hard disk, the method further includes: Determine at least one read load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the read load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the read load mode, and record the corresponding relationship between the read load mode and the optimal cache ratio; and, determine at least one write load mode, compare and analyze the average access times of single read operation requests with different cache ratios corresponding to the write load mode, use the cache ratio corresponding to the read operation request with the smallest average access time of the single read operation request as the optimal cache ratio of the write load mode, and record the corresponding relationship between the write load mode and the optimal cache ratio; Based on the corresponding relationship between the read load pattern and the optimal cache ratio and the corresponding relationship between the write load pattern and the optimal cache ratio, the load characteristic model is constructed; wherein the load pattern includes the read load pattern and the write load pattern.
6. The solid state drive cache management method according to claim 1, characterized in that: The adjusting the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and outputting the adjustment result specifically includes: Based on the first adjustment value and the second adjustment value, adjustment notification information is sent to the data cache area and the flash translation layer in the solid-state drive respectively, and based on the adjustment notification information, the current cache mapping table memory space and the current data cache memory space in the flash translation layer are released or space is increased, and the adjustment result is output.
7. A solid state drive cache management device, characterized in that: include: A statistical unit, configured to determine, when the solid-state hard disk to be managed completes a preset number of read and write operation requests, a load characteristic parameter currently corresponding to the solid-state hard disk according to the attribute characteristics of the read and write operation requests, and to perform statistical analysis on the load characteristic parameter currently corresponding to the solid-state hard disk to determine the current load characteristics of the solid-state hard disk; A calculation unit, configured to determine the optimal cache ratio of the current solid-state hard disk based on a matching analysis between the current solid-state hard disk load characteristics and a preset load characteristic model; wherein the load characteristic model includes a correspondence between at least one predetermined load mode and its optimal cache ratio; A decision unit, configured to determine a first adjustment value of a current cache mapping table memory space and a second adjustment value of a current data cache memory space in the solid-state drive according to the current optimal ratio of the solid-state drive cache and the memory space of the solid-state drive; The decision unit is specifically used to: determine a reference cache mapping table memory space and a reference data cache memory space according to the current SSD cache optimal ratio and the memory space of the SSD; compare and analyze the reference cache mapping table memory space with the current cache mapping table memory space to obtain a first cache mapping table memory space adjustment value; compare and analyze the reference data cache memory space with the current data cache memory space to obtain a first data cache memory space adjustment value; compare and analyze the first cache mapping table memory space adjustment value with a preset cache mapping table adjustment threshold, and compare and analyze the first data cache memory space adjustment value with a preset data cache adjustment threshold, and when the first cache mapping table memory space adjustment value is greater than the preset cache mapping table adjustment threshold or the first data cache memory space adjustment value is greater than the preset data cache adjustment threshold, determine the first adjustment value of the current cache mapping table memory space according to the reference cache mapping table memory space, and determine the second adjustment value of the current data cache memory space based on the reference data cache memory space; A notification unit is used to adjust the current cache mapping table memory space and the current data cache memory space respectively based on the first adjustment value and the second adjustment value, and output an adjustment result.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the solid state drive cache management method according to any one of claims 1 to 6 are implemented.
9. A processor-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the solid state drive cache management method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Storage apparatus, chip, and control method for storage apparatus
CN108401467A
Instrumentation profiling for reconfigurable processors
US11126574B1