CN116112563A - Dual-strategy self-adaptive cache replacement method based on popularity prediction - Google Patents
Dual-strategy self-adaptive cache replacement method based on popularity prediction Download PDFInfo
- Publication number
- CN116112563A CN116112563A CN202310091155.XA CN202310091155A CN116112563A CN 116112563 A CN116112563 A CN 116112563A CN 202310091155 A CN202310091155 A CN 202310091155A CN 116112563 A CN116112563 A CN 116112563A
- Authority
- CN
- China
- Prior art keywords
- popularity
- model
- cache
- time slot
- prediction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a dual-strategy self-adaptive cache replacement method based on popularity prediction, which comprises the following steps: collecting device request data; counting content popularity by taking a time slot as a unit and constructing a model data set; and constructing a content popularity prediction model based on a sequence model Seq2Seq, performing model training, and respectively storing the structure and weight of the trained popularity prediction model into a file. Aiming at the scene of industrial edge node caching, the dual-strategy self-adaptive cache replacement method based on popularity prediction, aiming at the characteristic of data popularity change along with time, the heat trend and the tide law of the data are mined, and the dual-strategy self-adaptive cache replacement algorithm based on the Seq2Seq and the method are provided by combining the traditional cache replacement algorithm and the deep learning method. When the prediction model encounters a request sequence without access popularity, the self-adaption of the method successfully improves the cache hit rate of the system, reduces network delay and ensures the real-time service performance of the industrial edge network.
Description
Technical Field
The invention relates to the technical field of data caching, in particular to a dual-strategy self-adaptive cache replacement method based on popularity prediction.
Background
The industrial Internet is used as an infrastructure for intelligent manufacturing, is a basic network for linking materials, machines, information systems and people, and is a basic guarantee for realizing intelligent manufacturing by constructing low-delay, high-reliability and wide-coverage industrial Internet.
Traditional cloud computing is to collect data through industrial field devices, send the data to a cloud, and transmit decision instructions to execution devices after the cloud is computed. With the transformation and upgrading of manufacturing industry, the number of manufacturing equipment is rapidly expanded, the new manufacturing mode has strict requirements on network time delay, but the data generated by equipment in an industrial field every day is large in scale, and the mass data are stored in a cloud server, so that if a cloud-based data service is adopted, the delay of data transmission is very large, and therefore, the problems cannot be effectively solved by the traditional centralized information processing and management mode. Therefore, the application of edge computing to industrial Internet of things has great advantages. The edge computing deploys the server equipment at the edge close to the user, and provides low-delay data transmission service for the user request by utilizing the storage and computing resources of the edge computing equipment, so that guarantee is provided for real-time task processing.
However, the storage capacity of the edge node is typically very limited, and it is not possible to cache all content at the edge node. Therefore, the cache content set is determined through a reasonable cache policy, the cache utilization rate is maximized, the number of content requests to the cloud server is reduced, and the method is very important for the service performance guarantee of the edge network.
Disclosure of Invention
This section is intended to outline some aspects of embodiments of the invention and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section as well as in the description summary and in the title of the application, to avoid obscuring the purpose of this section, the description summary and the title of the invention, which should not be used to limit the scope of the invention.
The present invention has been made in view of the above-described problems.
Therefore, the technical problems solved by the invention are as follows: the existing industrial Internet of things edge computing method has the problems that the capacity of an edge node is limited, all contents cannot be cached, and how to determine a cached content set through a reasonable caching strategy, so that the cache utilization rate is maximized, and the optimization problem of the number of times of requesting the content to a cloud server is reduced.
In order to solve the technical problems, the invention provides the following technical scheme: a dual-strategy self-adaptive cache replacement method based on popularity prediction comprises the following steps:
collecting device request data;
counting content popularity by taking a time slot as a unit and constructing a model data set;
and constructing a content popularity prediction model based on a sequence model Seq2Seq, performing model training, and respectively storing the structure and weight of the trained popularity prediction model into a file.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the collecting device request data comprises collecting device request information of each edge node in the edge network and time stamps of the request content, and sequencing according to the time stamps to construct a request sequence.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the counting content popularity in time slot units and constructing a model data set further comprises:
processing the request sequence in units of time slots;
the popularity vectors of a plurality of continuous historical time slots are used as a source sequence of the sequence to sequence model Seq2Seq input, the popularity vectors of a plurality of time slots in the future are used as a target sequence of the Seq2Seq model, the input part and the output part are combined, a data list is created, and the data list is divided into a training set, a verification set and a test set.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the building of the content popularity prediction model based on the Seq2Seq, the model training and the saving of the structure and the weight of the trained popularity prediction model into the file respectively further comprise: constructing a content popularity prediction model based on a Seq2Seq, inputting the training set and the verification set into the prediction model, calculating an error between an output sequence and a target sequence of a neural network, updating a weight of the neural network through back propagation, finally enabling the network to fit an optimal result, and respectively storing the structure and the weight of the trained popularity prediction model into a file; the prediction model is a popularity prediction model based on the Seq2Seq, teacherforce is started to accelerate model convergence, and an attribute mechanism is added to improve prediction accuracy.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the time slot is a continuous object request in the request sequence, the time slot length L is the number of object requests in the time slot, and x is defined w =(P 1,w ,P 2,w ,…,P D,w ) For the access probability vector of all unique objects in the time slot w, i.e. the popularity vector of the time slot, C d,w Representing the number of accesses (w is addressed from 0) of object d in the w-th time slot, and the probability P of accesses of object d in the w-th time slot d,w The method comprises the following steps:
wherein the type of the unique resource object is D, L is constant, and the statistical width of popularity calculation is reflected.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: when constructing the data set required by the model, the popularity vectors of the first M time slots including the time slot w are input as a popularity prediction model, namely:
X w ={x w-M+1 ,x w-M+2 ,…,x w }
and Y is w ={y s ,y m ,y l Output of popularity prediction model, where y s ,y m ,y l Respectively, short-term (s=w+1), medium-term (m=w+2) and long-term time slots (l=w+6) after the time slot w) The popularity vectors of all objects in the model target sequence Y are formed by the 3 vectors w The method comprises the steps of carrying out a first treatment on the surface of the Thus, the input and output of the model can be considered as a three-dimensional tensor, with dimensions (#sample, M, D) and (#sample, 3, D), respectively, where #sample is the number of samples; in constructing the input sequence X of the predictive model w When the sliding window is used for extracting more object access sequences, a group of sample data is generated by sliding the window each time from the beginning to the end of the sequences, and the collection of the data of all groups forms a final training data set;
wherein M is a constant and represents the number of selected historical time slots.
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the processing of the access sequence in time slot units is divided into three phases:
the first stage: entering a time slot w; at this point the time slot w-1 has ended and the algorithm uses the input sequence X formed by popularity vectors in the first M time slots including time slot w-1 w-1 And predicting and obtaining future popularity Y w-1 ;
And a second stage: in the time slot w; the second phase will process each access request: if the data to be accessed is already in the cache, the request is directly responded and is referred to as the first cache; if the cache is not full, responding to the request after applying for obtaining the data from the server, and caching the data to the tail of the cache queue; if the cache is full, adopting a corresponding cache replacement method according to the current strategy algo; if algo is LRU, LRU is adopted for replacement; whereas if algo is a simulated OPT, the future popularity vector Y predicted in the first stage is required w-1 Forming future comprehensive popularity; the specific mode is as follows:
the popularity vector predicted by the prediction model is popularity of different periods in the future, but one or more popularity vectors are not directly utilized in the algorithm, and the popularity vectors of different periods are weighted and calculated to obtain a final comprehensive popularity vector Fp= (Fp) 1 ,Fp 2 ,…,Fp D ),The calculation process is as follows, wherein the weight W s ,W m ,W l Respectively representing short, medium and long weight factors;
Fp=W s ×y s +W m ×y m +W l ×y l
when the cache is full and algo is a simulated OPT, comparing and finding out the object with the lowest popularity in the cache through Fp to perform replacement operation, wherein the data structure stores the cache object and popularity thereof by adopting a set map;
in the second stage, the actual cache replacement strategy depends on algo, but the cache replacement of another strategy is simulated at the same time, so as to obtain the cache hit rate of the other strategy;
and a third stage: at the end of the time slot w; in the third stage, the cache hit rates under the two strategies are compared, and the cache replacement strategy algo of the time slot w+1 is determined according to the following formula
As a preferable scheme of the popularity prediction-based dual-strategy self-adaptive cache replacement method, the invention comprises the following steps: the dual-strategy self-adaptive cache replacement method based on popularity prediction further comprises an online decision stage: replacing the cache content according to a prediction result by using a trained popularity prediction model, removing the file predicting the lowest access probability in a future period, and combining with a responsive cache replacement algorithm LRU; when a new request arrives, the algorithm can adaptively select whether cache replacement is performed by utilizing popularity prediction or by adopting an LRU (least recently used) mode, so that the edge cache node is updated.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method as described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor realizes the steps of the method as described above.
The invention has the beneficial effects that: aiming at the scene of industrial edge node caching, the dual-strategy self-adaptive cache replacement method based on popularity prediction, aiming at the characteristic of data popularity change along with time, the heat trend and the tide law of the data are mined, and the dual-strategy self-adaptive cache replacement algorithm based on the Seq2Seq and the method are provided by combining the traditional cache replacement algorithm and the deep learning method. When the prediction model encounters a request sequence without access popularity, the self-adaption of the method successfully improves the cache hit rate of the system, reduces network delay and ensures the real-time service performance of the industrial edge network.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
FIG. 1 is a general flow chart of a dual-strategy adaptive cache replacement method based on popularity prediction according to a first embodiment of the present invention;
FIG. 2 is a flowchart of an online cache decision of a dual-policy adaptive cache replacement method based on popularity prediction according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of an exemplary industrial edge network cache scenario of a dual-policy adaptive cache replacement method based on popularity prediction according to a second embodiment of the present invention;
fig. 4 is an internal structural diagram of a computer device in a computer device of a vision-based unmanned aerial vehicle distributed photovoltaic power station inspection method according to a first embodiment of the present invention;
FIG. 5 is a graph showing average hit rate of each algorithm under different cache capacities according to a dual-strategy adaptive cache replacement method based on popularity prediction according to a second embodiment of the present invention;
fig. 6 is a graph showing average time delay contrast of algorithms under different cache capacities according to a dual-strategy adaptive cache replacement method based on popularity prediction according to a second embodiment of the present invention.
Detailed Description
So that the manner in which the above recited objects, features and advantages of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to the embodiments, some of which are illustrated in the appended drawings. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present invention is not limited to the specific embodiments disclosed below.
Further, reference herein to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic can be included in at least one implementation of the invention. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments.
While the embodiments of the present invention have been illustrated and described in detail in the drawings, the cross-sectional view of the device structure is not to scale in the general sense for ease of illustration, and the drawings are merely exemplary and should not be construed as limiting the scope of the invention. In addition, the three-dimensional dimensions of length, width and depth should be included in actual fabrication.
Also in the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper, lower, inner and outer", etc. are based on the orientation or positional relationship shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the apparatus or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first, second, or third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
The terms "mounted, connected, and coupled" should be construed broadly in this disclosure unless otherwise specifically indicated and defined, such as: can be fixed connection, detachable connection or integral connection; it may also be a mechanical connection, an electrical connection, or a direct connection, or may be indirectly connected through an intermediate medium, or may be a communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
Example 1
Referring to fig. 1-4, for one embodiment of the present invention, a dual-policy adaptive cache replacement method based on popularity prediction is provided, including:
s1: collecting device request data;
further, collecting equipment request information of one edge node in the edge network and a time stamp of the request content, and sequencing according to the time stamp to construct a request sequence;
further, assume that R t ={r 1 ,r 2 ,…,r t The sequence of object requests up to the t-th time step. To predict popularity of objects we define x w =(P 1,w ,P 2,w ,…,P D,w ) The probability vectors of access for all unique objects within the time slot w, i.e. the popularity vectors of all objects. Here, a time slot is defined as a period of consecutive object requests in the sequence of object requests, and the time slot length is the number of object requests in the time slot. Let us set the time slot length as L and the number of unique resource objects as D. C (C) d,w Representing the number of accesses (w is addressed from 0) of object d in the w-th time slot, and the probability P of accesses of object d in the w-th time slot d,w The method comprises the following steps:
s2: counting content popularity by taking a time slot as a unit and constructing a model data set;
further, processing the request sequence in units of time slots;
the popularity vectors of a plurality of continuous historical time slots are used as a source sequence of the sequence to sequence model Seq2Seq input, the popularity vectors of a plurality of time slots in the future are used as a target sequence of the Seq2Seq model, the input part and the output part are combined, a data list is created, and the data list is divided into a training set, a verification set and a test set.
Further, to predict popularity vectors in the w+1th time slot, we input the first M time slot popularity vectors including the time slot w as popularity prediction models, namely:
X w ={x w-M+1 ,x w-M+2 ,…,x w }
Y w ={y s ,y m ,y l output of popularity prediction model, where y s ,y m ,y l Represented are the popularity vectors of each object within the short-term (s=w+1), medium-term (m=w+2) and long-term time slots (l=w+6) after the time slot w, respectively, which 3 vectors together constitute the model target sequence Y w 。
Thus, our inputs and outputs can be considered as a three-dimensional tensor, with dimensions (#sample, M, D) and (#sample, 3, D), respectively, where #sample is the number of samples.
In constructing the input sequence X of the predictive model w When a sliding window is used to extract more object access sequences. The size SL of the sliding window is set to the input length of the prediction model, i.e. the length of M time slots, with a step size S. Assuming a time slot length l=100, m=6, a sliding window length sl=600, and when the current time slot w=6, the sliding window length is defined by x 1 ,x 2 ,...,x 6 The access probability vectors of all unique objects in these 6 time slots form the input sequence X of the model 6 And x is 7 ,x 9 ,x 12 The 3 vectors correspond to the popularity vectors of each object in the short-, medium-and long-term time slots respectively, i.e. the input sample X 6 ={x 1 ,x 2 ,...,x 6 Target sequence Y of } 6 ={x 7 ,x 9 ,x 12 }. If the sliding step s=100, the next set of input samples X 7 ={x 2 ,x 3 ,...,x 7 },Y 7 ={x 8 ,x 10 ,x 13 }。
From the beginning to the end of the sequence, each sliding of the window generates a set of sample data, the set of data of all sets constituting the final training data set. Such that each set of training sets contains the dependencies of the context in the sequence.
S3: constructing a content popularity prediction model based on a sequence model Seq2Seq, performing model training, and respectively storing the structure and weight of the trained popularity prediction model into a file;
further constructing a content popularity prediction model based on a Seq2Seq, inputting the training set and the verification set into the prediction model, calculating an error between an output sequence and a target sequence of the neural network, updating a weight of the neural network through back propagation, finally enabling the network to fit an optimal result, and respectively storing the structure and the weight of the trained popularity prediction model into a file;
it should be noted that, the prediction model is a popularity prediction model based on Seq2Seq, wherein Encoder, decoder selects a GRU capable of retaining long-term learning and memory as a basic neural network, and simultaneously enables Teachersorce to accelerate model convergence, and adds an attribute mechanism to improve prediction accuracy.
Furthermore, on the basis of a trained prediction model, the algorithm processes the access sequence by taking a time slot as a unit, and the method mainly comprises three stages:
the first Phase (Phase 1) is: entering the time slot w. At this point the time slot w-1 has ended and the algorithm uses the input formed by the popularity vectors in the first M time slots including time slot w-1Into sequence X w-1 And predicting and obtaining future popularity Y w-1 。;
The second Phase (Phase 2) is: within the time slot w. This stage will process each access request: if the data to be accessed is already in the cache, the request is directly responded and is referred to as the first cache; and if the cache is not full, responding to the request after applying for acquiring the data from the server, and caching the data to the tail of the cache queue. If the cache is full, adopting a corresponding cache replacement method according to the current strategy algo; if algo is LRU, LRU is adopted for replacement; whereas if algo is a simulated OPT, the future popularity vector Y predicted in the first stage is required w-1 Forming future comprehensive popularity; the specific mode is as follows:
the popularity vector predicted by the prediction model is popularity of different periods in the future, but one or more popularity vectors are not directly utilized in the algorithm, and the popularity vectors of different periods are weighted and calculated to obtain a final comprehensive popularity vector Fp= (Fp) 1 ,Fp 2 ,…,Fp D ) The calculation process is as follows, wherein the weight W s ,W m ,W l Respectively represent the weight factors of short, medium and long periods.
Fp=W s ×y s +W m ×y m +W l ×y l
When the cache is full and algo is a simulated OPT, comparing and finding out the object with the lowest popularity in the cache through Fp to perform replacement operation, wherein the data structure stores the cache object and popularity thereof by adopting a set map;
in this stage, the actual cache replacement policy depends on algo, but at the same time, the cache replacement of another policy is simulated to obtain the cache hit rate of the other policy;
the third Phase (Phase 3) is: at the end of the time slot w. This stage compares the cache hit rates under the two strategies and determines the cache replacement strategy algo for time slot w+1 as follows.
Since the data of the first M time slots need to be used for predicting the future popularity, the first M time slots in the system start-up stage cannot be replaced by popularity prediction, and the stage is called a preheating stage; since the warm-up phase is extremely short, there is little impact on the overall hit rate, a simple replacement algorithm (e.g., LRU) may be employed to temporarily complete the replacement decision for the warm-up phase.
The algorithm performs the cache replacement of the simulated OPT according to the predicted future comprehensive content popularity, also considers the time relevance of information and the self-adaptability of the algorithm in the prediction process, further improves the cache hit rate of the system by combining with the responsive cache replacement algorithm, and reduces the transmission delay of the edge network.
The computer device may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data cluster data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a dual-policy adaptive cache replacement method based on popularity prediction.
Example 2
5-6, for one embodiment of the present invention, a dual-policy adaptive cache replacement method based on popularity prediction is provided, and in order to verify the beneficial effects of the present invention, the technical effects adopted in the method are scientifically demonstrated through a verification test.
In this embodiment, a conventional Cache replacement algorithm (LRU, LFU, FIFO, OPT) and a Deep Cache algorithm which also adopts a Deep learning algorithm are compared with the dual-strategy adaptive Cache replacement algorithm based on popularity prediction proposed herein.
The data portion is obtained by simulation from an independent reference model (independent reference model, IRM). The IRM model is a static model, assuming that the popularity of content requests does not change over time, the user requests follow the Zipf distribution. This model simplifies the complexity of the caching problem, but does not reflect the temporal locality characteristics of each object's popularity. The combined IRM model, i.e. the combination of IRM models under multiple segments of different parameters, is used herein. Since the popularity of objects accessed by a production task varies once at intervals, but the individual object popularity ranks remain substantially unchanged within each interval, the Zipf distribution can be used to approximate the popularity distribution of all objects within each interval. Therefore, the IRM combined model can simulate the application scene of the change rule of the industrial task.
In addition, SNM (shot noise traffic model) is employed herein as a user request data simulation model. In contrast to the IRM model, which describes a process of content request, the object request process can be represented as a superposition of many independent processes, each referencing a separate content. Therefore, the SNM can also simulate an application scenario where multiple industrial tasks are superimposed.
Setting experimental parameters: the data sets are combined IRM data set and SNM data set, the prediction model training round number epoch=500, the learning rate lr=0.001, the time slot length l=100, m=6, the file type fn=100, the sliding window length sl=600, and the sliding step s=100. The buffer capacity is 5, 10, 15, 20 and 25MB respectively, the single file size is 1MB, and the total access sequence length is 60000 times.
First, the performance of a single-strategy 'simulated OPT' replacement algorithm and a dual-strategy adaptive cache replacement algorithm under the combination of an IRM model dataset and an SNM dataset are compared. In the unknown popularity access sequence experiment of table 2, the unknown popularity access sequence is added to the combined IRM model dataset as a comparison, specifically, the last 1 segment in the combined IRM test sequence is replaced by a popularity access sequence which never appears in the training set, namely, the 1 segment adopts an access sequence generated by a zipf parameter beta different from the training set. The aim of the experiment is to explore whether a prediction model combined with an LRU algorithm has an effect of improving the overall performance when popularity changes, namely when the performance of the prediction model is worse than that of LRU, the cache hit rate can be improved by adopting an LRU strategy.
TABLE 1 cache hit ratio comparison for unknown popularity free access sequences
Data set | OPT | LRU | Simulating only OPT | DPAPP |
IRM1 | 0.705 | 0.497 | 0.580 | 0.631 |
IRM2 | 0.501 | 0.209 | 0.272 | 0.298 |
IRM3 | 0.869 | 0.771 | 0.764 | 0.823 |
SNM1 | 0.456 | 0.102 | 0.326 | 0.371 |
SNM2 | 0.507 | 0.213 | 0.373 | 0.435 |
SNM3 | 0.474 | 0.114 | 0.291 | 0.397 |
TABLE 2 cache hit ratio comparison with unknown popularity access sequences
Data set | OPT | LRU | Simulation onlyOPT | DPAPP |
IRM1 | 0.565 | 0.295 | 0.371 | 0.430 |
IRM2 | 0.560 | 0.306 | 0.337 | 0.362 |
IRM3 | 0.809 | 0.675 | 0.724 | 0.733 |
The experimental results in tables 1 and 2 show that after the reactive cache replacement algorithm LRU is added as a dual strategy, the performance of the algorithm under each data set is higher than that of the single strategy 'simulated OPT'. Especially in the SNM dataset of table 1, the performance of the algorithm is more pronounced than the "simulated OPT" improvement in the environment of the multitasking stack. The algorithm will also exhibit higher performance with the unknown popularity access sequences of table 2.
The performance of the dual-policy adaptive cache replacement algorithm and each conventional cache replacement algorithm (LRU, LFU, FIFO, OPT) and the deep cache algorithm, which also employs the deep learning algorithm, are then compared under the combination of the IRM model dataset and the SNM dataset. The average was taken from multiple experiments.
The experimental results are shown in fig. 4-5, and the results show that compared with LRU, LFU, FIFO, deepCache algorithm, the dual-strategy self-adaptive cache replacement algorithm based on popularity prediction provided by the invention obtains the best performance under different content distribution and user request models under 2 performance indexes of cache hit rate and average delay, and provides more choices for the cache algorithm in actual industrial application scenes.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
It should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention may be modified or substituted without departing from the spirit and scope of the technical solution of the present invention, which is intended to be covered in the scope of the claims of the present invention.
Claims (10)
1. The dual-strategy self-adaptive cache replacement method based on popularity prediction is characterized by comprising the following steps of:
collecting device request data;
counting content popularity by taking a time slot as a unit and constructing a model data set;
and constructing a content popularity prediction model based on a sequence model Seq2Seq, performing model training, and respectively storing the structure and weight of the trained popularity prediction model into a file.
2. The popularity prediction-based dual-policy adaptive cache replacement method of claim 1, wherein: the collecting device request data comprises collecting device request information of each edge node in the edge network and time stamps of the request content, and sequencing according to the time stamps to construct a request sequence.
3. The popularity prediction-based dual-policy adaptive cache replacement method of claim 1, wherein: the counting content popularity in time slot units and constructing a model data set further comprises:
processing the request sequence in units of time slots;
the popularity vectors of a plurality of continuous historical time slots are used as a source sequence of the sequence to sequence model Seq2Seq input, the popularity vectors of a plurality of time slots in the future are used as a target sequence of the Seq2Seq model, the input part and the output part are combined, a data list is created, and the data list is divided into a training set, a verification set and a test set.
4. A popularity prediction-based dual-policy adaptive cache replacement method according to any one of claims 1-3, wherein: the building of the content popularity prediction model based on the Seq2Seq, the model training and the saving of the structure and the weight of the trained popularity prediction model into the file respectively further comprise: constructing a content popularity prediction model based on a Seq2Seq, inputting the training set and the verification set into the prediction model, calculating an error between an output sequence and a target sequence of a neural network, updating a weight of the neural network through back propagation, finally enabling the network to fit an optimal result, and respectively storing the structure and the weight of the trained popularity prediction model into a file; the prediction model is a popularity prediction model based on the Seq2Seq, teacherforce is started to accelerate model convergence, and an attribute mechanism is added to improve prediction accuracy.
5. The popularity prediction-based dual-policy adaptive cache replacement method of any one of claims 1 or 3, wherein: the time slot is a continuous object request in the request sequence, the time slot length L is the number of object requests in the time slot, and x is defined w =(P 1,w ,P 2,w ,…,P D,w ) For the access probability vector of all unique objects in the time slot w, i.e. the popularity vector of the time slot, C d,w Representing the number of accesses (w is addressed from 0) of object d in the w-th time slot, and the probability P of accesses of object d in the w-th time slot d,w The method comprises the following steps:
wherein the type of the unique resource object is D, L is constant, and the statistical width of popularity calculation is reflected.
6. The popularity prediction-based dual-policy adaptive cache replacement method of claim 4, wherein: when constructing the data set required by the model, the popularity vectors of the first M time slots including the time slot w are input as a popularity prediction model, namely:
X w ={x w-M+1 ,x w-M+2 ,…,x w }
and Y is w ={y s ,y m ,y l Output of popularity prediction model, where y s ,y m ,y l Represented are the popularity vectors of each object within the short-term (s=w+1), medium-term (m=w+2) and long-term time slots (l=w+6) after the time slot w, respectively, which 3 vectors together constitute the model target sequence Y w The method comprises the steps of carrying out a first treatment on the surface of the Thus, the input and output of the model can be considered as a three-dimensional tensor, with dimensions (#sample, M, D) and (#sample, 3, D), respectively, where #sample is the number of samples; in constructing the input sequence X of the predictive model w When the sliding window is used for extracting more object access sequences, a group of sample data is generated by sliding the window each time from the beginning to the end of the sequences, and the collection of the data of all groups forms a final training data set;
wherein M is a constant and represents the number of selected historical time slots.
7. The popularity prediction-based dual-policy adaptive cache replacement method of claim 3, wherein: the processing of the access sequence in time slot units is divided into three phases:
the first stage: entering a time slot w; at this point the time slot w-1 has ended and the algorithm uses the input sequence X formed by popularity vectors in the first M time slots including time slot w-1 w-1 And predicting and obtaining future popularity Y w-1 ;
And a second stage: in the time slot w; the second phase will process each access request: if the data to be accessed is already in the cache, the request is directly responded and is referred to as the first cache; if the cache is not full, responding to the request after applying for obtaining the data from the server, and caching the data to the tail of the cache queue; if the cache is full, adopting a corresponding cache replacement method according to the current strategy algo; if algo is LRU, LRU is adopted for replacement; whereas if algo is an analog OPT, a first is requiredFuture popularity vector Y predicted in phase w-1 Forming future comprehensive popularity; the specific mode is as follows:
the popularity vector predicted by the prediction model is popularity of different periods in the future, but one or more popularity vectors are not directly utilized in the algorithm, and the popularity vectors of different periods are weighted and calculated to obtain a final comprehensive popularity vector Fp= (Fp) 1 ,Fp 2 ,…,Fp D ) The calculation process is as follows, wherein the weight W s ,W m ,W l Respectively representing short, medium and long weight factors;
Fp=W s ×y s +W m ×y m +W l ×y l
when the cache is full and algo is a simulated OPT, comparing and finding out the object with the lowest popularity in the cache through Fp to perform replacement operation, wherein the data structure stores the cache object and popularity thereof by adopting a set map;
in the second stage, the actual cache replacement strategy depends on algo, but the cache replacement of another strategy is simulated at the same time, so as to obtain the cache hit rate of the other strategy;
and a third stage: at the end of the time slot w; in the third stage, the cache hit rates under the two strategies are compared, and the cache replacement strategy algo of the time slot w+1 is determined according to the following formula
8. The popularity prediction-based dual-policy adaptive cache replacement method of any one of claims 1-7, wherein: the dual-strategy self-adaptive cache replacement method based on popularity prediction further comprises an online decision stage: replacing the cache content according to a prediction result by using a trained popularity prediction model, removing the file predicting the lowest access probability in a future period, and combining with a responsive cache replacement algorithm LRU; when a new request arrives, the algorithm can adaptively select whether cache replacement is performed by utilizing popularity prediction or by adopting an LRU (least recently used) mode, so that the edge cache node is updated.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310091155.XA CN116112563A (en) | 2023-02-09 | 2023-02-09 | Dual-strategy self-adaptive cache replacement method based on popularity prediction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310091155.XA CN116112563A (en) | 2023-02-09 | 2023-02-09 | Dual-strategy self-adaptive cache replacement method based on popularity prediction |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116112563A true CN116112563A (en) | 2023-05-12 |
Family
ID=86259500
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310091155.XA Pending CN116112563A (en) | 2023-02-09 | 2023-02-09 | Dual-strategy self-adaptive cache replacement method based on popularity prediction |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116112563A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116828053A (en) * | 2023-08-28 | 2023-09-29 | 中信建投证券股份有限公司 | Data caching method and device, electronic equipment and storage medium |
CN117270794A (en) * | 2023-11-22 | 2023-12-22 | 成都大成均图科技有限公司 | Redis-based data storage method, medium and device |
CN118034529A (en) * | 2024-04-09 | 2024-05-14 | 杭州宏枭科技有限公司 | Anti-harshness EMC circuit device of capacitive touch screen |
-
2023
- 2023-02-09 CN CN202310091155.XA patent/CN116112563A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116828053A (en) * | 2023-08-28 | 2023-09-29 | 中信建投证券股份有限公司 | Data caching method and device, electronic equipment and storage medium |
CN116828053B (en) * | 2023-08-28 | 2023-11-03 | 中信建投证券股份有限公司 | Data caching method and device, electronic equipment and storage medium |
CN117270794A (en) * | 2023-11-22 | 2023-12-22 | 成都大成均图科技有限公司 | Redis-based data storage method, medium and device |
CN117270794B (en) * | 2023-11-22 | 2024-02-23 | 成都大成均图科技有限公司 | Redis-based data storage method, medium and device |
CN118034529A (en) * | 2024-04-09 | 2024-05-14 | 杭州宏枭科技有限公司 | Anti-harshness EMC circuit device of capacitive touch screen |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116112563A (en) | Dual-strategy self-adaptive cache replacement method based on popularity prediction | |
Imteaj et al. | Federated learning for resource-constrained iot devices: Panoramas and state of the art | |
CN114048331A (en) | Knowledge graph recommendation method and system based on improved KGAT model | |
CN111091247A (en) | Power load prediction method and device based on deep neural network model fusion | |
CN111861013B (en) | Power load prediction method and device | |
Tang et al. | Representation and reinforcement learning for task scheduling in edge computing | |
CN113312505A (en) | Cross-modal retrieval method and system based on discrete online hash learning | |
WO2024067373A1 (en) | Data processing method and related apparatus | |
CN113568954A (en) | Parameter optimization method and system for network flow prediction data preprocessing stage | |
CN117194502B (en) | Database content cache replacement method based on long-term and short-term memory network | |
CN115544033B (en) | Method, device, equipment and medium for updating check repeat vector library and checking repeat data | |
CN117093885A (en) | Federal learning multi-objective optimization method integrating hierarchical clustering and particle swarm | |
CN116127121A (en) | Training method of image retrieval model and image retrieval algorithm based on training method | |
CN112667394B (en) | Computer resource utilization rate optimization method | |
CN114916013A (en) | Method, system and medium for optimizing unloading time delay of edge task based on vehicle track prediction | |
Sun et al. | Ssa: A content-based sparse attention mechanism | |
CN110188219A (en) | Deeply de-redundancy hash algorithm towards image retrieval | |
Zhang et al. | Small files storing and computing optimization in Hadoop parallel rendering | |
CN117892769B (en) | Neural network training method, video memory scheduling method, system, equipment and product | |
CN117474127B (en) | Distributed machine learning model training system, method and device and electronic equipment | |
CN117707795B (en) | Graph-based model partitioning side collaborative reasoning method and system | |
CN113506593B (en) | Intelligent inference method for large-scale gene regulation network | |
CN117474106B (en) | Bayesian network structure learning method based on full-flow parallel genetic algorithm | |
CN115630772B (en) | Comprehensive energy detection and distribution method, system, equipment and storage medium | |
CN116737607B (en) | Sample data caching method, system, computer device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |