Cache data processing method and device, computer equipment and storage medium

By using a prediction model based on the self-attention mechanism in the calculation separation architecture, the data to be cached for prediction tasks is stored in advance, the problem of low cache hit rate is solved and the operation efficiency of the computing layer is improved.

CN119620945APending Publication Date: 2025-03-14CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411726503.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

In the memory separation architecture, the cache acceleration effect is not ideal, especially for data that only needs to be read once, the cache hit rate is relatively low, resulting in a decrease in the operation efficiency of the computing layer.

Method used

By obtaining the task-related data of the currently running task, input it into the pre-trained prediction model based on the self-attention mechanism, and output a list of data to be cached, including the cache probability of each data unit. Determine the target cache data based on these probabilities and store it in advance into the preset cache.

Benefits of technology

It improves the cache hit rate, improves the running speed and efficiency of the computing layer, and is suitable for big data scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119620945A_ABST
    Figure CN119620945A_ABST
Patent Text Reader

Abstract

The invention relates to a cache data processing method and device, computer equipment, a storage medium and a computer program product. The method comprises the steps of obtaining task related data of a current running task, and inputting the task related data into a pre-trained prediction model; the prediction model is a machine learning model which is obtained based on self-attention mechanism training and is used for determining correlation among the operation tasks; a to-be-cached data list for the next task is output through the prediction model, the to-be-cached data list comprises respective caching probabilities of a plurality of data units, and each data unit comprises a data table and a data path; and determining target cache data according to the to-be-cached data list, and storing the target cache data in a preset cache. By adopting the method, the hit rate of the cache can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a cache data processing method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] With the explosive growth of data volume, traditional storage and computing fusion architecture (such as Hadoop's HDFS) has gradually exposed bottlenecks in scalability and performance. Storage and computing separation technology separates the storage layer from the computing layer, allowing storage and computing to be independently expanded and managed, and can more flexibly respond to the needs of big data processing.

[0003] Since the storage layer is separated from the computing layer, the computing layer cannot effectively utilize the local affinity of data like the storage-computing integrated architecture. The data will spend more time in the data transmission process when it flows from the storage layer to the computing layer. The operating efficiency of the computing layer will be greatly reduced due to data IO, sacrificing the operating speed of the computing layer. In order to solve the performance problem of data access, many storage-computing separation architectures introduce a cache layer to cache hot data near the computing node to reduce data access latency.

[0004] Although adding a local cache layer to the computing node can speed up the computing speed, the cache acceleration based on the storage-computing separation architecture still has certain shortcomings. The current cache acceleration effect is only effective for cached data that is read repeatedly. For data that only needs to be read once, the cache acceleration effect cannot be felt, and the cache hit rate is low. Considering that in big data scenarios, most data only needs to be read once, the cache acceleration effect in the storage-computing separation scenario is not ideal, and the cache hit rate is usually low. Summary of the invention

[0005] Based on this, it is necessary to provide a cache data processing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the cache hit rate in response to the above technical problems.

[0006] In a first aspect, the present application provides a cache data processing method. The method comprises:

[0007] Obtaining task-related data of the currently running task, and inputting the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks;

[0008] Outputting a list of data to be cached for the next task through the prediction model, the list of data to be cached including cache probabilities of each of a plurality of data units, the data units including a data table and a data path;

[0009] The target cache data is determined according to the list of data to be cached, and the target cache data is stored in a preset cache.

[0010] In one embodiment, before inputting the task-related data into the pre-trained prediction model, the method further includes:

[0011] Determine training tasks, and obtain task-related data for each of the training tasks;

[0012] Generating an input matrix for each of the training tasks according to the task-related data of each of the training tasks, and inputting the input matrix for each of the training tasks into the prediction model;

[0013] Outputting a predicted list of data to be cached for the next task through the prediction model;

[0014] Determine a true label corresponding to a next task, determine a loss based on the true label and the predicted to-be-cached data list for the next task, and adjust a model parameter of the prediction model based on the loss.

[0015] In one embodiment, generating an input matrix for each of the training tasks according to the task-related data for each of the training tasks includes:

[0016] Obtaining a task identifier, a data table identifier, a numerical feature of the amount of table data, and a time feature of the task execution time of the training task;

[0017] Encoding the task identifier and the data table identifier to obtain a feature vector of the task identifier and a feature vector of the data table identifier;

[0018] The feature vector of the task identifier, the feature vector of the data table identifier, the numerical feature of the table data volume and the time feature of the task execution time are concatenated to obtain the input matrix of the training task.

[0019] In one embodiment, the training task is stored in a training task list; and outputting a predicted list of data to be cached for the next task through the prediction model includes:

[0020] For the current training task in the training task list, the input matrix of the current training task and the position encoding of the input matrix of the current training task are input into the trained prediction model, and the input matrix of the current training task and the position encoding of the input matrix of the current training task are processed through the trained prediction model and based on the self-attention mechanism to obtain a predicted list of data to be cached for the next task.

[0021] In one embodiment, the method further comprises:

[0022] Determine, according to the list of data to be cached, candidate cache data to be eliminated in the preset cache;

[0023] Determine target cache data to be eliminated in the preset cache according to the list of data to be cached and the candidate cache data to be eliminated;

[0024] The target cache data is deleted from the preset cache.

[0025] In one embodiment, determining the target cache data to be eliminated in the preset cache according to the list of data to be cached and the candidate cache data to be eliminated includes:

[0026] Determine the hot data probability of the candidate cache data to be eliminated according to the list of data to be cached;

[0027] Determine the cache time of the candidate cache data for elimination;

[0028] Determine the elimination probability of the candidate eliminated cache data according to the hot data probability and the cache time;

[0029] According to the elimination probability of each candidate elimination data, target elimination cache data is determined.

[0030] In a second aspect, the present application also provides a cache data processing device. The device comprises:

[0031] A data acquisition module, used to acquire task-related data of the currently running task, and input the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks;

[0032] A model prediction module, used to output a list of data to be cached for the next task through the prediction model, wherein the list of data to be cached includes cache probabilities of each of a plurality of data units, wherein the data units include a data table and a data path;

[0033] The cache storage module is used to determine target cache data according to the list of data to be cached, and store the target cache data in a preset cache.

[0034] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any cache data processing method in the embodiments of the present application is implemented.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, any cache data processing method in the embodiments of the present application is implemented.

[0036] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, any cache data processing method in the embodiments of the present application is implemented.

[0037] The above-mentioned cache data processing method, device, computer equipment, storage medium and computer program product can input the task-related data of the currently running task into the prediction model by acquiring the task-related data of the currently running task. Since the prediction model is a pre-trained machine learning model, the prediction model can learn the dependencies between tasks through training. Therefore, when the prediction model acquires the task-related data of the currently running task, it can output the list of data to be cached for the next task based on the task-related data of the currently running task and the learned knowledge. Since the list of data to be cached includes the cache probabilities of each of the multiple data units, the target cache data in the list of data to be cached can be determined according to the cache probability. The target cache data is the data that the next task is about to access as determined by the prediction model. Therefore, caching the target cache data in the preset cache in advance can improve the hit rate of the data in the preset cache. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 An application environment diagram of a cache data processing method in one embodiment;

[0039] Figure 2 A schematic diagram of a flow chart of a cache data processing method in one embodiment;

[0040] Figure 3 A schematic diagram of an intelligent cache acceleration system in one embodiment;

[0041] Figure 4 A schematic diagram of the overall workflow of an intelligent cache acceleration system in one embodiment;

[0042] Figure 5 A schematic diagram of a computing storage device data bus architecture module in one embodiment;

[0043] Figure 6 It is a structural block diagram of a cache data processing device in one embodiment;

[0044] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] The cache data processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the computing node 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. The database deployed in the server 104 can store a data table, and the data in the data table can be pre-cached in a preset cache. When the computing node 102 executes the running task, it can read the data from the cache first, and then read the data from the database if the data is not read. Among them, the computing node 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0047] In one embodiment, Figure 2 As shown, a cache data processing method is provided, which is applied to Figure 1 The following steps are taken as an example to illustrate the computing node in the example:

[0048] Step 202, obtain task-related data of the currently running task, and input the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks.

[0049] Specifically, the computing node can obtain the task-related data of the currently running task. The currently running task refers to the currently running task, for example, the currently executed SQL statement can be considered as the currently running task. Task-related data refers to data related to the running task, for example, it can be the task identifier of the currently running task, the input table identifier of the currently running task, the table data volume of the input table, the task execution time, etc. The input table identifier refers to the identifier of the data table where the data needs to be input. Further, when the task-related data of the currently running task is determined, the task-related data of the currently running task can be input into the pre-trained prediction model. Among them, the prediction model refers to a machine learning model trained based on the self-attention mechanism for determining the correlation between each running task. For example, the prediction model can be specifically a Transformer model. The Transformer model is a neural network architecture based on a self-attention mechanism. The model was originally designed to improve machine translation tasks. It processes sequence data through an attention mechanism and can process all elements in the sequence in parallel, greatly improving the training efficiency of the model. The present application predicts the next running task based on Transformer.

[0050] In one of the embodiments, the task execution time of the currently running task can be determined based on the time taken to execute the currently running task previously.

[0051] Step 204: Use the prediction model to output a list of data to be cached for the next task. The list of data to be cached includes cache probabilities of multiple data units. The data units include data tables and data paths.

[0052] Specifically, when the task-related data of the currently running task is input into the prediction model, the prediction model can process the input data and output a list of data to be cached. The list of data to be cached includes the cache probabilities of multiple data units, and each data unit includes a data table and a data path. The cache probability of a data unit refers to the probability that the next task will process the data under the corresponding data path in the data table, that is, the probability that the next task needs to obtain the data under the corresponding data path in the data table in the cache. The next task refers to the next task to be executed after the current running task is completed.

[0053] For example, when the task-related data of the currently running task is input into the prediction model, the prediction model can output a list of data to be cached. ,in, That is, a data unit represents the cache probability of the i-th table and its data path obtained by the prediction model. The data path refers to the partition in the data table. The prediction model can not only predict the data table that needs to be processed by the next task, but also predict which partitions of the data in the data table need to be processed by the next task. Therefore, in this embodiment, the prediction model will output the data table and data path as a whole, and output the cache probability of the whole. The prediction model can sort the cache probability of each data unit from high to low according to the cache probability to obtain a list of data to be cached. .

[0054] In one of the embodiments, since the prediction model is a machine learning model obtained by pre-training, the prediction model can learn the dependencies between tasks through training. Therefore, when the prediction model obtains the task-related data of the currently running task, the dependencies between each candidate task in the preset candidate task set and the currently running task can be determined based on the task-related data of the currently running task, and the probability value of each candidate task being the next task of the currently running task can be determined based on the dependency. Since each candidate task corresponds to a data table and a data path, the probability value of the candidate task being the next task can be used as the cache probability of the data table and data path corresponding to the candidate task. By combining the cache probabilities of each data table and data path, a list of data to be cached for the next task can be obtained. The data table and data path corresponding to the candidate task refer to the data table that needs to be processed when the candidate task is executed and the partition where the data to be processed in the data table is located, which are determined in the data collection stage.

[0055] Step 206: determine target cache data according to the list of data to be cached, and store the target cache data in a preset cache.

[0056] Specifically, the computing node can determine the target cache data based on the list of data to be cached output by the prediction model. For example, the computing node can extract the first N data units from the cache data list and use the extracted data units as the target data units. For each target data unit, since the target data unit includes a data table and a data path, the data under the data path in the data table can be used as the target cache data. Furthermore, the computing node determines whether the target cache data exists in the preset cache. If the target cache data does not exist, the target cache data is read from the database and the read target cache data is stored in the preset cache. The preset cache can be a local cache of the computing node.

[0057] In the above cache data processing method, by obtaining the task-related data of the currently running task, the task-related data of the currently running task can be input into the prediction model. Since the prediction model is a pre-trained machine learning model, the prediction model can learn the dependencies between tasks through training. Therefore, when the prediction model obtains the task-related data of the currently running task, it can output a list of data to be cached for the next task based on the task-related data of the currently running task and the learned knowledge. Since the list of data to be cached includes the cache probabilities of multiple data units, the target cache data in the list of data to be cached can be determined according to the cache probability. The target cache data is the data that the next task is about to access as determined by the prediction model. Therefore, caching the target cache data in the preset cache in advance can improve the hit rate of the data in the preset cache.

[0058] In one embodiment, the above method also includes a prediction model training process, which includes: determining training tasks and obtaining task-related data for each training task; generating an input matrix for each training task based on the task-related data for each training task, and inputting the input matrix for each training task into the prediction model; outputting a predicted list of data to be cached for the next task through the prediction model; determining a true label corresponding to the next task, determining a loss based on the true label and the predicted list of data to be cached for the next task, and adjusting the model parameters of the prediction model based on the loss.

[0059] Specifically, the computing node can determine the training tasks and obtain the task-related data of each training task. The training tasks may be some tasks that have been executed, for example, using the executed SQL statements as training tasks. The task-related data of the training tasks may also include task identifiers, input table identifiers, output table identifiers, the amount of table data in the input table, task execution time, and the like. Furthermore, the computing node generates the input matrices of each training task according to the task-related data of each training task, and determines the position codes of each input matrix, and inputs each input matrix and the position codes of each input matrix into the prediction model that needs to be trained. The prediction model can output the prediction results, determine the loss based on the prediction results and the true labels, and adjust the model parameters of the prediction model based on the loss.

[0060] In one of the embodiments, the execution order of each training task can be determined based on task-related data, and the position code of the input matrix can be determined according to the execution order. Alternatively, the input matrices of each training task can be sorted according to the execution order of the training tasks to obtain a matrix sequence, and the position code can be generated according to the position of each input matrix in the matrix sequence.

[0061] In the above embodiment, by training the prediction model, the prediction model can learn the dependencies between the tasks, so that the subsequent prediction model can output more accurate results based on the learned knowledge.

[0062] In one of the embodiments, an input matrix for each training task is generated based on the task-related data of each training task, including: obtaining the task identifier, data table identifier, numerical characteristics of the table data volume, and time characteristics of the task execution time of the training task; encoding the task identifier and the data table identifier to obtain a feature vector of the task identifier and a feature vector of the data table identifier; concatenating the feature vector of the task identifier, the feature vector of the data table identifier, the numerical characteristics of the table data volume, and the time characteristics of the task execution time to obtain the input matrix of the training task.

[0063] Specifically, for each training task, the computing node can obtain the task identifier, data table identifier, numerical features of the table data volume, and time features of the task execution time of the training task, and generate a fixed-dimensional feature vector through the category index to represent the features of the task identifier or the data table identifier. Furthermore, the computing node concatenates the feature vector of the task identifier, the feature vector of the data table identifier, the numerical features of the table data volume, and the time features of the task execution time to obtain the input matrix of the training task.

[0064] In one embodiment, the feature vector of the task identifier or the feature vector of the data table identifier may be generated in the following manner:

[0065]

[0066] Where E is the embedding matrix and x is the task identifier or data table identifier.

[0067] In one embodiment, the input matrix of the training task can be ,in, is the feature vector of the task identifier, Characteristic vectors for data table identification, is the numerical feature of the table data volume, It is the time characteristic of task execution time.

[0068] In the above embodiment, by generating an input matrix, data that can be recognized by the prediction model can be obtained, and then the prediction model can be trained through the input matrix. And because the input matrix contains rich task information, the prediction model can deeply explore the dependency relationship between tasks through the rich task information, thereby achieving better training effect.

[0069] In one embodiment, the training tasks are stored in a training task list; a predicted list of data to be cached for the next task is output through a prediction model, including: for a current training task in the training task list, an input matrix of the current training task and a position encoding of the input matrix of the current training task are input into the trained prediction model; the input matrix of the current training task and the position encoding of the input matrix of the current training task are processed through the trained prediction model and based on a self-attention mechanism to obtain a predicted list of data to be cached for the next task.

[0070] Specifically, the training tasks are stored in the training task list, which is a list arranged in the order of execution of each training task. It is easy to understand that the training task list contains the execution order between the training tasks; further, since each training task corresponds to an input matrix, an input matrix sequence can be obtained according to the order of the training tasks in the training task list. The input matrices and corresponding position codes in the input matrix sequence are sequentially input into the prediction model. For the input matrix and position code of the current input, the prediction model can perform self-attention processing on the input matrix and position code of the current input, and obtain a predicted list of data to be cached for the next task based on the training task corresponding to the input matrix of the current input. That is, when the training task corresponding to the input matrix of the current input is used as the currently running task, a predicted list of data to be cached for the next task is obtained.

[0071] Furthermore, the computing node can obtain the true label. For example, since the training task sequence contains the execution order of each task, when the training task corresponding to the currently input input matrix is ​​used as the currently running task, the true next executed task can be determined based on the training task sequence, and the data table and data table path executed by the true next executed task can be used as the true label. After obtaining the true label, the loss can be determined based on the true label and the list of predicted data to be cached for the next task, and the model parameters of the prediction model can be adjusted through the loss.

[0072] In one embodiment, the overall training process of the prediction model may be as follows:

[0073] Step 1: Task and cache operation data collection, cleaning, and preprocessing:

[0074] Collection layer: Add data points in big data computing platforms (such as Spark, Hive, etc.) and cache layer components (such as Alluxio, JuiceFS, etc.) to timely export the characteristics and metadata information of the currently running tasks and their paths, and aggregate them into unified storage to form the original training data. The data to be calculated includes

[0075] (1) Catalog table metadata (table ID, table name, column name, storage path, etc.); (2) Task running data (task ID, input table name, output table name, start timestamp, end timestamp, etc.); (3) Cache layer data loading information (cache path name, start loading timestamp, completion loading timestamp, data volume, etc.).

[0076] Cleaning layer: Complete steps such as type check, range check, and data validity check for each field data to ensure the quality of the collected data.

[0077] Preprocessing layer: Completes feature extraction and encoding of collected data. Converts features in the task sequence into an input format that can be processed by the model, and the final representation is a feature vector.

[0078] Step 2: Fit the task table sequence features and train the prediction model:

[0079] Input layer: Construct a training task sequence and use the input matrix of each sequence node as the model input.

[0080] Model training layer: Build a prediction model based on the Transformer model to predict the input table and path of the next task. The steps for training the Transformer-based prediction model are as follows:

[0081] (1) Input embedding representation:

[0082] All feature embedding representations of a single training task (task ID, data table ID, numerical features of table data volume, and time features of execution time) are concatenated to form the input matrix X:

[0083] (2) Positional encoding:

[0084] Add positional encodings to the input sequence to preserve sequence information:

[0085]

[0086]

[0087] Among them, pos is the position, i is the dimension index, is the embedding dimension.

[0088] (3) Self-attention mechanism:

[0089] Calculate the query, key, and value matrix and capture the correlation between tasks through the self-attention mechanism:

[0090]

[0091] in, , , is the linear transformation matrix, is the dimension of the key.

[0092]

[0093] (4) Feedforward network:

[0094] Perform a feed-forward network on each attention output:

[0095] in, , is the weight matrix, , is the bias, and x is the input matrix X mentioned above.

[0096] (5) Layer normalization and residual connection:

[0097] Add layer normalization and residual connections after each layer:

[0098]

[0099]

[0100] (6) Probability output:

[0101] The output of Transformer is linearly transformed and softmax is used to obtain the probability distribution of the data table location required to be read for the next task.

[0102]

[0103] Among them, H is the output of Transformer, is the linear transformation matrix, is bias.

[0104] Evaluation layer: The Transformer model is used to calculate the predicted probability of the next node in the sequence when a certain feature sequence node appears. The same cross entropy loss function is used for both prediction and model training to measure the accuracy of model prediction:

[0105]

[0106] in, is the true label, is the predicted probability.

