A method and device for processing cache data
By obtaining the predicted access parameters of the access target in the electronic device and adjusting its replacement probability, the problems of limited cache resources and low management efficiency are solved, and the cache utilization and data processing efficiency are improved.
Patent Information
- Application Number
- CN202411823345.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-11
AI Technical Summary
In electronic devices, due to limited cache resources, it is necessary to select part of the data deletion from the cached data to store new data, but the prior art has problems such as waste of cache resources and low data management efficiency.
By obtaining the access request, the predicted access parameters of the access target are obtained, and the parameters of the access target are adjusted based on the parameter, so that it changes with the number of times the data is hit, thereby adjusting the probability of data being replaced.
This improves the efficiency of cache resources, reduces the situation where the last accessed data resides for a long time without being replaced, and improves the efficiency of data processing.
Smart Images

Figure CN119271573B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing, and in particular to a cache data processing method and device. Background Art
[0002] Since cache resources in electronic devices are limited, when storing cache data, if there are no idle cache resources, it is necessary to select some data from the cached data and delete them, so as to use the idle cache resources to store the cache data that needs to be stored.
[0003] At present, the waste of cache resources still exists, and the efficiency of cache data management needs to be improved. Summary of the invention
[0004] In view of this, the present application provides a cache data processing method and device, and its specific scheme is as follows:
[0005] A cache data processing method, comprising:
[0006] Get the first access request;
[0007] In response to data corresponding to a first access target in the first access request being hit, obtaining a first predicted access parameter of the first access target, wherein the first predicted access parameter is related to the number of historical hits of the first access target and can represent a predicted maximum number of consecutive hits of the first access target;
[0008] Based on the first predicted access parameter, adjust the first parameter of the first access target so that the first parameter can change with the number of times the data corresponding to the first access target has been hit, and the first parameter is related to the probability of the data corresponding to the first access target being replaced.
[0009] Further, the obtaining of the first predicted access parameter of the first access target includes: obtaining the first predicted access parameter according to the historical access parameter of the historical data corresponding to the first access target before being deleted;
[0010] The adjusting the first parameter of the first access target based on the first predicted access parameter includes:
[0011] According to the first access parameter of the first access request and the first predicted access parameter, a first parameter corresponding to the first access target is adjusted.
[0012] Further, the obtaining of a first predicted access parameter of the first access target includes:
[0013] Querying a historical record set, the historical record set at least includes: a plurality of preset access targets, and a plurality of predicted access parameters respectively corresponding to the plurality of preset access targets;
[0014] In response to the first access target and a first preset access target in the historical record set satisfying a first matching condition, a predicted access parameter corresponding to the first preset access target is determined as a first predicted access parameter of the first access target.
[0015] Further, the first predicted access parameter includes a first hit rate prediction parameter and a first credibility prediction parameter, and the first access parameter of the first access request includes a first hit rate parameter; and adjusting the first parameter of the first access target based on the first predicted access parameter includes:
[0016] In response to the first hit rate parameter being less than the first hit rate prediction parameter and the first credibility prediction parameter being greater than a first target threshold, adjusting the first parameter of the first access target to a first target value to reduce the probability that the data corresponding to the first access target is replaced;
[0017] In response to the first hit rate parameter being greater than or equal to the first hit rate prediction parameter, or the first credibility prediction parameter being less than the first target threshold, the first parameter of the first access target is adjusted to a second target value to increase the probability that the data corresponding to the first access target is replaced.
[0018] Furthermore, the plurality of preset access targets include a plurality of high-order preset access sub-targets, each of which corresponds to a plurality of low-order preset access sub-targets, and each of the high-order preset access sub-targets and each of the low-order preset access sub-targets corresponds to respective preset access parameters;
[0019] The first access target and a first preset access target in the historical record set meet a first matching condition, and determining the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target includes:
[0020] If the first access target matches a first low-order preset access sub-target in the historical record set, determining that a preset access parameter corresponding to the first low-order preset access sub-target is the first predicted access parameter of the first access target;
[0021] Alternatively, if the first access target does not match any low-order preset access sub-target in the historical record set, but matches the first high-order preset access sub-target, the predicted access parameter corresponding to the first high-order preset access sub-target is determined to be the first predicted access parameter of the first access target.
[0022] Furthermore, the first access target represents: an address parameter of a storage address of the data in the cache in the cache, and / or a data type parameter of the data in the cache.
[0023] Furthermore, it also includes: updating the historical record set;
[0024] The updating of the historical record set includes:
[0025] Obtaining a second access request, wherein current data of a second access target of the second access request is not hit, and a second historical access parameter of the second access target satisfies an update condition;
[0026] In response to the second access target and a second preset access target among the plurality of preset access targets in the historical record set satisfying a second matching condition, updating a predicted access parameter corresponding to the second preset access target according to a second historical access parameter of the second access target;
[0027] In response to the second access target and the several preset access targets in the historical record set not satisfying the second matching condition, the second access target is recorded as a new preset access target in the historical record set, and the predicted access parameters corresponding to the new preset access target are updated according to the second historical access parameters of the second access target.
[0028] Further, the predicted access parameter includes a hit rate prediction parameter and a credibility prediction parameter, and the second historical access parameter includes a historical hit rate parameter of historical data of the second access target;
[0029] The updating, according to the second historical access parameter of the second access target, of the predicted access parameter corresponding to the second preset access target includes:
[0030] The historical hit rate parameter of the second access target is used to update the credibility prediction parameter and the hit rate prediction parameter corresponding to the second preset access target;
[0031] Wherein, updating the credibility prediction parameter includes:
[0032] In response to the historical hit rate parameter of the second access target being greater than or equal to the current hit rate prediction parameter of the second preset access target, increasing the value of the credibility prediction parameter of the second preset access target;
[0033] In response to the historical hit rate parameter of the second access target being less than the current hit rate prediction parameter of the second preset access target, reducing the value of the credibility prediction parameter of the second preset access target;
[0034] And / or, updating the hit rate prediction parameter includes:
[0035] In response to the current credibility prediction parameter of the second preset access target being greater than or equal to a second target threshold, updating the hit rate prediction parameter of the second preset access target to a larger value between the value of the historical hit rate parameter of the second access target and the value of the current hit rate prediction parameter of the second preset access target;
[0036] In response to the value of the current credibility prediction parameter of the second preset access target being less than a second target threshold, the value of the current hit rate prediction parameter of the second preset access target is reduced.
[0037] Furthermore, the plurality of preset access targets include a plurality of high-order preset access sub-targets, each of which corresponds to a plurality of low-order preset access sub-targets, and each of the high-order preset access sub-targets and each of the low-order preset access sub-targets corresponds to respective preset access parameters;
[0038] In response to the second access target and a second preset access target among the plurality of preset access targets in the historical record set satisfying a second matching condition, updating the predicted access parameter corresponding to the second preset access target according to the second historical access parameter of the second access target, comprises:
[0039] In response to the second access target matching the second high-order preset access subtarget in the historical record set and matching the second low-order preset access subtarget corresponding to the second high-order preset access subtarget, respectively updating the predicted access parameters of the second high-order preset access subtarget and the second low-order preset access subtarget;
[0040] In response to the second access target matching the second high-order preset access sub-target in the history record set and not matching the second low-order preset access sub-target corresponding to the second high-order preset access sub-target, only the predicted access parameters of the second high-order preset access sub-target are updated.
[0041] A cache data processing device, comprising:
[0042] A first obtaining unit, configured to obtain a first access request;
[0043] a second obtaining unit, configured to obtain, in response to a hit on data corresponding to a first access target in the first access request, a first predicted access parameter of the first access target, wherein the first predicted access parameter is related to a historical hit count of the first access target and can represent a predicted maximum number of consecutive hits of the first access target;
[0044] An adjustment unit is used to adjust a first parameter of the first access target based on the first predicted access parameter so that the first parameter can change with the number of times the data corresponding to the first access target has been hit, and the first parameter is related to the probability of the data corresponding to the first access target being replaced. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of a cache data processing method disclosed in an embodiment of the present application;
[0047] Figure 2 A flowchart of another cache data processing method disclosed in an embodiment of the present application;
[0048] Figure 3 A flowchart of another cache data processing method disclosed in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of a historical record collection disclosed in an embodiment of the present application;
[0050] Figure 5 A schematic diagram of a correspondence between preset access targets in a historical record set disclosed in an embodiment of the present application;
[0051] Figure 6 A flowchart of another cache data processing method disclosed in an embodiment of the present application;
[0052] Figure 7 A flowchart of a cache data processing method disclosed in an embodiment of the present application;
[0053] Figure 8 A schematic diagram of the structure of a cache data processing device disclosed in an embodiment of the present application;
[0054] Fig. 9 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0056] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0057] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0058] The present application discloses a cache data processing method, the flow chart of which is as follows: Figure 1 As shown, including:
[0059] Step S11, obtaining a first access request;
[0060] Step S12: in response to the data corresponding to the first access target in the first access request being hit, obtaining a first predicted access parameter of the first access target, wherein the first predicted access parameter is related to the number of historical hits of the first access target and can represent the maximum number of consecutive hits of the predicted first access target;
[0061] Step S13, based on the first predicted access parameter, adjust the first parameter of the first access target so that the first parameter can change with the number of times the data corresponding to the first access target has been hit, and the first parameter is related to the probability of the data corresponding to the first access target being replaced.
[0062] Since cache resources in electronic devices are limited, when storing cache data, if there are no idle cache resources, it is necessary to select some data from the cached data and delete them, so as to use the idle cache resources to store the cache data that needs to be stored.
[0063] In some implementations, some data is selected from the cached data for deletion, usually by selecting which cached data to delete based on utilization, that is, deleting cached data with low utilization. Each time cached data is hit, the priority of deleting the data is lowered accordingly. However, in reality, cached data with low historical utilization (rarely hit) may be used later, while the data that is currently the last hit will not be used again, but still occupies cache resources, resulting in a waste of cache resources.
[0064] Based on this, in this scheme, after obtaining the first access request, if it is determined that the data corresponding to the first access target in the first access request is hit, the first parameter of the first access target is adjusted based on the first predicted access parameter of the first access target, so as to adjust the parameters related to the probability of the data corresponding to the first access target being replaced based on the parameters related to the historical number of hits of the first access target, thereby adjusting the probability of the data being replaced as the number of times the data corresponding to the first access target is hit changes, so that the data in the cache can be adjusted based on the probability of being replaced, thereby avoiding the situation where the data that was accessed for the last time is still in the storage state, while the data that may be hit is replaced.
[0065] The first access request is a request for accessing the data to be accessed from the cache, that is, a request for accessing the data corresponding to the first access target. After obtaining the first access request, it is necessary to first determine whether the data corresponding to the first access target in the first access request is hit, that is, whether the data to be accessed is stored in the cache. If the data to be accessed is stored in the cache, it can be determined that the data corresponding to the first access target is hit. If the data to be accessed is not stored in the cache, it can be determined that the data corresponding to the first access target is not hit.
[0066] When determining that the data corresponding to the first access target in the first access request is hit, it is necessary to further obtain the first predicted access parameter of the first access target. The first predicted access parameter is a parameter related to the historical hit count of the first access target, and can characterize the predicted maximum number of consecutive hits of the first access target. The historical hit count of the first access target, that is, the number of times the data corresponding to the first access target is hit in the historical records, that is, the first predicted access parameter is determined based on the historical hit count of the first access target, that is, the predicted maximum number of consecutive hits of the first access target is determined, so as to predict the probability of the data corresponding to the first access target being replaced, or to predict the number of times the data corresponding to the first access target is hit again.
[0067] The first predicted access parameter represents the maximum number of times the first access target is predicted to be hit continuously, such as: the maximum number of times the first access target is predicted to be hit continuously is 3 times, or the maximum number of times the first access target is predicted to be hit continuously is 5 times, that is, the prediction is a clear number of times the first access target is hit at most, rather than the probability of being accessed next time. For example, the probability of a target being hit once is 60%, that is, the target has a 60% chance of being hit, and similarly, there is a 40% probability that it will not be hit, which is not a clear hit. Therefore, the first predicted access parameter in this embodiment is different from the probability of being hit.
[0068] In addition, the first parameter of the first access target is adjusted using the predicted maximum number of consecutive hits of the first access target as a parameter, such as: the first predicted access parameter predicts that the maximum number of consecutive hits of the first access target is 5 times, and it has been hit 3 times currently, so it will be hit 2 more times in the future; if it has been hit currently, then it will not be hit again in the future; and if the single access probability is used as a parameter for corresponding adjustment, usually when the probability reaches a certain value, it is considered that the next time may be hit, such as: if the probability value is 70%, it is considered that the next time is likely to be hit, which is essentially different from using the predicted maximum number of consecutive hits of the first access target as a parameter to adjust the first parameter.
[0069] When the single access probability is used as a parameter for corresponding adjustment, when the access target is hit by a large number of consecutive accesses, the probability of the next access hit is usually very high, until there is no access hit or the number of access hits decreases after a period of time, then the predicted probability of the next access hit will decrease, so that the data in the access target is replaced; compared with the prediction method of the single access probability, the first predicted access parameter of the present application scheme represents the maximum number of access hits of the access target. When the number of consecutive access hits of the access target reaches the predicted maximum number, the first parameter will be adjusted so that the data in the access target is replaced; in this case, when the data of the access target is frequently accessed to the last time (reaching the predicted maximum number of times), it can be replaced in time, reducing the invalid occupancy time of the cache and improving cache utilization.
[0070] The first predicted access parameter may include a first hit rate prediction parameter, wherein the first hit rate prediction parameter is used to characterize the number of times or frequency of the data corresponding to the first access target being hit, such as predicting that the maximum number of times the data corresponding to the first access target is hit is 3 times, or 5 times, etc. Based on the first hit rate prediction parameter, the probability of the data corresponding to the first access target being hit again can be predicted.
[0071] Furthermore, the first predicted access parameter may also include a first credibility prediction parameter, which is used to characterize the credibility of predicting the first hit rate prediction parameter, and the prediction accuracy may be improved by providing a first hit rate prediction parameter with a higher credibility. Based on the first hit rate prediction parameter and the first credibility prediction parameter, the number of times the data corresponding to the first access target is hit again may be predicted, or, based on the first hit rate prediction parameter and the first credibility prediction parameter, the probability of the data corresponding to the first access target being replaced may be determined.
[0072] The first parameter is a parameter related to the probability of the data corresponding to the first access target being replaced. When the probability of the data corresponding to the first access target being hit again is high, the probability of the data corresponding to the first access target being replaced will be low; when the probability of the data corresponding to the first access target being hit again is low, the probability of the data corresponding to the first access target being replaced will be high. That is, the first parameter can represent the probability of the data corresponding to the first access target being replaced, and can also represent the probability of the data corresponding to the first access target being hit again.
[0073] Specifically, the first parameter may be: Re-reference Prediction Values (RRPV). Re-Reference Interval Prediction (RRIP) is an extension for cache replacement strategy, which is an improvement based on the NRU (Not Recently Used) strategy. RRIP introduces a re-reference prediction value (RRPV) to predict whether a block will be re-accessed in the near future. In RRIP, each cache block is assigned an RRPV value. Initially, all RRPV values are set to the maximum value. When a block is accessed, its RRPV value is reset.
[0074] Therefore, based on the first predicted access parameter, the first parameter of the first access target can be adjusted so that the first parameter can change with the number of times the data corresponding to the first access target is hit. Further, adjusting the first parameter based on the first predicted access parameter can more accurately reflect the probability of the data corresponding to the first access target being replaced or being hit again.
[0075] After determining the first parameter, the data in the cache can be adjusted in combination with the first parameter, such as: when there is target data that needs to be stored in the cache, and there is no free address in the cache to store the target data, at this time, the first parameter (i.e., the probability of each data stored in the cache being replaced) can be combined to determine which data in the cache can be deleted, so that after deleting the data, there is a free address in the cache that can store the target data. That is, when the number of times the data corresponding to the first access target is hit reaches the number of times the first access target represented by the first predicted access parameter is hit, the probability of the data corresponding to the first access target being replaced represented by the first parameter reaches the maximum. When the condition is met, the data corresponding to the first access target is deleted to clear the number of times that the cache will no longer be hit. The condition is met when there is new data that needs to be stored in the cache, and there is no free address in the cache to store the new data.
[0076] For example: based on the first parameter of each data stored in the cache, it is determined that the probability of data a in the cache being replaced has reached the highest. At this time, the probability of data a being hit again is 0. If data a is stored at address b in the cache, the data a in the cache can be deleted, and the address b in the cache is adjusted to a free address. At this time, the target data can be stored at address b in the cache. The historical utilization rate of data a is not considered in this process.
[0077] Among them, the first access target can be: the address of the data requested to be accessed in the first access request in the cache, and the data corresponding to the first access target, that is, the data stored at the address in the cache; the first access target can also be: the data type of the data requested to be accessed in the first access request, and the data corresponding to the first access target, that is, the data corresponding to the data type requested to be accessed in the first access request.
[0078] Specifically, when some data is stored in the cache, it will have certain local characteristics for the storage address or data type, such as: Graphics Processing Unit GPU, due to the GPU's single instruction multi-threaded SIMT architecture, multi-threaded high parallelism, during the GPU processing process, a large amount of intermediate data that needs to be temporarily stored will be generated, different threads have similar access frequencies to these types of data, and these types of data also have local characteristics in space. The number of accesses and addresses of certain threads when they become the last access can be used as a reference for the prediction mechanism of other threads, where the prediction mechanism is the cache data processing method disclosed in this embodiment, and the use of this prediction mechanism can significantly reduce the time that the intermediate data stays in the cache after the last access, thereby improving the hit rate.
[0079] The cache data processing method disclosed in this embodiment obtains a first access request; in response to the data corresponding to the first access target in the first access request being hit, obtains a first predicted access parameter of the first access target; based on the first predicted access parameter, adjusts the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of the data corresponding to the first access target being replaced. In this scheme, when determining that the data corresponding to the first access target in the first access request is hit, it is necessary to obtain the first predicted access parameter of the first access target, and adjust the first parameter of the first access target based on the first predicted access parameter, so as to accurately adjust the relevant parameters of the probability of the data corresponding to the first access target being replaced based on the relevant data of the number of historical hits of the first access target. Based on the first parameter as the parameter for replacing cache data, the utilization efficiency of cache resources can be improved, and the situation that the data accessed last time resides in the cache for a long time without being replaced and may still be replaced by the data that is hit again can be reduced, so that when the data is hit, the corresponding data can be obtained in time, thereby improving the data processing efficiency.
[0080] This embodiment discloses a cache data processing method, and its flow chart is as follows: Figure 2 As shown, including:
[0081] Step S21, obtaining a first access request;
[0082] Step S22, in response to the data corresponding to the first access target in the first access request being hit, obtaining a first predicted access parameter according to the historical access parameter of the historical data corresponding to the first access target before being deleted;
[0083] Step S23: Adjust the first parameter corresponding to the first access target according to the first access parameter of the first access request and the first predicted access parameter.
[0084] After obtaining the first access request, determine whether the data corresponding to the first access target in the first access request is hit. If the data corresponding to the first access target is hit, it indicates that the cache stores the data to be accessed of the first access request. In order to accurately determine whether the data stored in the cache needs to be replaced, or to determine whether the data stored in the cache can be hit again in the future, a first parameter can be set, and the first parameter is used to characterize the probability of the data in the cache being replaced. As long as it is determined that a certain data in the cache is hit by the first access request, the first parameter will be adjusted.
[0085] The adjustment of the first parameter is based on the first predicted access parameter. The first predicted access parameter is related to the number of historical hits of the first access target, that is, it is related to the number of times the data corresponding to the first access target is hit in the historical records, rather than the number of times a specific data is hit in the historical records. That is, no matter whether the data corresponding to the first access target is data a or data b, as long as the data corresponding to the first access target is hit, what needs to be obtained is the first predicted access parameter of the first access target, and what is adjusted based on this is the first parameter of the first access target.
[0086] In the cache data processing method disclosed in this embodiment, the access target may be: address information, that is, address parameters of the storage address of the data in the cache in the cache, such as: cache line cache line, then the data corresponding to the first access target is the data stored at the first address in the cache;
[0087] Alternatively, the access target may also be: a data type, that is, a data type parameter of the data stored in the cache, and the data corresponding to the first access target is the first type of data stored in the cache.
[0088] The first predicted access parameter can be determined based on the historical access parameter of the historical data corresponding to the first access target before being deleted. After determining the first access target corresponding to the first access request, the historical data corresponding to the first access target is retrieved, and the historical data includes the number of times the first access target is hit in the historical records, wherein the number of times the first access target is hit in the historical records refers to the number of times the data corresponding to the first access target is hit when the data corresponding to the first access target has not changed, that is, the hit frequency of the data corresponding to the first access target before being deleted. For example: when the first access target corresponds to data a, the hit frequency of the first access target is the number of times the data a corresponding to the first access target is hit when data a corresponds to the first access target, that is, the number of times the data a corresponding to the first access target is hit before data a is deleted; if data a is deleted, the first access target corresponds to data b, and the hit frequency of the first access target is the number of times the data b corresponding to the first access target is hit when data b corresponds to the first access target, that is, the number of times the data b corresponding to the first access target is hit before data b is deleted.
[0089] In the historical data corresponding to the first access target, the number of times each historical data is hit before being deleted, that is, the historical access parameters of the historical data corresponding to the first access target before being deleted, and the first predicted access parameters of the first access target are determined based on the historical access parameters of the first access target, that is, the frequency of hitting the first access target and the credibility of the hitting frequency are predicted based on the number of times the historical data corresponding to the first access target is hit.
[0090] In one embodiment, the values of the first predicted access parameter and the historical access parameter are the number of hits. For example: if the number of times the historical data corresponding to a cache line has been hit before being deleted (historical access parameter) is 3, then the first hit rate prediction parameter (predicted maximum hit number) in the first predicted access parameter of the cache line can be determined to be 3; for another example: if the number of times the historical data corresponding to a cache line has been hit before being deleted is 3 and 5, then the first hit rate prediction parameter in the first predicted access parameter of the cache line can be determined to be 4, that is, the average number of times the historical data has been hit before being deleted, or the first hit rate prediction parameter in the first predicted access parameter of the cache line can be determined to be 5, that is, the maximum number of times the historical data has been hit before being deleted, etc.
[0091] The value of the first hit rate prediction parameter can be the average number of accesses to data a or data b corresponding to a certain access target (i.e., the average number of times the historical data was hit before being deleted), or the maximum value (i.e., the maximum number of times the historical data was hit before being deleted), etc. Of course, considering the problem of fault tolerance, the value of the first hit rate prediction parameter may be greater than the historical value (i.e., the average value or maximum value mentioned above); considering the problem of efficiency, the value of the first hit rate prediction parameter may be appropriately smaller than the historical value (i.e., the average value or maximum value mentioned above).
[0092] After determining the first predicted access parameter of the first access target, in order to adjust the first parameter corresponding to the first access target, it is also necessary to determine the first access parameter of the first access request, that is, the current access frequency corresponding to the current access request, that is, the number of times the data corresponding to the first access target is hit.
[0093] For example: the first hit rate prediction parameter in the first predicted access parameter is 3 (corresponding to a maximum hit of 3 times), the first access request corresponds to the first hit on the data corresponding to the first access target, which has not reached the predicted maximum hit number, and the probability of being hit again is high, then the parameters corresponding to the first access target are adjusted so that the probability of the data corresponding to the adjusted first parameter being replaced is low; if the first access request corresponds to the second access to the data corresponding to the first access target, which has not reached the predicted maximum hit number, and the probability of being hit again is high, but the probability is lower than the first hit, then the parameters corresponding to the first access target are adjusted so that the probability of the data corresponding to the adjusted first parameter being replaced is low, but it is higher than the first hit; if the first access request corresponds to the third access to the data corresponding to the first access target, which has reached the predicted maximum hit number, and the probability of being hit again is low, then the parameters corresponding to the first access target are adjusted so that the probability of the data corresponding to the adjusted first parameter being replaced is high.
[0094] The cache data processing method disclosed in the present embodiment, after obtaining the first access request, if the data corresponding to the first access target of the first access request is hit, obtains the first predicted access parameter according to the historical access parameter of the historical data corresponding to the first access target before being deleted, so as to adjust the first parameter corresponding to the first access target by comparing the first access parameter of the first access request with the first predicted access parameter, and obtains the first predicted access parameter by using the historical access parameter of the historical data corresponding to the first access target before being deleted, thereby ensuring the accuracy of the first predicted access parameter; adjusts the first parameter based on the first access parameter of the first access request and the first predicted access parameter, thereby ensuring the accuracy of the adjustment of the first parameter, ensuring that the corresponding data can be obtained in time when the data is hit, and improving the data processing efficiency.
[0095] This embodiment discloses a data cache processing method, which more accurately adjusts the first parameter. The flow chart is as follows: Figure 3 As shown, including:
[0096] Step S31: obtaining a first access request;
[0097] Step S32: in response to the data corresponding to the first access target in the first access request being hit, query the historical record set, the historical record set at least including: a plurality of preset access targets, and a plurality of access parameters corresponding to the plurality of preset access targets respectively;
[0098] Step S33, in response to the first access target and the first preset access target in the historical record set satisfying a first matching condition, determining the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target;
[0099] Step S34, based on the first predicted access parameter, adjusting the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of data corresponding to the first access target being replaced.
[0100] After obtaining the first access request, determine whether the data corresponding to the first access target in the first access request is hit. If the data corresponding to the first access target is hit, it indicates that the cache stores the data to be accessed of the first access request. In order to accurately determine whether the data stored in the cache needs to be replaced, or to determine whether the data stored in the cache can be hit again, a first parameter can be set, and the first parameter is used to characterize the probability of the data in the cache being replaced. As long as it is determined that a certain data in the cache is hit by the first access request, the first parameter will be adjusted.
[0101] The adjustment of the first parameter is implemented based on the first predicted access parameter. The first predicted access parameter is related to the number of historical hits of the first access target. Specifically, it can be determined by querying the historical record set.
[0102] The historical record set includes at least: a number of preset access targets and a number of predicted access parameters corresponding to the preset access targets. Figure 4 As shown, it is a schematic diagram of a historical record set, where k is a positive integer greater than 1. Taking the address parameter of the storage address of the data in the cache as an example, the historical record set includes at least: multiple address parameters, and the predicted access parameters corresponding to each address parameter, namely, the hit rate parameter and the credibility parameter. More specifically, if the address parameter is a cache line, then the historical data set includes the address information of multiple cache lines, as well as the hit rate prediction parameter and the credibility prediction parameter of each cache line.
[0103] After obtaining the first access request, first determine whether the data corresponding to the first access target in the first access request is hit. If it is hit, query the relevant information of the first access target from the historical record set to determine the first predicted access parameter corresponding to the first access target. For example: if the first access target meets the first matching condition with the preset access target 1 in the historical record set, then it can be determined that the predicted access parameter 1 corresponding to the preset access target 1 is the first predicted access parameter corresponding to the first access target.
[0104] Among them, the first access target and the first preset access target in the historical record set meet the first matching condition, which may be: the address of the first access target is the same as or related to the address of the first preset access target in the historical record set (such as: the address range of the first access target is larger, which may include the address of the first preset access target; such as: the address of the first preset access target is larger, which may include the address of the first access target), then it can be determined that the first access target and the first preset access target meet the first matching condition, or it can also be: the type of data corresponding to the first access target is the same as the type of data corresponding to the first preset access target in the historical record set, then it can be determined that the first access target and the first preset access target meet the first matching condition.
[0105] After obtaining the first predicted access parameter of the first access target, adjusting the first parameter of the first access target based on the first predicted access parameter may be specifically as follows:
[0106] In response to the first hit rate parameter being less than the first hit rate prediction parameter, and the first credibility prediction parameter being greater than the first target threshold, adjusting the first parameter of the first access target to the first target value to reduce the probability that the data corresponding to the first access target is replaced; in response to the first hit rate parameter being greater than or equal to the first hit rate prediction parameter, or the first credibility prediction parameter being less than the first target threshold, adjusting the first parameter of the first access target to the second target value to increase the probability that the data corresponding to the first access target is replaced.
[0107] After obtaining the first predicted access parameter of the first access target, a first hit rate prediction parameter and a first credibility prediction parameter are obtained from the first predicted access parameter, that is, the predicted hit rate of the first access target and the credibility of the predicted hit rate of the first access target; in addition, after obtaining the first access request, the first access parameter of the first access request is also obtained, and the first access parameter includes at least a first hit rate parameter, that is, the actual number of visits to the first access target, that is, the number of times the first access target has been hit under the data currently corresponding to the first access target.
[0108] In order to adjust the first parameter, after obtaining the above data, it is necessary to compare the first hit rate parameter in the first access parameter of the first access request with the first hit rate prediction parameter in the first predicted access parameter to determine the size relationship between the first hit rate parameter and the first hit rate prediction parameter.
[0109] If it is determined that the first hit rate parameter is less than the first hit rate prediction parameter, it indicates that the current actual number of visits to the first access target has not yet reached the predicted first hit rate prediction parameter, and the data corresponding to the first access target may still be hit. Therefore, as long as it is determined that the first credibility prediction parameter is greater than the first target threshold, that is, the credibility of the first hit rate prediction parameter is high, the first parameter of the first access target can be adjusted to the first target value. When the first parameter is at the first target value, the first parameter can represent that the probability of the data corresponding to the first access target being replaced is low. For example, if the first parameter is set to 0, it represents that the probability of the data corresponding to the first access target being replaced is low.
[0110] If it is determined that the first hit rate parameter is greater than or equal to the first hit rate prediction parameter, it indicates that the current actual number of visits to the first access target has reached the predicted first hit rate prediction parameter, and the probability of the data corresponding to the first access target being hit is low. Therefore, the first parameter of the first access target can be adjusted to the second target value. When the first parameter is at the second target value, the first parameter can represent that the probability of the data corresponding to the first access target being replaced is high. For example, if the first parameter is set to 3, at this time, it represents that the probability of the data corresponding to the first access target being replaced is high.
[0111] If it is determined that the first credibility prediction parameter is less than the first target threshold, it indicates that the credibility of the first hit rate prediction parameter is low. At this time, the first parameter of the first access target can be directly adjusted to the second target value.
[0112] The above all correspond to the situation where the data corresponding to the first access target in the first access request is hit. If the data corresponding to the first access target in the first access request is not hit, that is, the data to be accessed of the first access request is not stored in the cache, then it is necessary to delete some data in the cache with a higher probability of being replaced, and store the data to be accessed of the first access request at the location where the deleted data is located, so that the data stored again at the location can be accessed later.
[0113] The data cache processing method disclosed in this embodiment determines how to adjust the first parameter through the first hit rate parameter, the first hit rate prediction parameter and the first credibility prediction parameter, thereby ensuring the accuracy of the first parameter adjustment.
[0114] The data cache processing method disclosed in this embodiment obtains a first access request; in response to the data corresponding to the first access target in the first access request being hit, queries a historical record set, the historical record set at least including: a number of preset access targets, and a number of access parameters corresponding to the preset access targets respectively; in response to the first access target and the first preset access target in the historical record set satisfying a first matching condition, determines the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target; based on the first predicted access parameter, adjusts the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of the data corresponding to the first access target being replaced. This scheme pre-sets a historical record set, and after determining the first access target of the first access request, determines the predicted access parameter corresponding to the first access target in the historical data set, and determines it as the first predicted access parameter, that is, the determination of the first predicted access parameter of the first access target is realized through the historical data set, which ensures that the determination of the first predicted access parameter is based on historical data, and ensures the accuracy of the data.
[0115] Furthermore, in the cache data processing method disclosed in this embodiment, the several preset access targets in the historical record set may include: several high-order preset access sub-targets, each high-order preset access sub-target corresponding to several low-order preset access sub-targets, and each high-order preset access sub-target and each low-order preset access sub-target respectively corresponding to their own preset access parameters.
[0116] Wherein, the high-order preset access sub-target and the low-order preset access sub-target may correspond to the high-order preset access sub-address and the low-order preset access sub-address respectively;
[0117] Alternatively, the high-order preset access sub-target and the low-order preset access sub-target correspond to the large type of data and the sub-type under the large type, respectively.
[0118] Wherein, if the access target represents the address parameter of the storage address of the data in the cache, the high-order preset access sub-target represents the high-order address parameter, and the low-order preset access sub-target represents the low-order address parameter, wherein the low-order preset access sub-target belongs to a subset of the high-order preset access sub-target, and the high-order preset access sub-target has a larger address range than the low-order preset access sub-target, for example, the spatial range of the high-order preset access sub-target can be: 16K, 32K, etc., and the subset of the high-order preset access sub-target, that is, the spatial range of the low-order preset access sub-target corresponding to the high-order preset access sub-target can be: 4K, 8K, etc.;
[0119] If the access target represents the data type parameter of the data in the cache, the high-order preset access sub-target represents the high-order data type, and the low-order preset access sub-target represents the low-order data type, wherein the low-order preset access sub-target belongs to a subset of the high-order preset access sub-target, and the high-order preset access sub-target includes a wider range of data types than the low-order preset access sub-target.
[0120] Therefore, no matter the access target represents address parameters or data types, the first access target is first matched with the low-order preset access sub-target in the historical record set. Only when it does not match the low-order preset access sub-target will it be matched with the high-order preset access sub-target in the historical record set.
[0121] like Figure 5 As shown, it is the correspondence between the preset access targets in the historical record set. The historical record set includes m high-order preset access sub-targets, each high-order preset access sub-target corresponds to n low-order preset access sub-targets, and m and n are both positive integers.
[0122] The first access target and the first preset access target in the historical record set meet a first matching condition, and determining the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target includes:
[0123] If the first access target matches the first low-order preset access sub-target in the historical record set, the preset access parameter corresponding to the first low-order preset access sub-target is determined to be the first predicted access parameter of the first access target; or, if the first access target does not match any low-order preset access sub-target in the historical record set, but matches the first high-order preset access sub-target, the predicted access parameter corresponding to the first high-order preset access sub-target is determined to be the first predicted access parameter of the first access target.
[0124] When searching for the first predicted access parameter corresponding to the first access target from the historical record set, the preset access target that matches the first access target in the historical record set can be first determined. Since the preset access targets stored in the historical record set include low-order preset access sub-targets and high-order preset access sub-targets, it is possible to first search from the low-order preset access sub-targets to see whether there is a low-order preset access sub-target that matches the first access target. If not, then search from the high-order preset access sub-targets to see whether there is a high-order preset access sub-target that matches the first access target. If there is a low-order preset access sub-target that matches the first access target among the low-order preset access sub-targets, then since the information in the low-order preset access sub-target is more strongly correlated with the information of the first access target, and the low-order preset access sub-target can match the first access target, then the high-order preset access sub-target must be able to match the first access target. Therefore, there is no need to search from the high-order preset access sub-targets to see whether there is a matching high-order preset access sub-target.
[0125] Alternatively, it is simultaneously searched from the lower preset access sub-targets and the higher preset access sub-targets whether there is a preset access sub-target that matches the first access target.
[0126] Specifically, if it is determined that the first access target matches the first low-order preset access sub-target in the historical record set, the preset access parameter corresponding to the first low-order preset access sub-target can be directly determined as the first predicted access parameter of the first access target. Since there are multiple low-order preset access sub-targets corresponding to the high-order preset access sub-target, when determining that the first low-order preset access sub-target corresponds to the first access target, there is no need to determine the high-order preset access sub-target corresponding to the first access target from the high-order preset access sub-targets.
[0127] If the first access target does not match any of the low-order preset access sub-targets in the historical record set, but only matches the first high-order preset access sub-target, the predicted access parameter corresponding to the first high-order preset access sub-target can be directly determined as the first predicted access parameter of the first access target. At this time, there is no low-order preset access sub-target that matches the first access target, and only the predicted access parameter corresponding to the high-order preset access sub-target can be used.
[0128] In addition, in the case where the first access target only matches the preset access sub-target in the historical record set, if the first hit rate parameter of the first access target is greater than or equal to the first hit rate prediction parameter of the preset access sub-target, or the first credibility prediction parameter of the preset access sub-target is less than the first target threshold, the first parameter of the first access target is adjusted to the second target value, and if the preset access sub-target is the first low-order preset access sub-target, the first parameter is directly set to 3, that is, the second target value is 3;
[0129] If the preset access sub-target is the first high-order preset access sub-target, when the access target represents the address parameter of the storage address of the data in the cache, the high-order preset access sub-target is a larger address range than the low-order preset access sub-target. When predicting within a larger address range, a certain margin needs to be retained for the prediction accuracy. Therefore, at this time, the first parameter can be set to 3, or directly subtract 1 from the original value of the first parameter.
[0130] The cache data processing method disclosed in the present embodiment, when matching the first access target with the preset access sub-target in the historical record set, first matches with the low-order preset access sub-target in the historical record set. Only when the preset access sub-target that matches the first access target does not exist in the low-order preset access sub-target, will the first access target be matched with the high-order preset access sub-target in the historical record set. In this way, the matching efficiency of the first access target and the preset access sub-target in the historical record set is improved, and the matching accuracy is improved, and the management granularity is finer.
[0131] This embodiment discloses a cache data processing method, and its flow chart is as follows: Figure 6 As shown, including:
[0132] Step S61: obtaining a first access request;
[0133] Step S62: in response to the data corresponding to the first access target in the first access request being hit, query the historical record set, the historical record set at least including: a plurality of preset access targets, and a plurality of access parameters corresponding to the plurality of preset access targets respectively;
[0134] Step S63, in response to the first access target and the first preset access target in the historical record set satisfying a first matching condition, determining the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target;
[0135] Step S64: adjusting a first parameter of the first access target based on the first predicted access parameter, wherein the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of data corresponding to the first access target being replaced;
[0136] Step S65 , in response to a data miss corresponding to the first access target in the first access request, updating the history record set, so that when the data corresponding to the first access target in the first access request is hit, the updated history record set can be queried.
[0137] After obtaining the first access request, determine whether the data corresponding to the first access target in the first access request is hit. If it is determined that the data corresponding to the first access target in the first access request is hit, it is necessary to query the historical record set to determine the first predicted access parameter of the first access target from the historical record set, thereby adjusting the first parameter of the first access target based on the first predicted access parameter, so that the first access parameter changes with the number of access requests, thereby ensuring the accuracy of data replacement.
[0138] In order to ensure the accuracy of the first parameter adjustment, the accuracy of the first predicted access parameter needs to be ensured, and the accuracy of the first predicted access parameter depends on the historical record set. Therefore, the historical record set needs to be updated based on actual needs to ensure that the first predicted access parameter is determined based on the updated historical record set, thereby ensuring the accuracy of the data.
[0139] Specifically, the update history record set can be:
[0140] A second access request is obtained, the current data of the second access target of the second access request is not hit, and the second historical access parameter of the second access target satisfies the update condition; in response to the second access target and a second preset access target among several preset access targets in the historical record set satisfying the second matching condition, the predicted access parameters corresponding to the second preset access target are updated according to the second historical access parameters of the second access target; in response to the second access target and several preset access targets in the historical record set not satisfying the second matching condition, the second access target is recorded as a new preset access target in the historical record set, and the predicted access parameters corresponding to the new preset access target are updated according to the second historical access parameters of the second access target.
[0141] A second access request is obtained, where the current data of the second access target is not hit, and the second historical access parameter of the second access target satisfies the update condition. Then, the historical record set can be updated.
[0142] The second historical access parameter of the second access target may include the number of accesses to the second access target in the historical records, and more specifically, may be a historical hit rate parameter of the second access target.
[0143] If the update condition is met, it can be: there is an access count in the historical record, that is, the historical hit rate parameter is a non-zero value. If the current data of the second access target of the second access request is not hit, and the second historical access parameter of the second access target meets the update condition, the historical record set is updated; if the current data of the second access target of the second access request is not hit, and the second historical access parameter of the second access target does not meet the update condition, at this time, the current process can be terminated, or a new preset access target can be added to the historical record set.
[0144] When the current data of the second access target is not hit and the second historical access parameter of the second access target meets the update condition, the update of the historical record set can be executed based on whether the second access target and several preset access targets in the historical record set meet the second matching condition. That is, different update strategies need to be executed if the second matching condition is met or not, that is, whether the historical record set records the data corresponding to the second access target, and different update strategies need to be executed if there is a record or not.
[0145] Specifically, if the second access target satisfies the second matching condition with a second preset access target among the preset access targets in the historical record set, the predicted access parameter corresponding to the second preset access target is directly updated according to the second historical access parameter of the second access target.
[0146] If the second access target and a second preset access target among several preset access targets in the historical record set meet the second matching condition, that is, the second preset access target and the second access target are matched in the historical record set, the second historical access parameter corresponding to the second access target can be used as a reference for the second preset access target, and an update is performed on this basis, that is, the data related to the second preset access target recorded in the historical record set can be updated based on the second historical access parameter of the second access request;
[0147] If the second access target and multiple preset access targets in the historical record set do not meet the second matching condition, that is, there is no second preset access target matching the second access target in the historical record set, at this time, it is necessary to add a new preset access target to the historical record set, that is, to use the second historical access parameters of the second access target as the predicted access parameters corresponding to the newly added preset access target, so as to realize the increase of the preset access targets stored in the historical record set.
[0148] Among them, for the newly added preset access target in the historical record set, initial predicted access parameters can be configured for it, wherein the initial predicted access parameters can be the historical parameters of the second access target, that is, its historical parameters are used as the predicted access parameters of the newly added preset access target in the historical record set.
[0149] In this embodiment, the historical record set is used to determine the predicted access parameters corresponding to the access target. Therefore, in the process of establishing the historical record set, access requests will be continuously obtained to determine whether the predicted access parameters corresponding to each access target recorded in the historical record set need to be updated and how to update them. That is, if the second access target of the second access request and the second preset access target in the historical record set meet the second matching condition, then the predicted access parameters related to the second preset access target recorded in the historical record set can be directly updated according to the second historical access parameters corresponding to the second access target that matches it, so as to make them conform to the second historical access parameters of the second access target; if the second access target of the second access request and any preset access target in the historical record set do not meet the second matching condition, then a new preset access target and the predicted access parameters of the new preset access target need to be added to the historical record set to supplement the historical record set.
[0150] The second historical access parameter of the second access target is the historical hit rate parameter of the second access target. At this time, the credibility prediction parameter and the hit rate prediction parameter can be directly updated according to the historical hit rate parameter of the second access target.
[0151] That is, when it is determined that the second access target satisfies the second matching condition with the second preset access target among the preset access targets in the historical record set, the credibility prediction parameter and the hit rate prediction parameter can be updated according to the historical hit rate parameter of the second access target.
[0152] The hit rate parameters of the second access target are stored in the historical record. When it is determined that the second access target and the second preset access target in the historical record set meet the second matching condition, since the second access target matches the second preset access target, the hit rate prediction parameters of the second preset access target can be directly adjusted according to the historical hit rate parameters corresponding to the second access target, and the credibility prediction parameters of the second preset access target can be updated at the same time, so as to realize the update of the hit rate prediction parameters and credibility prediction parameters recorded in the historical record set, so that the data recorded in the historical record set is more consistent with the hit rate of the actual access target.
[0153] Among them, updating the credibility prediction parameters and hit rate prediction parameters according to the historical hit rate parameters of the second access target can be divided into two parts, namely, updating the credibility prediction parameters according to the historical hit rate parameters of the second access target, and updating the hit rate prediction parameters according to the historical hit rate parameters of the second access target.
[0154] Among them, updating the credibility prediction parameter according to the historical hit rate parameter of the second access target can be: in response to the historical hit rate parameter value of the second access target being greater than or equal to the current hit rate prediction parameter of the second preset access target, increasing the credibility prediction parameter of the second preset access target; in response to the historical hit rate parameter of the second access target being less than the current hit rate prediction parameter of the second preset access target, reducing the value of the credibility prediction parameter of the second preset access target.
[0155] After determining that the second access target and the second preset access target in the historical record set meet the second matching condition, determine the historical hit rate parameters of the second access target. At the same time, determine the current hit rate prediction parameters and credibility prediction parameters of the second preset access target in the historical record set. After that, compare the numerical values of the historical hit rate parameters of the second access target with the current hit rate prediction parameters of the second preset access target.
[0156] If it is determined that the historical hit rate parameter of the second access target is greater than or equal to the current hit rate prediction parameter of the second preset access target, it means that the hit count of the second preset access target has reached the hit count historical record set corresponding to the current hit rate prediction parameter in the historical record set. At this time, it can be determined that the current hit rate prediction parameter of the second preset access target recorded in the historical record set is more accurate, and the value of the credibility prediction parameter of the second preset access target can be improved, such as: adding 1 to the value of the credibility prediction parameter of the second preset access target;
[0157] If it is determined that the historical hit rate parameter of the second access target is less than the current hit rate prediction parameter of the second preset access target, it means that the number of times the second preset access target is hit does not reach the value corresponding to the current hit rate prediction parameter recorded in the historical record set. Then, the value corresponding to the current hit rate prediction parameter recorded in the historical record set is too high and the accuracy is insufficient. At this time, it is necessary to lower the value of the credibility prediction parameter of the second preset access target, such as: subtracting 1 from the value of the credibility prediction parameter of the second preset access target.
[0158] It should be noted that two thresholds can be set for the credibility prediction parameter, namely, a high threshold and a low threshold, wherein the high threshold is the first target threshold involved in the above-mentioned embodiment, that is, as long as the credibility prediction parameter reaches the high threshold, it can be determined that the current credibility prediction parameter has met the requirements, and the data in the historical record set can no longer be adjusted. If the credibility prediction parameter does not reach the high threshold, it can be determined that the value of the current credibility prediction parameter is low and needs to be further adjusted;
[0159] The low threshold is the lowest threshold that needs to be adjusted, and it can be determined as the second target threshold. When the credibility prediction parameter is reduced to the low threshold, it indicates that the credibility of the hit rate prediction parameter corresponding to the credibility prediction parameter is low. At this time, the credibility prediction parameter needs to be adjusted to improve its corresponding credibility prediction parameter until the credibility prediction parameter reaches the high threshold, and then the adjustment is stopped.
[0160] In addition, it is necessary to further update the hit rate prediction parameter based on the historical hit rate parameter of the second access target. Specifically, in response to the current credibility prediction parameter of the second preset access target being greater than or equal to the second target threshold, the hit rate prediction parameter of the second preset access target is updated to the larger value of the historical hit rate parameter of the second access target and the current hit rate prediction parameter of the second preset access target; in response to the current credibility prediction parameter of the second preset access target being less than the second target threshold, the current hit rate prediction parameter of the second preset access target is reduced.
[0161] After determining that the second access target and the second preset access target in the historical record set meet the second matching condition, determine the historical hit rate parameters of the second access target. At the same time, determine the current hit rate prediction parameters and credibility prediction parameters of the second preset access target in the historical record set. Then, compare the value of the credibility prediction parameter of the second preset access target with the pre-set second target threshold to obtain a comparison result, so as to adjust the current hit rate prediction parameters of the second preset access target based on the comparison result.
[0162] If the second preset access target satisfies the second matching condition, and the current credibility prediction parameter of the second preset access target is greater than or equal to the preset second target threshold, it indicates that the current credibility prediction parameter corresponding to the second preset access target has met the requirement. At this time, the update of the hit rate prediction parameter of the second preset access target can be: select the larger value from the historical hit rate parameter of the second access target and the current hit rate prediction parameter of the second preset access target as the updated hit rate prediction parameter of the second preset access target, that is: if the historical hit rate parameter of the second access target is greater than the current hit rate prediction parameter of the second preset access target, then the current hit rate prediction parameter of the second preset access target is updated to the historical hit rate parameter of the second access target; if the historical hit rate parameter of the second access target is less than the current hit rate prediction parameter of the second preset access target, then the value of the current hit rate prediction parameter of the second preset access target remains unchanged and still maintains its original value;
[0163] If the second preset access target satisfies the second matching condition, but the current credibility prediction parameter of the second preset access target is less than the preset second target threshold, it indicates that the credibility of the current credibility prediction parameter corresponding to the second preset access target does not meet the requirement. At this time, the update of the hit rate prediction parameter of the second preset access target can be: directly reducing the value of the current hit rate prediction parameter of the second preset access target, such as: subtracting 1 from the value of the current hit rate prediction parameter of the second preset access target, as the updated current hit rate prediction parameter of the second preset access target, so as to ensure the accuracy of the data recorded in the historical record set.
[0164] The cache data processing method disclosed in this embodiment obtains a first access request; in response to the data corresponding to the first access target in the first access request being hit, queries a historical record set, the historical record set at least including: a number of preset access targets, and a number of access parameters corresponding to the preset access targets respectively; in response to the first access target and the first preset access target in the historical record set satisfying a first matching condition, determines that the predicted access parameter corresponding to the first preset access target is the first predicted access parameter of the first access target; based on the first predicted access parameter, adjusts the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of the data corresponding to the first access target being replaced; updates the historical record set, so that when the data corresponding to the first access target in the first access request is hit, the updated historical record set can be queried. This solution can update the historical data set based on demand, so that when the data corresponding to the first access target in the first access request is hit and the historical record set needs to be queried, the updated historical record set can be queried, so that the first parameter finally obtained is more accurate.
[0165] Furthermore, since the record set includes at least: a number of preset access targets, and a number of predicted access parameters corresponding to the preset access targets, wherein the preset access targets may include: a number of high-order preset access sub-targets, and each high-order preset access sub-target includes a number of low-order preset access sub-targets, wherein each high-order preset access sub-target and each low-order preset access sub-target respectively correspond to their own preset access parameters. That is, although each high-order preset access sub-target includes a number of low-order preset access sub-targets, both the high-order preset access sub-target and its corresponding low-order preset access sub-target each have their own corresponding preset access parameters, and the preset access parameters corresponding to the high-order preset access sub-target will not affect the preset access parameters corresponding to the low-order preset access sub-target, and accordingly, the preset access parameters corresponding to the low-order preset access sub-target will not affect the preset access parameters corresponding to the high-order preset access sub-target.
[0166] In response to the second access target and a second preset access target among the plurality of preset access targets in the historical record set satisfying a second matching condition, updating the predicted access parameter corresponding to the second preset access target according to the second historical access parameter of the second access target includes:
[0167] In response to the second access target matching the second highest preset access sub-target in the historical record set, and matching the second low preset access sub-target corresponding to the second highest preset access sub-target, the predicted access parameters of the second highest preset access sub-target and the second low preset access sub-target are updated respectively; in response to the second access target matching the second highest preset access sub-target in the historical record set, and not matching the second low preset access sub-target corresponding to the second high preset access sub-target, only the predicted access parameters of the second highest preset access sub-target are updated.
[0168] Since the historical record set consists of a high-order preset access sub-target and a low-order preset access sub-target, and the high-order preset access sub-target and the low-order preset access sub-target are in a relationship of inclusion and being included, when determining whether the second access target and the preset access target in the historical record set satisfy the second matching condition, it is possible to determine that the second access target satisfies both the low-order preset access sub-target and the high-order preset access sub-target in the historical record set, or it is possible to determine that the second access target only satisfies the second matching condition with the high-order preset access sub-target in the historical record set. Therefore, when updating the predicted access parameters, what is updated are the predicted access parameters of the preset access sub-target in the historical record set that satisfies the second matching condition with the second access target.
[0169] That is: if only a certain high-order preset access sub-target and the second access target meet the second matching condition, and any low-order preset access sub-target included under the high-order preset access sub-target and the second access target do not meet the second matching condition, then only the predicted access parameters corresponding to the high-order preset access sub-target are updated based on the access parameters of the second access target, and there is no need to update the predicted access parameters corresponding to any low-order preset access sub-target included under the high-order preset access sub-target;
[0170] If a high-order preset access sub-target satisfies the second matching condition with the second access target, and at the same time, a low-order preset access sub-target included under the high-order preset access sub-target also satisfies the second matching condition with the second access target, then it is necessary not only to update the predicted access parameters corresponding to the high-order preset access sub-target based on the access parameters of the second access target, but also to update the predicted access parameters corresponding to the low-order preset access sub-target included under the high-order preset access sub-target based on the access parameters of the second access target. However, there is no need to update the predicted access parameters corresponding to other low-order preset access sub-targets under the high-order preset access sub-target, so as to ensure that the update of data in the historical record set can meet the actual situation.
[0171] Further, if the second access target matches the second low-order preset access sub-target in the historical record set, then when updating the hit rate prediction parameter in the predicted access parameter of the second low-order preset access sub-target in the historical record set, the hit rate prediction parameter corresponding to the second low-order preset access sub-target in the historical record set can be directly updated based on the method disclosed in the above embodiment, that is, when the second low-order preset access sub-target meets the second matching condition and the current credibility prediction parameter of the second low-order preset access sub-target is greater than or equal to the preset second target threshold, the larger value is selected from the historical hit rate parameters of the second access target and the current hit rate prediction parameter of the second low-order preset access sub-target as the updated hit rate prediction parameter of the second low-order preset access sub-target; when the second low-order preset access sub-target meets the second matching condition and the current credibility prediction parameter of the second low-order preset access sub-target is less than the preset second target threshold, the value of the current hit rate prediction parameter of the second low-order preset access sub-target is directly reduced, such as: subtracting 1 from the value of the current hit rate prediction parameter of the second low-order preset access sub-target to serve as the updated hit rate prediction parameter of the second low-order preset access sub-target;
[0172] When the access target represents the address parameter, if the second access target matches the second highest preset access sub-target in the historical record set, then when updating the hit rate prediction parameter in the predicted access parameter of the second highest preset access sub-target in the historical record set, the hit rate prediction parameter cannot be updated in the above manner. Instead, it is necessary to select the smaller value from the historical hit rate parameter of the second access target and the current hit rate prediction parameter of the second low preset access sub-target as the updated hit rate prediction parameter of the second low preset access sub-target.
[0173] Specifically, when the access target represents the address parameters, the high-order address represents a larger address range, the low-order address represents a smaller address range, and the low-order address is a subset of the high-order address. Then, the high-order address itself is not a very precise address range, that is, the second high-order preset access sub-target itself is not a very precise address range, but a larger and broader range. Then, in this case, if the hit rate prediction parameters are still updated in accordance with the method of updating the hit rate prediction parameters of the low-order preset access sub-target, a larger value is selected from the historical hit rate parameters of the second access target and the current hit rate prediction parameters of the second high-order preset access sub-target as the updated hit rate prediction parameter of the second high-order preset access sub-target, there will be a problem of inaccurate hit rate prediction, such as: selecting a larger value of 6 as the second high-order preset access sub-target The target hit rate prediction parameter, however, there may be a low-order preset access sub-target with a hit rate prediction parameter of 5 or 4 in the subset corresponding to the second high-order preset access sub-target, and selecting 6 will result in a lot of data having reached the highest hit rate prediction parameter, but because the number of times it has been hit has not reached 6, it cannot be replaced, resulting in invalid occupation of resources in the cache. Therefore, when the second access target matches the second high-order preset access sub-target in the historical record set, the smaller value is selected from the historical hit rate parameters of the second access target and the current hit rate prediction parameters of the second low-order preset access sub-target as the updated hit rate prediction parameter of the second low-order preset access sub-target, so as to avoid the situation where the space in the cache is occupied by data that will no longer be hit, resulting in a waste of cache resources.
[0174] Specifically, the cache data processing method disclosed in this embodiment has a complete flow chart as shown in FIG. Figure 7 As shown, including:
[0175] Obtain access requests;
[0176] Whether the data in the cache is hit;
[0177] If hit, determine whether the low-order preset access sub-target is hit, such as: Laddr;
[0178] If so, compare the first hit rate parameter HF with the first hit rate prediction parameter HF', and the first credibility prediction parameter CF with the target threshold;
[0179] If HF is less than HF' and CF is greater than the target threshold, the first parameter RRPV is set to the first target value, such as 0;
[0180] If HF is greater than or equal to HF', or CF is less than the target threshold, RRPV is set to the second target value, such as 3;
[0181] If the low-order preset access sub-target is not hit, determine whether the high-order preset access sub-target is hit, such as Haddr;
[0182] If so, compare the first hit rate parameter HF with the first hit rate prediction parameter HF', and the first credibility prediction parameter CF with the target threshold;
[0183] If HF is less than HF' and CF is greater than the target threshold, the first parameter RRPV is set to the first target value, such as 0;
[0184] If HF is greater than or equal to HF', or CF is less than the target threshold, adjust the RRPV value, such as: RRPV = 3, or reduce RRPV by 1;
[0185] If the data in the cache is not hit, determine whether the historical record set is hit;
[0186] Determine whether the high preset access sub-target in the history record set is hit, such as Haddr;
[0187] If not, record the new preset access target in the history table;
[0188] If yes, determine whether the low-order preset access sub-target in the history record set is hit, such as: Laddr;
[0189] If not, update the predicted access parameters of the high-order preset access sub-goal in the history record set;
[0190] If so, update the predicted access parameters of the high-order preset access sub-goal and the low-order preset access sub-goal in the historical record set.
[0191] This embodiment discloses a cache data processing device, and its structural diagram is shown in FIG. Figure 8 As shown, including:
[0192] A first obtaining unit 81 , a second obtaining unit 82 and an adjusting unit 83 .
[0193] Wherein, the first obtaining unit 81 is used to obtain a first access request;
[0194] The second obtaining unit 82 is used for obtaining a first predicted access parameter of the first access target in response to the data corresponding to the first access target being hit in the first access request, wherein the first predicted access parameter is related to the number of historical hits of the first access target and can represent the maximum number of consecutive hits of the predicted first access target;
[0195] The adjustment unit 83 is used to adjust the first parameter of the first access target based on the first predicted access parameter so that the first parameter can change with the number of times the data corresponding to the first access target has been hit, and the first parameter is related to the probability of the data corresponding to the first access target being replaced.
[0196] Further, the second obtaining unit is used to: obtain the first predicted access parameter according to the historical access parameter of the historical data corresponding to the first access target before being deleted;
[0197] The adjustment unit is used to adjust a first parameter corresponding to a first access target according to a first access parameter of a first access request and a first predicted access parameter.
[0198] Furthermore, the second obtaining unit is used for:
[0199] Query a historical record set, the historical record set includes at least: a number of preset access targets, and a number of predicted access parameters corresponding to the preset access targets respectively; in response to a first access target and a first preset access target in the historical record set satisfying a first matching condition, determine the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target.
[0200] Further, the first predicted access parameter includes a first hit rate prediction parameter and a first credibility prediction parameter, and the first access parameter of the first access request includes a first hit rate parameter; and the adjustment unit is used to:
[0201] In response to the first hit rate parameter being less than the first hit rate prediction parameter and the first credibility prediction parameter being greater than the first target threshold, the first parameter of the first access target is adjusted to the first target value to reduce the probability that the data corresponding to the first access target is replaced; in response to the first hit rate parameter being greater than or equal to the first hit rate prediction parameter, or the first credibility prediction parameter being less than the first target threshold, the first parameter of the first access target is adjusted to the second target value to increase the probability that the data corresponding to the first access target is replaced.
[0202] Further, the plurality of preset access targets include a plurality of high-order preset access sub-targets, each of which corresponds to a plurality of low-order preset access sub-targets, and each of the high-order preset access sub-targets and each of the low-order preset access sub-targets corresponds to respective preset access parameters;
[0203] The second acquisition unit is used to:
[0204] If the first access target matches the first low-order preset access sub-target in the historical record set, the preset access parameter corresponding to the first low-order preset access sub-target is determined to be the first predicted access parameter of the first access target; or, if the first access target does not match any low-order preset access sub-target in the historical record set, but matches the first high-order preset access sub-target, the predicted access parameter corresponding to the first high-order preset access sub-target is determined to be the first predicted access parameter of the first access target.
[0205] Furthermore, the first access target is characterized by: an address parameter of a storage address of the data in the cache in the cache, and / or a data type parameter of the data in the cache.
[0206] Furthermore, the cache data processing device disclosed in this embodiment also includes:
[0207] An update unit, used to update the history record set;
[0208] The update unit is used to:
[0209] A second access request is obtained, the current data of the second access target of the second access request is not hit, and the second historical access parameter of the second access target satisfies the update condition; in response to the second access target and a second preset access target among the several preset access targets in the historical record set satisfying the second matching condition, the predicted access parameters corresponding to the second preset access target are updated according to the second historical access parameters of the second access target; in response to the second access target and several preset access targets in the historical record set not satisfying the second matching condition, the second access target is recorded as a new preset access target in the historical record set, and the predicted access parameters corresponding to the new preset access target are updated according to the second historical access parameters of the second access target.
[0210] Further, the predicted access parameter includes a hit rate prediction parameter and a credibility prediction parameter, and the second historical access parameter includes a historical hit rate parameter of historical data of the second access target;
[0211] The update unit is used to:
[0212] The historical hit rate parameter of the second access target is used to update the credibility prediction parameter and the hit rate prediction parameter corresponding to the second preset access target;
[0213] Among them, the update unit is used to:
[0214] In response to the historical hit rate parameter of the second access target being greater than or equal to the current hit rate prediction parameter of the second preset access target, increasing the value of the credibility prediction parameter of the second preset access target; in response to the historical hit rate parameter of the second access target being less than the current hit rate prediction parameter of the second preset access target, decreasing the value of the credibility prediction parameter of the second preset access target;
[0215] and / or,
[0216] In response to the current credibility prediction parameter of the second preset access target being greater than or equal to the second target threshold, the hit rate prediction parameter of the second preset access target is updated to the larger value of the historical hit rate parameter of the second access target and the current hit rate prediction parameter of the second preset access target; in response to the current credibility prediction parameter of the second preset access target being less than the second target threshold, the current hit rate prediction parameter of the second preset access target is reduced.
[0217] Further, the plurality of preset access targets include a plurality of high-order preset access sub-targets, each of which corresponds to a plurality of low-order preset access sub-targets, and each of the high-order preset access sub-targets and each of the low-order preset access sub-targets corresponds to respective preset access parameters;
[0218] The update unit is used to:
[0219] In response to the second access target matching the second highest preset access sub-target in the historical record set, and matching the second low preset access sub-target corresponding to the second highest preset access sub-target, the predicted access parameters of the second highest preset access sub-target and the second low preset access sub-target are updated respectively; in response to the second access target matching the second highest preset access sub-target in the historical record set, and not matching the second low preset access sub-target corresponding to the second high preset access sub-target, only the predicted access parameters of the second highest preset access sub-target are updated.
[0220] The cache data updating device disclosed in this embodiment is implemented based on the cache data updating method disclosed in the above embodiment, which will not be described in detail here.
[0221] The cache data processing device disclosed in this embodiment obtains a first access request; in response to the data corresponding to the first access target in the first access request being hit, obtains a first predicted access parameter of the first access target; based on the first predicted access parameter, adjusts the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of the data corresponding to the first access target being replaced. In this scheme, when determining that the data corresponding to the first access target in the first access request is hit, the first predicted access parameter of the first access target needs to be obtained, and the first parameter of the first access target is adjusted based on the first predicted access parameter, so as to adjust the data related to the probability of the data corresponding to the first access target being replaced based on the data related to the number of historical hits of the first access target. By adjusting the probability of data being replaced, it is ensured that when the probability of data being replaced reaches a certain value, the data can be replaced, avoiding the situation that data that will not be hit again is still not replaced, and the data with low utilization rate but still likely to be hit again is replaced, so that when the data is hit, the corresponding data can be obtained in time, thereby improving the data processing efficiency.
[0222] Furthermore, this embodiment discloses an electronic device, the structural diagram of which is shown in FIG. Fig. 9 As shown, including:
[0223] Processor 91 and memory 92.
[0224] The processor 91 is used to obtain a first access request; in response to the data corresponding to the first access target in the first access request being hit, obtain a first predicted access parameter of the first access target, which can characterize the maximum number of times the predicted first access target is hit continuously; based on the first predicted access parameter, adjust the first parameter of the first access target so that the first parameter can change with the change of the number of times the data corresponding to the first access target has been hit, the first predicted access parameter is related to the number of times the first access target has been hit historically, and the first parameter is related to the probability that the data corresponding to the first access target is replaced;
[0225] The memory 92 is used to store the programs required by the processor to execute the above processing procedures.
[0226] The electronic device disclosed in this embodiment is implemented based on the cache data updating method disclosed in the above embodiment, which will not be described in detail here.
[0227] The electronic device disclosed in this embodiment obtains a first access request; in response to the data corresponding to the first access target in the first access request being hit, obtains a first predicted access parameter of the first access target; based on the first predicted access parameter, adjusts the first parameter of the first access target, the first predicted access parameter is related to the number of historical hits of the first access target, and the first parameter is related to the probability of the data corresponding to the first access target being replaced. In this scheme, when determining that the data corresponding to the first access target in the first access request is hit, the first predicted access parameter of the first access target needs to be obtained, and the first parameter of the first access target is adjusted based on the first predicted access parameter, so as to adjust the data related to the probability of the data corresponding to the first access target being replaced based on the data related to the number of historical hits of the first access target. By adjusting the probability of data being replaced, it is ensured that when the probability of data being replaced reaches a certain value, the data can be replaced, so as to avoid the situation that data that will not be hit again is still not replaced, and the utilization rate is low, but the data that may still be hit again is replaced, so that when the data is hit, the corresponding data can be obtained in time, and the data processing efficiency is improved.
[0228] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0229] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0230] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0231] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A cache data processing method, comprising: Get the first access request; In response to data corresponding to a first access target in the first access request being hit, obtaining a first predicted access parameter of the first access target, wherein the first predicted access parameter is related to the number of historical hits of the first access target and can represent a predicted maximum number of consecutive hits of the first access target; Based on the first predicted access parameter, adjusting a first parameter of the first access target so that the first parameter can change with the number of times the data corresponding to the first access target has been hit, the first parameter representing a probability that the data corresponding to the first access target is replaced; Among them, when the first access parameter corresponding to the first access request is less than the first hit rate prediction parameter in the first predicted access parameter, the first parameter corresponding to the first access target is adjusted to reduce the probability of the data corresponding to the first parameter being replaced; when the first access parameter corresponding to the first access request is equal to the first hit rate prediction parameter in the first predicted access parameter, the first parameter corresponding to the first access target is adjusted to increase the probability of the data corresponding to the first parameter being replaced.
2. The method according to claim 1, wherein obtaining the first predicted access parameter of the first access target comprises: Obtaining the first predicted access parameter according to the historical access parameter of the historical data corresponding to the first access target before being deleted; The adjusting the first parameter of the first access target based on the first predicted access parameter includes: According to the first access parameter of the first access request and the first predicted access parameter, a first parameter corresponding to the first access target is adjusted.
3. The method according to claim 1, wherein obtaining the first predicted access parameter of the first access target comprises: Querying a historical record set, the historical record set at least includes: a plurality of preset access targets, and a plurality of predicted access parameters respectively corresponding to the plurality of preset access targets; In response to the first access target and a first preset access target in the historical record set satisfying a first matching condition, a predicted access parameter corresponding to the first preset access target is determined as a first predicted access parameter of the first access target.
4. The method according to claim 3, wherein the first predicted access parameter comprises a first hit rate prediction parameter and a first credibility prediction parameter, and the first access parameter of the first access request comprises a first hit rate parameter; and adjusting the first parameter of the first access target based on the first predicted access parameter comprises: In response to the first hit rate parameter being less than the first hit rate prediction parameter and the first credibility prediction parameter being greater than a first target threshold, adjusting the first parameter of the first access target to a first target value to reduce the probability that the data corresponding to the first access target is replaced; In response to the first hit rate parameter being greater than or equal to the first hit rate prediction parameter, or the first credibility prediction parameter being less than the first target threshold, the first parameter of the first access target is adjusted to a second target value to increase the probability that the data corresponding to the first access target is replaced. 5 . The method according to claim 4 , wherein the first hit rate parameter represents a predicted maximum number of consecutive hits of data corresponding to the first access target.
6. The method according to claim 3, wherein the plurality of preset access targets include a plurality of high-order preset access sub-targets, each of which corresponds to a plurality of low-order preset access sub-targets, and each of which corresponds to its own preset access parameter. The first access target and a first preset access target in the historical record set meet a first matching condition, and determining the predicted access parameter corresponding to the first preset access target as the first predicted access parameter of the first access target includes: If the first access target matches a first low-order preset access sub-target in the historical record set, determining that a preset access parameter corresponding to the first low-order preset access sub-target is the first predicted access parameter of the first access target; Alternatively, if the first access target does not match any low-order preset access sub-target in the historical record set, but matches the first high-order preset access sub-target, the predicted access parameter corresponding to the first high-order preset access sub-target is determined to be the first predicted access parameter of the first access target.
7. The method according to claim 3, wherein the first access target represents: an address parameter of a storage address of the data in the cache in the cache, and / or a data type parameter of the data in the cache.
8. The method according to claim 3, further comprising: updating the history record set; The updating of the historical record set includes: Obtaining a second access request, wherein current data of a second access target of the second access request is not hit, and a second historical access parameter of the second access target satisfies an update condition; In response to the second access target and a second preset access target among the plurality of preset access targets in the historical record set satisfying a second matching condition, updating a predicted access parameter corresponding to the second preset access target according to a second historical access parameter of the second access target; In response to the second access target and the several preset access targets in the historical record set not satisfying the second matching condition, the second access target is recorded as a new preset access target in the historical record set, and the predicted access parameters corresponding to the new preset access target are updated according to the second historical access parameters of the second access target.
9. The method according to claim 8, wherein the predicted access parameter comprises a hit rate prediction parameter and a credibility prediction parameter, and the second historical access parameter comprises a historical hit rate parameter of historical data of the second access target; The updating, according to the second historical access parameter of the second access target, of the predicted access parameter corresponding to the second preset access target includes: The historical hit rate parameter of the second access target is used to update the credibility prediction parameter and the hit rate prediction parameter corresponding to the second preset access target; Wherein, updating the credibility prediction parameter includes: In response to the historical hit rate parameter of the second access target being greater than or equal to the current hit rate prediction parameter of the second preset access target, increasing the value of the credibility prediction parameter of the second preset access target; In response to the historical hit rate parameter of the second access target being less than the current hit rate prediction parameter of the second preset access target, reducing the value of the credibility prediction parameter of the second preset access target; And / or, updating the hit rate prediction parameter, including: In response to the current credibility prediction parameter of the second preset access target being greater than or equal to a second target threshold, updating the hit rate prediction parameter of the second preset access target to a larger value between the value of the historical hit rate parameter of the second access target and the value of the current hit rate prediction parameter of the second preset access target; In response to the value of the current credibility prediction parameter of the second preset access target being less than a second target threshold, the value of the current hit rate prediction parameter of the second preset access target is reduced.
10. The method according to claim 9, wherein the plurality of preset access targets include a plurality of high-order preset access sub-targets, each high-order preset access sub-target corresponds to a plurality of low-order preset access sub-targets, and each high-order preset access sub-target and each low-order preset access sub-target respectively correspond to respective preset access parameters; In response to the second access target and a second preset access target among the plurality of preset access targets in the historical record set satisfying a second matching condition, updating the predicted access parameter corresponding to the second preset access target according to the second historical access parameter of the second access target, comprises: In response to the second access target matching the second high-order preset access subtarget in the historical record set and matching the second low-order preset access subtarget corresponding to the second high-order preset access subtarget, respectively updating the predicted access parameters of the second high-order preset access subtarget and the second low-order preset access subtarget; In response to the second access target matching the second high-order preset access sub-target in the history record set and not matching the second low-order preset access sub-target corresponding to the second high-order preset access sub-target, only the predicted access parameters of the second high-order preset access sub-target are updated.
11. A cache data processing device, comprising: A first obtaining unit, configured to obtain a first access request; a second obtaining unit, configured to obtain, in response to a hit on data corresponding to a first access target in the first access request, a first predicted access parameter of the first access target, wherein the first predicted access parameter is related to a historical hit count of the first access target and can represent a predicted maximum number of consecutive hits of the first access target; an adjusting unit, configured to adjust a first parameter of the first access target based on the first predicted access parameter, so that the first parameter can change with the change of the number of times the data corresponding to the first access target has been hit, the first parameter representing the probability that the data corresponding to the first access target is replaced; Among them, when the first access parameter corresponding to the first access request is less than the first hit rate prediction parameter in the first predicted access parameter, the first parameter corresponding to the first access target is adjusted to reduce the probability of the data corresponding to the first parameter being replaced; when the first access parameter corresponding to the first access request is equal to the first hit rate prediction parameter in the first predicted access parameter, the first parameter corresponding to the first access target is adjusted to increase the probability of the data corresponding to the first parameter being replaced.
Citation Information
Patent Citations
Data access method and device, electronic equipment and computer readable storage medium
CN116708579A