Data pre-reading method and device, equipment and storage medium

By acquiring historical access information from solid-state drives, determining load patterns and data popularity, and dynamically adjusting the pre-read strategy, the problem of low pre-read accuracy in complex load scenarios is solved, thereby improving pre-read accuracy and resource utilization efficiency.

CN120994124APending Publication Date: 2025-11-21JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511071581.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing technologies have low pre-read accuracy under complex load scenarios, leading to negative performance optimization and resource waste.

Method used

By acquiring historical access information from the solid-state drive, the load pattern and data popularity are determined, and the pre-read strategy is dynamically adjusted to pre-read only areas where the data popularity is higher than the threshold, thus avoiding invalid pre-reads.

Benefits of technology

It improves pre-read accuracy, reduces cache resource usage, and enhances data reading efficiency and resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994124A_ABST
    Figure CN120994124A_ABST
Patent Text Reader

Abstract

The invention discloses a data pre-reading method and device, equipment and a storage medium, and relates to the field of electronic computers.In the data pre-reading method, data heat, a load mode and a historical read command proportion are determined by analyzing historical access information, cache operation is judged based on the data heat, and a target hard disk area is predicted based on the load mode; and adjusting the size of a pre-read cache space based on the historical read command proportion to realize pre-read and cache management. By optimizing the data pre-reading strategy and cache resource allocation, the pre-reading precision of the data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage, and in particular to a data pre-reading method and device, an electronic device, and a storage medium. BACKGROUND

[0002] The pre-reading technology of a solid state disk (SSD) refers to predicting the logical block address (LBA) range of data to be read in advance, and reading the data from the hard disk to the cache based on the predicted address in advance. In this way, when a data reading request is received, the data can be directly read in the cache, thereby effectively reducing the read delay of the storage and improving the read performance.

[0003] With the complex changes of application scenarios, the pre-reading technology needs to meet the dual challenges of multi-dimensional environment adaptability and real-time decision accuracy. At present, in some traditional pre-reading technologies, the address prediction is mainly realized by statistical analysis of historical access, which has the phenomenon of insufficient robustness and even negative optimization of performance, and the pre-reading accuracy is not high. Therefore, how to effectively improve the pre-reading accuracy in a complex load scenario has become a problem to be solved. SUMMARY

[0004] The present application provides a data pre-reading method, a data pre-reading device, an electronic device, a computer readable storage medium, and a computer program product to at least solve the problem of low pre-reading accuracy in related technologies.

[0005] The present application provides a data pre-reading method, comprising:

[0006] Obtaining historical access information of a solid state disk, the historical access information comprising historical read addresses of a host in the solid state disk, and historical read frequencies of the host in each region of the solid state disk;

[0007] Based on the historical read addresses, determining a load pattern of the solid state disk, the load pattern representing address change characteristics of the host when reading data from the solid state disk;

[0008] Based on the load pattern, predicting a target hard disk region to be read by the host;

[0009] Based on the historical read frequencies, determining the data heat of the target hard disk region;

[0010] If the data heat is greater than a first heat threshold, reading the data of the target hard disk region to the cache, so that the host reads the data of the target hard disk region from the cache.

[0011] The present application also provides a data pre-reading device, comprising:

[0012] an information obtaining module, configured to obtain historical access information of the solid state disk, the historical access information comprising historical read addresses of the host in the solid state disk and historical read times of the host in each region of the solid state disk;

[0013] a load pattern determining module, configured to determine a load pattern of the solid state disk based on the historical read addresses, the load pattern representing address change characteristics of the host when reading data from the solid state disk;

[0014] a region predicting module, configured to predict a target hard disk region to be read by the host based on the load pattern;

[0015] a hotness determining module, configured to determine data hotness of the target hard disk region based on the historical read times;

[0016] a data pre-reading module, configured to read data of the target hard disk region into a cache if the data hotness is greater than a first hotness threshold, so that the host reads data of the target hard disk region from the cache.

[0017] The application further provides an electronic device, comprising a memory configured to store a computer program and a processor configured to execute the computer program to implement the steps of any of the data pre-reading methods.

[0018] The application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of any of the data pre-reading methods.

[0019] In the technical solutions of some embodiments of the present application, based on the historical access information of the solid state disk, the load mode of the solid state disk is determined and the target hard disk area to be read by the host is predicted, and meanwhile, based on the historical read times, the data hotness of the target hard disk area is determined, and then based on the data hotness, it is determined whether the data of the target hard disk area is read into the cache. In this way, the pre-reading strategy can be dynamically adjusted according to the load mode and the data hotness of the target hard disk area. For example, when the load mode is sequential read or mixed read load mode, the target hard disk area is determined based on the historical read address of the host last time, when the load mode is random read mode, the hard disk area with the highest historical read times and the surrounding area thereof are the target hard disk area, and only the data of the target hard disk area with the data hotness higher than a first threshold is pre-read, so that the pre-reading hit rate is improved while the occupation of the cache resource by invalid pre-reading is reduced. For another example, when the data hotness of the target hard disk area is low, pre-reading is not performed regardless of the load mode, so that the cache space waste can be avoided. In summary, the scheme of the present application can improve the pre-reading accuracy in the complex load scenario, thereby solving the problem of insufficient pre-reading accuracy in the complex load scenario in some technologies. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings described below are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0021] Figure 1 The architecture schematic diagram of the storage system provided by some embodiments of the present application is shown in the figure.

[0022] Figure 2 The flow schematic diagram of the data pre-reading method provided by some embodiments of the present application is shown in the figure.

[0023] Figure 3 The module schematic diagram of the data pre-reading device provided by some embodiments of the present application is shown in the figure.

[0024] Figure 4 The module schematic diagram of the electronic device provided by some embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0026] It should be noted that in the description of the present application, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, not to describe a specific order or sequence.

[0027] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below in conjunction with the drawings and specific embodiments.

[0028] In conjunction with the drawings Figure 1 The architecture schematic diagram of the storage system provided by some embodiments of the present application is shown. Figure 1 In some embodiments, the storage system includes a hard disk controller, a first memory and a second memory. The hard disk controller can be an SSD controller, the first memory can be a double data rate synchronous dynamic random access memory, and the second memory can be a solid state disk. The hard disk controller includes a host interface, a flash interface, a communication bus, a central processor cluster, a static random access memory and a dynamic random access memory controller. The central processor cluster, the static random access memory, the dynamic random access memory controller, the host interface and the flash interface can be connected through the communication bus. The host is connected to the hard disk controller through the host interface, and the second memory is connected to the hard disk controller through the flash interface. The host can issue data operation instructions (such as data read / write instructions, modification instructions, deletion instructions) to the hard disk controller through the host interface. The hard disk controller can execute data operations in the second memory based on the data operation instructions and return responses to the host.

[0029] In order to improve the data reading efficiency, in some technologies, the hard disk controller predicts the target data that the host needs to read in the future period based on the pre-reading technology, and reads the target data from the second memory to the first memory through the dynamic random access memory controller. The first memory can be used as a cache. In this way, when the host initiates a read request for the target data, the hard disk controller can directly read the data in the cache, thereby achieving the purpose of improving the data reading efficiency.

[0030] Currently, some traditional pre-reading technologies can only adapt to some simple load scenarios, and in the complex mode of alternating read and write, the pre-reading strategy is chaotic, it is difficult to dynamically adapt to the change of load characteristics, and it is easy to cause resource waste when the read / write ratio fluctuates, resulting in performance negative optimization. Therefore, how to effectively improve the pre-reading accuracy in complex load scenarios has become a problem to be solved.

[0031] In view of this, the application provides a data pre-reading method, which can solve the problem of low pre-reading accuracy in a complex load scenario. The data pre-reading method can be applied to an electronic device. The electronic device can include but is not limited to a tablet computer, a notebook computer, a desktop computer, a server, and the like. For better understanding Figure 2 The flowchart of the data pre-reading method provided for some embodiments of the application is shown in the figure. Figure 2 In some embodiments, the data pre-reading method includes the following steps:

[0032] In step S201, historical access information of a solid state disk is obtained, the historical access information including historical read addresses of a host in the solid state disk and historical read times of the host in each region of the solid state disk.

[0033] The historical access information of the solid state disk refers to information recorded by a hard disk controller in relation to historical data access of the host to the solid state disk, such as logical block addresses accessed by the host, access times of each LBA range, and time of each access.

[0034] The host can initiate a read access behavior to the solid state disk, such as a database system running in a server of a data center needs to read transaction records of users from the solid state disk (i.e., the host accesses data in the solid state disk). For another example, when an operating system is started in a personal computer, system files will be read from the solid state disk (i.e., the host accesses system files in the solid state disk).

[0035] When the host performs a read access to the solid state disk each time, the solid state disk controller can automatically record read command sequences in multiple collection periods. Based on the read command sequences, historical access information can be formed. Based on the historical access information, the access mode of the solid state disk can be traced back. Specifically, the access information can include but is not limited to the following information:

[0036] Read-write operation type, historical read address, historical read times of each region, last access time of the solid state disk, load state at the time of access, and data volume of read access.

[0037] In this embodiment, the controller of the solid state disk continuously collects historical access information at a fixed period. For example, when the controller of the solid state disk detects that the host access mode changes significantly (such as from sequential read to random read), the historical read addresses and the historical read times of each region in the recent period (such as the past 1 hour) are obtained as the historical access information.

[0038] Of course, it can be understood that the range of the historical access information can be adjusted according to actual needs, either short-term data or longer-term historical data can be obtained. The application does not limit this.

[0039] Step S202, determining a load pattern of the solid state disk based on the historical read addresses, the load pattern representing address change characteristics of the host when reading data from the solid state disk.

[0040] Specifically, by statistically analyzing the historical read addresses, the load pattern reflecting the address change characteristics can be obtained.

[0041] The address change characteristics refer to the regular characteristics of the logical block addresses accessed by the host, and specifically represent the continuity or discreteness of the read addresses in time sequence. For example, if the read addresses of adjacent time points present a continuous increasing or decreasing trend, the address change characteristics represent continuity; if the read addresses present random distribution in the logical block address space, the address change characteristics represent discreteness; if the above two characteristics appear alternately, the address change characteristics represent mixedness.

[0042] The load pattern is a classification of the above-mentioned address change characteristics. By analyzing the time sequence distribution characteristics of the historical read addresses, a basis can be provided for subsequent selection of an adaptive pre-reading strategy, so as to ensure that the pre-reading operation matches the actual access demand.

[0043] Step S203, predicting a target disk region to be read by the host based on the load pattern.

[0044] Specifically, according to the load pattern, the target disk region accessed by the host next can be predicted. For example, when the load pattern presents strong continuity, the read addresses of the host usually present increasing or decreasing characteristics, so that it can be predicted that the host will access the continuous region after the current read address next; when the load pattern presents strong discreteness, the read addresses of the host usually jump around the high-frequency access region, so that it can be predicted that the host will access the hot region and its surrounding region next; when the load pattern presents mixedness, the possible target disk region can be predicted in combination with the change trend of continuity and discreteness.

[0045] Step S204, determining the data heat of the target disk region based on the historical read times.

[0046] Specifically, according to the historical read times, the access frequency of the host to each region (including the target disk region) of the solid state disk, i.e., the data heat, can be obtained. For example, if the historical read times of a certain target disk region are high, it indicates that the data of the region is frequently used, and the data heat of the region is correspondingly high; if the historical read times of a certain target disk region are low, it indicates that the data access demand of the region is low, and the data heat of the region is correspondingly low.

[0047] Through the time series analysis of the historical read times, the change trend of the data hotness can be obtained. For example, if the historical read times of a certain region present an upward trend, the data hotness of the region is increasing, and the possibility of future access is increasing; if the historical read times of a certain region present a downward trend, the data hotness of the region is decreasing, and the possibility of future access is decreasing. Based on this trend, the change of data access demand can be predicted in advance, so that the pre-reading strategy can be adjusted flexibly. For example, for a region with high data hotness, pre-reading operation can be performed preferentially to reduce the access delay of the host; for a region with low data hotness, pre-reading operation can be reduced or suspended to optimize the use efficiency of cache resources.

[0048] In step S205, if the data hotness is greater than the first hotness threshold, the data of the target hard disk region is read into the cache, so that the host reads the data of the target hard disk region from the cache.

[0049] Specifically, the data hotness represents the frequency of access of the data of the target hard disk region, and the first hotness threshold is a standard for judging whether the data needs to be pre-read to the cache preferentially. When the data is stored in the cache in advance, the host can directly obtain the data from the cache, reducing the delay when reading from the solid state disk.

[0050] The controller of the solid state disk will evaluate the data hotness of the target hard disk region. If the evaluation result is that the data hotness exceeds the first hotness threshold, it indicates that the frequency of recent access of the data of the region by the host is high, and at this time the data is read into the cache, which can prepare the data in advance; if the evaluation result is that the data hotness does not exceed the first hotness threshold, it indicates that the frequency of recent access of the data of the region by the host is low, and at this time the pre-reading operation is not performed, which can avoid the occupation of the cache space by low-demand data, so that the cache resources are used efficiently.

[0051] In summary, in the technical solutions of some embodiments of the present application, based on the historical access information of the solid state disk, the load mode of the solid state disk is determined and the target hard disk area to be read by the host is predicted, and meanwhile, based on the historical read times, the data hotness of the target hard disk area is determined, and then based on the data hotness, it is determined whether to read the data of the target hard disk area into the cache. In this way, the pre-reading strategy can be dynamically adjusted according to the load mode and the data hotness of the target hard disk area. For example, when the load mode is sequential read or mixed read load mode, the target hard disk area is determined based on the historical read address of the host last time, when the load mode is random read mode, the hard disk area with the highest historical read times and the surrounding area thereof are the target hard disk area, and only the data of the target hard disk area with the data hotness higher than the first threshold value is pre-read, so that the pre-reading hit rate is improved while the occupation of cache resources by invalid pre-reading is reduced. For another example, when the data hotness of the target hard disk area is low, pre-reading is not performed regardless of the load mode, so that cache space waste can be avoided. In summary, the scheme of the present application can improve the pre-reading accuracy in complex load scenarios, thereby solving the problem of insufficient pre-reading accuracy in complex load scenarios in some technologies.

[0052] In some embodiments, after the data of the target hard disk area is read into the cache, the method of the present application further comprises:

[0053] If the data hotness is greater than the first hotness threshold value and less than the second hotness threshold value, the data of the target hard disk area is deleted from the cache in response to the host reading the data of the target hard disk area from the cache;

[0054] If the data hotness is greater than or equal to the second hotness threshold value, the data of the target hard disk area is deleted from the cache in response to the cache time length of the data of the target hard disk area in the cache reaching a preset time length;

[0055] If the data hotness is not greater than the first hotness threshold value, reading the data of the target hard disk area into the cache is suspended.

[0056] Specifically, in actual operation, the following operations can be performed:

[0057] 1) When the data hotness is greater than the first hotness threshold value and less than the second hotness threshold value, it indicates that the data of the target hard disk area is likely to be read by the host, but the read times are few. For example, after the host reads the data of the target hard disk area once, it will not read it again or a third time. In this case, after the host reads the data of the target hard disk area from the cache, the data of the target hard disk area can be deleted from the cache. In this way, the cache space is released and the occupation of the cache space is reduced.

[0058] 2) When the data hotness is greater than or equal to the second hotness threshold, it indicates that the data of the target hard disk region is accessed frequently, i.e., after the data of the target hard disk region is accessed by the host for the first time, it is possible to be accessed by the host for the second time or the third time. In this case, after the host reads the data of the target hard disk region from the cache, the data of the target hard disk region can be continued to be saved in the cache, so that when the host reads the data of the target hard disk region for the second time or the third time, the data can be continued to be read from the cache, thereby improving the data read efficiency.

[0059] 3) When the data hotness is not greater than the first hotness threshold, it indicates that the frequency of reading the data of the target hard disk region by the host is extremely low, and the data will not be read for a long time. Even if such data is pre-read into the cache, it is difficult to be accessed by the host, and instead, it will occupy limited cache resources. Therefore, the operation of reading the data into the cache can be suspended, so that the space of the cache can be used for data with access demand, thereby improving the overall running efficiency of the solid state disk.

[0060] In the above embodiments, whether the data of the target hard disk region needs to be pre-read into the cache is determined by referring to the characteristics that the data hotness of the target hard disk region is in different ranges, and the operations of deleting the data from the cache, retaining the data for a preset time and then deleting, and suspending the reading into the cache are performed for different cases, so that the utilization efficiency of the cache resources and the data read efficiency can be improved.

[0061] In some embodiments, the data hotness of the target hard disk region is determined based on the historical read number in step S204, including:

[0062] The first historical read number of the target hard disk region and the second historical read number of the reference hard disk region are weighted and fused to obtain an initial data hotness, wherein the reference hard disk region refers to a hard disk region adjacent to the target hard disk region;

[0063] A time difference between the current time and a reference time is determined, wherein the reference time refers to the time when the host last reads data in the target hard disk region;

[0064] Based on the time difference, a time decay weight is determined, wherein the time difference and the time decay weight are inversely proportional;

[0065] Based on the time decay weight, the initial data hotness is corrected to obtain the data hotness of the target hard disk region.

[0066] Specifically, the reference hard disk region can refer to a hard disk region adjacent to the target hard disk region. Generally, the data of adjacent hard disk regions can have certain correlation, and thus the data hotness of adjacent hard disk regions can also be similar. For example, assuming that hard disk regions A and B are adjacent, hard disk region A stores the first 3 characters of a string C, and hard disk region B stores the last 3 characters of the string C. Then, after the host reads data from hard disk region A, it generally also reads data from hard disk region B, so as to obtain a complete string. Therefore, by fusing the read frequencies of adjacent regions, the influence of spatial correlation on data hotness can be captured. For example, when the adjacent regions around the target hard disk region are frequently read, even if the read frequency of the target hard disk region itself is not high, the target hard disk region will be given a higher initial data hotness due to the weighted fusion.

[0067] The reference time refers to the time when the host last reads data in the target hard disk region. The above time difference reflects the timeliness of data access, that is, the closer to the current time, the more the read behavior can reflect the current hotness of the data. For example, if a target hard disk region is frequently read in a short period of time, but there is no read record thereafter, the time difference is large, that is, the timeliness is relatively low; if a target hard disk region is read multiple times in the near future, the time difference is small, that is, the timeliness is high.

[0068] Based on the time difference between the current time and the reference time, the time decay weight can be determined. The time difference is inversely proportional to the time decay weight, indicating that the influence of historical read behavior on current data hotness gradually weakens over time. For example, a time decay function is set, when the time difference is small, the time decay weight is large, and the influence of historical read frequency on data hotness is large; when the time difference is large, the time decay weight is small, and the influence of historical read frequency on data hotness is small. This decay strategy can reflect the trend of data hotness and avoid affecting the current data hotness due to historical high-frequency read behavior with a large time difference.

[0069] Based on the time decay weight, the initial data hotness is corrected to obtain the data hotness of the target hard disk region. For example, for a target hard disk region that has been read frequently but has a decreased read frequency in the near future, its initial data hotness can be high due to its previous high-frequency read behavior, but after correction combined with the time decay weight, the data hotness will decrease accordingly. After the time decay weight correction, the data hotness is more in line with the current actual situation, avoiding overestimation of the current data hotness due to previous high-frequency access behavior, and providing an accurate basis for subsequent cache strategies.

[0070] In the above embodiment, when determining the data hotness of the target hard disk area based on the historical read times, the first historical read times of the target hard disk area, the second historical read times of the reference hard disk area, and the time decay weight corresponding to the time difference are referred to, the initial data hotness is calculated by weighted fusion, and the final data hotness is obtained by combining the time decay weight correction, which can improve the accuracy of the data hotness and provide a basis for subsequent cache strategies.

[0071] In some embodiments, the load mode of the solid state disk is determined based on the historical read addresses in step S202, including:

[0072] The historical read addresses are sorted according to the order of reading data from the solid state disk by the host, and the difference between adjacent two historical read addresses is calculated respectively to obtain a plurality of jump distances;

[0073] The load mode of the solid state disk is determined according to the dispersion degree of the plurality of jump distances.

[0074] Specifically, the jump distance reflects the change of adjacent two read operations in the address, which is the key data for analyzing the read command behavior of the host. When reading data in a continuous hard disk area, the jump distance of adjacent addresses will show a small difference; when reading data in different positions, the jump distance will show a large difference.

[0075] The dispersion degree of the jump distance reflects the distribution state of the jump distance. If the jump distance is concentrated in a small range, the dispersion degree of the address change is small; if the jump distance is distributed in disorder, the dispersion degree of the address change is large.

[0076] In the above embodiment, the load mode of the solid state disk is determined based on the order of the historical read addresses, the jump distance of adjacent historical read addresses, and the dispersion degree of the plurality of jump distances, which can provide a basis for subsequent adjustment of the read-ahead strategy, improve the accuracy and efficiency of the read-ahead.

[0077] In some embodiments, the above load mode includes a sequential read mode, a random read mode, and a mixed read mode, wherein the mixed read mode refers to a data read mode in which sequential read and random read are alternately performed.

[0078] The load mode of the solid state disk is determined according to the dispersion degree of the plurality of jump distances, including:

[0079] If the dispersion degree of the plurality of jump distances is less than or equal to a first dispersion threshold, the load mode is determined as the sequential read mode;

[0080] If the dispersion degree of the plurality of jump distances is greater than or equal to a second dispersion threshold, the load mode is determined as the random read mode.

[0081] If the dispersion degree of the plurality of jump distances is greater than the first dispersion threshold and less than the second dispersion threshold, the load mode is determined as a mixed read mode.

[0082] Specifically, the load mode of the solid state disk is determined according to the dispersion degree of the plurality of jump distances, including:

[0083] 1) If the dispersion degree of the plurality of jump distances is less than or equal to the first dispersion threshold, the load mode is determined as a sequential read mode. When the dispersion degree of the plurality of jump distances is less than or equal to the first dispersion threshold, it indicates that the jump distance of adjacent addresses is small, showing obvious continuity. For example, when the host reads data, the address continuously advances in a fixed direction, and the jump distance of adjacent addresses is stable in a small range, rarely jumping greatly. Therefore, it is determined as a sequential read mode.

[0084] 2) If the dispersion degree of the plurality of jump distances is greater than or equal to the second dispersion threshold, the load mode is determined as a random read mode. When the dispersion degree of the plurality of jump distances is greater than or equal to the second dispersion threshold, it indicates that the jump distance of adjacent addresses is different, showing obvious randomness. For example, the host randomly reads between storage areas without a fixed rule, resulting in a large jump distance of adjacent read addresses and a scattered distribution. Therefore, it is determined as a random read mode.

[0085] 3) If the dispersion degree of the plurality of jump distances is greater than the first dispersion threshold and less than the second dispersion threshold, the load mode is determined as a mixed read mode. When the dispersion degree of the plurality of jump distances is greater than the first dispersion threshold and less than the second dispersion threshold, it indicates that the host read address changes have both regular and chaotic characteristics, with both continuous and random jump phases. For example, the host first continuously reads a segment of data, then jumps to read other areas, and then returns to the continuous read state. Therefore, it is determined as a mixed read mode.