[0107] In one embodiment, in actual production applications, the prediction model generated from the model training layer predicts the next possible task list based on the current task sequence node and gives the probability of each node. Based on the predicted probability, the hotspot data estimation is calculated and executed:

[0108] This is the core task of cache loading, that is, based on the current running task characteristics and time series characteristics, the model is used to calculate and give the subsequent list of data to be cached, and the different data in the list of data to be cached are sorted by probability for data cache preheating scheduling. Among them, the list of data to be cached (PredList) is determined based on the TopN algorithm.

[0109]

[0110] in, is the cache probability of the i-th table and its path obtained through the cache prediction model.

[0111] In one of the embodiments, the above method also includes: determining candidate cache data to be eliminated in the preset cache based on the list of data to be cached; determining target cache data to be eliminated in the preset cache based on the list of data to be cached and the candidate cache data to be eliminated; and deleting the target cache data to be eliminated from the preset cache.

[0112] Specifically, when the cache space of the preset cache is insufficient or the batch task ends, a cache elimination prediction can be performed for the data in the preset cache. The computing node determines the candidate cache data to be eliminated in the preset cache based on the list of data to be cached. For example, the computing node identifies a preset number of data tables in the preset cache with the lowest probability of being used by the next task based on the list of data to be cached. For example, the computing node identifies the T data tables in the preset cache with the lowest probability of being used by the next task, and sorts these T data tables in order from low to high in terms of the probability of being used by the next task to obtain a reverse data table. Furthermore, the computing node uses the data stored in the preset cache in these T data tables as candidate cache data to be eliminated. Among them, T is a positive integer greater than 0, and the specific value can be freely set according to demand.

[0113] Furthermore, the computing node determines the elimination probability of each candidate cached data according to the cache probability of each data unit in the cached data list and the order of each data table in the reverse data table. The preset number of candidate eliminated data with the highest elimination probability is used as the target eliminated data, and the target eliminated data is deleted from the preset cache.

[0114] In this embodiment, the target elimination data is determined in order of elimination probability from high to low, so that the data finally eliminated in the preset cache is the data least likely to be used by the next task, thereby reducing the probability of data to be used by the next task being eliminated and improving the cache hit rate.

[0115] In one of the embodiments, target cache data to be eliminated in a preset cache is determined based on a list of data to be cached and candidate cache data to be eliminated, including: determining the hot data probability of the candidate cache data to be eliminated based on the list of data to be cached; determining the cache time of the candidate cache data to be eliminated; determining the elimination probability of the candidate cache data to be eliminated based on the hot data probability and the cache time; and determining the target cache data to be eliminated based on the elimination probability of each candidate data to be eliminated.

[0116] Specifically, for each candidate eliminated data, the cache probability of the data table where the candidate eliminated data is located is used as the hot data probability of the candidate eliminated data. For example, for candidate eliminated data Ci, if Ci is in the data table Ti, and the cache probability of the data unit containing the data table Ti output by the prediction model is K, then the hot data probability of the candidate eliminated data Ci is also K. Further, the computing node determines the time when each candidate eliminated cache data is cached in the preset cache, uses the time as the cache time, and determines the elimination probability of each candidate eliminated cache data according to the hot data probability and cache time of each candidate eliminated cache data. The computing node selects the target eliminated cache data from the candidate eliminated cache data in order of elimination probability from high to low.

[0117] In one of the embodiments, the computing node may also determine the elimination probability of each data table in the reverse data table, select a preset data table in order of elimination probability from high to low, and delete the data in the selected data table from the preset cache. For example, for data table Ti, the cache probability of the data unit containing data table Ti output by the prediction model is K, and the hot data probability of data table Ti is also K. The computing node determines the elimination probability of each data table in the reverse data table based on the time when each data table in the reverse data table is cached in the preset cache and the hot data probability of each data table in the reverse data table. It is easy to understand that the elimination probability of a data table and the elimination probability of cached data in the data table may be consistent.

[0118] In one of the embodiments, when the cache is insufficient or the batch task ends, it is necessary to perform cache elimination prediction for the data in the current cache system. Timely identify and process the N tables with the lowest probability of use and their cached data. This process needs to sort the T tables and their cached data stored in the current cache layer in reverse order based on the prediction results of the current sequence. At the same time, the LRU (Least Recently Used) algorithm is combined for weighted calculation to obtain the elimination probability, and the N tables with the highest elimination probability and their cached data are deleted or migrated in time. The cache data to be cleaned up can be identified by the following formula:

[0119]

[0120]

[0121] Among them, cache data Belongs to the current cache data set C, The data obtained by caching the prediction model The predicted probability (hotspot data probability), The order of the currently cached data to be eliminated (the earlier the order, the older the data). , Preset weights respectively.

[0122] In one of the embodiments, an intelligent cache acceleration system for storage and computing separation scenarios is provided, which can help realize cache data prediction, preheating scheduling, cache elimination and other capabilities in storage and computing separation scenarios. The detailed module design of the intelligent cache acceleration system can be referred to Figure 3 , including the functions and execution processes of each module, and the interaction processes between modules. The intelligent cache acceleration system includes the following modules: cache information collector, cache model fitter, cache data predictor, dynamic cache scheduler, and cache storage module, a total of 5 parts.

