A function-priority-based serverless computing scheduling method
By constructing a serverless computing scheduling method based on function priority, utilizing an improved Spearman rank correlation coefficient and a hybrid Prophet-LightGBM prediction model, combined with a deep reinforcement learning Q-network, and dynamically managing the container pool and scheduling function requests, the problem of neglecting function priority and resource characteristics in serverless computing is solved, and the system response latency is minimized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN BUSINESS UNIV
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-12
AI Technical Summary
Existing serverless computing technologies fail to effectively consider the different priorities and resource characteristics of functions, resulting in the inability to minimize overall response latency and significant cold start latency.
By acquiring historical function execution data, we calculate the improved Spearman rank correlation coefficient and couple it with corrected objective weights to construct a function priority model. Combining the hybrid Prophet-LightGBM prediction model and deep reinforcement learning Q-network, we dynamically manage the container pool and schedule function requests to optimize resource allocation.
It significantly reduced the overall system response latency, ensured that high-value requests were prioritized, enabled elastic scaling and real-time decision-making for the container pool, and optimized resource allocation.
Smart Images

Figure CN122195593A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to function scheduling methods, belonging to the field of cloud computing technology, and particularly to a serverless computing scheduling method based on function priority. Background Technology
[0002] Serverless computing extends state-of-the-art cloud computing technologies, freeing developers from the need to configure and manage servers, fault tolerance and scaling of containers, maintenance of virtual machines or physical servers. Serverless computing has propelled Function as a Service (FaaS) to become a popular cloud service model, typically associated with building microservice applications and allowing users to execute code in response to events without complex infrastructure, gaining increasing popularity among developers and users. In FaaS, when a function request arrives, the system checks if a container is ready to service the call. When an idle container is available, it's called a hot start; if no container is ready, the function starts a new container (cold start). Because a cold start requires creating a container, fetching and installing necessary libraries and dependencies before the function itself can execute, cold start latency is typically several times or even tens of times higher than a hot start.
[0003] However, all innovations in existing technologies focus on reducing the total number of cold starts without considering the different priorities of functions and their varying impacts on overall system latency. Measurements show that simply reducing the number of cold starts does not equate to minimizing overall response latency. While the latency gain of all requests hitting a warm start can be measured by adding the latency difference between cold and warm starts, the impact of various characteristics of containerized functions—such as resource consumption, call frequency, and container initialization overhead—on system latency varies. Furthermore, although the number of cold starts reflects system performance to some extent, it does not fully represent the overall system latency. Therefore, there is an urgent need for a serverless computing scheduling method that considers function characteristics and priorities to minimize system response latency and improve system performance. Summary of the Invention
[0004] The purpose of this invention is to overcome the above-mentioned defects and problems in the prior art and provide a serverless computing scheduling method based on function priority to minimize system response latency.
[0005] To achieve the above objectives, the technical solution of this invention is: a serverless computing scheduling method based on function priority, comprising:
[0006] S1. Obtain historical function execution data and extract resource-sensitive interval data; based on the resource-sensitive interval data, calculate the improved Spearman rank correlation coefficient and couple it for correction, then calculate the objective weight; based on the objective weight, construct a function priority model and determine the function scheduling priority;
[0007] S2. Construct a hybrid Prophet-LightGBM prediction model, where prediction function requests are distributed and container pools are dynamically managed.
[0008] S3. Construct a deep reinforcement learning Q-network, design a clustering reinforcement learning scheduling strategy to train the deep reinforcement learning Q-network, and schedule function requests based on the trained deep reinforcement learning Q-network, function priority, and container pool state management to minimize scheduling latency.
[0009] Optionally, step S1 specifically includes:
[0010] S11. Obtain historical function execution data, define latency data as the end-to-end response time of function requests, and construct a set of key influencing factors. The key influencing factors include CPU resources, memory resources, I / O resources, parameter input size, cold start initialization time, function execution time, command termination time, function call frequency, and function most recent call time.
[0011] S12, Targeting Key Influencing Factors The relationship with delayed data is analyzed by performing a moving average smoothing process on the delayed data to obtain a smooth curve. And calculate the difference gradient Its expression is as follows:
[0012] ;
[0013] in: For the first The delay value of each sampling point after smoothing by moving average; For the first Resource quantity of key influencing factors corresponding to each sampling point;
[0014] S13, Calculate key influencing factors Maximum global gradient And set a dynamic convergence threshold. ;in, This is the preset sensitivity coefficient;
[0015] S14. Based on the dynamic convergence threshold, traverse the delayed data, and when the differential gradient of several consecutive sampling points... When the first sampling point that meets the dynamic convergence threshold is determined to be the resource saturation threshold point, the historical function execution data is divided into resource-sensitive interval data and resource-saturated interval data based on the resource saturation threshold point.
[0016] S15. Based on the resource-sensitive interval data, calculate the improved Spearman rank correlation coefficient, denoted as the baseline correlation score, whose expression is as follows:
[0017] ;
[0018] in: The baseline relevance score; This refers to the number of sampling points for data in resource-sensitive regions. It is the difference in rank;
[0019] S16. Calculate the normalized mutual information between any two key influencing factors in the set of key influencing factors. The expression is as follows:
[0020] ;
[0021] in: For any two key influencing factors and Normalized mutual information between them; For mutual information; Information entropy;
[0022] Set coupling determination threshold ,when If the two key influencing factors are found to have strong coupling redundancy, they are denoted as a strong coupling factor pair.
[0023] S17. Based on the strongly coupled factor pairs, the average value of the benchmark correlation score is corrected, and the expression is as follows:
[0024] ;
[0025] in: The corrected relevance score; , These are the pairs of strongly coupled factors. The benchmark relevance score;
[0026] S18. Based on the corrected relevance score, calculate the objective weight values of key influencing factors. The normalized expression is as follows:
[0027] ;
[0028] in: This is an objective weighting value; For the first The adjusted relevance scores of the key influencing factors; for The sum of the adjusted relevance scores of the key influencing factors;
[0029] S19. Construct a function priority model based on objective weight values, and select a linear model or a log-linear model to calculate the function priority according to the application scenario.
[0030] Optionally, in step S19, selecting the priority of the linear model or log-linear model for calculating the function according to the application scenario specifically includes:
[0031] S191. Real-time statistics on the call frequency of each type of function within the time window, calculation of the load dominance rate, defined as the proportion of the most frequently called function to the total number of calls, expressed as follows:
[0032] ;
[0033] in: Load dominance rate; For the first Function call frequency;
[0034] S192, Set the load dominance threshold ;when When the current situation is a general equilibrium scenario, the linear model is used to calculate the function priority; when If the current scenario is determined to be dominated by a single load, then the log-linear model is used to calculate the function priority.
[0035] Optionally, in step S2, constructing the hybrid Prophet-LightGBM prediction model specifically includes:
[0036] S21. Construct the Prophet model, whose expression is as follows:
[0037] ;
[0038] in: For time steps The predicted value; For trend functions; It is a periodic term; For holidays; This is the error term;
[0039] The trend function The dynamic logistic regression model is used, and its expression is as follows:
[0040] ;
[0041] in: The load-bearing capacity parameter changes dynamically over time; For growth rate; The time of the inflection point in the trend;
[0042] S22. Based on the Prophet model, Bayesian posterior sampling is performed on the historical function execution data, and the probability distribution of the predicted values at future time steps is calculated. At the same time, quantiles with a pre-set confidence level are selected as the upper and lower bounds of the confidence interval. ;
[0043] S23. Establish the LightGBM model, select L1 regularization as the objective function of LightGBM, and optimize the hyperparameters.
[0044] When optimizing hyperparameters, the upper and lower bounds of the confidence intervals generated by the Prophet model are used. As a hard constraint boundary, if the prediction results of the hyperparameters exceed the hard constraint boundary in the early stage of training, the pruning operation is immediately triggered to forcibly terminate the invalid search until all effective parameters are optimized to obtain the optimal hyperparameters. The LightGBM model is then trained based on the optimal hyperparameters to obtain the hybrid Prophet-LightGBM prediction model.
[0045] Optionally, in step S2, the prediction function requests arrival at the distribution and dynamically manages the container pool, specifically including:
[0046] S24. Obtain the total memory capacity and total CPU cores of the current node, calculate the sum of the resources occupied by the currently active containers and the resources occupied by the planned preheating containers. If the resource sufficiency condition is met simultaneously, the system resources are deemed sufficient, and the preheating operation is allowed. The expression for the resource sufficiency condition is as follows:
[0047] ;
[0048] ;
[0049] in: This represents the amount of memory currently used by the active containers. The amount of memory to be used by the planned preheating container; The amount of memory required for a single preheating container; This represents the total memory capacity of the current node. This represents the number of CPU cores currently being used by the active containers. The number of CPU cores required for a single preheating container; This represents the total number of CPU cores.
[0050] S25. Based on the amount of memory currently occupied by active containers. The requested arrival amount of the function at the predicted next time step. ,like If sufficient resources are available, preheating can be carried out in advance. A container; if Then calculate the idle cost of keeping the container active and the cold start cost of rebuilding after destruction;
[0051] The idle cost of keeping the container active is expressed as follows:
[0052] ;
[0053] in: To maintain the idle costs of keeping containers active; Request the arrival time for the predicted next time step function; The current time; For container memory specifications;
[0054] The cold start cost of destroying and rebuilding is expressed as follows:
[0055] ;
[0056] in: The cold start cost of rebuilding after destruction; This refers to the time required for a cold start. This is the priority adjustment coefficient; Function precedence;
[0057] like If so, a keep-alive operation is performed to preserve the idle container; if If the condition is met, a termination operation will be performed to release the resources.
[0058] Optionally, step S3 specifically includes:
[0059] S31. Construct a concurrency matrix for a high-dimensional sparse state space to transform the serverless environment into a high-dimensional sparse state representation; based on the concurrency matrix, use KNN environment clustering transfer deep reinforcement learning Q network parameters based on workload pattern matching to accelerate policy convergence in the cold start phase.
[0060] S32. Construct a multi-objective composite reward function of timeliness, cost, and fairness as a guide for reinforcement learning agents;
[0061] S33. Based on state representation and reward function, optimize the deep reinforcement learning Q network and train it, then output a robust function scheduling strategy.
[0062] S34. Based on a robust function scheduling strategy, an automatic request-response latency dynamic threshold is adopted to dynamically balance the response latency of function scheduling requests.
[0063] Optionally, step S31 specifically includes:
[0064] S311, Define environment status Normalized concurrent request feature matrix Among them: dimension Function type; dimension For concurrent statistical characteristics;
[0065] S312. Construct a historical environment experience base based on historical function execution data. And calculate the information entropy value of each function type within the time window. Define feature weight vectors in reverse based on information entropy values. ;
[0066] S313. Calculate the current concurrent request feature matrix based on the feature weight vector. Historical environment The weighted cosine similarity between them is expressed as follows:
[0067] ;
[0068] in: For weighted cosine similarity; For the first Each feature weight vector; For the first A feature matrix of concurrent requests; For the first in the historical environment Concurrency characteristics of class functions;
[0069] S314. Select several historical environment clusters with the highest weighted cosine similarity, and assign the weighted average of the initial parameters of these historical environment clusters to the deep reinforcement learning Q-network as the warm-start initialization parameters to accelerate the convergence of the policy during the cold-start phase. The expression is as follows:
[0070] ;
[0071] in: Initialize parameters for warm start; For the first Initial parameters for a historical environment cluster; The number of initial parameters for the historical environment cluster.
[0072] Optionally, in step S32, the expression for the timeliness-cost-fairness multi-objective composite reward function is as follows:
[0073] ;
[0074] in: Positive rewards for delayed income; Penalty for resource consumption; For the purpose of fairness, penalties for breach of contract; For fairness weighting;
[0075] The expression for the delayed positive reward is as follows:
[0076] ;
[0077] in: For the first Improved Spearman rank correlation coefficient of each scheduled request; The set of improved Spearman rank correlation coefficients for the scheduled requests;
[0078] The resource consumption penalty is expressed as follows:
[0079] ;
[0080] in: For the first The memory specifications of each container; For the first Average cold start initialization time for each container; For the first Number of CPU cores; This is the conversion factor between CPU and memory weights; The collection of containers created after a function scheduling action triggers a cold start;
[0081] The fairness breach penalty incorporates a request-response delay threshold mechanism, as detailed below:
[0082] The waiting time for low-priority function requests in the scheduling queue At that time, a nonlinear penalty based on the natural exponential function is applied. The threshold for request-response latency is expressed as follows:
[0083] ;
[0084] ;
[0085] in: For the first Queuing time for each function scheduling request; Request a queue for functions waiting to be scheduled; It is a non-linear penalty function; Basic penalty coefficient; This is the parameter for the exponential growth rate.
[0086] Optionally, step S33 specifically includes:
[0087] S331. Construct a deep reinforcement learning Q-network and collect empirical samples from a serverless scheduling environment. Calculate the absolute value of the temporal difference error for each empirical sample, as expressed below:
[0088] ;
[0089] in: For the first The absolute value of the time difference error of the empirical samples; The reward for the current action; Discount factor; This is the current Q value; The maximum Q value for the next state;
[0090] S332. Based on the absolute value of the time difference error of each empirical sample, calculate the sampling probability during empirical playback, as expressed below:
[0091] ;
[0092] in: The sampling probability; Adjust the priority coefficient; For the first The absolute value of the time difference error of the empirical samples;
[0093] S333. Based on sampling probability, state representation and reward function, optimize the deep reinforcement learning Q network and train it until convergence or the preset number of training rounds is reached, and output a robust function scheduling strategy.
[0094] Optionally, step S34 specifically includes:
[0095] S341. Construct a global baseline request-response latency threshold, the expression of which is as follows:
[0096] ;
[0097] in: This serves as the global baseline request-response latency threshold. This represents the global average warm-up delay time. Standard deviation;
[0098] S342. Construct the cold start tolerance request response latency threshold, the expression of which is as follows:
[0099] ;
[0100] in: Set a threshold for tolerating request response latency during cold starts; This is the dynamic tolerance coefficient; The historical average cold start initialization time;
[0101] The dynamic tolerance coefficient By setting a target default rate And monitor the percentage of the total actual waiting time that exceeds the request response latency. ;like Then increase Conversely, it decreases. ;
[0102] S343. Based on the global baseline request response latency threshold and the cold start tolerance request response latency threshold, the corresponding request response latency threshold is dynamically selected, and its expression is as follows:
[0103] ;
[0104] in: This is the corresponding request-response latency threshold.
[0105] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0106] This invention discloses a serverless computing scheduling method based on function priority. The method first acquires historical function execution data, extracts resource-sensitive data, calculates the improved Spearman rank correlation coefficient and couples it with corrected objective weights, constructs a function priority model, and determines function scheduling priorities. Then, a hybrid Prophet-LightGBM prediction model is constructed to predict the arrival distribution of function requests and dynamically manage the container pool. Next, a deep reinforcement learning Q-network is constructed, a clustering reinforcement learning scheduling strategy is designed and trained, and function requests are scheduled based on function priority and container pool state to minimize scheduling latency. In application, this design extracts resource-sensitive intervals, calculates the improved Spearman coefficient, and couples the corrected objective weights to construct an accurate function priority model, ensuring high-value requests are prioritized. Then, based on the hybrid Prophet-LightGBM prediction model, the request arrival distribution is dynamically predicted, enabling elastic scaling of the container pool and reducing cold start events at the source. Finally, combined with the clustering reinforcement learning scheduling strategy, real-time decisions are made in a dynamic environment with priority as the core and container resources as the basis, ultimately optimizing resource allocation at the global level and significantly reducing the overall system response latency. Attached Figure Description
[0107] Figure 1 This is a flowchart of the method of the present invention.
[0108] Figure 2 This is a schematic diagram of the workflow of the CRL model in Embodiment 1 of the present invention.
[0109] Figure 3This is a schematic diagram of the overall system architecture in Embodiment 1 of the present invention.
[0110] Figure 4 This is a structural diagram of the device of the present invention.
[0111] In the diagram: Processor 1, Memory 2, Computer program code 21. Detailed Implementation
[0112] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0113] Example 1:
[0114] Research on serverless environments revealed significant differences between functions, which should not be treated equally in terms of cold starts. Furthermore, different functions have different "priorities" in terms of latency benefits, determined by factors such as call frequency, resource usage, and initialization overhead. Secondly, traditional scheduling strategies, such as First-Come, First-Served (FCFS) or Fair Scheduling, fail to consider the priorities of different functions, leading to suboptimal performance when scheduling workloads. Thirdly, executing requests as directly as possible implies that containers need to start and terminate at appropriate times so that functions can avoid initialization and termination costs.
[0115] Therefore, this research is based on measurements of the Azure public dataset and experiments demonstrate that simply focusing on reducing the number of cold starts is not effective in reducing overall system latency. In serverless computing environments, the impact of function diversity and different scheduling strategies on system performance needs to be considered. To achieve optimal performance, this solution designs a function priority-based scheduling framework that considers various characteristics of functions, including resource consumption, call frequency, and initialization overhead, as detailed below:
[0116] See Figure 1 A serverless computing scheduling method based on function priority includes:
[0117] S1. Obtain historical function execution data and extract resource-sensitive interval data; based on the resource-sensitive interval data, calculate the improved Spearman rank correlation coefficient and couple it for correction, then calculate the objective weight; based on the objective weight, construct a function priority model and determine the function scheduling priority;
[0118] In this embodiment, to ensure the objectivity and accuracy of function priority, this invention does not directly employ conventional Spearman rank correlation coefficient analysis. Existing technologies typically calculate Pearson or Spearman coefficients directly, but this ignores the diminishing marginal utility (i.e., saturation effect) in serverless computing. To objectively identify this physical boundary, this scheme does not use a simple first derivative, but instead proposes a sliding window smoothing difference method, an improved Spearman analysis method based on marginal utility threshold segmentation and coupling correction, as detailed below:
[0119] S11. Obtain historical function execution data, define latency data as the end-to-end response time of function requests, and construct a set of key influencing factors. The key influencing factors include CPU resources, memory resources, I / O resources, parameter input size, cold start initialization time, function execution time, command termination time, function call frequency, and function most recent call time.
[0120] The delay data refers to the request delay recorded in the system log, which includes the entire process time of initialization, queuing, execution, and transmission.
[0121] S12. Due to the jitter and noise in the server log data, direct differentiation will cause gradient oscillation. Therefore, it is necessary to address the key influencing factors. To correlate with the delayed data, a moving average smoothing process (window size W=5) is applied to the delayed data to obtain a smooth curve. And calculate the difference gradient Its expression is as follows:
[0122] ;
[0123] in: For the first The delay value of each sampling point after smoothing by moving average; For the first Resource quantity of key influencing factors corresponding to each sampling point;
[0124] S13, Calculate key influencing factors Maximum global gradient And set a dynamic convergence threshold. ;in, The preset sensitivity coefficient (range 0.01-0.05) is used; in existing technologies, it is usually set to a fixed threshold, but the delay magnitudes of different functions vary greatly (from milliseconds to seconds), and a fixed threshold is prone to failure. Therefore, this solution sets... For dynamic relative values: That is, when the gradient descent amplitude is less than 5% of the maximum descent amplitude and continues for N=3 points, it is determined that the benefit brought by the resource investment is negligible. This point is the saturation threshold. This method is universal and does not require manual adjustment of parameters for each function.
[0125] S14. Based on the dynamic convergence threshold, traverse the delayed data, and when the differential gradient of several consecutive sampling points... When the first sampling point that meets the dynamic convergence threshold is determined to be the resource saturation threshold point, the historical function execution data is divided into resource sensitive interval data (not reaching the saturation threshold) and resource saturation interval data (exceeding the saturation threshold) based on the resource saturation threshold point.
[0126] This approach does not assume a simple linear relationship between resources and latency. Instead, it uses gradient analysis to identify the saturation threshold where the marginal effect of resources diminishes. When allocated memory exceeds a certain threshold, the function execution speed no longer improves significantly, and the gradient approaches zero. Based on this, historical data is divided into resource-sensitive intervals and resource-saturated intervals. To address the shortcomings of traditional full-data analysis, only data from the resource-sensitive interval is extracted to calculate the Spearman rank correlation coefficient, thus eliminating the dilution effect of data from the resource-saturated interval on the correlation results. Data from the resource-saturated interval is not included in the correlation calculation, thereby quantifying the actual latency benefits of resources within the effective interval.
[0127] S15. In traditional methods, a large amount of flat data (gradient close to 0) in the saturation interval can lead to a decrease in the absolute value of the overall Spearman coefficient, thus misleading the system into believing that the resource is "unimportant." This scheme defines an improved Spearman rank correlation coefficient. Essentially, it's a local Spearman coefficient. The system only extracts data from the resource-sensitive interval and substitutes it into the Spearman formula. The physical meaning of this approach is: to assess the importance of a resource only within the range where it can generate significant benefits, as detailed below:
[0128] Based on resource-sensitive interval data, the improved Spearman rank correlation coefficient is calculated and denoted as the baseline correlation score. Its expression is as follows:
[0129] ;
[0130] in: The baseline relevance score; This refers to the number of sampling points for data in resource-sensitive regions. It is the difference in rank;
[0131] S16. Calculate the normalized mutual information between any two key influencing factors in the set of key influencing factors. The expression is as follows:
[0132] ;
[0133] in: For any two key influencing factors and Normalized mutual information between them; For mutual information; Information entropy;
[0134] Set coupling determination threshold ,when If a strong coupling redundancy exists between two key influencing factors, it is determined that a strong coupling factor pair exists (including CPU and memory factor pairs restricted by cloud platform quota mechanisms). Since the value of conventional mutual information is affected by the range of variable values, it is difficult to set a uniform threshold. This solution uses normalized mutual information, mapping the value to [0,1], and sets a threshold. =0.8.
[0135] On AWS Lambda or Google Cloud Functions platforms, CPU allocation is often forcibly tied to memory size (1 vCPU per 1792MB of memory). This physical mechanism leads to a strong statistical correlation between the two variables. If not corrected, the model will repeatedly calculate the weight of "computing power," causing the model to be overly biased towards computing resources and ignoring business factors such as call frequency. Therefore, it is necessary to correct this to eliminate the repeated superposition of weights due to collinearity. This ensures that the two coupled factors contribute to the priority as a whole "feature group," rather than contributing separately.
[0136] S17. Based on the strongly coupled factor pairs, the average value of the benchmark correlation score is corrected, and the expression is as follows:
[0137] ;
[0138] in: The corrected relevance score; , These are the pairs of strongly coupled factors. The benchmark relevance score;
[0139] S18. Based on the corrected relevance score, calculate the objective weight values of key influencing factors. The normalized expression is as follows:
[0140] ;
[0141] in: This is an objective weighting value; For the first The adjusted relevance scores of the key influencing factors; for The formula is the sum of the adjusted relevance scores of the key influencing factors; it transforms the relevance scores into objective weights in a probabilistic sense, ensuring... This eliminates the arbitrariness of subjectively setting weights.
[0142] S19. Construct a function priority model based on objective weight values, and select a linear model or a log-linear model to calculate the function priority according to the application scenario;
[0143] Linear models are relatively simple but have good versatility and can adapt to general scenarios. In contrast, log-linear models can be better adapted to workloads with certain characteristics through parameter adjustments. To eliminate the subjectivity of model selection, this solution introduces an automatic switching mechanism. Details are as follows:
[0144] S191. Real-time statistics on the call frequency of each type of function within the time window, calculation of the load dominance rate, defined as the proportion of the most frequently called function to the total number of calls, expressed as follows:
[0145] ;
[0146] in: Load dominance rate; For the first Function call frequency;
[0147] S192, Set the load dominance threshold (e.g., 0.6); when When the current scenario is determined to be a general equilibrium scenario, a linear model is used to calculate the function priority to ensure fairness and universality in scheduling multiple function types; when If the current scenario is determined to be dominated by a single load, a log-linear model is used to calculate the function priority. The priority weight of the dominant function is increased through the multiplication amplification effect to maximize the latency benefits in the specific scenario.
[0148] In this scheme, the calculated function priority is as follows:
[0149] ;
[0150] in: CPU resources; For memory resources; For I / O resources; Enter the size for the parameter; This is the initialization time for a cold start. For function execution time; This is the command termination time; Function call frequency; This represents the interval between the arrival time of the last command and the current time.
[0151] In this embodiment, to better preprocess high-priority functions that may be called in the future, it is necessary to predict the distribution of function arrivals. Traditional time series forecasting models and ARIMA typically require manual configuration of model and uncertainty parameters. Although machine learning-based models can capture long-term dependencies in data, they require a large number of training samples and training time, and cannot easily incorporate non-time-based external features, noise, or uncertainty into their predictions.
[0152] LightGBM is renowned for its speed and high accuracy, but it is sensitive to feature selection and emphasizes specialized statistical knowledge and experience. The latest Prophet model combines time series decomposition and machine learning fitting for prediction, but its accuracy is affected when predicting complex patterns, and its long-term predictions are unreliable. To overcome these problems and achieve generalizable and scalable predictions, a hybrid Prophet-LightGBM prediction model is constructed. This method has two advantages: first, it utilizes the seasonality, trend, and confidence intervals provided by Prophet to extract more meaningful features for LightGBM, improving prediction accuracy; second, LightGBM has the characteristics of fast gradient descent and low memory usage, and combined with the special event settings and boundary constraints specified by Prophet, it can avoid overfitting or iteration traps, as detailed below:
[0153] S2. Construct a hybrid Prophet-LightGBM prediction model, where prediction function requests are distributed and container pools are dynamically managed.
[0154] In step S2, constructing the hybrid Prophet-LightGBM prediction model specifically includes:
[0155] S21. Construct the Prophet model, whose expression is as follows:
[0156] ;
[0157] in: For time steps The predicted value; For trend functions; It is a periodic term; For holidays; This is the error term;
[0158] Since the parallelism of functions in serverless computing is limited, this solution uses a logistic regression function with a maximum parallelism limit and dynamically adjusts the trend function according to the constraints. Unlike conventional logistic regression trend functions, this solution uses a trend function... The saturation growth limit is dynamically bound to the real-time maximum container parallelism limit of the serverless platform. When a change in cloud platform resource quota (expansion or reduction) is detected, the limit is updated in real time. The system sets an upper limit parameter to prevent the model from predicting invalid request volumes that exceed the physical resource capacity; the system periodically polls the cloud service provider's Quota API to obtain the real-time maximum number of container concurrency allowed for the current account. Once a quota change is detected, update immediately. Value and refit trend term This ensures that the predicted request volume will never violate the physical limitations of the cloud platform, a physical constraint capability that general time-series forecasting models lack. Furthermore, Fourier series adjustments are used to account for periodic variations.
[0159] The trend function The dynamic logistic regression model is used, and its expression is as follows:
[0160] ;
[0161] in: The load-bearing capacity parameter changes dynamically over time; For growth rate; The time of the inflection point in the trend;
[0162] S22. Based on the Prophet model, Bayesian posterior sampling is performed on the historical function execution data, and the probability distribution of the predicted values at future time steps is calculated. At the same time, quantiles (95%) of a pre-set confidence level are selected as the upper and lower bounds of the confidence interval. ;
[0163] In this scheme, the search space is pruned based on confidence intervals: The Prophet model is used to fit historical function execution data. Leveraging the Bayesian properties of the Prophet model, during the fitting process, the model performs posterior sampling of the trend change rate and seasonality coefficient. Based on the parameter distribution obtained from the sampling, 1000 (configurable) simulated prediction paths are generated for future time steps. The distribution of these 1000 prediction values is then statistically analyzed, and the 2.5% quantile is selected as the lower bound. The 97.5% quantile was selected as the upper bound. This allows us to construct a 95% confidence interval. This interval reflects the range of uncertainty in historical data fluctuations; this step not only extracts trend and seasonal components as features, but more importantly, it outputs the upper and lower bounds of the confidence interval for the predicted values at future time steps. In order to use the aforementioned confidence interval as a prior hard constraint for hyperparameter search when building the LightGBM model.
[0164] S23. Establish the LightGBM model, select L1 regularization as the objective function of LightGBM, and perform hyperparameter optimization. This scheme specifically selects L1 regularization instead of L2 regularization as the objective function optimization term of the LightGBM model to meet the low latency requirements of minute-level prediction in serverless environments. L1 regularization can effectively promote the weights of non-important features to zero, thereby generating a sparse model, significantly reducing the feature dimension and computational overhead during online inference, and meeting the real-time scheduling requirements.
[0165] In this scheme, the Optuna tool is used for hyperparameter optimization. Unlike existing techniques that rely solely on median pruning based on validation set loss, this scheme introduces a physical boundary constraint pruner, as detailed below:
[0166] When optimizing hyperparameters, the upper and lower bounds of the confidence intervals generated by the Prophet model are used. As a hard constraint boundary; if the prediction result of the hyperparameter in the early stage of training exceeds the hard constraint boundary, even if its loss has not yet converged, the pruning operation is immediately triggered to forcibly terminate the invalid search, thereby quickly eliminating solutions that do not conform to physical laws in the hyperparameter space.
[0167] After optimizing all effective parameters, the optimal hyperparameters are obtained, and the LightGBM model is trained based on the optimal hyperparameters to obtain the hybrid Prophet-LightGBM prediction model.
[0168] In step S2, the prediction function requests arrival at the distribution and dynamically manages the container pool, specifically including:
[0169] S24. Resource Adequacy Determination: Obtain the total memory capacity and total CPU cores of the current node, calculate the sum of resources occupied by currently active containers and resources occupied by planned preheating containers. If both conditions are met, the system resources are deemed sufficient, and the preheating operation is allowed. The expression for the resource adequacy condition is as follows:
[0170] ;
[0171] ;
[0172] in: This represents the amount of memory currently used by the active containers. The amount of memory to be used by the planned preheating container; The amount of memory required for a single preheating container; This represents the total memory capacity of the current node. This represents the number of CPU cores currently being used by the active containers. The number of CPU cores required for a single preheating container; This represents the total number of CPU cores.
[0173] S25. Retention decision based on resource-time game theory: based on the amount of memory currently occupied by active containers. The requested arrival amount of the function at the predicted next time step. ,like If sufficient resources are available, preheating can be carried out in advance. A container; if Then calculate the idle cost of keeping the container active and the cold start cost of rebuilding after destruction;
[0174] This solution models the question of "whether to retain the container" as a cost minimization problem, focusing on the idle cost of keeping the container active. This refers to the value of resources wasted by letting containers idle; the cold start cost of destroying and rebuilding them. This refers to the cost of rebuilding a new container after the current container is destroyed. It consists of two parts: the resources consumed during the rebuilding process and the user experience degradation caused by the latency due to cold starts.
[0175] The idle cost of keeping the container active is expressed as follows:
[0176] ;
[0177] in: To maintain the idle costs of keeping containers active; Request the arrival time for the predicted next time step function; The current time; For container memory specifications;
[0178] The cold start cost of destroying and rebuilding is expressed as follows:
[0179] ;
[0180] in: The cold start cost of rebuilding after destruction; This refers to the time required for a cold start. This is the priority adjustment coefficient; Function precedence;
[0181] like This indicates that "keeping" the idle container is more cost-effective than "killing and rebuilding" it (usually when the next request is imminent, or when the function has extremely high priority and cannot tolerate a cold start). Therefore, a keep-alive operation is performed to preserve the idle container; if If the idle time is too long, resulting in significant resource waste, or if the function has a low priority, a termination operation is performed to release resources. This strategy achieves an optimal balance between resource consumption and startup latency.
[0182] S3. Construct a deep reinforcement learning Q-network, design a clustering reinforcement learning scheduling strategy to train the deep reinforcement learning Q-network, and minimize scheduling latency based on the trained deep reinforcement learning Q-network, function priority, and container pool scheduling function requests.
[0183] In this scheme, the function scheduling priority problem (FPS problem) is formalized as a problem of maximizing weighted priority, considering that within time t, there may be K function requests with N different types arriving. These different functions are represented by a set. Each element represents a different type of function. For , its first The request is represented as ; Indicates satisfaction of The request set, Indicates all A set. For a set with memory and CPU core For a given server, the function scheduling at time t is treated as a variable: Furthermore, the execution time and resource consumption of each function should meet the following requirements:
[0184] ;
[0185] ;
[0186] ;
[0187] in: express Response delay; Indicates the timeout limit for the request; Indicates task The CPU resource consumption is the result of the container configuration calculation; This indicates the allocated memory; no restrictions are specified for block I / O in this scheme because the relative priority of block I / O can be changed by adjusting blkioweight, so no special restrictions are required.
[0188] Based on the above definition, the function scheduling priority problem (FPS problem) in serverless computing is defined as follows:
[0189] ;
[0190] in: For the first The function under the th function The scheduling priority of each request; Indicator variables selected for scheduling; The set of variables for scheduling decisions; It is a collection of all function types; For the first The set of all requests corresponding to a function; since the priority of each request is equal to the priority of its corresponding function, all requests associated with the same function share the same priority during the time period before the function priority is updated.
[0191] The Faster-Solve-Size (FPS) problem is actually a 0-1 multiple knapsack problem; it can be viewed as scheduling (packing) N function requests (items) with different resource requirements (weight) and priorities (values) under available resource constraints (available weight) to maximize weighted priority (total value). Therefore, the FPS problem is equivalent to the knapsack problem and is also an NP-complete problem.
[0192] Existing heuristics, including dynamic programming (DP) and branch and bound (BB), are either time-consuming or inaccurate, failing to meet the requirements of serverless scenarios for fast response, low cost, and high accuracy. When the load is low, DP is fast (approximately tens of milliseconds); however, under high load, its latency can even reach tens of seconds, completely blocking function scheduling and failing to guarantee accuracy.
[0193] Reinforcement learning (RL) has been widely proposed for efficiently solving such NP-complete problems. Generally, RL works as follows: at each decision epoch, the agent makes a decision based on the current state of the environment. Once a decision is made, the agent receives a reward, and the state of the environment is updated for future decisions; the agent attempts to maximize the cumulative reward over time. With RL, the FPS problem can be solved in a Markov Decision Process (MDP), which is a quintuple: ,in: Represents a set of states; Represents a set of actions; Represents the transition probability distribution; Represents the reward function; This represents the discount factor for future rewards; to solve the FPS problem, different components of RL need to be specially designed.
[0194] In serverless computing, function code and request arrival distribution are dynamic, while existing RL methods typically assume a fixed environment. Therefore, RL should not be directly applied to the scenario in this solution. Directly using the RL model in this case will lead to poor decision performance. Furthermore, training traditional RL models is time-consuming, which can become a bottleneck during scaling. Therefore, to address the FPS problem, it is necessary to learn the current environment. The key point of this solution is that the more similar the historical moments, the more similar the environments—the core of clustering. Inspired by this, this solution divides historical data into different clusters for learning, adapting to the dynamically changing environment and accelerating the learning process.
[0195] CRL is more lightweight, efficient, and practical than traditional RL. This solution designs a CRL method for function scheduling, whose key components include environment modeling, state space, action space, reward function, and optimization. The CRL workflow and components are as follows: Figure 2 As shown, the specific steps are as follows:
[0196] Furthermore, step S3 specifically includes:
[0197] S31. Construct a concurrency matrix for a high-dimensional sparse state space to transform the serverless environment into a high-dimensional sparse state representation; based on the concurrency matrix, use KNN environment clustering transfer deep reinforcement learning Q network parameters based on workload pattern matching to accelerate policy convergence in the cold start phase.
[0198] Furthermore, step S31 specifically includes:
[0199] S311. Constructing the concurrency matrix of a high-dimensional sparse state space:
[0200] To address the characteristics of serverless computing, such as diverse function types and large fluctuations in concurrency, the environment state is defined. Normalized concurrent request feature matrix Among them: dimension Function type; dimension For concurrent statistical characteristics;
[0201] S312, Improved KNN Environment Clustering and Knowledge Transfer Based on Information Entropy Weighting:
[0202] A historical environment experience database was built based on historical function execution data. And calculate the information entropy value of each function type within the time window. Define feature weight vectors in reverse based on information entropy values. ;
[0203] In this embodiment, existing cosine similarity treats all dimensions of features (i.e., all types of functions) as equally important; however, in serverless workloads, the concurrency of some resident functions is very stable, while the concurrency of "bursting functions" fluctuates wildly, the latter often determining the current system's load pattern. Therefore, this scheme introduces information entropy to quantify this discriminative power for function types. Calculate its information entropy value within the time window. The smaller the entropy, the more ordered (stable); the larger the entropy, the more disordered (fluctuating). The feature weight vector is defined in reverse based on the information entropy value. This means that the function type with greater fluctuation will have a greater weight in the similarity calculation. This improves the shortcomings of traditional cosine similarity in that it cannot distinguish between "key features" and "background noise".
[0204] S313. Calculate the current concurrent request feature matrix based on the feature weight vector. Historical environment The weighted cosine similarity between them is expressed as follows:
[0205] ;
[0206] in: For weighted cosine similarity; For the first Each feature weight vector; For the first A feature matrix of concurrent requests; For the first in the historical environment Concurrency characteristics of class functions;
[0207] To address the slow convergence of reinforcement learning in large state spaces, this solution constructs a historical environment experience database and employs an improved kNN environment clustering algorithm for pattern matching. It calculates the information entropy-weighted cosine similarity between the current concurrent request feature matrix and historical environments, rather than the traditional cosine similarity. This is because in serverless scenarios, the focus is on the "proportional pattern of function calls" rather than "absolute values." Therefore, the k most similar historical environment clusters are selected, and their corresponding Q-Tables or network parameters are used as the initialization state for the current reinforcement learning, achieving knowledge transfer and accelerating policy convergence during the cold start phase.
[0208] S314. Select several historical environment clusters with the highest weighted cosine similarity, and assign the weighted average of the initial parameters of these historical environment clusters to the deep reinforcement learning Q-network as the warm-start initialization parameters. This skips the random exploration phase and accelerates the convergence of the policy in the cold-start phase. The expression is as follows:
[0209] ;
[0210] in: Initialize parameters for warm start; For the first Initial parameters for a historical environment cluster; The initial parameters of the historical environment cluster are denoted as . Traditional reinforcement learning typically uses random initialization when facing a new environment, resulting in extremely poor decision quality during the cold start phase. Therefore, this scheme uses clustering results to assign values for a warm start, which gives the reinforcement learning agent "experience" in handling similar scenarios from the very beginning, significantly reducing the number of exploration and trial and error attempts.
[0211] S32. To address the problem of weak guidance from single rewards in existing technologies, a multi-objective composite reward function of timeliness, cost, and fairness is constructed to guide the reinforcement learning agent.
[0212] Furthermore, the expression for the timeliness-cost-fairness multi-objective composite reward function is as follows:
[0213] ;
[0214] in: The positive reward for delayed gains is proportional to the correlation coefficient of the improved Spearman rank. The resource consumption penalty is the product of the new container size and the cold start time. For the purpose of fairness, penalties for breach of contract; For fairness weighting;
[0215] The expression for the delayed positive reward is as follows:
[0216] ;
[0217] in: For the first Improved Spearman rank correlation coefficient of each scheduled request; The set of improved Spearman rank correlation coefficients for scheduled requests; when a request is scheduled and satisfies the high priority of the function, positive feedback is given to guide the reinforcement learning agent to prioritize high-performance tasks.
[0218] The resource consumption penalty incurred when a scheduling action triggers a new cold start (creating a new container) requires additional resource overhead from the system. This solution defines this overhead as the "product of resources and time ineffectively occupied during the cold start phase," and its expression is as follows:
[0219] ;
[0220] in: For the first Memory specifications of each container (unit: GB); For the first Average cold start initialization time per container (in seconds); For the first Number of CPU cores; The conversion factor for CPU and memory weights (determined based on the cloud platform billing unit price ratio); This is the set of containers created after a cold start triggered by a function scheduling action; this penalty forces the reinforcement learning agent to weigh whether to reuse existing idle containers or pay the cost of creating new ones when making decisions.
[0221] In the aforementioned fairness breach penalty, to ensure the fairness of long-tail requests, a Request Response Delay Threshold (SLO) mechanism is introduced, as follows:
[0222] The waiting time for low-priority function requests in the scheduling queue At that time, a nonlinear penalty based on the natural exponential function is applied. The threshold for request-response latency is expressed as follows:
[0223] ;
[0224] ;
[0225] in: For the first Queuing time for each function scheduling request; Request a queue for functions waiting to be scheduled; It is a non-linear penalty function; Basic penalty coefficient; This is the parameter for the exponential growth rate. When the waiting time... Just over At that time, the penalty value is relatively small; as... As the penalty value increases further, it grows exponentially. This mechanism generates a strong negative reward signal, forcing the reinforcement learning agent to prioritize scheduling these "about to time out" requests in the next moment, thereby automatically generating protection strategies for long-tail requests.
[0226] S33. Based on state representation and reward function, optimize the deep reinforcement learning Q network and train it, then output a robust function scheduling strategy.
[0227] In this embodiment, a four-layer fully connected neural network is used for training, including an input layer, a first hidden layer, a second hidden layer, and an output layer; the input layer dimension is adapted to the number of function types N, and the output layer corresponds to the scheduling action space of the container pool; the Adam optimizer is used to optimize the network parameters, and the mean squared error is used as the loss function; a policy network and a target network are established; and the network parameters are optimized using the Adam optimizer. The greedy strategy randomly selects actions or chooses actions with the highest expected Q value; and to overcome the problem of sparse cold-start samples, a priority experience replay strategy is adopted: during training, sampling probabilities are assigned based on the absolute value of the temporal difference error of the samples, and priority is given to replaying those "unexpected" samples that produce high resource penalties or severe SLO defaults, thereby improving the model's learning efficiency for extreme cases. Specifically, this includes:
[0228] Step S33 specifically includes:
[0229] The improvement of this solution lies in addressing the sparsity of cold start and timeout events in serverless scenarios. In conventional uniform sampling, reinforcement learning agents struggle to learn these few but fatal negative samples. Therefore, based on TD-error... To define the sampling probability This ensures that unexpected samples (i.e., samples with large prediction errors, usually corresponding to sudden cold start penalties or timeout penalties) are repeatedly trained more frequently, thereby significantly improving the model's ability to cope with extreme cases, as follows:
[0230] S331. Construct a deep reinforcement learning Q-network and collect empirical samples from a serverless scheduling environment. Calculate the absolute value of the temporal difference error for each empirical sample, as expressed below:
[0231] ;
[0232] in: For the first The absolute value of the time difference error of the empirical samples; The reward for the current action; Discount factor; This is the current Q value; The maximum Q value for the next state;
[0233] S332. Based on the absolute value of the time difference error of each empirical sample, calculate the sampling probability during empirical playback, as expressed below:
[0234] ;
[0235] in: The sampling probability; Adjustment coefficient for priority; For the first The absolute value of the time difference error of the empirical samples;
[0236] S333. Based on sampling probability, state representation and reward function, optimize the deep reinforcement learning Q network and train it until convergence or the preset number of training rounds is reached, and output a robust function scheduling strategy.
[0237] In this embodiment, while the priority-based CRL scheduling strategy ensures that important functions are scheduled first, it may cause low-priority functions to be starved and remain unexecuted for extended periods. To avoid this unfairness, this solution establishes a SLO (Solution Time Limit) standard, prioritizing the scheduling of requests with waiting times close to the SLO limit based on response latency. Subsequently, the remaining functions are scheduled using the CRL model. It is important to emphasize that SLO refers to request response latency, i.e., the time from invocation to scheduling, excluding execution time.
[0238] In existing technologies, SLOs typically rely on users manually setting them based on experience. This method is highly subjective and cannot adapt to the dynamically changing load characteristics of cloud platforms. Therefore, to eliminate human intervention, this solution proposes a fully automated method for dynamically establishing SLOs, as follows:
[0239] S34. Based on a robust function scheduling strategy, an automatic request-response latency dynamic threshold is adopted to dynamically balance the response latency of function scheduling requests.
[0240] Step S34 specifically includes:
[0241] S341. Construct a global baseline request response latency threshold. The system no longer uses a fixed default value, but instead maintains in real time the hot start latency distribution of all containers across the entire platform within the most recent time window (10 minutes), based on the normal distribution assumption and statistics. In principle, the global baseline request-response latency threshold is automatically calculated, and its expression is as follows:
[0242] ;
[0243] in: This serves as the global baseline request-response latency threshold. This represents the global average warm-up delay time. The standard deviation is the absolute value; this value objectively represents the baseline of the responsiveness that the current physical platform can provide under "normal load," covering 99.7% of warm start requests, without the need for manual specification.
[0244] S342. Construct a cold start tolerance request response latency threshold. For requests that inevitably undergo a cold start, the SLO is defined as a dynamic proportion of the cold start time, and its expression is as follows:
[0245] ;
[0246] in: Set a threshold for tolerating request response latency during cold starts; This is the dynamic tolerance coefficient; The historical average cold start initialization time;
[0247] The dynamic tolerance coefficient Unlike existing technologies that use a fixed percentage, this solution introduces a PID feedback control mechanism to automatically find the optimal tolerance coefficient. The system monitors the overall fairness default rate in real time. This refers to the percentage of requests whose actual waiting time exceeds the SLO (Solution Time Order), with a preset target default rate. (For example, 1%); if This indicates that the current SLO setting is too strict, causing a large number of low-priority requests to "starve" and default. Therefore, the SLO setting will be automatically increased. (Relax constraints); conversely, if This indicates that system resources are relatively abundant, so the amount will be automatically reduced. (Tightening constraints) in pursuit of a more responsive experience;
[0248] S343. Based on the global baseline request response latency threshold and the cold start tolerance request response latency threshold, the corresponding request response latency threshold is dynamically selected, and its expression is as follows:
[0249] ;
[0250] in: This is the corresponding request-response latency threshold.
[0251] By calculating the values of both and selecting the maximum value as the final SLO threshold, the platform's responsiveness and the additional time spent on cold starts are balanced. Through this mechanism, unattended automated configuration of SLO is achieved. The system can automatically "forgive" waiting time during peak load periods to avoid system crashes, and automatically "strictly" require service quality during off-peak periods, thereby finding the best dynamic balance between "scheduling fairness" and "user experience".
[0252] Example 2:
[0253] See Figure 3 A serverless computing scheduling system based on function priority includes:
[0254] The controller module is responsible for receiving requests, scheduling, and managing the container pool;
[0255] A function priority model is proposed, which determines function priority based on an improved Spearman rank correlation coefficient.
[0256] The function arrival predictor uses a hybrid Prophet-LightGBM model to predict the function request arrival distribution;
[0257] The container manager dynamically manages container pools, warms up containers, and terminates containers based on prediction results.
[0258] The CRL scheduling model makes scheduling decisions based on function priority and container pool status.
[0259] Resource monitors track the status and resource usage of container pools;
[0260] The function information table stores key information related to function execution and invocation.
[0261] The controller is the core module, responsible for receiving, scheduling, and managing the container pool. Specifically, the function scheduler is responsible for the deployment orchestration of requests. It receives the output from the CRL model and calls deployment operations to execute the requests. The deployment operations handle the reuse and creation of containers. If there is an idle container in the pool corresponding to the request, it can be reused (warm start); otherwise, under sufficient resource conditions, a new container is created for the request (cold start).
[0262] The function priority model is used to update function priorities; it processes resource usage information from the function information table, as well as execution and termination latency data for function containers. After a container terminates, the model recalculates and updates priorities. These updates are sent to the CRL model and the function information table.
[0263] The function arrival predictor is used to predict the arrival of function requests; it uses historical arrival data of functions in the function information table to predict the number of function calls in the next minute and communicates this to the container manager.
[0264] The container manager is used to monitor the container pool and perform update operations, including preheating containers and timely termination.
[0265] The CRL model is responsible for making scheduling decisions based on the current request and container pool state. It takes resource information from the function information table and priority data from the priority model as input. After a request on the server is completed, it makes a new scheduling decision and outputs it to the function scheduler.
[0266] The resource monitor tracks the status and resource usage of the container pool and reports these metrics to the function information table. It updates the container's initialization overhead and active status immediately after deployment, updates resource usage information after execution, and updates remaining information after the container terminates.
[0267] The function information table is a data structure that stores key information related to function execution and invocation; it includes function priority, resource usage, and various latency indicators (response, execution, termination); the table stores the priority of a class of functions, rather than the priority of a single request, and if the table is not updated, all requests from the same function will maintain the same priority level.
[0268] The system's workflow includes request scheduling and container pool management. For request scheduling, after a request has been authenticated, authorized, and certified, it is passed to the controller; requests are assigned priorities according to a function information table, and all requests for the same function share the same priority until this table is updated; when a request is completed, the CRL model outputs a new scheduling decision to select the request to be executed, and the function scheduler calls the deployment to execute the selected request.
[0269] For container pool management, the function arrival predictor predicts the number of function calls in the next minute based on the function's historical arrival data and sends the information to the container manager. This module manages the lifecycle of containers through update operations, warming up or terminating containers based on the expected number of future requests. Request scheduling and container management are not executed synchronously, but rather operate independently and collaboratively based on container creation, reuse, and termination operations.
[0270] For the specific implementation steps of each of the above components, please refer to the corresponding description in Example 1, which will not be repeated here.
[0271] In this embodiment, the system is implemented based on OpenWhisk, including adjustments to the controller, the addition of a function information table, and the implementation of a priority model. When a request arrives, the function information table communicates with the client and the controller to update the request data, and supplements the data by querying the CouchDB database.
[0272] Example 3:
[0273] See Figure 4 A serverless computing scheduling device based on function priority, the device including a processor 1 and a memory 2;
[0274] The memory 2 is used to store computer program code 21 and transmit the computer program code 21 to the processor 1;
[0275] The processor 1 is used to execute the serverless computing scheduling method based on function priority as described in Embodiment 1 according to the instructions in the computer program code 21.
[0276] This embodiment also includes a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed on a computer, the serverless computing scheduling method based on function priority described in Embodiment 1 is implemented.
[0277] Generally, the computer instructions for implementing the method of the present invention can be carried on any combination of one or more computer-readable storage media. Non-transitory computer-readable storage media can include any computer-readable medium except for the signal itself, which is temporarily propagating.
[0278] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EKROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0279] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages—such as Java, Smarttalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. In particular, Python, suitable for neural network computation, and platform frameworks such as TensorFlow and PyTorch can be used. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer or to an external computer (e.g., via the Internet using an Internet service provider) through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0280] The aforementioned devices and non-transitory computer-readable storage media can be found in the detailed description of a serverless computing scheduling method based on function priority and its beneficial effects, which will not be repeated here.
[0281] Although embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A serverless computing scheduling method based on function priority, characterized in that, include: S1. Obtain historical function execution data and extract resource-sensitive interval data; Based on resource-sensitive interval data, the improved Spearman rank correlation coefficient is calculated and coupled with correction to calculate the objective weight; Based on objective weights, a function priority model is constructed and the function scheduling priority is determined. S2. Construct a hybrid Prophet-LightGBM prediction model, where prediction function requests are distributed and container pools are dynamically managed. S3. Construct a deep reinforcement learning Q-network, design a clustering reinforcement learning scheduling strategy to train the deep reinforcement learning Q-network, and schedule function requests based on the trained deep reinforcement learning Q-network, function priority, and container pool state management to minimize scheduling latency.
2. The serverless computing scheduling method based on function priority according to claim 1, characterized in that: Step S1 specifically includes: S11. Obtain historical function execution data, define latency data as the end-to-end response time of function requests, and construct a set of key influencing factors. The key influencing factors include CPU resources, memory resources, I / O resources, parameter input size, cold start initialization time, function execution time, command termination time, function call frequency, and function most recent call time. S12, Targeting Key Influencing Factors The relationship with delayed data is analyzed by performing a moving average smoothing process on the delayed data to obtain a smooth curve. And calculate the difference gradient Its expression is as follows: ; in: For the first The delay value of each sampling point after smoothing by moving average; For the first Resource quantity of key influencing factors corresponding to each sampling point; S13, Calculate key influencing factors Maximum global gradient And set a dynamic convergence threshold. ;in, This is the preset sensitivity coefficient; S14. Based on the dynamic convergence threshold, traverse the delayed data, and when the differential gradient of several consecutive sampling points... When the first sampling point that meets the dynamic convergence threshold is determined to be the resource saturation threshold point, the historical function execution data is divided into resource-sensitive interval data and resource-saturated interval data based on the resource saturation threshold point. S15. Based on the resource-sensitive interval data, calculate the improved Spearman rank correlation coefficient, denoted as the baseline correlation score, whose expression is as follows: ; in: The baseline relevance score; This refers to the number of sampling points for data in resource-sensitive regions. It is the difference in rank; S16. Calculate the normalized mutual information between any two key influencing factors in the set of key influencing factors. The expression is as follows: ; in: For any two key influencing factors and Normalized mutual information between them; For mutual information; Information entropy; Set coupling determination threshold ,when If the two key influencing factors are found to have strong coupling redundancy, they are denoted as a strong coupling factor pair. S17. Based on the strongly coupled factor pairs, the average value of the benchmark correlation score is corrected, and the expression is as follows: ; in: The corrected relevance score; , These are the pairs of strongly coupled factors. The benchmark relevance score; S18. Based on the corrected relevance score, calculate the objective weight values of key influencing factors. The normalized expression is as follows: ; in: This is an objective weighting value; For the first The adjusted relevance scores of the key influencing factors; for The sum of the adjusted relevance scores of the key influencing factors; S19. Construct a function priority model based on objective weight values, and select a linear model or a log-linear model to calculate the function priority according to the application scenario.
3. The serverless computing scheduling method based on function priority according to claim 2, characterized in that: In step S19, the priority of selecting the linear model or log-linear model for calculating the function is determined according to the application scenario, specifically including: S191. Real-time statistics on the call frequency of each type of function within the time window, calculation of the load dominance rate, defined as the proportion of the most frequently called function to the total number of calls, expressed as follows: ; in: Load dominance rate; For the first Function call frequency; S192, Set the load dominance threshold ;when When the current situation is a general equilibrium scenario, the linear model is used to calculate the function priority; when If the current scenario is determined to be dominated by a single load, then the log-linear model is used to calculate the function priority.
4. The serverless computing scheduling method based on function priority according to claim 1, characterized in that: In step S2, constructing the hybrid Prophet-LightGBM prediction model specifically includes: S21. Construct the Prophet model, whose expression is as follows: ; in: For time steps The predicted value; For trend functions; It is a periodic term; For holidays; This is the error term; The trend function The dynamic logistic regression model is used, and its expression is as follows: ; in: The load-bearing capacity parameter changes dynamically over time; For growth rate; The time of the inflection point in the trend; S22. Based on the Prophet model, Bayesian posterior sampling is performed on the historical function execution data, and the probability distribution of the predicted values at future time steps is calculated. At the same time, quantiles with a pre-set confidence level are selected as the upper and lower bounds of the confidence interval. ; S23. Establish the LightGBM model, select L1 regularization as the objective function of LightGBM, and optimize the hyperparameters. When optimizing hyperparameters, the upper and lower bounds of the confidence intervals generated by the Prophet model are used. As a hard constraint boundary, if the prediction results of the hyperparameters exceed the hard constraint boundary in the early stage of training, the pruning operation is immediately triggered to forcibly terminate the invalid search until all effective parameters are optimized to obtain the optimal hyperparameters. The LightGBM model is then trained based on the optimal hyperparameters to obtain the hybrid Prophet-LightGBM prediction model.
5. The serverless computing scheduling method based on function priority according to claim 1, characterized in that: In step S2, the prediction function requests arrival at the distribution and dynamically manages the container pool, specifically including: S24. Obtain the total memory capacity and total CPU cores of the current node, calculate the sum of the resources occupied by the currently active containers and the resources occupied by the planned preheating containers. If the resource sufficiency condition is met simultaneously, the system resources are deemed sufficient, and the preheating operation is allowed. The expression for the resource sufficiency condition is as follows: ; ; in: This represents the amount of memory currently used by the active containers. The amount of memory to be used by the planned preheating container; The amount of memory required for a single preheating container; This represents the total memory capacity of the current node. This represents the number of CPU cores currently being used by the active containers. The number of CPU cores required for a single preheating container; This represents the total number of CPU cores. S25. Based on the amount of memory currently occupied by active containers. The requested arrival amount of the function at the predicted next time step. ,like If sufficient resources are available, preheating can be carried out in advance. A container; if Then calculate the idle cost of keeping the container active and the cold start cost of rebuilding after destruction; The idle cost of keeping the container active is expressed as follows: ; in: To maintain the idle costs of keeping containers active; Request the arrival time for the predicted next time step function; The current time; For container memory specifications; The cold start cost of destroying and rebuilding is expressed as follows: ; in: The cold start cost of rebuilding after destruction; This refers to the time required for a cold start. This is the priority adjustment coefficient; Function precedence; like If so, a keep-alive operation is performed to preserve the idle container; if If the condition is met, a termination operation will be performed to release the resources.
6. The serverless computing scheduling method based on function priority according to claim 1, characterized in that: Step S3 specifically includes: S31. Construct a concurrency matrix for a high-dimensional sparse state space to transform the serverless environment into a high-dimensional sparse state representation; based on the concurrency matrix, use KNN environment clustering transfer deep reinforcement learning Q network parameters based on workload pattern matching to accelerate policy convergence in the cold start phase. S32. Construct a multi-objective composite reward function of timeliness, cost, and fairness as a guide for reinforcement learning agents; S33. Based on state representation and reward function, optimize the deep reinforcement learning Q network and train it, then output a robust function scheduling strategy. S34. Based on a robust function scheduling strategy, an automatic request-response latency dynamic threshold is adopted to dynamically balance the response latency of function scheduling requests.
7. The serverless computing scheduling method based on function priority according to claim 6, characterized in that: Step S31 specifically includes: S311, Define environment status Normalized concurrent request feature matrix Among them: dimension Function type; dimension For concurrent statistical characteristics; S312. Construct a historical environment experience base based on historical function execution data. And calculate the information entropy value of each function type within the time window. Define feature weight vectors in reverse based on information entropy values. ; S313. Calculate the current concurrent request feature matrix based on the feature weight vector. Historical environment The weighted cosine similarity between them is expressed as follows: ; in: For weighted cosine similarity; For the first Each feature weight vector; For the first A feature matrix of concurrent requests; For the first in the historical environment Concurrency characteristics of class functions; S314. Select several historical environment clusters with the highest weighted cosine similarity, and assign the weighted average of the initial parameters of these historical environment clusters to the deep reinforcement learning Q-network as the warm-start initialization parameters to accelerate the convergence of the policy during the cold-start phase. The expression is as follows: ; in: Initialize parameters for warm start; For the first Initial parameters for a historical environment cluster; The number of initial parameters for the historical environment cluster.
8. The serverless computing scheduling method based on function priority according to claim 6, characterized in that: In step S32, the expression for the timeliness-cost-fairness multi-objective composite reward function is as follows: ; in: Positive rewards for delayed income; Penalty for resource consumption; For the purpose of fairness, penalties for breach of contract; For fairness weighting; The expression for the delayed positive reward is as follows: ; in: For the first Improved Spearman rank correlation coefficient of each scheduled request; The set of improved Spearman rank correlation coefficients for the scheduled requests; The resource consumption penalty is expressed as follows: ; in: For the first The memory specifications of each container; For the first Average cold start initialization time for each container; For the first Number of CPU cores; This is the conversion factor between CPU and memory weights; The collection of containers created after a function scheduling action triggers a cold start; The fairness breach penalty incorporates a request-response delay threshold mechanism, as detailed below: The waiting time for low-priority function requests in the scheduling queue At that time, a nonlinear penalty based on the natural exponential function is applied. The threshold for request-response latency is expressed as follows: ; ; in: For the first Queuing time for each function scheduling request; Request a queue for functions waiting to be scheduled; It is a non-linear penalty function; Basic penalty coefficient; This is the parameter for the exponential growth rate.
9. The serverless computing scheduling method based on function priority according to claim 6, characterized in that: Step S33 specifically includes: S331. Construct a deep reinforcement learning Q-network and collect empirical samples from a serverless scheduling environment. Calculate the absolute value of the temporal difference error for each empirical sample, as expressed below: ; in: For the first The absolute value of the time difference error of the empirical samples; The reward for the current action; Discount factor; This is the current Q value; The maximum Q value for the next state; S332. Based on the absolute value of the time difference error of each empirical sample, calculate the sampling probability during empirical playback, as expressed below: ; in: The sampling probability; Adjustment coefficient for priority; For the first The absolute value of the time difference error of the empirical samples; S333. Based on sampling probability, state representation and reward function, optimize the deep reinforcement learning Q network and train it until convergence or the preset number of training rounds is reached, and output a robust function scheduling strategy.
10. The serverless computing scheduling method based on function priority according to claim 6, characterized in that: Step S34 specifically includes: S341. Construct a global baseline request-response latency threshold, the expression of which is as follows: ; in: This serves as the global baseline request-response latency threshold. This represents the global average warm-up delay time. Standard deviation; S342. Construct the cold start tolerance request response latency threshold, the expression of which is as follows: ; in: Set a threshold for tolerating request response latency during cold starts; This is the dynamic tolerance coefficient; The historical average cold start initialization time; The dynamic tolerance coefficient By setting a target default rate And monitor the percentage of the total actual waiting time that exceeds the request response latency. ;like Then increase Conversely, it decreases. ; S343. Based on the global baseline request response latency threshold and the cold start tolerance request response latency threshold, the corresponding request response latency threshold is dynamically selected, and its expression is as follows: ; in: This is the corresponding request-response latency threshold.