[0086] In the above embodiment, the load state of the solid state disk is determined according to the dispersion degree of the plurality of jump distances, and based on the dispersion degree being in different ranges, it is determined as one of a sequential read mode, a random read mode, or a mixed read mode, which can provide a basis for formulating a differentiated pre-reading strategy and improve the effectiveness of pre-reading and resource utilization efficiency.

[0087] In some embodiments, the target hard disk area to be read by the host is predicted based on the load mode in step S203, including:

[0088] If the load mode is a sequential read mode or a mixed read mode, a reference position of the solid state disk is determined based on the historical read address of the host last time, and the hard disk area where the reference position is located is determined as the target hard disk area;

[0089] If the load mode is the random read mode, a hard disk area with the highest historical read frequency is taken as a reference area, and the reference area is taken as a target hard disk area, or the reference area and areas around the reference area are taken as target hard disk areas.

[0090] Specifically, in the sequential read mode, the historical read address behavior of the host continuously advances in a certain direction, and the address of each read only continuously changes in a small range compared with the last time, and does not jump greatly. In view of this, the area that will be continuously read in the future can be predicted based on the last historical read address. In the mixed read mode, although there is random jumping of the address, most of the time still maintains a state of continuous reading, and the current continuously accessed address can be determined through the last historical read address, and then the target hard disk area that may be read next can be determined.

[0091] In the random read mode, the read address distribution of the host is scattered, and the address of each read may jump greatly compared with the last address, and there is no fixed direction and rule. At this time, the area with the highest historical read frequency indicates a higher probability of being accessed, and the reference area is read in advance, which can improve the possibility that the pre-read data is actually read. At the same time, considering that the data of adjacent areas may be read together, the areas around the reference range are also pre-read, which can further cover possible access requirements and reduce read delay caused by random jumping of the address.

[0092] In the above embodiment, when predicting the target hard disk area to be read by the host based on the load mode, the operation of determining the target area based on the last historical read address and the operation of determining the target area based on the area with the highest historical read frequency are performed respectively for different load modes, which can improve the accuracy of pre-reading and optimize the overall performance of the solid state disk.

[0093] In some embodiments, the historical access information obtained in step S201 further includes historical read commands and historical write commands of the host in the solid state disk, and the method of the present application further includes:

[0094] According to the number of commands of the historical read commands and the historical write commands, a command proportion of the historical read commands is determined.

[0095] According to the command proportion, the size of the cache is adjusted, wherein the command proportion is proportional to the cache size.

[0096] Specifically, a command proportion of the historical read commands is determined according to a command quantity of the historical read commands and a command quantity of the historical write commands. The command proportion of the historical read commands is obtained by dividing a total quantity of the historical read commands by a sum of the total quantity of the historical read commands and a total quantity of the historical write commands within a certain time. The command proportion of the historical read commands intuitively reflects whether the host accesses the solid state disk mainly in a read operation or in a write operation. For example, if the quantity of the historical read commands is much greater than the quantity of the historical write commands, the command proportion is high, which indicates that the host performs the data read operation more frequently.

[0097] According to the command proportion, the size of the cache is adjusted, and the command proportion is proportional to the size of the cache. When the command proportion of the historical read commands is high, it indicates that the host has more data read demand, and at this time, the cache capacity of the pre-read cache area is increased, so that more data to be read can be pre-stored in the cache, thereby reducing the waiting time of the host when reading data. When the command proportion of the historical read commands is low, it indicates that the host has more data write operation and less read demand, and at this time, the cache capacity of the pre-read cache area should be reduced, so as to avoid idle of the cache resources and save the resources to support the write operation. Therefore, the size of the cache can be dynamically adjusted according to the command proportion of the historical read commands, so that the allocation of the cache resources can be more in line with the actual access demand of the host, the pre-read cache area is increased when the read demand is high, and the pre-read cache area is reduced when the read demand is low, thereby improving the utilization efficiency of the cache resources and the response speed of the solid state disk.

[0098] In the above embodiment, the size of the pre-read cache area is adjusted by increasing or reducing the pre-read cache area according to the command proportion of the historical read commands, so that the utilization efficiency of the cache resources and the response speed of the solid state disk can be improved.

[0099] Corresponding to the data pre-reading method, the application also provides a data pre-reading device. For details, see the description of the data pre-reading method. Figure 3 The module schematic diagram of the data pre-reading device provided for some embodiments of the application is shown. Figure 3 In some embodiments of the application, the data pre-reading device comprises:

[0100] The information acquisition module 301 is configured to acquire historical access information of the solid state disk, wherein the historical access information comprises historical read addresses of the host in the solid state disk and historical read quantities of the host in each region of the solid state disk;

[0101] The load mode determination module 302 is configured to determine a load mode of the solid state disk based on the historical read addresses, wherein the load mode represents an address change feature of the host when reading data in the solid state disk;

[0102] The area prediction module 303 is configured to predict a target hard disk area to be read by the host based on the load pattern.

[0103] The heat determination module 304 is configured to determine a data heat of the target hard disk area based on the historical read times.

[0104] The data pre-reading module 305 is configured to read data of the target hard disk area into a cache if the data heat is greater than a first heat threshold, so that the host reads the data of the target hard disk area from the cache.

[0105] In some embodiments, the data pre-reading module 305 is specifically configured to:

[0106] If the data heat is greater than the first heat threshold and less than a second heat threshold, delete the data of the target hard disk area from the cache in response to the host reading the data of the target hard disk area from the cache;

[0107] If the data heat is greater than or equal to the second heat threshold, delete the data of the target hard disk area from the cache in response to a cache duration of the data of the target hard disk area in the cache reaching a preset duration;

[0108] If the data heat is not greater than the first heat threshold, suspend reading the data of the target hard disk area into the cache.

[0109] In some embodiments, the heat determination module 304 is specifically configured to:

[0110] perform weighted fusion calculation on a first historical read time of the target hard disk area and a second historical read time of a reference hard disk area to obtain an initial data heat, wherein the reference hard disk area refers to a hard disk area adjacent to the target hard disk area;

[0111] determine a time difference between a current time and a reference time, wherein the reference time refers to a time when the host last reads data in the target hard disk area;

[0112] determine a time decay weight based on the time difference, wherein the time difference and the time decay weight are inversely proportional;

[0113] correct the initial data heat based on the time decay weight to obtain the data heat of the target hard disk area.

[0114] In some embodiments, the load pattern determination module 302 is specifically configured to:

[0115] The historical read addresses are sorted according to the sequence in which the host reads data from the solid state disk, and a difference between two adjacent historical read addresses is calculated to obtain a plurality of jump distances;

[0116] According to a dispersion degree of the plurality of jump distances, a load mode of the solid state disk is determined.

[0117] In some embodiments, the load mode determination module 302 is specifically configured to:

[0118] The determination of the load mode of the solid state disk according to the dispersion degree of the plurality of jump distances comprises:

[0119] If the dispersion degree of the plurality of jump distances is less than or equal to a first dispersion threshold, the load mode is determined to be a sequential read mode;

[0120] If the dispersion degree of the plurality of jump distances is greater than or equal to a second dispersion threshold, the load mode is determined to be a random read mode;

[0121] If the dispersion degree of the plurality of jump distances is greater than the first dispersion threshold and less than the second dispersion threshold, the load mode is determined to be a mixed read mode.

[0122] In some embodiments, the region prediction module 303 is specifically configured to:

[0123] If the load mode is the sequential read mode or the mixed read mode, a reference position of the solid state disk is determined based on a historical read address of the host last time, and a hard disk region where the reference position is located is taken as the target hard disk region;

[0124] If the load mode is the random read mode, a hard disk region with the highest historical read frequency is taken as a reference region, and the reference region is taken as the target hard disk region, or the reference region and regions around the reference region are taken as the target hard disk region.

[0125] In some embodiments, the data pre-reading module 305 is specifically configured to:

[0126] According to a command quantity of the historical read commands and the historical write commands, a command proportion of the historical read commands is determined;

[0127] According to the command proportion, a size of the cache is adjusted, wherein the command proportion is proportional to the cache size.

[0128] The features of the data pre-reading device corresponding to the embodiments can be referred to the related descriptions of the sample data processing method corresponding to the embodiments, which will not be repeated here.

[0129] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a necessary general hardware platform, and of course can also be realized by hardware, but in many cases the former is a better embodiment.

[0130] With reference to Figure 4 The embodiment of the present application also provides an electronic device, including a memory 10 and a processor 20, the memory 10 stores a computer program, and the processor 20 is configured to execute the computer program to perform the steps in any of the above data pre-reading method embodiments.

[0131] The embodiment of the present application also provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is configured to perform the steps in any of the above data pre-reading method embodiments when executed.

[0132] In an example embodiment, the above computer readable storage medium can include but is not limited to: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0133] The embodiment of the present application also provides a computer program product, the computer program product includes a computer program, and the computer program is executed by a processor to realize the steps in any of the above data pre-reading method embodiments.

[0134] The embodiment of the present application also provides another computer program product, including a non-volatile computer readable storage medium, the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps in any of the above data pre-reading method embodiments.