[0123] Cache Information Collector: Module functions: 1. Collect information related to cache usage, including cache hit rate, data access frequency, data size, access timestamp, etc. 2. Monitor the execution of tasks and record the data access pattern of each task. Execution process of cache information collector: 1. Obtain data access logs from the data cache layer (such as Alluxio, Juicefs) and the computing layer (such as Spark, an offline log collection tool). 2. Record the number of accesses, the most recent access time, and other information for each data block. 3. Pass the collected information to the cache model fitter.

[0124] Cache Model Fitter: Module functions: 1. Fit cache access patterns using machine learning or statistical models based on collected cache information. 2. Use the Transformer model to predict data table location and access frequency. Execution process: 1. Receive information from the cache information collector. 2. Use historical data to train the Transformer model to learn the access pattern of the task. 3. Output a prediction model and pass it to the cache data predictor.

[0125] Cache Data Predictor: Module functions: 1. Predict data access for the task to be run based on the model provided by the cache model fitter. 2. Predict the data that is most likely to be accessed in the future. Execution process: 1. Receive the prediction model provided by the cache model fitter. 2. Predict the data table location and data block that will be accessed in the future based on the task to be run and the historical access pattern (the data table location and data block are also the above-mentioned data units). 3. Pass the prediction results to the dynamic cache scheduler.

[0126] Dynamic Cache Scheduler: Module functions: 1. Dynamically schedule cache resources based on the prediction results of the cache data predictor. 2. Implement operations such as data preheating, cache elimination, and cache expansion. Execution process: 1. Receive the prediction results of the cache data predictor. 2. Determine which data needs to be loaded into the cache in advance (data preheating). 3. Based on the cache capacity and current load, decide whether to eliminate old data or expand the cache. 4. Orchestrate tasks such as cache data loading and elimination, and hand them over to the cache storage executor for actual operation.

[0127] Cache Storage Executor: Module functions: 1. Actually store cache data and provide fast data reading capabilities. 2. Interact with the storage layer and computing layer to provide data access interfaces. Execution process: 1. Receive instructions from the dynamic cache scheduler to load or eliminate data. 2. Provide data read and write interfaces for computing tasks.

[0128] Based on the five modules divided above, the overall workflow of the system can be referred to Figure 4 ,as follows:

[0129] Step 401, information collection: the cache information collector continuously collects cache and task related information.

[0130] Step 402, model fitting: The cache model fitter periodically uses the collected information to train and update the prediction model.

[0131] Step 403, data prediction: before the task is about to be executed, the cache data predictor uses the prediction model to predict the data required for the task.

[0132] Step 404, cache scheduling: The dynamic cache scheduler arranges data preheating, cache elimination, and expansion operations according to the prediction results.

[0133] Step 405, data storage: The cache storage executor is responsible for specific data loading, elimination, reading and writing operations to ensure that the task can quickly access data.

[0134] The intelligent cache acceleration system for storage and computing separation scenarios proposed in the embodiment of the present application rationally analyzes the functions of the cache acceleration system and reasonably divides it into five modules: cache information collector, cache model fitter, cache data predictor, dynamic cache scheduler, and cache storage executor. Through the cooperation of the various modules of the system, it can be used to achieve efficient cache acceleration.

[0135] In one of the embodiments, in order to make the cache data more in line with the actual needs of task operation, considering the size of the table data corresponding to different tasks, the frequency of use and other factors, a device containing only a single storage medium is difficult to meet the needs of cache dynamic scheduling. Herein, a computing storage device integrating multiple cache media is designed, and a four-level cache medium is introduced into it by transforming the data bus. The device can be designed specifically for task computing in a storage and computing separation scenario. It can achieve efficient use of storage resources by utilizing the differences in capacity and performance of multiple storage media while ensuring the locality of task computing.

[0136] The computing storage device data bus architecture module can refer to Figure 5 :

[0137] Central Processing Unit (CPU): Instruction control unit, used to initiate computing task scheduling and control instructions. Graphics Processing Unit (GPU): Graphics computing unit, dedicated to data image computing and processing. Data Bus: High-speed data bus, capable of supporting PCIe or NVMe protocols, enabling the connection and dynamic expansion of multiple cache media. Cache Controller: Cache control unit, responsible for managing and coordinating data allocation and scheduling of each cache medium.

[0138] Cache media (four-level cache): DRAM: As the running data cache layer, it has the fastest speed and small capacity, and is suitable for storing active data in operation. NVM (Non-Volatile Memory): It stores hot data, has a fast speed and medium capacity, and is suitable for storing frequently accessed data. SSD: It stores warm data, has a moderate speed and large capacity, and is suitable for storing data that is not frequently accessed but still has a certain access frequency. HDD: It stores cold data, has a slow speed and the largest capacity, and is suitable for storing rarely accessed data.

