Cache data adjusting method and device, storage medium and program product
Through the data prediction model, the client will predict future data access to data and adjust the cache strategy in real time, solving the problem of low cache hit rate in NFS systems, improving data access speed and system performance.
Patent Information
- Application Number
- CN202411231280.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-13
AI Technical Summary
The cache method in existing network file systems (NFS) has a low cache hit rate and cannot effectively respond to changes in client access mode, resulting in insufficient performance.
By obtaining the access data set of the target client, determining its data characteristics, and using the data prediction model to predict future access data, adjusting the cache strategy in real time, storing high-frequency data in the high-frequency cache space, and storing low-frequency data in the low-frequency cache space, improving cache Hit rate.
Improves cache hit rate, reduces the number of requests to servers and network latency, and improves data access speed and system performance.
Smart Images

Figure CN119127082A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of data storage, and in particular, to a method and device for adjusting cache data, a storage medium, and a program product. Background Art
[0002] Network File System (NFS) allows users to access remote file systems through the network just like accessing local file systems. In the process of using NFS, cache technology plays a certain role. For example, for the client, the client can cache data to improve the performance of file access and reduce network traffic. Data access speed is accelerated by storing copies of frequently accessed data locally.
[0003] In the related art, cache eviction algorithms are often used to decide which data to remove when the cache reaches its capacity limit. Usually, the data that has not been accessed for the longest time or the data with the least number of accesses is removed, which cannot predict future access patterns, and cannot respond quickly to changes in access patterns in the face of client changes, actual business adjustments, etc. In other words, the cache hit rate (ratio of cache hits to total requests) of the cache method in the related art is low.
[0004] In the related art, an effective solution has not yet been proposed for the technical problem that the cache hit rate of the cache method in the current NFS system is low. Summary of the invention
[0005] The embodiments of the present application provide a method and device for adjusting cache data, a storage medium, and a program product to at least solve the technical problem of low cache hit rate of the cache method in the current NFS system in the related art.
[0006] According to one embodiment of the present application, a method for adjusting cached data is provided, comprising: obtaining a first access data set of a target client within a first time period, and determining a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate characteristics and access patterns of the first access data; inputting the data features corresponding to the first access data set and at least one first access data into a data prediction model to obtain a second access data set corresponding to the target client; obtaining the second access data set, and caching the second access data set.
[0007] In an exemplary embodiment, the above-mentioned cache processing of the second access data set includes: inputting data features corresponding to the first access data set and at least one first access data into a data prediction model to obtain the second access data set, and cache level information corresponding to at least one second access data in the second access data set; when the cache level information corresponding to the second access data is the first cache level, storing the second access data in a high-frequency cache space; when the cache level information corresponding to the second access data is the second cache level, storing the second access data in a low-frequency cache space.
[0008] In an exemplary embodiment, the training process of the above-mentioned data prediction model includes: obtaining a reference access data set of a reference client within a second time period, and determining the data features corresponding to each reference access data in the reference access data set; obtaining initialization parameters of the data prediction model; using the reference access data set to train the data prediction model to update the parameters of the data prediction model, and obtaining a trained data prediction model when preset conditions are met.
[0009] In an exemplary embodiment, the above-mentioned method of obtaining a reference access data set of a reference client within a second time period and determining data features corresponding to each reference access data in the reference access data set includes: performing data cleaning and standardization on the reference access data set and data features corresponding to each of the multiple reference access data to obtain a reference access data set to be determined; removing data features that meet preset conditions from the data features corresponding to each of the reference access data in the reference access data set to be determined to obtain an updated reference access data set.
[0010] In an exemplary embodiment, the above-mentioned method of training the data prediction model using a reference access data set to update the parameters of the data prediction model and obtaining a trained data prediction model when preset conditions are met includes: randomly dividing the reference access data set into M access data subsets; traversing the M access data subsets, and performing the following operations during the i-th traversal process: using all access data subsets of the M access data subsets except the i-th access data subset as training sets to train the data prediction model, and inputting the i-th access data subset into the data prediction model to obtain the i-th evaluation function result of the data prediction model, wherein M is an integer greater than 0, and i is an integer greater than 0 and less than or equal to M; when the M evaluation function results meet the preset conditions, a trained data prediction model is obtained.
[0011] In an exemplary embodiment, the above-mentioned method of using all access data subsets except the i-th access data subset in the M access data subsets as training sets to train the data prediction model includes: performing T random sampling on the training set, and in each random sampling process, performing the following operations: collecting n samples in the training set to obtain a sampling set containing n samples, wherein T is an integer greater than 0, and n is the same as the number of reference access data contained in the training set; establishing T data prediction sub-models, and making one-to-one correspondence between the T sampling sets and the T data prediction sub-models; using the sampling sets to train the corresponding data prediction sub-models, and the training process of the data prediction sub-models includes: when currently in the first node layer, according to the number of features, randomly determining the first feature set from the data features corresponding to each of the reference access data, wherein the number of feature types of the data features in the feature set is the same as the number of features; establishing candidate nodes of the second node layer according to the first feature set, and evaluating the candidate nodes using the first feature set to obtain evaluation results of the candidate nodes of the second node layer; determining the candidate nodes of the second node layer according to the evaluation results of the candidate nodes of the second node layer. Node; split the sampling set according to the nodes of the second node layer to obtain the sampling subsets corresponding to the nodes of the second node layer; when currently in the p-th node layer, according to the feature number, randomly determine the q-th feature set from the sampling subsets corresponding to the nodes of the p-th node layer; establish the candidate nodes of the p+1-th node layer according to the q-th feature set, and use the q-th feature set to evaluate the candidate nodes of the p+1-th node layer to obtain the evaluation results of the candidate nodes of the p+1-th node layer; determine the p+1-th node layer according to the evaluation results of the candidate nodes of the p+1-th node layer. nodes of the p-th node layer; split the sampling subset corresponding to the nodes of the p-th node layer according to the nodes of the p+1-th node layer to obtain the sampling subset corresponding to the nodes of the p+1-th node layer, wherein p is an integer greater than 1, and q is an integer greater than 1; when the number of reference access data contained in the sampling subset corresponding to the nodes of the p+1-th node layer is less than or equal to the preset number of data or p is greater than or equal to the preset number of layers, the model composed of the current p+1 node layers is determined as the data prediction sub-model; and the T data prediction sub-models are integrated to obtain the data prediction model.
[0012] In an exemplary embodiment, after the trained data prediction model is obtained as described above, it also includes: obtaining a third access data set of the target client within a third time period, and determining data features corresponding to each of the multiple third access data in the third access data set; and updating the parameters of the data prediction model using the third access data set and the data features corresponding to each of the third access data to obtain an updated data prediction model.
[0013] According to another embodiment of the present application, a cache data adjustment device is provided, including: a data acquisition module, used to acquire a first access data set of a target client within a first time period, and determine a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate a characteristic and an access pattern of the first access data; a data prediction module, used to input the data features corresponding to the first access data set and at least one first access data into a data prediction model to obtain a second access data set corresponding to the target client; a data caching module, used to acquire the second access data set and cache the second access data set.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0015] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] Through the present application, the first access data set of the target client in the first time period is obtained, and the data features corresponding to at least one first access data in the first access data set are determined, wherein the data features are used to indicate the characteristics and access mode of the first access data; the data features corresponding to the first access data set and at least one first access data are input into the data prediction model to obtain the second access data set corresponding to the target client; the second access data set is obtained, and the second access data set is cached. In the case where the target client accesses data to the server, the data accessed by the target client from the server in the first time period can be obtained, and part of it is selected as the first access data set. After obtaining the first access data set, its corresponding data features can be determined, and the data that the target client may access in the future can be obtained by using the data prediction model through the access data and the data features, and it is used as the second access data set, and the second access data set is cached from the server to the client. In this way, the data that the client may access can be determined in real time according to the data accessed by the client, prepared and cached in advance, and can be directly read from the cache when in use, solving the technical problem of low cache hit rate of the cache method in the current NFS system in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a hardware structure block diagram of an optional method for adjusting cache data according to an embodiment of the present application;
[0018] Figure 2 is a flowchart of an optional method for adjusting cache data according to an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of an optional method for adjusting cache data according to an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of another optional method for adjusting cache data according to an embodiment of the present application;
[0021] Figure 5 is a schematic diagram of another optional method for adjusting cache data according to an embodiment of the present application;
[0022] Figure 6 It is a structural block diagram of an optional cache data adjustment device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0025] According to one aspect of an embodiment of the present application, a method for adjusting cache data is provided. As an optional implementation, the method for adjusting cache data can be applied to, but is not limited to, Figure 1 The system for adjusting cache data in the hardware environment shown. The system for adjusting cache data may include but is not limited to a terminal device 102, a network 110, a server 112, and a database 114. The terminal device 102 includes a display 108, a processor 106, and a memory 104. The display 108 may be used to display different application interfaces, etc., and is also used to provide a human-computer interaction interface to receive touch human-computer interaction operations for different information. The processor is used to generate an interaction instruction in response to the above human-computer interaction operation, and send the interaction instruction to the server to obtain the stored data. The memory is used to store access data required for the client to run.
[0026] In addition, the server 112 includes a processing engine 116, and the processing engine 116 is used to perform a storage or reading operation on the database 114. Specifically, the processing engine 116 reads the second access data set from the database 114.
[0027] The specific process of this embodiment is as follows: as in steps S102 and S104, a first access data set within a first time period is obtained, and data features corresponding to at least one first access data in the first access data set are determined, wherein the data features are used to indicate the characteristics and access mode of the first access data; the data features corresponding to the first access data set and at least one first access data are input into the data prediction model to obtain a second access data set corresponding to the target client. After determining the second access data set, step S106 can be executed to request the second access data set from the server 112 through the network 110, and the terminal device 102 may be one or more devices; after receiving the request sent by the terminal device 102, the server 112 obtains the second access data set from the database 114 and sends the second access data set to the terminal device 102. After the terminal device 102 obtains the second access data set from the server 112 and / or the terminal device 118, step S108 is executed in the terminal device 102 to cache the second access data set.
[0028] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a target program, and may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WI FI and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and this embodiment does not impose any limitation on this.
[0029] Through the present application, the first access data set of the target client in the first time period is obtained, and the data features corresponding to at least one first access data in the first access data set are determined, wherein the data features are used to indicate the characteristics and access mode of the first access data; the data features corresponding to the first access data set and at least one first access data are input into the data prediction model to obtain the second access data set corresponding to the target client; the second access data set is obtained, and the second access data set is cached. In the case where the target client accesses data to the server, the data accessed by the target client from the server in the first time period can be obtained, and part of it is selected as the first access data set. After obtaining the first access data set, its corresponding data features can be determined, and the data that the target client may access in the future can be obtained by using the data prediction model through the access data and the data features, and it is used as the second access data set, and the second access data set is cached from the server to the client. In this way, the data that the client may access can be determined in real time according to the data accessed by the client, prepared and cached in advance, and can be directly read from the cache when in use, solving the technical problem of low cache hit rate of the cache method in the current NFS system in the related technology.
[0030] In this embodiment, a method for adjusting cache data is provided. Figure 2 is a flowchart of an optional method for adjusting cache data according to an embodiment of the present application, such as Figure 2 As shown, the method for adjusting the cache data includes:
[0031] Step S202, obtaining a first access data set of a target client in a first time period, and determining a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate a characteristic and an access mode of the first access data;
[0032] It should be noted that the data that the NFS client can access depends on the exported directories and corresponding access permissions configured on the server. The NFS server can designate certain directories as exported directories, which are visible and accessible to the client. The client can access and operate the files and folders in these exported directories, including reading, modifying, and executing files.
[0033] In an optional implementation, the first time period can be preset, and during the process of the current NFS client accessing the data of the server, the access data in the first time period can be read, and part or all of the access data can be used as the first access data set for prediction of subsequent access data. The access data can be in the form of data blocks, files, etc., and there is no limitation on the form.
[0034] In an optional implementation, after determining the first access data set, data features corresponding to each access data therein may be used, such as data size (the size of the data item, which affects storage requirements and transmission time), access frequency (how frequently the data is accessed, which affects cache strategies and performance), data type (the format or category of the data, such as text, pictures, videos, etc.), data temperature (which may be hot data (frequently accessed), warm data (occasionally accessed), cold data (rarely accessed)), data location (the physical or logical location of the data storage, which affects access latency), and other features.
[0035] Step S204, inputting the first access data set and the data features corresponding to the at least one first access data into the data prediction model to obtain a second access data set corresponding to the target client;
[0036] It should be noted that the data prediction model can be a pre-trained model, and the data prediction model can take the first access data set and the data features corresponding to the first access data as input, and output the second access data set. The second access data set can be data that the target client may access, which is not an unchanging fixed data set. It will be determined based on the first access data set of the client in the first time period.
[0037] Step S206: Acquire a second access data set, and cache the second access data set.
[0038] It should be noted that after determining the second access data set, the second access data set can be obtained from the server and cached, so that when the client subsequently uses the data in the second access data set, the number of requests to the server can be reduced, thereby reducing network delay and improving data access speed. In addition, the access to the NFS server can be reduced to reduce the I / O load of the server and improve the responsiveness and processing efficiency of the server.
[0039] Through the present application, the first access data set of the target client in the first time period is obtained, and the data features corresponding to at least one first access data in the first access data set are determined, wherein the data features are used to indicate the characteristics and access mode of the first access data; the data features corresponding to the first access data set and at least one first access data are input into the data prediction model to obtain the second access data set corresponding to the target client; the second access data set is obtained, and the second access data set is cached. In the case where the target client accesses data to the server, the data accessed by the target client from the server in the first time period can be obtained, and part of it is selected as the first access data set. After obtaining the first access data set, its corresponding data features can be determined, and the data that the target client may access in the future can be obtained by using the data prediction model through the access data and the data features, and it is used as the second access data set, and the second access data set is cached from the server to the client. In this way, the data that the client may access can be determined in real time according to the data accessed by the client, prepared and cached in advance, and can be directly read from the cache when in use, solving the technical problem of low cache hit rate of the cache method in the current NFS system in the related technology.
[0040] In an optional embodiment, the above-mentioned caching processing of the second access data set includes: inputting data features corresponding to the first access data set and at least one first access data into a data prediction model to obtain the second access data set, and cache level information corresponding to at least one second access data in the second access data set; when the cache level information corresponding to the second access data is the first cache level, storing the second access data in a high-frequency cache space; when the cache level information corresponding to the second access data is the second cache level, storing the second access data in a low-frequency cache space.
[0041] In an optional embodiment, the data prediction model can use the second access data set and the corresponding data features as input to obtain the cache level information of the second access data in the second access data set. The second access data set can be predicted using the data prediction model and the first access data set and the corresponding data features. The second access data set can also be the data file currently cached by the client.
[0042] In an optional embodiment, the data prediction model may utilize the prediction function of the model when using the first access data set and the corresponding data features for prediction. The second access data set may also be divided into high-frequency data and low-frequency data, utilizing the classification function of the model. Dividing the second access data set into high-frequency data and low-frequency data not only predicts the access data, but also predicts the timing that the access data may use. The second access data whose cache level information is the first cache level may be the most frequently accessed data to reduce the processor waiting time. The second access data whose cache level information is the second cache level may be data that is accessed more frequently but is not immediately needed.
[0043] In an optional implementation, the high-frequency cache space may be a high-speed cache, which may be located inside or very close to the processor, with an access speed close to or only slightly lower than the execution speed of the processor, and using a faster storage technology such as S RAM (static random access memory). The low-frequency cache space may be a low-speed cache, which is located on the motherboard and is far away from the processor, and may have a larger storage capacity, and may use a cheaper storage technology such as DRAM (dynamic random access memory).
[0044] Through the above implementation of the present application, the data prediction model can be used to classify the second access data set, or the access data currently stored by the client, and determine the cache level information corresponding to each access data. And according to different cache level information, the access data is stored in the high-frequency cache space or the low-frequency cache space. When the client obtains the access data, the access data of the first cache level can be obtained faster, so as to improve the access speed and improve the performance of the system.
[0045] In an optional embodiment, the training process of the above-mentioned data prediction model includes: obtaining a reference access data set of the reference client within a second time period, and determining the data features corresponding to each reference access data in the reference access data set; obtaining initialization parameters of the data prediction model; using the reference access data set to train the data prediction model to update the parameters of the data prediction model, and obtaining a trained data prediction model when preset conditions are met.
[0046] In an optional implementation, before training the model, a training data set needs to be determined, and a reference access data set of a reference client in a second time period can be obtained. The reference client can be at least one client including the target client, and the reference client can read access data from the NFS server. The second time period can also be pre-set, and the second time period can be a certain period before training, or a time period with the current time as one end of the time period.
[0047] In an optional implementation, after obtaining the training data (reference access data set), the parameters of the data prediction model can be initialized, and then the data prediction model can be trained using the reference access data set to update its parameters. Meeting the preset condition can be that the preset indicators such as the accuracy, recall rate, and mean square error of the data prediction model reach a preset threshold range. When the preset conditions are met, the model training is considered to be completed.
[0048] Through the above implementation of the present application, the model can be trained using the reference access data set of multiple clients in the second period. And the preset evaluation index of the model can be used to indicate whether the model training is completed. The robustness, universality and accuracy of the trained model can be improved.
[0049] In an optional embodiment, the above-mentioned obtaining of a reference access data set of a reference client within a second time period and determining data features corresponding to each reference access data in the reference access data set includes: performing data cleaning and standardization on the reference access data set and data features corresponding to each of the multiple reference access data to obtain a reference access data set to be determined; removing data features that meet preset conditions from the data features corresponding to each of the reference access data in the reference access data set to be determined to obtain an updated reference access data set.
[0050] In an optional embodiment, after obtaining the reference access data, the data features corresponding to each of them can be determined. Then the data is cleaned, and missing value processing can be performed: identifying and processing missing values in the reference access data set and the corresponding data features, possibly by deletion, filling (such as using the mean, median, mode or model-based prediction, etc.). Outlier detection can be performed: identifying outliers in the reference access data set and the corresponding data features and deciding how to handle them, such as deleting, replacing or transforming. Deduplication: checking and deleting duplicate records in the reference access data set and the corresponding data features to avoid bias in the analysis. Error correction: correcting entry errors in the reference access data set and the corresponding data features or errors in the data extraction process.
[0051] In an optional implementation, data features for training may be determined before processing the training data, such as retaining data features such as data size and data type, and removing data features such as data security, so as to remove irrelevant or redundant data features.
[0052] Optionally, after data cleaning, annotation, and feature selection, the reference access data set is subjected to an updated reference access data set as a data set for the model training phase.
[0053] Through the above-mentioned implementation mode of the present application, the updated reference access data set obtained after data cleaning, annotation, and feature selection is used as the data set in the model training stage, which can improve the performance and accuracy of the trained model and increase the model training speed.
[0054] In an optional embodiment, the above-mentioned method of training the data prediction model using a reference access data set to update the parameters of the data prediction model, and obtaining a trained data prediction model when preset conditions are met, includes: randomly dividing the reference access data set into M access data subsets; traversing the M access data subsets, and performing the following operations during the i-th traversal process: using all access data subsets of the M access data subsets except the i-th access data subset as training sets to train the data prediction model, and inputting the i-th access data subset into the data prediction model to obtain an i-th evaluation function result of the data prediction model, wherein M is an integer greater than 0, and i is an integer greater than 0 and less than or equal to M; when the M evaluation function results meet the preset conditions, a trained data prediction model is obtained.
[0055] Figure 3 is a schematic diagram of an optional method for adjusting cache data according to an embodiment of the present application; Figure 3 As shown, the reference access data set 302 (such as Figure 3 D) is randomly divided into M access data subsets 304 (such as Figure 3 D1 to D M ). M access data subsets can be traversed, and the following operations can be performed during each traversal: all access data subsets except the i-th access data subset in the M access data subsets are used as training sets to train the data prediction model, and the i-th access data subset is input into the data prediction model to obtain the i-th evaluation function result of the data prediction model. The evaluation function result obtained in each traversal can be averaged and other operations can be performed to evaluate the performance of the model. The above can be used to test the hyperparameter combination in the data prediction model, such as the number of features, number of node layers, access data threshold and other parameters of the data prediction model. The role of specific parameters in the training process will be described in detail below and will not be repeated here.
[0056] In an optional implementation, when the evaluation function result does not meet the preset conditions (such as the mean of the evaluation function result is less than the preset result), the parameters of the data prediction model can be changed and trained again to determine the above-mentioned hyperparameters of the data prediction model.
[0057] Through the above implementation of the present application, the reference access data set can be randomly split into a training set and a validation set, and the performance of the data prediction model can be trained and evaluated multiple times to determine the hyperparameters of the data prediction model, and the optimal parameter configuration can be selected to improve the performance of the data prediction model. In this way, the prediction results of the model are more accurate during the application process, and the performance of the system is improved.
[0058] In an optional embodiment, the above-mentioned use of all access data subsets except the i-th access data subset in the M access data subsets as training sets to train the data prediction model includes: performing T random sampling on the training set, and in each random sampling process, performing the following operations: collecting n samples in the training set to obtain a sampling set containing n samples, wherein T is an integer greater than 0, and n is the same as the number of reference access data contained in the training set; establishing T data prediction sub-models, and making one-to-one correspondence between the T sampling sets and the T data prediction sub-models; using the sampling sets to train the corresponding data prediction sub-models, and the training process of the data prediction sub-models includes: when currently in the first node layer, according to the number of features, randomly determining the first feature set from the data features corresponding to each of the reference access data, wherein the number of feature types of the data features in the feature set is the same as the number of features; establishing candidate nodes of the second node layer according to the first feature set, and evaluating the candidate nodes using the first feature set to obtain evaluation results of the candidate nodes of the second node layer; determining the candidate nodes of the second node layer according to the evaluation results of the candidate nodes of the second node layer. Node; split the sampling set according to the nodes of the second node layer to obtain the sampling subsets corresponding to the nodes of the second node layer; when currently in the p-th node layer, according to the feature number, randomly determine the q-th feature set from the sampling subsets corresponding to the nodes of the p-th node layer; establish the candidate nodes of the p+1-th node layer according to the q-th feature set, and use the q-th feature set to evaluate the candidate nodes of the p+1-th node layer to obtain the evaluation results of the candidate nodes of the p+1-th node layer; determine the p+1-th node layer according to the evaluation results of the candidate nodes of the p+1-th node layer. nodes of the p-th node layer; split the sampling subset corresponding to the nodes of the p-th node layer according to the nodes of the p+1-th node layer to obtain the sampling subset corresponding to the nodes of the p+1-th node layer, wherein p is an integer greater than 1, and q is an integer greater than 1; when the number of reference access data contained in the sampling subset corresponding to the nodes of the p+1-th node layer is less than or equal to the preset number of data or p is greater than or equal to the preset number of layers, the model composed of the current p+1 node layers is determined as the data prediction sub-model; and the T data prediction sub-models are integrated to obtain the data prediction model.
[0059] In an optional implementation, the reference access data set may be used as a training set for training, and the training set may be randomly sampled T times. In each random sampling process, the following operations are performed: the training set is sampled n times to obtain a sampling set containing n samples. In the process of determining the sampling set, a sample may be randomly taken out and put into the sampling set, and then the sample is put back into the initial data set, so that the sample may still be selected in the next sampling.
[0060] In an optional embodiment, a data prediction sub-model may be established. Figure 4is a schematic diagram of another optional method for adjusting cache data according to an embodiment of the present application; Figure 4 As shown, after obtaining T sampling sets using the reference data set, the sampling sets can be used to train the corresponding data prediction sub-models. After the training of the T data prediction sub-models is completed, they are integrated to obtain a trained data prediction model.
[0061] In an optional embodiment, there may be one node (root node) in the first node layer, and the nodes in the second node layer may be obtained by splitting the root node. Determining that the nodes in the second node layer may be split may be performed based on the type of data features. As previously described, the number of features of the model may be determined, which defines the number of features to be considered when looking for the best split. It may be an integer or a ratio of the total number of features. If the number of features is set to an integer, then at each splitting node, the number of features specified by this integer will be randomly selected for evaluation. If the number of features is set to a floating point number, then it indicates that a certain proportion of the total number of original features will be considered. For example, if the data set has 100 features, an eigenvalue of 0.3 means that 30 features will be considered at each split point.
[0062] In an optional implementation, in the process of determining the splitting node, the determination method can be changed according to the form of the data feature. For example, for continuous features, it is necessary to traverse all unique values and calculate the evaluation value of each possible splitting point; for discrete features, each different category value is a potential splitting point. For each splitting point, the evaluation result after splitting is calculated. For classification tasks, information gain can be used as a function to determine the evaluation result; for regression tasks, mean square error may be used as a function to determine the evaluation result.
[0063] As mentioned above, when the first access data set and the corresponding data features are used to input the data prediction model to determine the second access data set to be cached, the data prediction model can be a model for regression tasks, and the model can be trained using mean square error. When the access data currently cached by the client or the second access data set is used to input the data prediction model to determine the cache level information of the access data, the data prediction model can be a model for classification tasks, and the model can be trained using information gain. The above data can be used to train two different models for different tasks.
[0064] In an optional implementation, the above process can be repeated for each node until the number of node layers reaches a preset number of layers, or the number of reference access data contained in the sampling subset corresponding to the node is less than or equal to the preset number of data, and the training of the data prediction sub-model can be completed. The preset number of layers and the preset number of data can be determined in advance as described above.
[0065] Through the above-mentioned implementation mode of the present application, a data prediction model can be obtained by training multiple data prediction sub-models and integrating them. In this way, the overfitting problem of a single model can be effectively resisted, more stable and accurate prediction results can be provided, and the cache strategy can maintain good performance under various complex access modes.
[0066] In an optional embodiment, after the trained data prediction model is obtained as described above, it also includes: obtaining a third access data set of the target client within a third time period, and determining data features corresponding to each of the multiple third access data in the third access data set; and updating the parameters of the data prediction model using the third access data set and the data features corresponding to each of the third access data to obtain an updated data prediction model.
[0067] Figure 5 is a schematic diagram of another optional method for adjusting cache data according to an embodiment of the present application; Figure 5 As shown, the target client can obtain access data from the NFS server, and can determine the access data within the third time period in the access data to determine the third access data set. The access data within the first time period is determined to determine the first access data set. The first access data set and the corresponding data features can be used to input the data prediction model to obtain the second access data set, and the second access data can be obtained from the server and cached in the NFS client (target client). The third access data set can also be used to update the parameters of the data prediction model in the above manner to obtain an updated data prediction model.
[0068] Through the above implementation of the present application, the third access data set can be collected regularly to retrain and update the data prediction model. This can ensure that the system can continue to adapt to new access patterns and maintain the optimal state of the cache strategy, thereby improving the performance of the system and increasing the hit rate of cached data.
[0069] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, or by hardware, but in many cases the former is a better implementation method. Based on this understanding, the computer software product is stored in a storage medium (such as ROM / RAM, disk, CD), including several instructions for enabling a terminal device (which can be a computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0070] In this embodiment, a device for adjusting cache data is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0071] Figure 6 is a structural block diagram of an optional cache data adjustment device according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:
[0072] A data acquisition module 62 is used to acquire a first access data set of a target client within a first time period, and determine a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate a characteristic and an access mode of the first access data;
[0073] A data prediction module 64, configured to input the first access data set and the data features corresponding to the at least one first access data into a data prediction model to obtain a second access data set corresponding to the target client;
[0074] The data cache module 66 is used to obtain the second access data set and cache the second access data set.
[0075] Through the present application, the first access data set of the target client in the first time period is obtained, and the data features corresponding to at least one first access data in the first access data set are determined, wherein the data features are used to indicate the characteristics and access mode of the first access data; the data features corresponding to the first access data set and at least one first access data are input into the data prediction model to obtain the second access data set corresponding to the target client; the second access data set is obtained, and the second access data set is cached. In the case where the target client accesses data to the server, the data accessed by the target client from the server in the first time period can be obtained, and part of it is selected as the first access data set. After obtaining the first access data set, its corresponding data features can be determined, and the data that the target client may access in the future can be obtained by using the data prediction model through the access data and the data features, and it is used as the second access data set, and the second access data set is cached from the server to the client. In this way, the data that the client may access can be determined in real time according to the data accessed by the client, prepared and cached in advance, and can be directly read from the cache when in use, solving the technical problem of low cache hit rate of the cache method in the current NFS system in the related technology.
[0076] Optionally, the above-mentioned data cache module 66 is also used to input the data features corresponding to the first access data set and at least one first access data into the data prediction model to obtain the second access data set, and the cache level information corresponding to at least one second access data in the second access data set; when the cache level information corresponding to the second access data is the first cache level, the second access data is stored in the high-frequency cache space; when the cache level information corresponding to the second access data is the second cache level, the second access data is stored in the low-frequency cache space.
[0077] Optionally, the training process of the above-mentioned data prediction model includes: obtaining a reference access data set of the reference client within the second time period, and determining the data features corresponding to each reference access data in the reference access data set; obtaining initialization parameters of the data prediction model; using the reference access data set to train the data prediction model to update the parameters of the data prediction model, and obtaining a trained data prediction model when preset conditions are met.
[0078] Optionally, the above-mentioned obtaining of a reference access data set of a reference client within a second time period, and determining data features corresponding to each reference access data in the reference access data set, includes: performing data cleaning and standardization on the reference access data set and the data features corresponding to each of the multiple reference access data to obtain a reference access data set to be determined; removing data features that meet preset conditions from the data features corresponding to each of the reference access data in the reference access data set to be determined, to obtain an updated reference access data set.
[0079] Optionally, the above-mentioned method of training the data prediction model using the reference access data set to update the parameters of the data prediction model, and obtaining a trained data prediction model when preset conditions are met, includes: randomly dividing the reference access data set into M access data subsets; traversing the M access data subsets, and performing the following operations during the i-th traversal process: using all access data subsets of the M access data subsets except the i-th access data subset as training sets to train the data prediction model, and inputting the i-th access data subset into the data prediction model to obtain the i-th evaluation function result of the data prediction model, wherein M is an integer greater than 0, and i is an integer greater than 0 and less than or equal to M; when the M evaluation function results meet the preset conditions, a trained data prediction model is obtained.
[0080] Optionally, the above-mentioned use of all access data subsets except the i-th access data subset in the M access data subsets as training sets to train the data prediction model includes: performing T random sampling on the training set, and in each random sampling process, performing the following operations: collecting n samples in the training set to obtain a sampling set containing n samples, wherein T is an integer greater than 0, and n is the same as the number of reference access data contained in the training set; establishing T data prediction sub-models, and making one-to-one correspondence between the T sampling sets and the T data prediction sub-models; using the sampling sets to train the corresponding data prediction sub-models, and the training process of the data prediction sub-models includes: when currently in the first node layer, according to the number of features, randomly determining the first feature set from the data features corresponding to each of the reference access data, wherein the number of feature types of the data features in the feature set is the same as the number of features; establishing candidate nodes of the second node layer according to the first feature set, and using the first feature set to evaluate the candidate nodes to obtain evaluation results of the candidate nodes of the second node layer; determining the nodes of the second node layer according to the evaluation results of the candidate nodes of the second node layer; The sampling set is split according to the nodes of the second node layer to obtain the sampling subsets corresponding to the nodes of the second node layer; when the node is currently in the p-th node layer, the q-th feature set is randomly determined from the sampling subsets corresponding to the nodes of the p-th node layer according to the feature number; the candidate nodes of the p+1-th node layer are established according to the q-th feature set, and the candidate nodes of the p+1-th node layer are evaluated using the q-th feature set to obtain the evaluation results of the candidate nodes of the p+1-th node layer; the p+1-th node layer is determined according to the evaluation results of the candidate nodes of the p+1-th node layer. Nodes of the node layer; split the sampling subsets corresponding to the nodes of the p-th node layer according to the nodes of the p+1-th node layer to obtain the sampling subsets corresponding to the nodes of the p+1-th node layer, wherein p is an integer greater than 1, and q is an integer greater than 1; when the number of reference access data contained in the sampling subsets corresponding to the nodes of the p+1-th node layer is less than or equal to the preset number of data or p is greater than or equal to the preset number of layers, the model composed of the current p+1 node layers is determined as the data prediction sub-model; and the T data prediction sub-models are integrated to obtain the data prediction model.
[0081] Optionally, after the above-mentioned trained data prediction model is obtained, it also includes: obtaining a third access data set of the target client within a third time period, and determining the data features corresponding to each of the multiple third access data in the third access data set; using the third access data set and the data features corresponding to each of the third access data to update the parameters of the data prediction model to obtain an updated data prediction model.
[0082] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0083] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0084] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0085] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0086] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0087] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0088] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0089] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for adjusting cache data, It is characterized in that The method comprises: Acquire a first access data set of a target client in a first time period, and determine a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate a characteristic and an access mode of the first access data; Inputting data features corresponding to the first access data set and the at least one first access data into a data prediction model to obtain a second access data set corresponding to the target client; The second access data set is obtained, and the second access data set is cached.
2. The method according to claim 1, It is characterized in that The caching the second access data set includes: Inputting data features corresponding to the first access data set and the at least one first access data into a data prediction model to obtain the second access data set and cache level information corresponding to at least one second access data in the second access data set; When the cache level information corresponding to the second access data is the first cache level, storing the second access data in the high-frequency cache space; When the cache level information corresponding to the second access data is the second cache level, the second access data is stored in a low-frequency cache space.
3. The method according to claim 2, It is characterized in that The training process of the data prediction model includes: Acquire a reference access data set of the reference client in a second period of time, and determine data features corresponding to each of the reference access data in the reference access data set; Obtaining initialization parameters of the data prediction model; The data prediction model is trained using the reference access data set to update the parameters of the data prediction model, and the trained data prediction model is obtained when preset conditions are met.
4. The method according to claim 3, It is characterized in that The obtaining of a reference access data set of the reference client in the second time period, and determining data features corresponding to each of the reference access data in the reference access data set, includes: Performing data cleaning and standardization processing on the reference access data set and data features corresponding to each of the plurality of reference access data to obtain a reference access data set to be determined; The data features that meet the preset conditions are removed from the data features corresponding to the reference access data in the reference access data set to be determined, so as to obtain the updated reference access data set.
5. The method according to claim 3, It is characterized in that The step of training the data prediction model by using the reference access data set to update the parameters of the data prediction model, and obtaining the trained data prediction model when a preset condition is met, includes: Randomly divide the reference access data set into M access data subsets; The M access data subsets are traversed, and the following operations are performed during the i-th traversal: Using all the access data subsets except the i-th access data subset in the M access data subsets as training sets to train the data prediction model, and inputting the i-th access data subset into the data prediction model to obtain the i-th evaluation function result of the data prediction model, wherein M is an integer greater than 0, and i is an integer greater than 0 and less than or equal to M; When the M evaluation function results meet the preset conditions, the trained data prediction model is obtained.
6. The method according to claim 5, It is characterized in that The step of using all the access data subsets except the i-th access data subset in the M access data subsets as training sets to train the data prediction model comprises: Perform T random sampling on the training set, and in each random sampling process, perform the following operations: collect n samples in the training set to obtain a sampling set containing n samples, wherein T is an integer greater than 0, and n is the same as the number of the reference access data contained in the training set; Establishing T data prediction sub-models, and making one-to-one correspondence between the T sampling sets and the T data prediction sub-models; The corresponding data prediction sub-model is trained using the sampling set, and the training process of the data prediction sub-model includes: In the case of being currently in the first node layer, according to the feature number, randomly determine the first feature set from the data features corresponding to each of the reference access data, wherein the number of feature types described in the data features in the feature set is the same as the feature number; establish candidate nodes of the second node layer according to the first feature set, and evaluate the candidate nodes using the first feature set to obtain evaluation results of the candidate nodes of the second node layer; determine the nodes of the second node layer according to the evaluation results of the candidate nodes of the second node layer; split the sampling set according to the nodes of the second node layer to obtain sampling subsets corresponding to the nodes of the second node layer; In the case of being currently in the p-th node layer, according to the feature number, randomly determine the q-th feature set from the sampling subsets corresponding to the nodes of the p-th node layer; establish the candidate nodes of the p+1-th node layer according to the q-th feature set, and use the q-th feature set to evaluate the candidate nodes of the p+1-th node layer to obtain the evaluation results of the candidate nodes of the p+1-th node layer; determine the nodes of the p+1-th node layer according to the evaluation results of the candidate nodes of the p+1-th node layer; split the sampling subsets corresponding to the nodes of the p-th node layer according to the nodes of the p+1-th node layer to obtain the sampling subsets corresponding to the nodes of the p+1-th node layer, wherein p is an integer greater than 1, and q is an integer greater than 1; When the number of the reference access data contained in the sampling subset corresponding to the nodes of the p+1th node layer is less than or equal to the preset number of data or p is greater than or equal to the preset number of layers, the model composed of the current p+1 node layer is determined as the data prediction sub-model; The T data prediction sub-models are integrated to obtain the data prediction model.
7. The method according to claim 3, It is characterized in that After obtaining the trained data prediction model, the method further includes: Acquire a third access data set of the target client within a third time period, and determine data features corresponding to each of a plurality of third access data in the third access data set; The parameters of the data prediction model are updated using the data features corresponding to the third access data set and the third access data to obtain the updated data prediction model.
8. A cache data adjustment device, It is characterized in that The device comprises: a data acquisition module, configured to acquire a first access data set of a target client within a first time period, and determine a data feature corresponding to at least one first access data in the first access data set, wherein the data feature is used to indicate a characteristic and an access mode of the first access data; A data prediction module, configured to input data features corresponding to the first access data set and the at least one first access data into a data prediction model to obtain a second access data set corresponding to the target client; The data cache module is used to obtain the second access data set and cache the second access data set.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Server management method and device, storage medium and program product
CN119828875A
Server management method and apparatus, storage medium, and program product
CN119828875B