[0135] The skilled person can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0136] The above describes in detail the data pre-reading method, device, equipment and storage medium provided by the present application. The principles and implementation modes of the present application are described by applying specific examples, and the above description of the embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, the present application can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A data pre-reading method, characterized in that, The method includes: Obtain historical access information of the solid-state drive (SSD), including the historical read addresses of the host in the SSD and the historical read counts of the host in each region of the SSD. Based on the historical read addresses, the load mode of the solid-state drive is determined, and the load mode characterizes the address change characteristics of the host when reading data from the solid-state drive; Based on the load pattern, predict the target hard disk area that the host will read; Based on the historical read count, the data popularity of the target hard disk area is determined; If the data popularity is greater than the first popularity threshold, the data of the target hard disk area is read into the cache so that the host can read the data of the target hard disk area from the cache.

2. The method according to claim 1, characterized in that, After reading the data of the target hard disk area into the cache, the method further includes: If the data popularity is greater than the first popularity threshold and less than the second popularity threshold, then in response to the host reading the data of the target hard disk area from the cache, the data of the target hard disk area is deleted from the cache; If the data popularity is greater than or equal to the second popularity threshold, then in response to the data of the target hard disk area being cached in the cache for a preset duration, the data of the target hard disk area is deleted from the cache; If the data popularity does not exceed the first popularity threshold, then reading data from the target hard disk area into the cache will be paused.

3. The method according to claim 1 or 2, characterized in that, Determining the data popularity of the target hard disk region based on the historical read count includes: The initial data heat is obtained by weighted fusion calculation of the first historical read count of the target hard disk area and the second historical read count of the reference hard disk area, wherein the reference hard disk area refers to the hard disk area adjacent to the target hard disk area; Determine the time difference between the current time and the reference time, wherein the reference time refers to the time when the host last read data from the target hard disk area; Based on the time difference, a time decay weight is determined, wherein the time difference is inversely proportional to the time decay weight; Based on the time decay weight, the initial data heat is corrected to obtain the data heat of the target hard disk area.

4. The method according to claim 1, characterized in that, Determining the load mode of the solid-state drive based on the historical read addresses includes: According to the order in which the host reads data from the solid-state drive, the historical read addresses are sorted, and the difference between two adjacent historical read addresses is calculated to obtain multiple jump distances; The load mode of the solid-state drive is determined based on the dispersion of the multiple jump distances.

5. The method according to claim 4, characterized in that, The load modes include sequential read mode, random read mode, and mixed read mode, wherein the mixed read mode refers to a data reading mode in which sequential read and random read are performed alternately; Determining the load mode of the solid-state drive based on the dispersion of the multiple jump distances includes: If the dispersion of the multiple jump distances is less than or equal to the first dispersion threshold, then the load mode is determined to be a sequential read mode; If the dispersion of the multiple jump distances is greater than or equal to the second dispersion threshold, then the load mode is determined to be a random read mode; If the dispersion of the multiple jump distances is greater than the first discrete threshold and less than the second discrete threshold, then the load mode is determined to be a mixed read mode.

6. The method according to claim 5, characterized in that, The prediction of the target hard disk area that the host will read based on the load pattern includes: If the load mode is the sequential read mode or the mixed read mode, then the reference position of the solid-state drive is determined based on the host's most recent historical read address, and the hard drive area where the reference position is located is taken as the target hard drive area; If the load mode is the random read mode, then the hard disk area with the highest historical read count is used as the reference area, and the reference area is used as the target hard disk area, or the reference area and the area surrounding the reference area are used as the target hard disk area.

7. The method according to claim 1, characterized in that, The historical access information also includes the host's historical read commands and historical write commands on the solid-state drive, and the method further includes: The percentage of historical read commands is determined based on the number of historical read commands and historical write commands. The size of the cache is adjusted according to the command proportion, wherein the command proportion is proportional to the cache size.

8. A data pre-reading device, characterized in that, The device includes: The information acquisition module is used to acquire historical access information of the solid-state drive. The historical access information includes the historical read address of the host in the solid-state drive and the historical read count of the host in each area of ​​the solid-state drive. The load mode determination module is used to determine the load mode of the solid-state drive based on the historical read addresses, wherein the load mode characterizes the address change characteristics of the host when reading data from the solid-state drive; The region prediction module is used to predict the target hard disk region that the host will read based on the load pattern. A heat determination module is used to determine the data heat of the target hard disk area based on the historical read count; The data pre-reading module reads the data of the target hard disk area into the cache if the data popularity is greater than a first popularity threshold, so that the host can read the data of the target hard disk area from the cache.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the data prefetching method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data prefetching method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Data pre-reading method and device, equipment and medium

    CN122196046A

  • A data pre-reading method, apparatus, device and medium

    CN122196046B