[0139] Finally, by transforming the data bus, the computing storage device needs to include multiple modules such as the central processing unit (CPU), graphics processing unit (GPU), cache controller, cache media (DRAM, NVM, SSD, HDD), etc. By utilizing the characteristics of not using cache media, the device model can not only perform CPU-based calculations and acceleration of a small amount of hot data, but also provide GPU-based large-volume data calculations and persistent accelerated access capabilities. By identifying the characteristics of hot data and accelerating it to specific media, cache scheduling will be more accurate.

[0140] The storage and computing device that integrates multiple cache media proposed in the embodiment of the present application transforms the data bus of the existing storage and computing device, introduces multiple cache media (DRAM, NVM, SSD, HDDss), and utilizes the different access speeds and capacities of different cache media to make the scheduling of hot data more accurate. In the scenario of storage and computing separation, for big data processing and deep learning applications, the device can provide integrated customization, elastic scalability, flexible and efficient cache acceleration and computing services.

[0141] In one specific embodiment, a cache data processing method is provided, including:

[0142] Determine the training tasks and obtain the task-related data of each training task; obtain the task identifier, data table identifier, numerical characteristics of the table data volume and time characteristics of the task execution time of the training task.

[0143] The task identifier and the data table identifier are encoded to obtain a feature vector of the task identifier and a feature vector of the data table identifier.

[0144] The feature vector of the task identifier, the feature vector of the data table identifier, the numerical features of the table data volume and the time features of the task execution time are concatenated to obtain the input matrix of the training task, and the input matrix of each training task is input into the prediction model.

[0145] The training tasks are stored in the training task list; for the current training task in the training task list, the input matrix of the current training task and the position encoding of the input matrix of the current training task are input into the trained prediction model, and the input matrix of the current training task and the position encoding of the input matrix of the current training task are processed based on the self-attention mechanism to obtain a predicted list of cached data for the next task.

[0146] Determine the true label corresponding to the next task, determine the loss based on the true label and the predicted cached data list for the next task, and adjust the model parameters of the prediction model based on the loss.

[0147] The task-related data of the currently running task is obtained, and the task-related data is input into a pre-trained prediction model; the prediction model is a machine learning model trained based on the self-attention mechanism for determining the correlation between the running tasks.

[0148] The prediction model is used to output a list of data to be cached for the next task, where the list of data to be cached includes the cache probabilities of multiple data units, and the data units include data tables and data paths; target cache data is determined based on the list of data to be cached, and the target cache data is stored in a preset cache.

[0149] According to the list of data to be cached, determine the candidate cache data to be eliminated in the preset cache; according to the list of data to be cached, determine the hot data probability of the candidate cache data to be eliminated.

[0150] Determine the cache time of candidate cache data to be eliminated; determine the elimination probability of candidate cache data to be eliminated according to the probability of hot data and cache time; determine the target cache data to be eliminated according to the elimination probability of each candidate data to be eliminated; and delete the target cache data to be eliminated from the preset cache.

[0151] The embodiment of the present application proposes an intelligent acceleration cache acceleration algorithm based on the Transformer mechanism. The Transformer self-attention mechanism is used to deeply explore the complex dependencies between computing tasks and accurately predict the table sequence corresponding to the task. Based on this cache loading model, it can be used to timely identify and load hot data, filter and eliminate cache data, improve cache hit rate, achieve the improvement of task operation speed, optimize cache resource utilization, and reduce storage access costs, and has high application value.

[0152] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0153] Based on the same inventive concept, the embodiment of the present application also provides a cache data processing device for implementing the cache data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more cache data processing device embodiments provided below can refer to the limitations of the cache data processing method above, and will not be repeated here.

[0154] In one embodiment, Figure 6 As shown, a cache data processing device 600 is provided, comprising: a data acquisition module 602, a model prediction module 604 and a cache storage module 606, wherein:

[0155] The data acquisition module 602 is used to acquire task-related data of the currently running task and input the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks;

[0156] A model prediction module 604, configured to output a list of data to be cached for the next task through a prediction model, wherein the list of data to be cached includes cache probabilities of each of a plurality of data units, and the data unit includes a data table and a data path;

[0157] The cache storage module 606 is used to determine target cache data according to the list of data to be cached, and store the target cache data in a preset cache.

[0158] In one embodiment, the cache data processing device 600 also includes a model training module, which is used to determine training tasks and obtain task-related data of each training task; generate an input matrix of each training task according to the task-related data of each training task, and input the input matrix of each training task into the prediction model; output a predicted list of data to be cached for the next task through the prediction model; determine the true label corresponding to the next task, determine the loss based on the true label and the predicted list of data to be cached for the next task, and adjust the model parameters of the prediction model based on the loss.

[0159] In one of the embodiments, the model training module is also used to obtain the task identifier, data table identifier, numerical characteristics of the table data volume, and time characteristics of the task execution time of the training task; encode the task identifier and the data table identifier to obtain a feature vector of the task identifier and a feature vector of the data table identifier; and concatenate the feature vector of the task identifier, the feature vector of the data table identifier, the numerical characteristics of the table data volume, and the time characteristics of the task execution time to obtain an input matrix of the training task.

