Cache pre-reading method and electronic equipment
By using the GRU model to filter and process historical prefetch results and response information, and utilizing data identifiers for cache prefetching, the problem of low accuracy and resource waste caused by the reliance on sequentiality in existing cache prefetching strategies is solved, achieving higher hit rate and flexibility.
Patent Information
- Application Number
- CN202511461241.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2025-11-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing cache prefetching strategies rely on the sequentiality of data access, which makes it difficult to cope with the frequent random and skip-access events in practice. This results in low prefetching accuracy, wasted cache resources, and reduced system performance.
A flexible and accurate cache prefetching method is constructed by adopting a gated recurrent unit (GRU) model, using reset weights and update weights to filter historical prefetch results and response information, and performing data prefetching through data identifiers.
It improves the hit rate and flexibility of cache prefetching, reduces invalid prefetching, and enhances cache resource utilization and data reading efficiency.
Smart Images

Figure CN120929398A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, and more specifically to a cache prefetching method and an electronic device. Background Technology
[0002] In current storage systems, cache prefetching is becoming increasingly important because it can improve data access performance. The purpose of cache prefetching is to pre-read a portion of data that has not yet been hit from the storage medium and add it to the cache based on the cache hit results. This allows future read requests to read data from the cache without having to access the storage medium, thereby reducing data read time.
[0003] Since the current cache prefetching strategy is based on sequential access, it is difficult to deal with non-sequential access such as random access and skip access that frequently occur during the actual reading process. As a result, the data prefetched by the current cache prefetching strategy is difficult to be hit, which not only wastes cache resources but also reduces the accuracy of cache prefetching. Summary of the Invention
[0004] In view of the above problems, the present invention provides a cache prefetching method and electronic device to improve cache resource utilization and cache prefetching accuracy.
[0005] One aspect of the present invention provides a cache prefetching method, the method comprising: responding to a prefetching request, obtaining response information of a read request in the current time period and historical prefetching results, the historical prefetching results including historical prefetching data, the response information including the hit rate of the read request hitting the historical prefetching data, and the data identifier of the data read by the read request, the data identifier being used to characterize the time information of writing the data to the storage medium; obtaining an initial prefetching result based on the historical prefetching results that need to be remembered and the response information filtered from the historical prefetching results based on a reset weight; obtaining a target prefetching result based on the historical prefetching sub-results that need to be retained and the initial prefetching sub-results filtered from the historical prefetching results and the initial prefetching results respectively based on an update weight, the target prefetching result including a target data identifier of the target prefetching data; and reading the target data from the storage medium according to the target data identifier and storing the target data in a cache area.
[0006] Another aspect of the present invention provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above-described cache prefetching method.
[0007] According to an embodiment of the present invention, in response to a pre-read request, the response information of the read request for the current time period and the historical pre-read results are obtained. A reset weight is used to filter and store the historical pre-read results and response information that need to be remembered from the historical pre-read results to obtain an initial pre-read result. An update weight is then used to filter and store the historical pre-read sub-results and initial pre-read sub-results that need to be retained from the historical pre-read results and the initial pre-read results respectively to obtain a target pre-read result. Data is then read according to the target data identifier in the target pre-read result. Since the current response information and historical pre-read results are filtered using reset and update weights during the pre-read process, interference from invalid information on the target pre-read result can be avoided, thereby increasing the accuracy of the pre-read data and improving the hit rate. On the other hand, since response information including data identifiers is processed, based on the reset and update weights, target pre-read data including the target data identifier can be obtained according to the continuous or random change patterns of information such as data identifiers. During the data pre-read process, continuous or random pre-read data can be performed based on the target data identifier, instead of continuous pre-reading based on the physical location of data storage, improving the flexibility and accuracy of cache pre-reading. Attached Figure Description
[0008] The above-described features, other objects, and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:
[0009] Figure 1 A diagram illustrating an application scenario of the cache prefetching method according to an embodiment of the present invention is shown.
[0010] Figure 2 A flowchart of a cache prefetching method according to an embodiment of the present invention is shown.
[0011] Figure 3A An architecture diagram of the GRU model for processing response information and historical prefetch results according to an embodiment of the present invention is shown.
[0012] Figure 3B It shows Figure 3A Local processing architecture diagram.
[0013] Figure 4 A schematic diagram of reading pre-read data according to an embodiment of the present invention is shown.
[0014] Figure 5 A structural block diagram of a cache prefetching device according to an embodiment of the present invention is shown.
[0015] Figure 6 A block diagram of an electronic device suitable for implementing a cache prefetching method according to an embodiment of the present invention is shown. Detailed Implementation
[0016] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.
[0017] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0018] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0019] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0020] Current cache prefetching strategies are based on sequential access, which assumes strong sequentiality in data access. When a sequential read operation is detected, the system can prefetch data from several consecutive physical memory blocks, starting with the first hit data block, into the cache. For example, in a file system, if an application sequentially reads a large file, the prefetching mechanism will prefetch several data blocks of fixed size (e.g., 4KB or 8KB). This strategy can achieve performance improvements in scenarios with regular and sequential data access patterns. The implementation of this current prefetching strategy can be configured at the file system's input / output (I / O) layer.
[0021] Current read-ahead strategies based on sequential access rely heavily on the assumption of sequential data access. When faced with complex patterns such as frequent random access, skip access, and concurrent access in real-world scenarios, the accuracy of read-ahead is extremely low. For example, in database query scenarios, users may randomly access different parts of a data file based on different query conditions. A sequential read-ahead strategy would result in a large number of invalid reads, wasting I / O bandwidth resources and potentially preventing the cache from caching the truly needed data, thus reducing overall system performance. Therefore, current read-ahead strategies are difficult to adjust flexibly based on real-time changes in read-ahead results. When the system is under high load, excessive invalid read-ahead operations may further increase the I / O burden, leading to slower system response.
[0022] With the explosive growth of data volume and the diversification of application scenarios, users have placed higher demands on the response speed and throughput of storage systems. Current cache prefetching strategies are no longer sufficient to meet these complex needs. Data reading often exhibits irregularities, including both batch sequential access to large-scale data and random queries of specific data, making it difficult for cache prefetching to match all results.
[0023] In view of this, embodiments of the present invention address the problems of current prefetching strategies, such as the difficulty in flexibly adjusting prefetching results, modifying prefetching methods, and prefetching windows based on real-time prefetching results, as well as the low prefetching hit rate. Furthermore, while consuming a certain amount of system bandwidth, the prefetching operation does not accurately prefetch data from subsequent read requests into the cache, resulting in poor prefetching accuracy. The present invention provides a more flexible and accurate cache prefetching method. This method uses data snapshots to time-stamp data written to the storage device to distinguish between different data types. During the prefetching process, a recurrent network model based on a Gate Recurrent Unit (GRU) is constructed. Utilizing the memory characteristics of the GRU, the data to be prefetched next is predicted based on historical prefetching results and the hit results of historical prefetching data, thereby improving the prefetching hit rate and increasing the utilization of cache resources.
[0024] Figure 1 A diagram illustrating an application scenario of the cache prefetching method according to an embodiment of the present invention is shown.
[0025] like Figure 1 As shown, the application scenario of this embodiment may include a controller 101, a storage medium 102, and a cache area 103. The storage medium 102 may include multiple data blocks for storing data, which can be represented by a~z.
[0026] The controller 101 can respond to a cache prefetch request by reading the read request response information and historical prefetch results for the current time period from the database, and read the data of the target data block from the storage medium 102 based on the read request response information and historical prefetch results for the current time period, such as reading data blocks b and c, and storing the data of data blocks b and c in the cache area 103.
[0027] It should be noted that the cache prefetching method provided in this embodiment of the invention can generally be executed by the controller 105. Accordingly, the cache prefetching device provided in this embodiment of the invention can generally be set in the controller 105.
[0028] It should be understood that Figure 1 The number of controllers 101, storage media 102, data blocks a~z, and cache areas 103 shown are merely illustrative. Depending on implementation requirements, any number of controllers 101, storage media 102, data blocks a~z, and cache areas 103 may be included.
[0029] The following will be based on Figure 1 The described scene, through Figures 2-4 The cache prefetching method of this invention will be described in detail.
[0030] Figure 2 A flowchart of a cache prefetching method according to an embodiment of the present invention is shown.
[0031] like Figure 2 As shown, the cache prefetching method in this embodiment includes operations S210 to S240.
[0032] In operation S210, in response to the read-ahead request, the response information of the read request for the current time period and the historical read-ahead results are obtained. The historical read-ahead results include historical read-ahead data. The response information includes the hit rate of the read request hitting the historical read-ahead data, and the data identifier of the data read by the read request. The data identifier is used to characterize the time information of writing the data to the storage medium.
[0033] In operation S220, the initial pre-read result is obtained based on the historical pre-read results and response information that need to be remembered, which are filtered from the historical pre-read results based on the reset weight.
[0034] In operation S230, the target pre-read result is obtained by selecting the historical pre-read sub-results and initial pre-read sub-results that need to be retained from the historical pre-read results and initial pre-read results based on the update weights. The target pre-read result includes the target data identifier of the target pre-read data.
[0035] In operation S240, target data is read from the storage medium according to the target data identifier and stored in the cache area.
[0036] In some embodiments, a prefetch request can be an instruction or event used to trigger a prefetch operation. For example, it can be a timed prefetch request triggered by the prefetch system based on a timed prefetch task, a prefetch request automatically triggered by the prefetch system after completing one or more user read requests, or a prefetch request automatically triggered by the prefetch system when it receives a cache hit rate lower than a predetermined hit rate, in order to perform feedback learning and adjust the cache prefetch strategy.
[0037] In some embodiments, the response information for a read request in the current time period may be response information collected within a predetermined duration at the time of responding to the pre-read request. The predetermined duration may be a period ending at the request time or a period ending at any time before the request time. The response information may be a sequence of read request hit rates for pre-read data in the cache within the predetermined duration, and a sequence of data identifiers for the data read by the read request. The pre-read data in the cache may be historical pre-read data predicted at historical times before the request time.
[0038] In some embodiments, the historical readout result may include the historical data identifier and the historical readout window range of the historical readout data predicted at a historical time prior to the requested time.
[0039] In some embodiments, the data identifier and historical data identifier read by the read request can be time information used to characterize the data read by the read request and the historical pre-read data when they were written to the storage medium. This data identifier can be used to classify the data on the storage medium. The data identifier may include a snapshot ID.
[0040] For example, a storage medium contains data A, B, C, D, E, and F, with data identifiers of 2.0, 2.5, and 3.0. Each time interval, such as 10 seconds, the data identifier increments by 0.5. For instance, at time T, the current data identifier stored in the storage medium is 2.0. When data A is written to the storage medium, its data identifier can still be 2.0. At time T+8 seconds, when data B is written to the storage medium, the current data identifier stored in the storage medium has not been updated, so data B's data identifier can still be 2.0. At time T+10 seconds, the time interval is reached, and the current data identifier stored in the storage medium is incremented from 2.0 to 2.5. At time T+12 seconds, when data C is written to the storage medium, its data identifier can also be 2.5. Similarly, at time T+18 seconds, data D's data identifier can also be 2.5. At time T+20 seconds, the time interval is reached, and the current data identifier stored in the storage medium is incremented from 2.5 to 3.0. When data E is written to the storage medium at time T+23s, the data identifier of data E may include 3.0. Similarly, at time T+17s, the data identifier of data F may include 3.0. That is, the data identifier in this embodiment of the invention can classify the storage output in the storage medium into three categories: the first category has a data identifier of 2.0, the second category has a data identifier of 2.5, and the third category has a data identifier of 2.5. The aforementioned timing period can be adaptively adjusted according to actual needs. The shorter the timing period, the more frequently the data identifier will be updated, and the more refined the classification of the stored data will be.
[0041] In some embodiments, reset weights and update weights can be used to process the response information and historical prefetch results described above. Reset weights can be used to determine which parts of the historical prefetch results need to be remembered and which need to be forgotten. Reset weights can be a vector between 0 and 1 output from the reset gate of the GRU model. Resetting is not simply selecting or discarding, but rather scaling the historical prefetch results element-wise. Reset weights can filter out the historical prefetch results that need to be remembered.
[0042] Update weights can be used to determine the parts of the historical prefetch results that need to be retained, and to determine the proportion of the historical prefetch results in the target prefetch results. Update weights can be a vector between 0 and 1 output by the update gate of the GRU model.
[0043] In some embodiments, the initial pre-read result obtained based on the historical pre-read results and response information can be the initially determined initial data identifier and initial pre-read window range of the pre-read data. The initial pre-read result can be the candidate hidden state calculated by the GRU model based on the response information of the current input and the historical pre-read results.
[0044] In some embodiments, the historical readout sub-result can be the historical data identifiers and historical readout window ranges that the update gate of the GRU model selects from the historical readout results to be retained. The initial readout sub-result can be the initial data identifiers and initial readout window ranges that the update gate of the GRU model selects from the initial readout results to be retained. The target readout result can be obtained by summing the historical readout sub-results and the initial readout sub-results.
[0045] In some embodiments, the target prefetch result may include the target data identifier and the target prefetch window range of the target data that needs to be prefetched.
[0046] In some embodiments, the storage medium can refer to a non-volatile data persistence carrier, such as a hard disk or disk drive. The cache area can be a temporary storage area for frequently accessed data, used to accelerate access to this data. Based on the target data identifier, target data can be read from the storage medium and stored in the cache, so that future read requests can directly access the cache to obtain the data needed for the read request without needing to access the storage medium, thus improving data reading efficiency.
[0047] Embodiments of the present invention can read pre-read data through data identifiers. Since the data identifiers record the time information of data being written to the storage medium, embodiments of the present invention utilize the time dimension to read pre-read data. The GRU can perform pre-reading based on the continuous or random variation of the data identifiers, instead of relying on the continuity of physical location, thus improving the hit rate of pre-read data. In one embodiment, if the data identifier sequence input to the GRU is snap id={1, 2, 4, 1, 2, 4, 1, 2, 5}, the GRU may read data with snap id=1, then read data with snap id=2 and snap id=4, instead of reading data that has a physical storage location continuity with the data with snap id=1. This addresses non-sequential pre-reading situations that may occur during actual reading, improving the flexibility of pre-reading and the cache hit rate.
[0048] According to an embodiment of the present invention, in response to a pre-read request, the response information of the read request for the current time period and the historical pre-read results are obtained. A reset weight is used to filter and store the historical pre-read results and response information that need to be remembered from the historical pre-read results to obtain an initial pre-read result. An update weight is then used to filter and store the historical pre-read sub-results and initial pre-read sub-results that need to be retained from the historical pre-read results and the initial pre-read results respectively to obtain a target pre-read result. Data is then read according to the target data identifier in the target pre-read result. Since the current response information and historical pre-read results are filtered using reset and update weights during the pre-read process, interference from invalid information on the target pre-read result can be avoided, thereby increasing the accuracy of the pre-read data and improving the hit rate. On the other hand, since response information including data identifiers is processed, based on the reset and update weights, target pre-read data including the target data identifier can be obtained according to the continuous or random change patterns of information such as data identifiers. During the data pre-read process, continuous or random pre-read data can be performed based on the target data identifier, instead of continuous pre-reading based on the physical location of data storage, improving the flexibility and accuracy of cache pre-reading.
[0049] In some embodiments, the data identifier described above can be obtained through data snapshots. For example, a data snapshot can be constructed in a storage system, and the modification of the data identifier (e.g., snapshot id) can be controlled by a timer. After the timer reaches its timing period, the data identifier can be incremented according to a preset step size. For example, taking a timing period of 10 seconds as an example, at time T, the current data identifier stored in the storage medium is 2.0. At time T+10 seconds, the timing period is reached, and the current data identifier stored in the storage medium is incremented from 2.0 to 2.5. At time T+20 seconds, the timing period is reached, and the current data identifier stored in the storage medium is incremented from 2.5 to 3.0.
[0050] For each updated data identifier, the following operations can be performed: in response to the generation operation of the updated data identifier, a storage instruction for storing the data identifier is generated; the storage instruction is executed to store the updated data identifier in the identifier storage area of the storage medium.
[0051] In some embodiments, the updated data identifier can be persisted to disk. The storage instruction can be an instruction to store the updated data identifier in an identifier storage area of a storage medium, such as an instruction to store it in an identifier storage area of a disk. The identifier storage area is, for example, the address of the first logical block partitioned on the disk. By executing this storage instruction, the updated data identifier can be stored in the identifier storage area.
[0052] In some embodiments, by storing the data identifier for each increment, it is possible to avoid the data identifier restarting from the initial value (e.g., 0) after the controller fails and is repaired, which would result in the same snapshot version of data appearing on the storage medium at different points in time, thereby improving the accuracy of data prefetching.
[0053] In some embodiments, the data identifier obtained by the above operations can be used to characterize the data write time information in the following manner: in response to a write request to write data to the storage medium, the current data identifier stored in the storage medium is obtained from the identifier storage area of the storage medium; if the validity period of the current data identifier has not reached the predetermined period, the current data identifier is added to the metadata of the data; if the validity period of the current data identifier has reached the predetermined period, the current data identifier is updated, and the updated data identifier is added to the metadata of the data.
[0054] In some embodiments, the predetermined duration can refer to the timing period of a timer. When the host issues a write request to write data to the storage medium, it can obtain the current data identifier from the identifier storage area and compare whether the validity duration of the current data has reached the timing period. If the timing period has not been reached, a flag bit for the data identifier (e.g., a snap id) can be added to the key of the metadata used to describe the data, and the data identifier can be added to the flag bit. If the validity duration of the current data has reached the timing period, the data identifier can be updated first, and then the updated data identifier can be added to the metadata.
[0055] In some embodiments, by writing data identifiers into the metadata of the data, it is possible to classify the data using data identifiers, so that GRU can accurately predict the target pre-read data, thereby improving the pre-read data hit rate and the cache hit rate.
[0056] According to embodiments of the present invention, classifying data by taking data snapshots allows for more detailed differentiation of data, reduces interference from invalid data, and enables the weights obtained from subsequent GRU model training to more accurately calculate pre-read information.
[0057] Figure 3A An architecture diagram of the GRU model for processing response information and historical prefetch results according to an embodiment of the present invention is shown.
[0058] like Figure 3A As shown, T represents time information. , as well as The response information inputs are for time points t1, t2, and t3, respectively. This refers to the historical pre-read results output before time t0, prior to time t1. , as well as These are the outputs at times t1, t2, and t3, respectively. The GRU model can use features of multiple dimensions as both training and input, such as the input at time t1. It can be the hit rate sequence collected at time t1, the read data identifier sequence, and the output at time t0. (For example, the historical data identifier and historical readout window range of the historical readout data). Output at time t1 It can include the target data identifier and the target prefetch window range. The output target data identifier and target prefetch window range can be summarized into a (0,1) vector information.
[0059] Figure 3B It shows Figure 3A Local processing architecture diagram.
[0060] like Figure 3B As shown, during model execution, because GRU is a lightweight Long Short-Term Memory network, it operates at a granular level at each time point, such as... Figure 3B As shown, Input the response information at time t1. The output at time t0 represents the output at time t1. and The input information at time t1 is fed into the GRU. The GRU's gating mechanism includes a reset gate and an update gate. The reset gate can be based on the activation function and the weight matrix, according to... and filter Get the reset weight The process can be shown in formula (1).
[0061] (1)
[0062] in, To reset the weights, For the activation function, ( , , Let be the learnable weight matrix of the reset gate, where for Reset gate weights, for Reset gate weights, To reset the gate's bias vector, This can include response information input at time t1, such as the acquired hit rate sequence and the read data identifier sequence. It can be the output at time t0, such as the historical data identifier and historical pre-read window range of historical pre-read data.
[0063] In some embodiments, the weight is reset. It can be used to confirm historical read results (e.g.) This involves information that needs to be remembered and forgotten. Here, "forgetting" and "remembering" do not mean completely discarding or retaining the historical preview results, but rather determining the reset weights through a reset gate. By resetting the weights Quantifying historical preview results to achieve the goal of forgetting, and resetting weights. This can be done by judging the target pre-read result output at time point t1 based on the historical pre-read results (i.e. The weights that need to be referenced in ).
[0064] In some embodiments, the reset weights obtained from the above operations can be used to filter out the historical prefetch results and response information that need to be remembered from the historical prefetch results, thereby obtaining the initial prefetch results. For example, the reset weights can be used to filter out the historical data identifiers and the historical prefetch window ranges that need to be remembered from the historical data identifiers and the historical prefetch window ranges, respectively; based on the historical data identifiers, the historical prefetch window ranges, the hit rate in the response information, and the data identifiers, the initial prefetch results including the initial data identifiers and the initial prefetch window ranges are obtained.
[0065] For example, in historical preview results (e.g.) The historical data identifier output in the model is 3.0, and the historical read-ahead window range is 32k (this is an intuitive form used for illustration; the actual historical read-ahead result output by the GRU model is in normalized vector form). The reset weights for the historical data identifier and the historical read-ahead window range are calculated to be 0.8 and 0.5 respectively using the reset weights. After filtering and memorizing the historical data identifier and the historical read-ahead window range using their respective reset weights, the resulting historical data identifier to be memorized is 2.4, and the historical read-ahead window range to be memorized is 16k. Since the process of filtering the historical read-ahead result using reset weights is part of the GRU prediction process, and the GRU prediction is not yet complete, the read-ahead window range does not need to be rounded to 4k unless it is an integer multiple of 4k.
[0066] In some embodiments, the reset weight can be determined based on the reset weight output by the reset gate. Response information input at time t1 and the historical pre-read results output at time t0. Calculate the candidate hidden state Candidate hidden state This can represent the GRU's response information based on time t1. and the historical pre-read results output at time t0. The calculated initial pre-read result needs to be combined with the update weights output by the GRU update gate to obtain the target pre-read result.
[0067] In some embodiments, based on the reset weight output by the reset gate Response information input at time t1 and the historical pre-read results output at time t0. Calculate the candidate hidden state The process can be shown in formula (2).
[0068] (2)
[0069] in, These are candidate hidden states, which can be used as initial pre-read results. For the activation function, ( , ) is a learnable weight matrix. for The weight, for The weight, Input the response information at time t1. This is the historical preview result output at time t0.
[0070] According to embodiments of the present invention, by utilizing reset weights to filter historical pre-read results, refined filtering of historical pre-read results is achieved. The embodiments of the present invention also clarify that generating initial pre-read results requires integrating information from multiple dimensions, including filtered historical data identifiers, filtered historical window ranges, currently collected hit rate sequences representing feedback information, and data identifier sequences representing current observations. This ensures that all information related to pre-reading is taken into consideration, improving the rationality and accuracy of initial pre-read results and increasing the accuracy of pre-reading. Furthermore, by interpreting hidden states as explicit business parameters, such as data representation and window ranges, the decision-making process of the GRU becomes traceable and understandable.
[0071] In some embodiments, the initial prefetch results and historical prefetch results described above can be further processed using the update weights output by the GRU update gate.
[0072] The weights can be updated based on the response information at time t1. and the historical pre-read results output at time t0. The calculation yields the updated weights. The process of obtaining the updated weights can be shown in formula (3).
[0073] (3)
[0074] in, To update the weights, the first updated weights can be those used for historical pre-read results. For the activation function, ( , , ) is the updated learnable weight matrix, where, for Update gate weights, for Update gate weights, To update the bias vector of the gate Input the response information at time t1. This is the historical preview result output at time t0.
[0075] Update weights It can be used to determine the initial pre-read result (i.e., the candidate hidden state) obtained at time t1. ) and historical preview results (i.e. How much information is retained in each of the pre-read results, and how much of that retained information is used to calculate the target pre-read result? This refers to the final hidden state output of the model. For example... = 0.3, then the final target result is calculated. hour, Only 0.3 units of information will be retained, so the initial pre-read result at time t1 will be used. To obtain the target pre-read results .
[0076] In some embodiments, the update weight obtained according to the above operations can be used as the first update weight for historical pre-read results (e.g.) The initial pre-read results can be configured with a second update weight (e.g., 1-). The sum of the first update weight and the second update weight can be a fixed value, such as 1.
[0077] The process of obtaining the target pre-read result based on the historical pre-read sub-results and initial pre-read sub-results that need to be retained, selected from the historical pre-read results and initial pre-read results respectively based on update weights, may include the following operations: selecting the historical data identifiers and historical pre-read window ranges that need to be retained from the historical data identifiers and historical pre-read window ranges according to the first update weight; selecting the initial data identifiers and initial pre-read window ranges that need to be retained from the initial data identifiers and initial pre-read window ranges according to the second update weight; and obtaining the target pre-read result based on the historical data identifiers and historical pre-read window ranges that need to be retained, as well as the initial data identifiers and initial pre-read window ranges that need to be retained.
[0078] In some embodiments, the process of obtaining the target preread result by filtering out the historical preread results and the initial preread results that need to be retained from the historical preread results and the initial preread results based on the update weights can be as shown in formula (4).
[0079] (4)
[0080] in, The output at time t1 can be used as the target pre-read result. It can be in the form of a two-dimensional vector, including the target data identifier and the target pre-read window range. The first update weight, This refers to the historical readout results output at time t0, such as historical data identifiers and historical readout window ranges. It can be done by filtering historical data identifiers and historical read-ahead window ranges to select the historical data identifiers and historical read-ahead window ranges that need to be retained, 1- For the second update weight, For the initial pre-read results, It can be used to filter out the initial data identifiers and initial pre-read window ranges that need to be retained from the initial data identifiers and initial pre-read window ranges.
[0081] According to an embodiment of the present invention, by using updated weights to filter the historical pre-read results and the initial pre-read results respectively to obtain the target pre-read result, the obtained target pre-read result can comprehensively consider both the historical pre-read results and the initial pre-read results, rather than considering only the historical pre-read results or the initial pre-read results alone. This improves the flexibility and accuracy of determining the target pre-read result, thereby increasing the hit rate of the pre-read data.
[0082] According to an embodiment of the present invention, based on the characteristics of the Long Short-Term Memory Network (GRU), the target pre-read result can not simply consider the current input and past hit information, but selectively filter the input information to avoid interference from invalid pre-read information that leads to inaccurate calculation results, retain as much valid information as possible, and add data identification information to the input to improve the accuracy of the pre-read data and increase the pre-read accuracy.
[0083] In some embodiments, the GRU model described above can be replaced by a Long Short-Term Memory (LSTM) network model. At the expense of some computation time and space usage, LSTM can remember information for a longer period of time, which can improve the accuracy of pre-reading.
[0084] In some embodiments, the target prefetch data identifier in the target prefetch result output by the above operation does not need to be rounded to an integer, but the target prefetch window range needs to be rounded to 4k, because the smallest granularity of disk read in the storage system is 4k granularity.
[0085] The process of rounding the target read-ahead window range to 4k can be as follows: determine the difference between the length of the target read-ahead window range and an integer multiple of the predetermined read length; if the difference is not the predetermined difference, adjust the length of the target read-ahead window range until the length of the target read-ahead window range is an integer multiple of the predetermined read length.
[0086] In some embodiments, the predetermined read length can be 4k. During the rounding process of the target read-ahead window range to 4k, the difference between the target read-ahead window range and an integer multiple of 4k can be determined. If the difference is not the read-ahead difference (e.g., 0), the length of the target read-ahead window range is adjusted. The adjustment direction can be increasing the target read-ahead window range until the length of the target read-ahead window range is an integer multiple of 4k. For example, if the target read-ahead window range is 23k, which is not an integer multiple of 4k, the target read-ahead window range can be adjusted to 24k.
[0087] According to embodiments of the present invention, by aligning the range of the target prefetch window to integer multiples of 4k, it is ensured that each prefetch request is for one or more complete sectors. This allows the disk controller to directly perform efficient pure read operations, improving data reading efficiency.
[0088] In some embodiments, based on the target data identifier and target pre-read window range output by the GRU, target data can be read from the storage medium in the following manner: based on the target data identifier, the target starting position for reading the target data is located on the storage medium; based on the target starting position, the target data is read from the data block corresponding to the target pre-read window range.
[0089] In some embodiments, the data identifier may include a first sub-identifier, which is used to determine the initial starting position for reading target data. The process of locating the target starting position for reading target data from the storage medium based on the target data identifier may include the following operations: determining the target data version to which the target pre-read data belongs based on the first sub-identifier; determining the storage capacity occupied by the storage data included in the target data version in the storage medium; and locating the target starting position based on the initial starting position and storage capacity determined based on the first sub-identifier.
[0090] Figure 4 A schematic diagram of reading pre-read data according to an embodiment of the present invention is shown.
[0091] like Figure 4As shown, the stored data in the storage medium can be divided into three data versions: the first data version 401 is the version with data identifier 1, the second data version 402 is the version with data identifier 2, and the third data version 403 is the version with data identifier 3. Each data version can include multiple data blocks used for storing data.
[0092] The data identifier can include integer and decimal places, and the first sub-identifier can be the integer part of the data identifier. Taking the target data identifier output by the GRU as 2.5 as an example, the initial starting position 404 can be determined based on the first sub-identifier, i.e., 2. Based on the first sub-identifier 2, it can also be determined that the target data version to which the target pre-read data belongs is the second type of data version 402, and then the storage capacity occupied by the storage data included in the second type of data version 402 on the storage medium can be determined, such as the disk length. In one embodiment, the disk length can be 128M. Based on the initial starting position 404 and the storage capacity of 128M, the target starting position 405 for reading the target data can be determined.
[0093] In some embodiments, the data identifier may further include a second sub-identifier, which is used to determine the offset of the target starting position relative to the initial starting position. The process of locating the target starting position based on the initial starting position determined by the first sub-identifier and the storage capacity may include the following operations: determining the offset of the target starting position relative to the initial starting position based on the second sub-identifier and the storage capacity; and, starting from the initial starting position determined by the first sub-identifier, offsetting by the offset along a direction that increments in the target identifier to obtain the target starting position.
[0094] In some embodiments, the second sub-identifier can be a decimal place of the data identifier. Taking the target data identifier output by the GRU as 2.5 as an example, the second sub-identifier is 0.5 obtained by subtracting 2 from 2.5. The offset is determined based on the second sub-identifier and the storage capacity, for example, it can be 128 × 0.5 = 64M. That is, the offset is 64M.
[0095] Starting from the initial starting position 404, the target starting position 405 can be obtained by offsetting 64M in the predetermined direction 406.
[0096] In one embodiment, the target pre-read window range can be 16k. Based on this, target data can be read from data blocks within the 16k range, starting from the target start position 405.
[0097] According to an embodiment of the present invention, by determining the initial starting position based on the first sub-identifier of the data identifier, and determining the offset of the target starting position relative to the initial starting position based on the second sub-identifier, the target starting position is obtained. Then, pre-read data is read according to the target pre-read window range. This allows for fine-grained positioning of the target pre-read data, ensuring that the metadata of the pre-read data corresponds to the output target data identifier. Because the model's output considers data within this time period to be more likely to be hit, the hit rate of the target pre-read data read in this way is high.
[0098] In some embodiments, the process of storing target data in a cache area can be carried out by hierarchically caching the target data based on the historical behavior data of the target prefetch data, the target prefetch window range, and the load of the cache area.
[0099] In some embodiments, the cache region can be configured with a two-tier caching architecture, where the access latency of the first-level cache device is less than a predetermined duration, and the access latency of the second-level cache device can be greater than or equal to the predetermined duration. That is, the access speed of the first-level cache device needs to be higher than the access speed of the second-level cache device.
[0100] When storing target pre-read data in the cache area, the recent historical access information of that target pre-read data can be obtained. For example, if the access rate of the target pre-read data is greater than a predetermined access rate threshold within a predetermined time period, it is considered hot data and can be placed in the first-level cache device to shorten the time for reading the target pre-read data and improve data reading efficiency. If the access rate of the target pre-read data is less than or equal to the predetermined access rate threshold within the predetermined time period, it is considered non-hot data and can be placed in the second-level cache device to avoid occupying the read resources of the first-level cache device and improve resource utilization.
[0101] For example, if the read-ahead window range is smaller than a predetermined range, the read target read-ahead data can be placed in the first-level cache device to improve the access efficiency of the target read-ahead data. If the read-ahead window range is greater than or equal to the predetermined range, the read target read-ahead data can be placed in the second-level cache device to avoid occupying the read resources of the first-level cache device and improve resource utilization.
[0102] For example, before placing the target prefetched data into the cache area, the load on the first-level cache and the second-level cache can be obtained, such as CPU resource utilization. If the CPU resource utilization of the first-level cache is higher than or equal to that of the second-level cache, the read target prefetched data can be placed into the second-level cache, avoiding the occupation of read resources on the first-level cache and improving resource utilization. If the CPU resource utilization of the first-level cache is lower than that of the second-level cache, the read target prefetched data can be placed into the first-level cache to improve the access efficiency of the target prefetched data.
[0103] In some embodiments, different weights can be assigned to the historical behavioral data, the target prefetch window range, and the load of the cache region. Each weight represents the importance of these factors in improving the efficiency of accessing the target prefetch data. Based on the historical behavioral data, the target prefetch window range, and the load of the cache region, and their respective weights, a cache evaluation value is obtained. The storage location of the target prefetch data is then determined based on this cache evaluation value. For example, if the cache evaluation value is greater than a predetermined evaluation value, the probability of the target prefetch data being hit is considered high, and it can be stored in the first-level cache device. If the cache evaluation value is less than or equal to the predetermined evaluation value, the probability of the target prefetch data being hit is considered low, and it can be stored in the second-level cache device.
[0104] In some embodiments, the above-described two-layer caching architecture can also be a three-layer or more caching architecture, for example, dividing the caching devices into three levels. The access speed of the first-level caching device is greater than or equal to the access speed of the second-level caching device, which is also greater than or equal to the access speed of the third-level caching device. Simultaneously, the cache capacity of the first-level caching device is less than or equal to the cache capacity of the second-level caching device, which is less than or equal to the cache capacity of the third-level caching device. By dividing the caching devices into multiple levels, it is easier to implement hierarchical caching of the target pre-read data, improving resource utilization while also increasing the access efficiency of the target pre-read data.
[0105] According to embodiments of the present invention, by setting up a multi-level caching architecture and performing hierarchical caching of target data based on historical behavior data of target pre-read data, target pre-read window range, and cache area load, the access efficiency and resource utilization of target pre-read data can be effectively balanced, thereby improving the intelligence level of caching.
[0106] In some embodiments, the timing period of the data identifier can be changed according to actual needs. For example, if fine differentiation of data write times is required, the timing period should be shorter, such as 1 second or 100 ms. If fine differentiation of data write times is not required, the timing period should be longer, such as 1 minute. Each data identifier can also be physically isolated on the storage medium (e.g., disk) to ensure that the data corresponding to each identical data identifier is continuous.
[0107] In some embodiments, a shorter timing period results in a denser sequence of data identifiers, a smaller data volume per identifier, and higher time resolution. This allows for more accurate extraction of pre-read data, thereby improving the hit rate of pre-read data. Conversely, a longer timing period results in a sparser sequence of data identifiers, a larger data volume per identifier, and lower time resolution.
[0108] In some embodiments, the data lifecycle can be controlled by changing the pre-read estimation data interval by controlling the timing period of the data identifier.
[0109] The timing period refers to the frequency at which the data identifier increments. For example, changing the increment from once every 1 second to once every 5 seconds.
[0110] The data interval for preview estimation refers to the range of data covered by the data identifiers predicted by GRU.
[0111] In one embodiment, if the data identifier changes every second, then the difference between data identifier 1 and data identifier 2 is only the data written within 1 second, which is a very small data interval.
[0112] If the data identifier changes every 5 seconds, then there will be a 5-second difference between the data with the data identifier 1 and the data identifier 2, and this data interval becomes larger.
[0113] The lifecycle of data mainly refers to the length of time that data remains in the cache.
[0114] Cache space is limited. When the cache is full, the system needs to remove some old cached data to make room for new cached data. The process from when data enters the cache to when it is removed from the cache is the "lifecycle" of that data in the cache.
[0115] In one embodiment, if the timing period is short, such as 1 second, 100 data identifiers will be generated within 100 seconds. Each data identifier may only include data written within 1 second. If only 10M is written within 1 second, the data interval is small. During GRU prefetching, it may only prefetch a small portion (e.g., 1M) of the 10M data. Because the amount of data prefetched each time is small (1M) and there are many data versions (e.g., 100), the cache will soon be filled with a large number of small data blocks with different data identifiers. When the cache space is insufficient, the earliest prefetched data that has not been accessed and is identified as 1, 2, 3... will be quickly evicted from the cache, resulting in a short lifespan.
[0116] This invention categorizes written data by time using data snapshots and inputs the read data identifier sequence into a GRU, enabling the GRU to better distinguish the characteristics of data hits during pre-reading. Furthermore, by utilizing the memory and forgetting properties of the GRU model itself, it considers both past pre-reading results and the current pre-reading input, making the pre-reading pattern quantifiable. By controlling the data snapshot time interval to change the estimated data interval, the lifecycle of data can be controlled, thereby improving the pre-reading hit rate.
[0117] Based on the above-described cache prefetching method, this invention also provides a cache prefetching device. The following will combine... Figure 5 The device is described in detail.
[0118] Figure 5 A structural block diagram of a cache prefetching device according to an embodiment of the present invention is shown.
[0119] like Figure 5 As shown, the cache prefetching device 500 of this embodiment includes a first acquisition module 510, a first filtering module 520, a second filtering module 530, and a reading module 540.
[0120] The first acquisition module 510 is used to respond to the read request, acquire the response information of the read request in the current time period and the historical read results. The historical read results include historical read data. The response information includes the hit rate of the read request hitting the historical read data and the data identifier of the data read by the read request. The data identifier is used to characterize the time information of writing the data to the storage medium.
[0121] The first filtering module 520 is used to obtain the initial pre-reading result based on the historical pre-reading results and response information that need to be remembered and are filtered from the historical pre-reading results based on the reset weight.
[0122] The second filtering module 530 is used to obtain the target pre-read result based on the historical pre-read sub-results and initial pre-read sub-results that need to be retained, which are filtered from the historical pre-read results and initial pre-read results respectively based on the update weight. The target pre-read result includes the target data identifier of the target pre-read data.
[0123] The read module 540 is used to read target data from the storage medium according to the target data identifier and store the target data in the cache area.
[0124] In some embodiments, the reading module 540 may include a positioning submodule and a reading submodule.
[0125] The positioning submodule is used to locate the starting position of the target for reading the target data from the storage medium based on the target data identifier.
[0126] The read submodule is used to read target data from the data block corresponding to the pre-read window range based on the target start position.
[0127] In some embodiments, the positioning submodule may include a first determining unit, a second determining unit, and a positioning unit.
[0128] The first determining unit is configured to determine the target data version to which the target pre-read data belongs based on the first sub-identifier.
[0129] The second determining unit is used to determine the storage capacity occupied by the storage data included in the target data version in the storage medium.
[0130] The positioning unit is used to locate the starting position of the target based on the initial starting position determined based on the first sub-identifier and the storage capacity.
[0131] In some embodiments, the positioning unit may include a determining subunit and an offset subunit.
[0132] The sub-unit is determined based on the second sub-identifier and storage capacity to determine the offset of the target starting position relative to the initial starting position.
[0133] The offset sub-unit is used to offset the target starting position by an offset amount along the direction of increasing target identifier, starting from the initial starting position determined by the first sub-identifier.
[0134] In some embodiments, the cache prefetching device 500 may further include a determination module and an adjustment module.
[0135] The determination module is used to determine the difference between the length of the pre-read window range and an integer multiple of the predetermined read length.
[0136] The adjustment module is used to adjust the length of the pre-read window range when the difference is not a predetermined difference, until the length of the pre-read window range is an integer multiple of the predetermined read length.
[0137] In some embodiments, the cache prefetching device 500 may further include a second acquisition module, a first addition module, and a second addition module.
[0138] The second acquisition module is used to obtain the current data identifier stored in the storage medium from the identifier storage area of the storage medium in response to a write request to write data to the storage medium.
[0139] The first addition module is used to add the current data identifier to the data's metadata if the validity period of the current data identifier has not reached the predetermined duration.
[0140] The second adding module is used to update the current data identifier when the validity period of the current data identifier reaches the predetermined duration, and to add the updated data identifier to the data's metadata.
[0141] In some embodiments, the cache prefetching device 500 may further include a generation module and an execution module.
[0142] The generation module is used to generate storage instructions for storing data identifiers in response to the generation operation of the updated data identifier.
[0143] The execution module is used to execute storage instructions to store the updated data identifier into the identifier storage area of the storage medium.
[0144] In some embodiments, the first filtering module 520 may include a first filtering unit and a first result unit.
[0145] The first filtering unit is used to filter the memory history data identifiers and memory history pre-reading window ranges that need to be memorized from the historical data identifiers and the historical pre-reading window ranges respectively by resetting the weights.
[0146] The first result unit is used to obtain the initial pre-read result, including the initial data identifier and the initial pre-read window range, based on the memory history data identifier, the memory history pre-read window range, the hit rate and data identifier in the response information.
[0147] In some embodiments, the second filtering module 530 may include a second filtering unit, a third filtering unit, and a second result unit.
[0148] The second filtering unit is used to filter out the historical data identifiers and historical pre-read window ranges that need to be retained from the historical data identifiers and historical pre-read window ranges according to the first update weight.
[0149] The third filtering unit is used to filter out the initial data identifiers and initial pre-read window ranges that need to be retained from the initial data identifiers and initial pre-read window ranges according to the second update weight.
[0150] The second result unit is used to obtain the target pre-read result based on the historical data identifiers and historical pre-read window ranges that need to be retained, as well as the initial data identifiers and initial pre-read window ranges that need to be retained.
[0151] According to embodiments of the present invention, any plurality of modules among the first acquisition module 510, the first filtering module 520, the second filtering module 530, and the reading module 540 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of the present invention, at least one of the first acquisition module 510, the first filtering module 520, the second filtering module 530, and the reading module 540 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any one of the three implementation methods, or in a suitable combination of any of them. Alternatively, at least one of the first acquisition module 510, the first filtering module 520, the second filtering module 530, and the reading module 540 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0152] Figure 6 A block diagram of an electronic device suitable for implementing a cache prefetching method according to an embodiment of the present invention is shown.
[0153] like Figure 6 As shown, an electronic device 600 according to an embodiment of the present invention includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0154] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 executes various operations of the method flow according to embodiments of the present invention by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also execute various operations of the method flow according to embodiments of the present invention by executing programs stored in said one or more memories.
[0155] According to an embodiment of the present invention, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0156] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.
[0157] According to embodiments of the present invention, a computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of the present invention, a computer-readable storage medium may include ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603 described above.
[0158] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the cache prefetching method provided in the embodiments of the present invention.
[0159] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this invention. According to embodiments of the invention, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0160] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0161] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this embodiment of the invention. According to embodiments of the invention, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0162] According to embodiments of the present invention, program code for executing the computer programs provided in the embodiments of the present invention can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0164] Those skilled in the art will understand that the features described in the various embodiments of the present invention can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention can be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or combinations fall within the scope of the present invention.
[0165] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.
Claims
1. A cache prefetching method, characterized in that, The method includes: In response to a read request, obtain the response information of the read request for the current time period and the historical read results. The historical read results include historical read data. The response information includes the hit rate of the read request hitting the historical read data and the data identifier of the data read by the read request. The data identifier is used to characterize the time information of writing the data to the storage medium. Based on the historical pre-read results that need to be remembered, selected from the historical pre-read results based on the reset weight, and the response information, the initial pre-read result is obtained; Based on the historical pre-read results and initial pre-read results that need to be retained, which are selected from the historical pre-read results and the initial pre-read results respectively based on the update weights, the target pre-read result is obtained. The target pre-read result includes the target data identifier of the target pre-read data. Based on the target data identifier, target data is read from the storage medium and stored in the cache area.
2. The method according to claim 1, characterized in that, The target pre-read result also includes the target pre-read window range of the target pre-read data; Reading target data from the storage medium based on the target data identifier includes: Based on the target data identifier, locate the target starting position for reading the target data from the storage medium; Based on the target's starting position, the target data is read from the data block corresponding to the target's pre-read window range.
3. The method according to claim 2, characterized in that, The data identifier includes a first sub-identifier, which is used to determine the initial starting position for reading the target data; The step of locating the target starting position for reading the target data from the storage medium based on the target data identifier includes: Based on the first sub-identifier, determine the target data version to which the target pre-read data belongs; Determine the storage capacity occupied by the storage data included in the target data version in the storage medium; The target starting position is located based on the initial starting position determined by the first sub-identifier and the storage capacity.
4. The method according to claim 3, characterized in that, The data identifier further includes a second sub-identifier, which is used to determine the offset of the target starting position relative to the initial starting position; The step of locating the target starting position based on the initial starting position determined based on the first sub-identifier and the storage capacity includes: Based on the second sub-identifier and the storage capacity, determine the offset of the target starting position relative to the initial starting position; Starting from the initial starting position determined by the first sub-identifier, the target starting position is obtained by offsetting the offset amount in the direction of increasing target identifier.
5. The method according to claim 2, characterized in that, The method further includes: Determine the difference between the length of the target pre-read window range and an integer multiple of the predetermined read length; If the difference is not a predetermined difference, adjust the length of the target pre-read window range until the length of the target pre-read window range is an integer multiple of the predetermined read length.
6. The method according to claim 1, characterized in that, The data identifier represents the time information of the data being written to the storage medium in the following manner: In response to a write request to write the data to the storage medium, the current data identifier stored in the storage medium is obtained from the identifier storage area of the storage medium; If the validity period of the current data identifier has not reached the predetermined duration, the current data identifier will be added to the metadata of the data. If the validity period of the current data identifier reaches the predetermined duration, the current data identifier is updated, and the updated data identifier is added to the metadata of the data.
7. The method according to claim 6, characterized in that, The method further includes: In response to the updated data identifier generation operation, a storage instruction for storing the data identifier is generated; Execute the storage instruction to store the updated data identifier in the identifier storage area of the storage medium.
8. The method according to claim 1, characterized in that, The historical pre-read results also include the historical data identifiers and historical pre-read window ranges of the historical pre-read data; The process of obtaining the initial pre-read result based on the historical pre-read results that need to be remembered, selected from the historical pre-read results based on reset weights, and the response information includes: Using the reset weight, the memory history data identifiers and memory history pre-read window ranges that need to be remembered are respectively filtered from the historical data identifiers and the historical pre-read window ranges; Based on the memory history data identifier, the memory history pre-read window range, the hit rate in the response information, and the data identifier, the initial pre-read result, including the initial data identifier and the initial pre-read window range, is obtained.
9. The method according to claim 8, characterized in that, The update weights include a first update weight for the historical pre-read results and a second update weight for the initial pre-read results, wherein the sum of the first update weights and the second update weights is a predetermined value; The step of obtaining the target pre-read result based on the historical pre-read sub-results and initial pre-read sub-results that need to be retained, selected from the historical pre-read results and the initial pre-read results respectively based on update weights, includes: Based on the first update weight, select the historical data identifiers and historical pre-read window ranges that need to be retained from the historical data identifiers and the historical pre-read window ranges; Based on the second update weight, the initial data identifiers and initial pre-read window ranges that need to be retained are selected from the initial data identifiers and the initial pre-read window ranges; The target pre-read result is obtained by using the historical data identifiers and historical pre-read window ranges that need to be retained, as well as the initial data identifiers and initial pre-read window ranges that need to be retained.
10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Data caching method and device, electronic equipment and storage medium
CN112905569A
Cache replacement method and device based on gated loop unit network
CN118606228A