Multi-tenant serverless platform resource management method and system
By constructing function affinity matrices and weighted relationship graphs, combined with time prediction models and adaptive control algorithms, dynamically adjust resource allocation, the resource management challenges of serverless platforms in multi-tenant environments are solved, and efficient resource utilization and performance improvement are achieved. .
Patent Information
- Application Number
- CN202410940200.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-07-15
AI Technical Summary
Existing serverless platforms have challenges in resource management in multi-tenant environments such as resource isolation, fairness, dynamic scaling, cold start optimization and cost optimization. In particular, it is difficult to achieve efficient resource allocation and scheduling in multi-tenant environments.
By defining the concept of function affinity, constructing a function affinity matrix and weighted relationship graph, combined with the pre-trained time prediction model and adaptive control algorithm, dynamically adjust resource allocation, use deep reinforcement learning to optimize scheduling parameters, and achieve fine-grained resource isolation. and efficient utilization.
It improves resource utilization efficiency, reduces cold start delay, optimizes resource allocation, improves system performance and user experience, and achieves more accurate resource management and scheduling.
Smart Images

Figure CN118467186B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to data processing technology, and in particular to a multi-tenant serverless platform resource management method and system. Background Art
[0002] With the development of cloud computing technology, serverless computing, as an emerging cloud computing model, is receiving more and more attention. Serverless computing allows users to focus on application development without having to pay attention to the management and maintenance of the underlying infrastructure. In serverless platforms, Function-as-a-Service (FaaS) is the main service form. Users write and deploy applications in units of functions, and the platform automatically allocates and scales resources according to the actual execution of the functions. However, existing serverless platforms still face some challenges in resource management in a multi-tenant environment. First, multiple tenants share the computing resources of the serverless platform, and it is necessary to ensure resource isolation between different tenants to prevent mutual interference. At the same time, resources should be allocated fairly and reasonably to avoid some tenants occupying too many resources and affecting the service quality of other tenants. Secondly, the serverless platform needs to dynamically adjust resource allocation according to the actual execution of the function. When function requests increase, resources should be expanded in time to meet performance requirements; when function requests decrease, resources should be reduced in time to save costs. However, accurately predicting resource requirements and adjusting resource allocation in time is still a challenge. In addition, serverless platforms usually adopt an on-demand startup mode. When a function is called for the first time or is called again after being idle for a period of time, the operating environment needs to be restarted, resulting in a long startup delay, which is the cold start problem. How to minimize the impact of cold start on function execution performance is a challenge currently faced by serverless platforms.
[0003] Although existing serverless platforms, such as AWS Lambda and Google Cloud Functions, have made some progress in automatic scaling and on-demand billing, there is still much room for improvement in resource isolation and fairness in a multi-tenant environment, accuracy of dynamic scaling, cold start optimization, cost optimization, and heterogeneous resource management. Therefore, a new resource management method for multi-tenant serverless platforms is urgently needed to solve the above problems and improve the performance, efficiency, and user experience of the platform. Summary of the invention
[0004] The embodiments of the present invention provide a multi-tenant serverless platform resource management method and system, which can solve the problems in the prior art.
[0005] According to a first aspect of the embodiments of the present invention,
[0006] A multi-tenant serverless platform resource management method is provided, including:
[0007] Based on the multi-tenant serverless platform system model, the concept of function affinity is defined, and the function affinity matrix is constructed through the calling frequency and data transmission volume between functions to characterize the calling dependency relationship between functions in the workflow. At the same time, the function execution time is predicted using the pre-trained time prediction model to obtain the prediction result of the function execution time;
[0008] Based on the constructed function affinity matrix and the prediction results of function execution time, a weighted relationship graph between functions is constructed and divided. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and functions are allocated to different servers to obtain the first-stage scheduling results.
[0009] Based on the scheduling results of the first stage, the function instance queue is maintained independently on each server. The scheduling parameters of the function instance queue are dynamically adjusted according to the performance indicators and resource utilization of the function instance queue itself. At the same time, resource utility measurement indicators are introduced. Under the premise of satisfying the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation plan.
[0010] In an optional embodiment,
[0011] The function execution time is predicted using the pre-trained time prediction model. After obtaining the prediction result of the function execution time, the following steps are also included:
[0012] During the function execution process, the actual function execution time is recorded in real time, compared with the predicted result of the function execution time, and the prediction error data is calculated;
[0013] Perform forecast deviation analysis based on forecast error data, identify function types and execution modes with large forecast errors and frequent fluctuations, and output forecast deviation analysis results;
[0014] According to the results of prediction deviation analysis, the parameters of the time prediction model are dynamically adjusted using an online learning algorithm. A variety of prediction correction strategies are designed for different function types and execution modes. The optimal correction strategy is adaptively selected based on function characteristics and system status.
[0015] In an optional embodiment,
[0016] Partitioning the weighted relationship graph between functions includes:
[0017] The partitioning process of the weighted relationship graph between functions is divided into a load balancing optimization stage, a communication optimization stage and a critical path optimization stage;
[0018] In the load balancing optimization stage, a quadratic objective function of the balancing deviation is constructed, a balancing tolerance constraint subgraph size upper limit is introduced, a heuristic algorithm is used to solve the load balancing partitioning scheme, and a preliminary balancing partitioning result is obtained;
[0019] The obtained preliminary balanced partitioning result is used as the initial solution of the communication optimization stage. In the communication optimization stage, a communication cost objective function based on graph cut is constructed, and the delay tolerance is introduced to constrain the critical path length. The local search algorithm is used to optimize the initial solution under the premise of maintaining load balance, reduce the communication cost, and obtain a low communication partitioning result;
[0020] Based on the obtained low communication partitioning result, in the critical path optimization stage, the critical path length is extracted as the optimization target, the load balancing and communication cost constraints are combined, and the low communication partitioning result is adjusted by using the critical path scheduling algorithm to obtain the critical path optimization partitioning result;
[0021] The key path optimization partitioning results are used as the input for the next round of load balancing optimization. The partitioning result optimization steps are repeated until the preset convergence conditions are met, and the final partitioning results of the weighted relationship graph between functions are output.
[0022] In an optional embodiment,
[0023] The scheduling parameters for dynamically adjusting the function instance queue include:
[0024] The performance indicators, resource utilization, and current scheduling parameter values of the function instance queue are used as the state space of reinforcement learning. The value ranges of all adjustable scheduling parameters are divided into discrete levels to form the action space of reinforcement learning.
[0025] Constructing a multi-objective reward function according to the multi-objectives dynamically adjusted by the scheduling parameters, wherein the multi-objective reward function may include reducing the average response time, improving the throughput, and reducing the error rate;
[0026] Based on the designed state space, action space and reward function, a deep reinforcement learning model is used to model the dynamic adjustment problem of scheduling parameters, and the parameters of the deep reinforcement learning model are updated through the policy gradient algorithm. The updated deep reinforcement learning model is used to output the final target scheduling parameter adjustment strategy, and the target scheduling parameter adjustment strategy is used to dynamically adjust the scheduling parameters of the function instance queue.
[0027] In an optional embodiment,
[0028] The calculation formula for updating the parameters of the deep reinforcement learning model through the policy gradient algorithm is as follows:
[0029] ;
[0030] Among them, θ * represents the updated policy parameters, θ represents the policy parameters, α represents the learning rate, N represents the number of sampled trajectories, i represents the sampled trajectory index, T represents the adopted trajectory length, t represents the current time step, represents the gradient operation on θ, π(·) represents the conditional probability distribution, and a t Indicates action, s t represents the current state, t' represents the next time step of the current time step, γ represents the discount factor, R(·) represents the reward, and s t' Indicates the state at the next time step of the current time step, a t' Indicates the action corresponding to the state at the next time step of the current time step.
[0031] In an optional embodiment,
[0032] Using adaptive control algorithms to dynamically adjust resource allocation, the optimal resource allocation solution includes:
[0033] Collecting system resource utilization data, including CPU utilization, memory utilization, and disk I / O utilization;
[0034] Preprocess and extract features of the collected resource utilization data to obtain standard utilization data, input the standard utilization data into a pre-trained resource prediction model, and obtain the prediction results of resource utilization within a preset time;
[0035] Use anomaly detection algorithms to analyze resource utilization data in real time. When an abnormal situation is detected, dynamic adjustment of resource allocation is triggered. The analysis results are compared with the preset abnormal threshold to obtain abnormal information of resource allocation.
[0036] An objective function is constructed based on the predicted results of resource utilization within a preset time and the abnormal information of resource allocation. The optimal resource allocation plan is generated by minimizing the objective function.
[0037] In an optional embodiment,
[0038] The calculation formula of the objective function is as follows:
[0039] ;
[0040] Among them, J represents the objective function, λ1 represents the weight coefficient of the resource utilization prediction result, M represents the number of samples, i represents the sample index, and y i Indicates actual resource utilization data, represents the prediction result, λ2 represents the weight coefficient of abnormal information, X represents resource utilization, μ represents the mean value of the data set, and σ represents the standard deviation of the data set.
[0041] According to a second aspect of the embodiments of the present invention,
[0042] Provided is a multi-tenant serverless platform resource management system, including:
[0043] The first unit is used to define the concept of function affinity according to the multi-tenant serverless platform system model, build a function affinity matrix through the call frequency and data transmission volume between functions, characterize the call dependency relationship between functions in the workflow, and use the pre-trained time prediction model to predict the function execution time to obtain the prediction result of the function execution time;
[0044] The second unit is used to construct a weighted relationship graph between functions based on the constructed function affinity matrix and the prediction results of the function execution time, and divide the weighted relationship graph between functions. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and the functions are allocated to different servers to obtain the scheduling results of the first stage;
[0045] The third unit is used to independently maintain the function instance queue on each server based on the scheduling results of the first stage, dynamically adjust the scheduling parameters of the function instance queue according to the performance indicators and resource utilization of the function instance queue itself, and introduce resource utility measurement indicators. Under the premise of satisfying the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation plan.
[0046] According to a third aspect of the embodiments of the present invention,
[0047] An electronic device is provided, comprising:
[0048] processor;
[0049] a memory for storing processor-executable instructions;
[0050] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0051] A fourth aspect of the embodiments of the present invention is:
[0052] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0053] In this embodiment, by constructing a function affinity matrix, the call dependency relationship between functions in the workflow can be accurately characterized, providing an important basis for function scheduling. By using a pre-trained time prediction model to predict the function execution time, the time overhead of function execution can be better evaluated, providing a reference for resource allocation. Based on the function affinity matrix and the function execution time prediction results, a weighted relationship graph is constructed, and a greedy algorithm is used for function partitioning, so that functions with high affinity can be allocated to the same server as much as possible, reducing cross-server communication overhead. By introducing a balancing factor to limit the number of function instances and the total resource demand on a single server, it is possible to avoid excessive load on individual servers and improve overall resource utilization efficiency. By independently maintaining a function instance queue on each server and dynamically adjusting the scheduling parameters according to the performance indicators and resource utilization of the queue, a more flexible scheduling strategy can be implemented to improve resource utilization. By introducing resource utility measurement indicators and dynamically adjusting resource allocation using an adaptive control algorithm, fine-grained resource isolation and efficient utilization can be achieved, the overall performance and resource utilization efficiency of the system can be improved, and a comprehensive solution can be provided for resource scheduling and management of serverless platforms. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A schematic diagram of a process for managing resources of a multi-tenant serverless platform according to an embodiment of the present invention;
[0055] Figure 2 It is a structural diagram of a multi-tenant serverless platform resource management system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0058] Figure 1 FIG. 1 is a flow chart of a multi-tenant serverless platform resource management method according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0059] S101. According to the multi-tenant serverless platform system model, the concept of function affinity is defined, and the function affinity matrix is constructed through the calling frequency and data transmission volume between functions to characterize the calling dependency relationship between functions in the workflow. At the same time, the function execution time is predicted using the pre-trained time prediction model to obtain the prediction result of the function execution time;
[0060] Among them, the multi-tenant serverless platform system model includes key elements such as physical machine clusters, function instances, and workflow tasks.
[0061] In a serverless platform, users do not need to manage the specific details of the server because the management and allocation of server resources are completed by the serverless platform provider. Users only need to upload and configure the function code, and the serverless platform will automatically allocate server resources to execute the function according to the user's needs, and dynamically scale the server according to the requested load. Users do not need to worry about the specific configuration, deployment and maintenance of the server, and can focus on developing and deploying function code.
[0062] Although users do not need to manage servers directly, they still need servers to host the execution of function instances. The server is the infrastructure of the serverless platform, responsible for providing computing, storage, and network resources for executing function code. The serverless platform dynamically allocates function instances to available servers based on user requests, and automatically migrates and adjusts the location of function instances based on load conditions. Therefore, servers are still an indispensable component of the serverless platform to support users' function execution needs.
[0063] Among them, constructing the function affinity matrix through the calling frequency and data transmission volume between functions includes counting the number of direct calls between two functions. The more the number of calls, the higher the coupling degree between the two functions and the greater the affinity; counting the amount of data transmitted between the two functions. The greater the data transmission volume, the more intermediate data needs to be exchanged between them, and the greater the affinity. The function affinity matrix can characterize the calling dependency relationship between functions in the workflow. Functions with higher affinity should be assigned to the same server as much as possible for execution, which can reduce the data transmission overhead across servers and improve execution efficiency.
[0064] For example, the training of the time prediction model first collects the historical execution records of the function, extracts the features such as the function execution time, the amount of input data, and the resource usage, and constructs the training data set and the test data set. The data is preprocessed by cleaning and normalizing to improve the data quality.
[0065] The time prediction model is trained using the training data set, and the model hyperparameters are optimized through methods such as cross-validation to improve the prediction performance of the single model and obtain the final time prediction model.
[0066] In an optional embodiment,
[0067] The function execution time is predicted using the pre-trained time prediction model. After obtaining the prediction result of the function execution time, the following steps are also included:
[0068] During the function execution process, the actual function execution time is recorded in real time, compared with the predicted result of the function execution time, and the prediction error data is calculated;
[0069] Perform forecast deviation analysis based on forecast error data, identify function types and execution modes with large forecast errors and frequent fluctuations, and output forecast deviation analysis results;
[0070] According to the results of prediction deviation analysis, the parameters of the time prediction model are dynamically adjusted using an online learning algorithm. A variety of prediction correction strategies are designed for different function types and execution modes. The optimal correction strategy is adaptively selected based on function characteristics and system status.
[0071] For example, before the function is executed, the predicted execution time of the function is recorded. During the execution of the function, the actual execution time of the function is recorded in real time through the inserter or performance analysis tool, the prediction error is calculated, and the error value is stored in the feedback database together with the function identifier. At the same time, the system status information during the execution of the function, such as CPU utilization, memory usage, etc., is collected and stored in association with the function identifier.
[0072] Read prediction error data from the feedback database regularly and group them by function type and execution mode. Perform statistical analysis on the prediction error data in each group and calculate the mean and standard deviation of the error. According to the preset threshold, identify the function type and execution mode that meet the conditions and mark them as high deviation groups.
[0073] For each function type and execution mode in the high deviation group, extract the corresponding historical execution data and system status information. Use online learning algorithms, such as Online Gradient Descent, to dynamically adjust the parameters of the prediction model.
[0074] Design prediction correction strategies for different function types and execution modes. For example, parameter fine-tuning: For functions with small prediction errors, fine-tune model parameters through online learning algorithms to reduce prediction errors. Model retraining: For functions with large prediction errors that persist for a period of time, use the latest execution data to retrain the prediction model to improve prediction accuracy. Historical data weighting: For functions with frequent fluctuations in prediction errors, weight historical execution data according to time distance to reduce the impact of past data and adapt to the latest execution mode.
[0075] According to the prediction error statistical characteristics of the function and the system status information, the optimal correction strategy is adaptively selected using classification algorithms such as decision trees or random forests.
[0076] In this embodiment, by calculating the prediction error and analyzing the prediction deviation, it is possible to identify which function types and execution modes are prone to large prediction errors, thereby optimizing the prediction model in a targeted manner and improving the overall prediction accuracy. Using the online learning algorithm, the model can dynamically adjust its own parameters based on the execution time data collected in real time, so that the prediction model continues to adapt to the actual operating status of the system and avoids the performance of the prediction model from deteriorating over time. By designing a variety of prediction correction strategies and adaptively selecting the optimal strategy for different function characteristics and system states, it is possible to effectively cope with the diverse function types and execution modes in the serverless platform and improve the versatility and robustness of the prediction model. Based on more accurate execution time prediction results, resources can be planned and allocated more reasonably, providing more reliable data support for resource scheduling and optimization of the serverless platform, thereby achieving efficient resource utilization and improving the overall performance of the system.
[0077] S102. Based on the constructed function affinity matrix and the prediction results of the function execution time, a weighted relationship graph between functions is constructed, and the weighted relationship graph between functions is divided. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and the functions are allocated to different servers to obtain the first stage scheduling result;
[0078] In an optional embodiment,
[0079] Partitioning the weighted relationship graph between functions includes:
[0080] The partitioning process of the weighted relationship graph between functions is divided into a load balancing optimization stage, a communication optimization stage and a critical path optimization stage;
[0081] In the load balancing optimization stage, a quadratic objective function of the balancing deviation is constructed, a balancing tolerance constraint subgraph size upper limit is introduced, a heuristic algorithm is used to solve the load balancing partitioning scheme, and a preliminary balancing partitioning result is obtained;
[0082] The obtained preliminary balanced partitioning result is used as the initial solution of the communication optimization stage. In the communication optimization stage, a communication cost objective function based on graph cut is constructed, and the delay tolerance is introduced to constrain the critical path length. The local search algorithm is used to optimize the initial solution under the premise of maintaining load balance, reduce the communication cost, and obtain a low communication partitioning result;
[0083] Based on the obtained low communication partitioning result, in the critical path optimization stage, the critical path length is extracted as the optimization target, the load balancing and communication cost constraints are combined, and the low communication partitioning result is adjusted by using the critical path scheduling algorithm to obtain the critical path optimization partitioning result;
[0084] The key path optimization partitioning results are used as the input for the next round of load balancing optimization. The partitioning result optimization steps are repeated until the preset convergence conditions are met, and the final partitioning results of the weighted relationship graph between functions are output.
[0085] For example, the entire partitioning process needs to be divided into multiple independent optimization stages. Each stage focuses on specific optimization goals and constraints, and gradually improves different quality indicators of the partitioning results by solving them in stages. Specifically, the partitioning process is divided into a load balancing optimization stage, a communication optimization stage, and a critical path optimization stage.
[0086] The main goal of the load balancing optimization phase is to optimize load balancing, that is, to make the scale of each subgraph as close as possible. By balancing the load, the efficiency of parallel processing can be improved, and task waiting and resource waste can be avoided. A quadratic function is used to describe the load balancing deviation. The smaller the deviation, the more uniform the load distribution. The load balancing deviation can be obtained by dividing the average of the square of the difference between the number of vertices in each subgraph and the total number of vertices by the number of subgraphs. The introduction of balancing tolerance relaxes the restrictions on communication overhead while ensuring load balancing, allowing local imbalance to obtain a better global partitioning effect.
[0087] The main goal of the communication optimization phase is to minimize the communication overhead between subgraphs. By minimizing the number or weight of cross-subgraph edges, data transmission and synchronization operations between subgraphs can be reduced, and the scalability of parallel computing can be improved. The communication cost of the communication partitioning scheme is described as the sum of the weights of the cross-subgraph edges. By minimizing the communication cost, the partitioning scheme with the lowest communication overhead can be obtained. Constraints are used to limit the size of a single subgraph to not exceed the total number of vertices divided by the number of subgraphs plus the tolerance. The main goal of the critical path optimization phase is to shorten the critical path length of the function relationship graph. By optimizing the task allocation and execution order on the critical path, the overall delay of parallel computing can be reduced and the efficiency of task-level parallelism can be improved. Constraints are used to limit the delay of the critical path to not exceed the product of the critical path length of the partitioning scheme in the previous stage multiplied by the tolerance plus one.
[0088] The critical path length represents the length of the longest path among all possible paths, and the sum of the execution times of all vertices on the path. Optionally, the division and order of the stages can be flexibly adjusted according to the characteristics of the problem and the optimization requirements. At the same time, multi-granularity optimization can also be introduced according to the stage division, and different granularity optimization strategies can be adopted in different stages, such as coarse-grained balancing, fine-grained communication optimization, etc.
[0089] In multi-stage partitioning optimization, a reasonable information transmission mechanism between stages can greatly improve the overall optimization effect. By using the optimization results of the previous stage as the input of the next stage, a connection can be established between different stages to achieve progressive optimization of the partitioning results.
[0090] The balanced partitioning result obtained by the balance optimization is used as the initial solution of the communication optimization stage. In the communication optimization process, the balanced partitioning result is used as a reference to design a perturbation function. Under the premise of maintaining load balance, the partitioning boundary is locally adjusted to reduce the communication cost. After the communication optimization is completed, the optimized partitioning result is returned to the balanced optimization stage as the input of the next round of balanced optimization, and the local load imbalance area is rebalanced. Multi-stage optimization is carried out through iteration until the preset convergence condition is reached or the specified number of optimization rounds is completed. A similar information transmission mechanism can also be established between the communication optimization stage and the critical path optimization stage, and the low communication partition is used as the basis for critical path optimization. While shortening the critical path, the optimization effect of the communication cost is maintained as much as possible.
[0091] The multi-stage partitioning optimization is carried out through iteration, using the information transmission mechanism between stages to exchange intermediate optimization results, dynamically adjust the optimization objectives and constraints of each stage, and collaboratively optimize load balancing, communication costs, and critical path performance until the preset convergence conditions are reached or the specified number of optimization rounds are completed, and the global optimal partitioning result is output.
[0092] In this embodiment, by integrating multiple optimization objectives such as load balancing, communication cost and critical path length into a unified framework, the optimal solution that meets multiple objectives can be obtained through multi-stage iterative approximation. In the load balancing optimization stage, by constructing a quadratic objective function of balanced deviation and introducing balanced tolerance constraints, load balancing between servers can be effectively achieved to avoid overloading of individual servers. In the communication optimization stage, a communication cost objective function based on graph cuts is constructed, and the initial solution is optimized using a local search algorithm. High affinity functions can be allocated to the same server as much as possible to reduce cross-server communication overhead. In the critical path optimization stage, the critical path length is extracted as the optimization target, and the critical path scheduling algorithm is used for adjustment, which can shorten the critical path length that affects the overall performance. Through multiple rounds of iterative execution of load balancing, communication and critical path optimization, the optimization targets of subsequent stages can be continuously improved on the basis of maintaining the optimization results of the previous stage, and the global optimal solution can be gradually approached. The optimal function scheduling scheme that meets various constraints is obtained through iterative approximation, thereby comprehensively improving the performance and scalability of the serverless platform.
[0093] S103. Based on the scheduling results of the first stage, the function instance queue is independently maintained on each server. The scheduling parameters of the function instance queue are dynamically adjusted according to the performance indicators and resource utilization of the function instance queue itself. At the same time, resource utility measurement indicators are introduced. Under the premise of satisfying the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation plan.
[0094] The function instance queue records all function instance information running on the current server, including attributes such as the tenant, priority, resource requirements, and execution status.
[0095] Fine-grained resource isolation mechanisms include CPU isolation, which binds different instances to different CPU cores or threads through CPU affinity settings to reduce performance interference introduced by sharing, such as CPU cache and scheduling overhead. CPU time slice allocation dynamically adjusts the length and frequency of CPU time slices obtained by each instance based on instance priority and resource requirements to ensure the execution quality of key tasks. LLC isolation uses hardware features such as Intel CAT to allocate LLC ways to different instances in proportion to avoid performance degradation caused by LLC pollution. The isolation scheme can be dynamically adjusted based on instance memory access mode, data locality and other characteristics. Memory bandwidth isolation: Use technologies such as Intel MBA to limit the memory bandwidth usage of each instance to prevent memory-intensive instances from occupying too much bandwidth and affecting other instances. I / O isolation: Use I / O request scheduling, current limiting and other methods to prevent I / O-intensive instances from affecting other instances. It can be combined with the I / O service quality assurance mechanism to improve the I / O performance of key tasks.
[0096] The resource utility measurement index comprehensively considers factors such as resource utilization, resource contention, and resource allocation fairness, and designs a multi-dimensional index system. For each dimension of the index, the corresponding calculation formula and scoring rules are designed, and the scores of each index are dynamically calculated by real-time collection of system operation data. By weighted combination of the index scores of multiple dimensions, a comprehensive resource utility measurement value is obtained.
[0097] Scheduling parameters can include concurrency, timeout, cache strategy, etc.
[0098] In an optional embodiment,
[0099] The scheduling parameters for dynamically adjusting the function instance queue include:
[0100] The performance indicators, resource utilization, and current scheduling parameter values of the function instance queue are used as the state space of reinforcement learning. The value ranges of all adjustable scheduling parameters are divided into discrete levels to form the action space of reinforcement learning.
[0101] Constructing a multi-objective reward function according to the multi-objectives dynamically adjusted by the scheduling parameters, wherein the multi-objective reward function may include reducing the average response time, improving the throughput, and reducing the error rate;
[0102] Based on the designed state space, action space and reward function, a deep reinforcement learning model is used to model the dynamic adjustment problem of scheduling parameters, and the parameters of the deep reinforcement learning model are updated through the policy gradient algorithm. The updated deep reinforcement learning model is used to output the final target scheduling parameter adjustment strategy, and the target scheduling parameter adjustment strategy is used to dynamically adjust the scheduling parameters of the function instance queue.
[0103] Exemplarily, the performance indicators, resource utilization and current scheduling parameter values of the function instance queue are used as the state space of reinforcement learning. The value ranges of all adjustable scheduling parameters (such as concurrency, timeout, etc.) are divided into discrete levels to form the action space of reinforcement learning. According to the optimization goals of adaptive scheduling (such as reducing response time, improving throughput, saving resource overhead, etc.), a reasonable reward function is designed to quantitatively evaluate the quality of each scheduling decision. The design of the reward function needs to comprehensively consider multiple performance and resource indicators to achieve the global optimum.
[0104] Select appropriate reinforcement learning algorithms, such as DQN, DDPG, PPO, etc., to model and solve scheduling parameter optimization problems. Select the best matching algorithm based on the characteristics of the state space, action space, and reward function.
[0105] A deep reinforcement learning algorithm is selected, and a deep reinforcement learning model is constructed according to the state space, the action space, and the reward function. The deep reinforcement learning model uses a deep neural network as a value function approximator and a policy function approximator, and optimizes and solves the scheduling parameter selection strategy through value function approximation and policy gradient ascent.
[0106] The performance indicators and resource utilization data in the state space are continuously collected at fixed time intervals. Each time a new set of state data is collected, a scheduling decision is triggered, the deep reinforcement learning model is called, the optimal scheduling parameter configuration is selected according to the current state, and the scheduling parameter configuration is sent to the function instance queue and the scheduling is executed. At the same time, the state transfer data and reward feedback data after the scheduling execution are collected for updating the parameters of the deep reinforcement learning model.
[0107] The parameter update of the deep reinforcement learning model adopts the method of experience replay and asynchronous parallel learning. A certain amount of historical state transition data and reward feedback data is cached through the experience replay pool, and the data in the replay pool is randomly sampled to achieve efficient use of data and stable training of the algorithm. At the same time, multiple parallel learning agents are used, each of which independently interacts with the environment to collect data and update model parameters, and regularly uploads local model parameters to the central model for aggregate update, realizing distributed asynchronous parallel learning and improving training efficiency and performance.
[0108] The updated deep reinforcement learning model is applied to the online scheduling decision of Function as a Service, and the scheduling parameter configuration is dynamically adjusted in real time according to changes in system status, so as to continuously optimize the performance and resource utilization efficiency of Function as a Service and realize adaptive optimization of scheduling.
[0109] In an optional embodiment,
[0110] The calculation formula for updating the parameters of the deep reinforcement learning model through the policy gradient algorithm is as follows:
[0111] ;
[0112] Among them, θ * represents the updated policy parameters, θ represents the policy parameters, α represents the learning rate, N represents the number of sampled trajectories, i represents the sampled trajectory index, T represents the adopted trajectory length, t represents the current time step, represents the gradient operation on θ, π(·) represents the conditional probability distribution, and a t Indicates action, s t represents the current state, t' represents the next time step of the current time step, γ represents the discount factor, R(·) represents the reward, and s t' Indicates the state at the next time step of the current time step, a t' Indicates the action corresponding to the state at the next time step of the current time step.
[0113] In this embodiment, through the deep reinforcement learning model, the optimal combination of scheduling parameters can be automatically searched to achieve automation and intelligence of parameter adjustment. The scheduling decision is dynamically output according to the current queue status and resource utilization, which has strong real-time adaptability and can flexibly respond to dynamic changes during system operation. Modeling the problem of dynamic adjustment of scheduling parameters as a deep reinforcement learning task can achieve the advantages of automation, multi-objective optimization, real-time adaptability, and continuous optimization of scheduling decisions, thereby improving the resource utilization efficiency, system throughput and response performance of the serverless platform, while reducing labor costs and improving operation and maintenance efficiency.
[0114] In an optional embodiment,
[0115] Using adaptive control algorithms to dynamically adjust resource allocation, the optimal resource allocation solution includes:
[0116] Collecting system resource utilization data, including CPU utilization, memory utilization, and disk I / O utilization;
[0117] Preprocess and extract features of the collected resource utilization data to obtain standard utilization data, input the standard utilization data into a pre-trained resource prediction model, and obtain the prediction results of resource utilization within a preset time;
[0118] Use anomaly detection algorithms to analyze resource utilization data in real time. When an abnormal situation is detected, dynamic adjustment of resource allocation is triggered. The analysis results are compared with the preset abnormal threshold to obtain abnormal information of resource allocation.
[0119] An objective function is constructed based on the predicted results of resource utilization within a preset time and the abnormal information of resource allocation. The optimal resource allocation plan is generated by minimizing the objective function.
[0120] For example, the resource utilization data of the system is first collected in real time, including multi-dimensional indicators such as CPU utilization, memory utilization, and disk I / O utilization. Machine learning algorithms, such as time series prediction algorithms, are used to model and predict resource utilization data. Common time series prediction algorithms include ARIMA, LSTM, GRU, etc. A resource utilization prediction model is established by extracting features and mining patterns from historical resource utilization data, and a sliding window mechanism is used to perform incremental training and updates on the model. In the process of resource allocation optimization, the prediction model predicts the trend of resource utilization changes in the future based on the latest resource utilization data.
[0121] By monitoring resource utilization data in real time, anomaly detection algorithms are used to discover abnormal fluctuations and change patterns. Anomaly detection methods can be divided into statistical methods and machine learning methods. Statistical methods set anomaly thresholds and mark data points that exceed the threshold as abnormal; machine learning methods train anomaly detection models, learn the distribution characteristics of normal data, and mark data points that deviate from the normal distribution as abnormal. Common anomaly detection algorithms include isolation forest, one-class SVM, local anomaly factor, etc.
[0122] Taking into account the resource utilization prediction results and anomaly detection results, the resource allocation strategy is adjusted dynamically to generate the optimal resource allocation plan. The resource allocation optimization problem can be modeled as a multi-objective optimization problem, and the objective functions include maximizing resource utilization, minimizing response time, and resource allocation fairness. The constraints of the optimization problem include resource capacity limitations and service quality assurance. Intelligent optimization algorithms such as heuristic algorithms, evolutionary algorithms, and reinforcement learning can be used to solve the resource allocation optimization problem. By solving the resource allocation optimization model in real time, a dynamically adjusted resource allocation plan is generated, and resource allocation and adjustment are performed through the resource scheduler to achieve adaptive optimization of resource allocation.
[0123] In an optional embodiment,
[0124] The calculation formula of the objective function is as follows:
[0125] ;
[0126] Among them, J represents the objective function, λ1 represents the weight coefficient of the resource utilization prediction result, M represents the number of samples, i represents the sample index, and y i Indicates actual resource utilization data, represents the prediction result, λ2 represents the weight coefficient of abnormal information, X represents resource utilization, μ represents the mean value of the data set, and σ represents the standard deviation of the data set.
[0127] In this embodiment, by using the resource utilization prediction model to predict the resource demand in the future, resources can be planned and allocated more accurately, resource waste can be avoided, and resource utilization efficiency can be improved. By continuously monitoring the resource utilization data, once an abnormal situation is detected, the dynamic adjustment of resource allocation will be triggered, so that resource allocation can respond to system changes in real time. Introducing anomaly detection algorithms to analyze resource utilization, timely discover anomalies, and feed back abnormal information to the optimization process will help generate a more reasonable resource allocation plan and ensure the stable operation of the system. By constructing an objective function and performing optimization solutions, the optimal resource allocation plan can be generated, so that limited resources can be reasonably allocated and utilized, and the quality and efficiency of overall resource allocation can be improved. It realizes dynamic optimization of resource allocation, ensures system stability, reduces operation and maintenance costs, supports fine-grained resource management, and is a powerful means for serverless platforms to achieve efficient, reliable, and intelligent resource management.
[0128] Figure 2 Schematic diagram of the structure of a multi-tenant serverless platform resource management system according to an embodiment of the present invention. Figure 2 As shown, the system comprises:
[0129] The first unit is used to define the concept of function affinity according to the multi-tenant serverless platform system model, build a function affinity matrix through the call frequency and data transmission volume between functions, characterize the call dependency relationship between functions in the workflow, and use the pre-trained time prediction model to predict the function execution time to obtain the prediction result of the function execution time;
[0130] The second unit is used to construct a weighted relationship graph between functions based on the constructed function affinity matrix and the prediction results of the function execution time, and divide the weighted relationship graph between functions. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and the functions are allocated to different servers to obtain the scheduling results of the first stage;
[0131] The third unit is used to independently maintain the function instance queue on each server based on the scheduling results of the first stage, dynamically adjust the scheduling parameters of the function instance queue according to the performance indicators and resource utilization of the function instance queue itself, and introduce resource utility measurement indicators. Under the premise of satisfying the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation plan.
[0132] According to a third aspect of the embodiments of the present invention,
[0133] An electronic device is provided, comprising:
[0134] processor;
[0135] a memory for storing processor-executable instructions;
[0136] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0137] A fourth aspect of the embodiments of the present invention is:
[0138] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0139] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-tenant serverless platform resource management method, characterized in that: include: Based on the multi-tenant serverless platform system model, the concept of function affinity is defined, and the function affinity matrix is constructed through the calling frequency and data transmission volume between functions to characterize the calling dependency relationship between functions in the workflow. At the same time, the function execution time is predicted using the pre-trained time prediction model to obtain the prediction result of the function execution time; Based on the constructed function affinity matrix and the prediction results of function execution time, a weighted relationship graph between functions is constructed and divided. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and functions are allocated to different servers to obtain the first-stage scheduling results. Based on the scheduling results of the first phase, the function instance queue is independently maintained on each server. The scheduling parameters of the function instance queue are dynamically adjusted according to the performance indicators and resource utilization of the function instance queue itself. At the same time, resource utility measurement indicators are introduced. Under the premise of meeting the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation solution. Partitioning the weighted relationship graph between functions includes: The partitioning process of the weighted relationship graph between functions is divided into a load balancing optimization stage, a communication optimization stage and a critical path optimization stage; In the load balancing optimization stage, a quadratic objective function of the balancing deviation is constructed, a balancing tolerance constraint subgraph size upper limit is introduced, a heuristic algorithm is used to solve the load balancing partitioning scheme, and a preliminary balancing partitioning result is obtained; The obtained preliminary balanced partitioning result is used as the initial solution of the communication optimization stage. In the communication optimization stage, a communication cost objective function based on graph cut is constructed, and the delay tolerance is introduced to constrain the critical path length. The local search algorithm is used to optimize the initial solution under the premise of maintaining load balance, reduce the communication cost, and obtain a low communication partitioning result; Based on the obtained low communication partitioning result, in the critical path optimization stage, the critical path length is extracted as the optimization target, the load balancing and communication cost constraints are combined, and the low communication partitioning result is adjusted by using the critical path scheduling algorithm to obtain the critical path optimization partitioning result; The key path optimization partitioning results are used as the input for the next round of load balancing optimization. The partitioning result optimization steps are repeated until the preset convergence conditions are met, and the final partitioning results of the weighted relationship graph between functions are output.
2. The method according to claim 1, characterized in that The function execution time is predicted using the pre-trained time prediction model. After obtaining the prediction result of the function execution time, the following steps are also included: During the function execution process, the actual function execution time is recorded in real time, compared with the predicted result of the function execution time, and the prediction error data is calculated; Perform forecast deviation analysis based on forecast error data, identify function types and execution modes with large forecast errors and frequent fluctuations, and output forecast deviation analysis results; According to the results of prediction deviation analysis, the parameters of the time prediction model are dynamically adjusted using an online learning algorithm. A variety of prediction correction strategies are designed for different function types and execution modes. The optimal correction strategy is adaptively selected based on function characteristics and system status.
3. The method according to claim 1, characterized in that The scheduling parameters for dynamically adjusting the function instance queue include: The performance indicators, resource utilization, and current scheduling parameter values of the function instance queue are used as the state space of reinforcement learning. The value ranges of all adjustable scheduling parameters are divided into discrete levels to form the action space of reinforcement learning. Constructing a multi-objective reward function according to the multi-objectives dynamically adjusted by the scheduling parameters, wherein the multi-objective reward function includes reducing the average response time, improving the throughput, and reducing the error rate; Based on the designed state space, action space and reward function, a deep reinforcement learning model is used to model the dynamic adjustment problem of scheduling parameters, and the parameters of the deep reinforcement learning model are updated through the policy gradient algorithm. The updated deep reinforcement learning model is used to output the final target scheduling parameter adjustment strategy, and the target scheduling parameter adjustment strategy is used to dynamically adjust the scheduling parameters of the function instance queue.
4. The method according to claim 3, characterized in that The calculation formula for updating the parameters of the deep reinforcement learning model through the policy gradient algorithm is as follows: ; Among them, θ * represents the updated policy parameters, θ represents the policy parameters, α represents the learning rate, N represents the number of sampled trajectories, i represents the sampled trajectory index, T represents the adopted trajectory length, t represents the current time step, ∇ θ represents the gradient operation on θ, π(·) represents the conditional probability distribution, and a t Indicates action, s t represents the current state, t' represents the next time step of the current time step, γ represents the discount factor, R(·) represents the reward, and s t' Indicates the state at the next time step of the current time step, a t' Indicates the action corresponding to the state at the next time step of the current time step.
5. The method according to claim 1, characterized in that Using adaptive control algorithms to dynamically adjust resource allocation, the optimal resource allocation solution includes: Collecting system resource utilization data, including CPU utilization, memory utilization, and disk I / O utilization; Preprocess and extract features of the collected resource utilization data to obtain standard utilization data, input the standard utilization data into a pre-trained resource prediction model, and obtain the prediction results of resource utilization within a preset time; Use anomaly detection algorithms to analyze resource utilization data in real time. When an abnormal situation is detected, dynamic adjustment of resource allocation is triggered. The analysis results are compared with the preset abnormal threshold to obtain abnormal information of resource allocation. An objective function is constructed based on the predicted results of resource utilization within a preset time and the abnormal information of resource allocation. The optimal resource allocation plan is generated by minimizing the objective function.
6. The method according to claim 5, characterized in that The calculation formula of the objective function is as follows: ; Among them, J represents the objective function, λ1 represents the weight coefficient of the resource utilization prediction result, M represents the number of samples, i represents the sample index, and y i Indicates actual resource utilization data, represents the prediction result, λ2 represents the weight coefficient of abnormal information, X represents resource utilization, μ represents the mean value of the data set, and σ represents the standard deviation of the data set.
7. A multi-tenant serverless platform resource management system, used to implement the method described in any one of claims 1 to 6, characterized in that: include: The first unit is used to define the concept of function affinity according to the multi-tenant serverless platform system model, build a function affinity matrix through the call frequency and data transmission volume between functions, characterize the call dependency relationship between functions in the workflow, and use the pre-trained time prediction model to predict the function execution time to obtain the prediction result of the function execution time; The second unit is used to construct a weighted relationship graph between functions based on the constructed function affinity matrix and the prediction results of the function execution time, and divide the weighted relationship graph between functions. At the same time, a balancing factor is introduced to limit the number of function instances and the total resource demand on a single server, and the functions are allocated to different servers to obtain the scheduling results of the first stage; The third unit is used to independently maintain the function instance queue on each server based on the scheduling results of the first stage, dynamically adjust the scheduling parameters of the function instance queue according to the performance indicators and resource utilization of the function instance queue itself, and introduce resource utility measurement indicators. Under the premise of meeting the fine-grained resource isolation mechanism, the adaptive control algorithm is used to dynamically adjust resource allocation to obtain the optimal resource allocation solution; Partitioning the weighted relationship graph between functions includes: The partitioning process of the weighted relationship graph between functions is divided into a load balancing optimization stage, a communication optimization stage and a critical path optimization stage; In the load balancing optimization stage, a quadratic objective function of the balancing deviation is constructed, a balancing tolerance constraint subgraph size upper limit is introduced, a heuristic algorithm is used to solve the load balancing partitioning scheme, and a preliminary balancing partitioning result is obtained; The obtained preliminary balanced partitioning result is used as the initial solution of the communication optimization stage. In the communication optimization stage, a communication cost objective function based on graph cut is constructed, and the delay tolerance is introduced to constrain the critical path length. The local search algorithm is used to optimize the initial solution under the premise of maintaining load balance, reduce the communication cost, and obtain a low communication partitioning result; Based on the obtained low communication partitioning result, in the critical path optimization stage, the critical path length is extracted as the optimization target, the load balancing and communication cost constraints are combined, and the low communication partitioning result is adjusted by using the critical path scheduling algorithm to obtain the critical path optimization partitioning result; The key path optimization partitioning results are used as the input for the next round of load balancing optimization. The partitioning result optimization steps are repeated until the preset convergence conditions are met, and the final partitioning results of the weighted relationship graph between functions are output.
8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Adaptive unloading method for object-oriented application with function as granularity in edge environment
CN116301949A
Resource allocation method based on function feature information in edge no-service platform
CN117492993A
Cold start optimization method, system and equipment for non-inductive framework of server and medium
CN117931316A
Fine-grained function arrangement method and system for cross-domain server-free data analysis
CN118113467A
Serverless computing adaptive resource scheduling method and system and computer device
WO2024114484A1