[0160] In one embodiment, the training tasks are stored in a training task list; the model training module is also used to input the input matrix of the current training task and the position encoding of the input matrix of the current training task into the trained prediction model for the current training task in the training task list, and process the input matrix of the current training task and the position encoding of the input matrix of the current training task based on the self-attention mechanism to obtain a predicted list of cached data for the next task.

[0161] In one of the embodiments, the cache storage module is also used to determine candidate cache data to be eliminated in the preset cache based on the list of data to be cached; determine target cache data to be eliminated in the preset cache based on the list of data to be cached and the candidate cache data to be eliminated; and delete the target cache data to be eliminated from the preset cache.

[0162] In one of the embodiments, the cache storage module 606 is also used to determine the hot data probability of candidate cache data for elimination based on the list of data to be cached; determine the cache time of the candidate cache data for elimination, and determine the elimination probability of the candidate cache data for elimination based on the hot data probability and the cache time; and determine the target cache data for elimination based on the elimination probability of each candidate data for elimination.

[0163] Each module in the cache data processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0164] In one embodiment, a computer device is provided. The computer device may be a computing node, and the computing node may be a terminal. The internal structure diagram thereof may be as follows: Figure 7As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a cache data processing method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0165] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0166] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, any cache data processing method in the embodiments of the present application is implemented.

[0167] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any cache data processing method in the embodiments of the present application is implemented.

[0168] In one embodiment, a computer program product is provided, including a computer program, which implements any cache data processing method in the embodiments of the present application when executed by a processor.

[0169] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0170] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0171] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0172] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A cache data processing method, characterized in that: The method comprises: Obtaining task-related data of the currently running task, and inputting the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks; Outputting a list of data to be cached for the next task through the prediction model, the list of data to be cached including cache probabilities of each of a plurality of data units, the data units including a data table and a data path; The target cache data is determined according to the list of data to be cached, and the target cache data is stored in a preset cache.

2. The method according to claim 1, characterized in that Before inputting the task-related data into the pre-trained prediction model, the method further includes: Determine training tasks, and obtain task-related data for each of the training tasks; Generating an input matrix for each of the training tasks according to the task-related data of each of the training tasks, and inputting the input matrix for each of the training tasks into the prediction model; Outputting a predicted list of data to be cached for the next task through the prediction model; Determine a true label corresponding to a next task, determine a loss based on the true label and the predicted to-be-cached data list for the next task, and adjust a model parameter of the prediction model based on the loss.

3. The method according to claim 2, characterized in that Generating an input matrix for each training task according to the task-related data of each training task includes: Obtaining a task identifier, a data table identifier, a numerical feature of the amount of table data, and a time feature of the task execution time of the training task; Encoding the task identifier and the data table identifier to obtain a feature vector of the task identifier and a feature vector of the data table identifier; The feature vector of the task identifier, the feature vector of the data table identifier, the numerical feature of the table data volume and the time feature of the task execution time are concatenated to obtain the input matrix of the training task.

4. The method according to claim 2, characterized in that: The training task is stored in a training task list; the predicted data list to be cached for the next task is outputted by the prediction model, including: For the current training task in the training task list, the input matrix of the current training task and the position encoding of the input matrix of the current training task are input into the trained prediction model, and the input matrix of the current training task and the position encoding of the input matrix of the current training task are processed through the trained prediction model and based on the self-attention mechanism to obtain a predicted list of data to be cached for the next task.

5. The method according to claim 1, characterized in that The method further comprises: Determine, according to the list of data to be cached, candidate cache data to be eliminated in the preset cache; Determine target cache data to be eliminated in the preset cache according to the list of data to be cached and the candidate cache data to be eliminated; The target cache data is deleted from the preset cache.

6. The method according to claim 5, characterized in that The step of determining target cache data to be eliminated in the preset cache according to the list of data to be cached and the candidate cache data to be eliminated includes: Determine the hot data probability of the candidate cache data to be eliminated according to the list of data to be cached; Determine the cache time of the candidate cache data for elimination; Determine the elimination probability of the candidate eliminated cache data according to the hot data probability and the cache time; According to the elimination probability of each candidate elimination data, target elimination cache data is determined.

7. A cache data processing device, characterized in that: The device comprises: A data acquisition module, used to acquire task-related data of the currently running task, and input the task-related data into a pre-trained prediction model; the prediction model is a machine learning model trained based on a self-attention mechanism for determining the correlation between the running tasks; A model prediction module, used to output a list of data to be cached for the next task through the prediction model, wherein the list of data to be cached includes cache probabilities of each of a plurality of data units, wherein the data units include a data table and a data path; The cache storage module is used to determine target cache data according to the list of data to be cached, and store the target cache data in a preset cache.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Block level cache prefetching optimization method and system based on deep learning

    CN110245094A

  • Method and device for realizing cache data scheduling

    CN110334036A

  • Cache management method, device and equipment

    CN114817319A

  • Virtual machine boot data prediction

    US20210182075A1

Cited By

  • Solid state disk state information prediction model training method, prediction method and device

    CN120821647A