A method and system for dynamic scheduling of containers in a serverless architecture

The time series prediction method predicts the change value of the scaling index and function call frequency, and calculates the number of containers in combination with weight and importance, solving the problem of inaccurate container scheduling when there is insufficient historical data under the service-free architecture, and achieving more accurate container dynamic scheduling.

CN118708286BActive Publication Date: 2025-04-25FU JIUE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410688827.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2025-04-25
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

Under the serviceless architecture, the existing container scheduling methods cannot accurately predict the frequency of function calls when historical data is insufficient, resulting in inaccurate container expansion and capacity, affecting dynamic scheduling.

Method used

The timing prediction method is used to predict the change value of each scaling index and function call frequency in the future time, and calculate the number of containers and function weights based on the index weight and initial importance to realize dynamic container scheduling.

Benefits of technology

Improve the accuracy of container expansion and capacity when historical data is insufficient, optimize the dynamic scheduling of containers, and ensure the rationality of allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708286B_ABST
    Figure CN118708286B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for dynamic scheduling of containers under a serverless architecture, wherein the method predicts the index change value of each expansion and contraction index and the call change value of the call frequency of a function in the future respectively through a time series prediction method, calculates the number of expansion and contraction containers according to the index change value and the corresponding index weight, thereby obtaining the total number of future containers, and combines the call change value of the call frequency of the function with the initial importance to calculate the future weight of the function, and distributes the total number of future containers according to the future weight of the function to achieve dynamic scheduling of containers. Therefore, the present invention comprehensively considers the index change value and the index weight when calculating the number of expansion and contraction containers, improves the accuracy of the number of expansion and contraction containers, comprehensively considers the call change value of the call frequency of the function and the initial importance of the function, improves the accuracy of the future weight of the function, and thus improves the accuracy of container expansion and contraction when historical data is insufficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for dynamic scheduling of containers in a serverless architecture. Background Art

[0002] The existing method for scheduling containers in a serverless architecture usually calculates the container scaling ratio of an application based on an indicator, and then scales the container up or down based on the scaling ratio. However, in actual scenarios, applications in a serverless architecture are composed of multiple functions, and the scaling ratio calculated by the indicator is a unified scaling ratio. However, the frequencies at which each function is called are different, and the calling frequencies may change. Therefore, scaling the container up or down based on a unified scaling ratio may result in oversupply of some function containers and undersupply of some function containers, which cannot meet actual demand. To address this defect, some scholars later proposed to build a prediction model through deep reinforcement learning training, and use the prediction model to predict the calling frequency of each function to calculate the container scaling of each function. However, this method requires a large amount of historical data when building the prediction model, that is, it requires the application to be online for a period of time to accumulate sufficient historical data before it can be carried out. In the case of insufficient historical data, the accuracy of the constructed prediction model cannot be guaranteed, which in turn affects the accuracy of the calculated container scaling of the function and the dynamic scheduling of the container. Summary of the invention

[0003] The technical problem to be solved by the present invention is: the present invention provides a method and system for dynamic scheduling of containers in a serverless architecture, which improves the accuracy of container expansion and contraction when historical data is insufficient and optimizes the dynamic scheduling of containers.

[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0005] In a first aspect, the present invention provides a method for dynamic scheduling of containers in a serverless architecture, comprising:

[0006] Receive all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator, obtain first time series data of each scaling indicator, predict the indicator change value of each scaling indicator in the future time based on the first time series data by using a time series prediction method, calculate the number of scaling containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of scaling containers;

[0007] Obtain a DAG description file of each function, calculate the initial importance corresponding to each function according to the DAG description file, obtain second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by a time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value;

[0008] The total number of future containers is allocated according to the future weight of each function to achieve dynamic scheduling of containers.

[0009] The beneficial effects of the present invention are as follows: in the absence of a large amount of historical data, a time series prediction method is used to predict the indicator change value of each expansion and contraction indicator in the future, and the indicator change value of each expansion and contraction indicator is calculated with the corresponding indicator weight to obtain the number of expansion and contraction containers, thereby improving the accuracy of the number of expansion and contraction containers and ensuring the accuracy of the total number of future containers. At the same time, a time series prediction method is used to predict the calling frequency of each function in the future, and the future weight of each function is calculated in combination with the initial importance of each function, thereby improving the accuracy of the calculated future weight of each function, and finally allocating the number of containers to the functions according to the future weight of each function, thereby ensuring the rationality of the allocation, improving the accuracy of container expansion and contraction when historical data is insufficient, and optimizing the dynamic scheduling of containers.

[0010] Optionally, the calculating the number of expansion and contraction containers according to the indicator change value and the corresponding indicator weight, and obtaining the total number of future containers according to the number of expansion and contraction containers includes:

[0011] The indicator change value and the corresponding indicator weight are input into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is:

[0012]

[0013] Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time;

[0014] The total number of current containers at the current time is obtained, and the total number of current containers and the weighted sum change value of the indicator are input into the expansion and contraction container quantity calculation formula for calculation to obtain the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is:

[0015] sum(t)=K(t)*num(t-1)-num(t-1)

[0016] Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time.

[0017] The number of expansion and contraction containers is input into the future total number of container calculation formula to obtain the future total number of containers, wherein the future total number of containers calculation formula is:

[0018] Sum(t)=sum(t)+num(t-1)

[0019] Wherein, Sum(t) represents the total number of future containers at time point t in the future.

[0020] According to the above description, the indicator weighted sum change value of the expansion and contraction indicator is calculated based on the indicator change value and the corresponding indicator weight, and the indicator weighted sum change value and the current total number of containers at the current time are combined to calculate the number of expansion and contraction containers, thereby improving the accuracy of the number of expansion and contraction containers, and further ensuring the accuracy of the total number of future containers obtained based on the number of expansion and contraction containers and the current total number of containers.

[0021] Optionally, the obtaining of a DAG description file of each function and calculating the initial importance corresponding to each function according to the DAG description file includes:

[0022] Obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion;

[0023] Summing all functions to obtain the total number of functions, obtaining the successor function of each function, and calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion;

[0024] The first ratio and the second ratio are input into the importance formula to calculate, and the initial importance corresponding to each function is obtained, wherein the importance formula is:

[0025]

[0026] Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale.

[0027] According to the above description, when calculating the initial importance of a function, the proportion of the number of workflows in which the function is located in the total number of workflows, as well as the proportion of the function's successor functions in the total number of functions are taken into account to ensure the accuracy of the calculated initial importance of the function, and in the importance formula, adjustment parameters corresponding to different proportions are set to further improve the accuracy of the calculated initial importance.

[0028] Optionally, calculating the future weight of each function according to the initial importance and the call change value includes:

[0029] The initial importance and the call change value are input into the future weight prediction formula for calculation to obtain the future weight of each function, where the future weight prediction formula is:

[0030]

[0031] u=1-v

[0032] Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

[0033] According to the above description, when calculating the future weight of a function, the initial importance of the function and the call change value of the function's call frequency are taken into comprehensive consideration, and corresponding adjustment parameters are set for the initial importance of the function and the call change value of the function's call frequency in the future weight prediction formula to ensure the accuracy and rationality of the calculated future weight of the function.

[0034] Optionally, it also includes:

[0035] Obtain historical data of all scaling indicators and historical call frequencies of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequencies both reach a first threshold, use a deep learning algorithm to build an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequencies, respectively;

[0036] The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

[0037] According to the above description, when the data quantity of historical data and the frequency quantity of historical call frequency both reach the first threshold, that is, when the historical data is sufficient, a deep learning algorithm is used to construct an indicator prediction model and a frequency prediction model, and the number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model, thereby realizing the update of the dynamic scheduling of containers and improving the accuracy of the dynamic scheduling of containers.

[0038] In a second aspect, the present invention provides a system for dynamic scheduling of containers in a serverless architecture, comprising:

[0039] A total number calculation module for scaling containers, used to receive all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator, obtain the first time series data of each scaling indicator, predict the indicator change value of each scaling indicator in the future time based on the first time series data by using a time series prediction method, calculate the number of scaling containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of scaling containers;

[0040] A function future weight calculation module is used to obtain a DAG description file of each function, calculate the initial importance corresponding to each function according to the DAG description file, obtain second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by a time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value;

[0041] The container dynamic scheduling module is used to allocate the total number of future containers according to the future weight of each function to achieve dynamic container scheduling.

[0042] The beneficial effects of the present invention are as follows: in the absence of a large amount of historical data, a time series prediction method is used to predict the indicator change value of each expansion and contraction indicator in the future, and the indicator change value of each expansion and contraction indicator is calculated with the corresponding indicator weight to obtain the number of expansion and contraction containers, thereby improving the accuracy of the number of expansion and contraction containers and ensuring the accuracy of the total number of future containers. At the same time, a time series prediction method is used to predict the calling frequency of each function in the future, and the future weight of each function is calculated in combination with the initial importance of each function, thereby improving the accuracy of the calculated future weight of each function, and finally allocating the number of containers to the functions according to the future weight of each function, thereby ensuring the rationality of the allocation, improving the accuracy of container expansion and contraction when historical data is insufficient, and optimizing the dynamic scheduling of containers.

[0043] Optionally, the total number of expansion and contraction containers calculation module is specifically used to:

[0044] The indicator change value and the corresponding indicator weight are input into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is:

[0045]

[0046] Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time;

[0047] The total number of current containers at the current time is obtained, and the total number of current containers and the weighted sum change value of the indicator are input into the expansion and contraction container quantity calculation formula for calculation to obtain the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is:

[0048] sum(t)=K(t)*num(t-1)-num(t-1)

[0049] Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time.

[0050] The number of expansion and contraction containers is input into the future total number of container calculation formula to obtain the future total number of containers, wherein the future total number of containers calculation formula is:

[0051] Sum(t)=sum(t)+num(t-1)

[0052] Wherein, Sum(t) represents the total number of future containers at time point t in the future.

[0053] According to the above description, the indicator weighted sum change value of the expansion and contraction indicator is calculated based on the indicator change value and the corresponding indicator weight, and the indicator weighted sum change value and the current total number of containers at the current time are combined to calculate the number of expansion and contraction containers, thereby improving the accuracy of the number of expansion and contraction containers, and further ensuring the accuracy of the total number of future containers obtained based on the number of expansion and contraction containers and the current total number of containers.

[0054] Optionally, the function future weight calculation module includes:

[0055] An initial importance calculation module, used to obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion;

[0056] Summing all functions to obtain the total number of functions, obtaining the successor function of each function, and calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion;

[0057] The first ratio and the second ratio are input into the importance formula to calculate, and the initial importance corresponding to each function is obtained, wherein the importance formula is:

[0058]

[0059] Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale.

[0060] According to the above description, when calculating the initial importance of a function, the proportion of the number of workflows in which the function is located in the total number of workflows, as well as the proportion of the function's successor functions in the total number of functions are taken into account to ensure the accuracy of the calculated initial importance of the function, and in the importance formula, adjustment parameters corresponding to different proportions are set to further improve the accuracy of the calculated initial importance.

[0061] Optionally, the function future weight calculation module is specifically used for:

[0062] The initial importance and the call change value are input into the future weight prediction formula for calculation to obtain the future weight of each function, where the future weight prediction formula is:

[0063]

[0064] u=1-v

[0065] Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

[0066] According to the above description, when calculating the future weight of a function, the initial importance of the function and the call change value of the function's call frequency are taken into comprehensive consideration, and corresponding adjustment parameters are set for the initial importance of the function and the call change value of the function's call frequency in the future weight prediction formula to ensure the accuracy and rationality of the calculated future weight of the function.

[0067] Optionally, it also includes:

[0068] An update module is used to obtain historical data of all scaling indicators and historical call frequencies of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequencies both reach a first threshold, a deep learning algorithm is used to construct an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequencies respectively;

[0069] The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

[0070] According to the above description, when the data quantity of historical data and the frequency quantity of historical call frequency both reach the first threshold, that is, when the historical data is sufficient, a deep learning algorithm is used to construct an indicator prediction model and a frequency prediction model, and the number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model, thereby realizing the update of the dynamic scheduling of containers and improving the accuracy of the dynamic scheduling of containers. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 A flowchart of a method for dynamic scheduling of containers in a serverless architecture provided by an embodiment of the present invention;

[0072] Figure 2 A schematic diagram of the overall process of a method for dynamic scheduling of containers in a serverless architecture provided by an embodiment of the present invention;

[0073] Figure 3 A schematic diagram of the structure of a system for dynamic container scheduling in a serverless architecture provided by an embodiment of the present invention.

[0074] [Description of Reference Numerals]

[0075] 1. A method system for dynamic scheduling of containers in a serverless architecture;

[0076] 2. Module for calculating the total number of expansion and contraction containers;

[0077] 3. Function future weight calculation module; 31. Initial importance calculation module;

[0078] 4. Container dynamic scheduling module;

[0079] 5. Update module. DETAILED DESCRIPTION

[0080] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0081] Embodiment 1

[0082] Please refer to Figure 1 to Figure 2 The present invention provides a method for dynamic scheduling of containers in a serverless architecture, comprising the steps of:

[0083] S1. Receive all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator, obtain the first time series data of each scaling indicator, predict the indicator change value of each scaling indicator in the future time based on the first time series data by using a time series prediction method, calculate the number of scaling containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of scaling containers;

[0084] In this embodiment, if Figure 2As shown, all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator are received, wherein the scaling indicators include but are not limited to: total CPU resource requirements, total GPU resource requirements and total memory requirements, and the indicator change value of each scaling indicator in the future time is predicted by a time series prediction method based on the first time series data of each scaling indicator obtained, wherein the time series prediction method includes: simple moving average method, weighted moving average method and exponential moving average method. In this embodiment, the exponential moving average method is preferably used to predict the indicator change value, and the calculated indicator change value is calculated with the corresponding indicator weight to obtain the number of scaling containers, and then the total number of future containers is obtained according to the calculated number of scaling containers.

[0085] At this time, the step S1 calculates the number of expansion and contraction containers according to the indicator change value and the corresponding indicator weight, and obtains the total number of future containers according to the number of expansion and contraction containers, including:

[0086] S11. Input the indicator change value and the corresponding indicator weight into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is:

[0087]

[0088] Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time;

[0089] S12, obtaining the total number of current containers at the current time, inputting the total number of current containers and the weighted sum change value of the index into the expansion and contraction container quantity calculation formula for calculation, and obtaining the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is:

[0090] sum(t)=K(t)*num(t-1)-num(t-1)

[0091] Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time.

[0092] S13, inputting the number of the expanded and shrunk containers into a calculation formula for the total number of future containers to obtain the total number of future containers, wherein the calculation formula for the total number of future containers is:

[0093] Sum(t)=sum(t)+num(t-1)

[0094] Wherein, Sum(t) represents the total number of future containers at time point t in the future.

[0095] In this embodiment, if Figure 2 As shown, the indicator weight and change value of the expansion and contraction indicator are obtained according to the indicator change value and the corresponding indicator weight, so as to calculate the number of expansion and contraction containers in combination with the current total number of containers at the current time, and the calculated number of expansion and contraction containers and the current total number of containers are combined to obtain the total number of containers in the future.

[0096] S2. Obtain a DAG description file for each function, calculate the initial importance of each function according to the DAG description file, obtain second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by using a time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value;

[0097] In this embodiment, if Figure 2 As shown, a DAG (Directed acyclic graph) description file of each function is obtained, and the initial importance corresponding to each function is calculated according to the obtained DAG description file. The call change value of the call frequency of each function is predicted by a timing prediction method based on the second time series data of the call frequency of each function obtained. The timing prediction method at this time may be the same as the timing prediction method for predicting the indicator change value of each scaling indicator in step S1, or may be different. The future weight of each corresponding function is calculated according to the obtained initial importance of the function and the call change value of the call frequency of the function.

[0098] At this time, the step S2 of obtaining the DAG description file of each function and calculating the initial importance corresponding to each function according to the DAG description file includes:

[0099] S21. Obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion.

[0100] In this embodiment, if Figure 2As shown, the number of workflows and the total number of workflows of the corresponding function are obtained from the DAG description file of each function. The workflow here refers to a path from the starting point to the end point of the DAG description file, so as to calculate the proportion of the number of workflows of each function in the total number of workflows to obtain the first ratio.

[0101] S22, summing up all functions to obtain the total number of functions, obtaining a successor function of each function, and respectively calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion;

[0102] In this embodiment, if Figure 2 As shown, the proportion of the successor function of each function in the total number of functions is calculated to obtain the second proportion.

[0103] S23, inputting the first ratio and the second ratio into the importance formula to calculate, and obtaining the initial importance corresponding to each function, wherein the importance formula is:

[0104]

[0105] Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale.

[0106] In this embodiment, the first ratio and the second ratio obtained in step S21 and step S22 are input into the importance formula to calculate the initial importance corresponding to the function, wherein the first adjustment parameter a of the first ratio and the second adjustment parameter b of the second ratio are respectively used to adjust the influence of different ratios, and the specific values ​​of the adjustment parameters are adjusted and set according to the specific actual situation.

[0107] At this time, the calculation of the future weight of each function according to the initial importance and the call change value in step S2 includes:

[0108] S24, inputting the initial importance and the call change value into a future weight prediction formula for calculation to obtain the future weight of each function, wherein the future weight prediction formula is:

[0109]

[0110] u=1-v

[0111] Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

[0112] In this embodiment, if Figure 2 As shown, the initial importance and call change value of the function are input into the future weight prediction formula to calculate the future weight, wherein in the future weight prediction formula, corresponding adjustment parameters are set for the initial importance of the function and the call change value of the function's call frequency, which are used to adjust their influence on the future weight. The specific values ​​of the adjustment parameters are adjusted and set according to the specific actual situation.

[0113] S3. Allocate the total number of future containers according to the future weight of each function to achieve dynamic scheduling of containers.

[0114] In this embodiment, if Figure 2 As shown in the figure, after calculating the total number of future containers, the number of containers is allocated according to the future weight of each function to achieve dynamic scheduling of containers. After the application has been online for a period of time and sufficient historical data has been accumulated, the prediction model will be rebuilt through the deep learning algorithm to update the dynamic scheduling of containers. The specific update steps are as follows:

[0115] Obtain historical data of all scaling indicators and historical call frequencies of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequencies both reach a first threshold, use a deep learning algorithm to build an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequencies, respectively;

[0116] The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

[0117] In this embodiment, if Figure 2As shown, when the data quantity of historical data and the frequency quantity of historical call frequency both reach the first threshold, the deep learning algorithm will be used to construct the indicator prediction model and the frequency prediction model respectively, wherein the first threshold is set according to the actual situation, and then the indicator change value is re-predicted according to the constructed indicator prediction model, so as to recalculate the number of expanded and reduced capacity containers, and obtain the new total number of future containers, and re-predict the call change value of the function's call frequency according to the constructed frequency prediction model, so as to recalculate the future weight of the function, and redistribute the number of containers according to the new future total number of containers according to the new future weight of the function, so as to realize the update of dynamic scheduling of containers.

[0118] Embodiment 2

[0119] Please refer to Figure 3 The present invention provides a system 1 for dynamic scheduling of containers under a serverless architecture, which specifically includes: a total number of expansion and contraction containers calculation module 2, a function future weight calculation module 3, an initial importance calculation module 31, a container dynamic scheduling module 4 and an update module 5.

[0120] Among them, the total number of expansion and contraction containers calculation module 2 is used to receive all expansion and contraction indicators of the application selected by the user and the indicator weight corresponding to each expansion and contraction indicator, obtain the first time series data of each expansion and contraction indicator, predict the indicator change value of each expansion and contraction indicator in the future time based on the first time series data by using the time series prediction method, calculate the number of expansion and contraction containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of expansion and contraction containers;

[0121] Function future weight calculation module 3, used to obtain the DAG description file of each function, calculate the initial importance corresponding to each function according to the DAG description file, obtain the second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by using the time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value;

[0122] The container dynamic scheduling module 4 is used to allocate the total number of future containers according to the future weight of each function to achieve dynamic container scheduling.

[0123] Specifically, the total number of expansion and contraction containers calculation module 2 is specifically used for:

[0124] The indicator change value and the corresponding indicator weight are input into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is:

[0125]

[0126] Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time;

[0127] The total number of current containers at the current time is obtained, and the total number of current containers and the weighted sum change value of the indicator are input into the expansion and contraction container quantity calculation formula for calculation to obtain the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is:

[0128] sum(t)=K(t)*num(t-1)-num(t-1)

[0129] Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time.

[0130] The number of expansion and contraction containers is input into the future total number of container calculation formula to obtain the future total number of containers, wherein the future total number of containers calculation formula is:

[0131] Sum(t)=sum(t)+num(t-1)

[0132] Wherein, Sum(t) represents the total number of future containers at time point t in the future.

[0133] Specifically, the function future weight calculation module 3 includes:

[0134] The initial importance calculation module 31 is used to obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion;

[0135] Summing all functions to obtain the total number of functions, obtaining the successor function of each function, and calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion;

[0136] The first ratio and the second ratio are input into the importance formula to calculate, and the initial importance corresponding to each function is obtained, wherein the importance formula is:

[0137]

[0138] Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale.

[0139] Specifically, the function future weight calculation module 3 is specifically used for:

[0140] The initial importance and the call change value are input into the future weight prediction formula for calculation to obtain the future weight of each function, where the future weight prediction formula is:

[0141]

[0142] u=1-v

[0143] Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

[0144] Specifically, the update module 5 is used to obtain the historical data of all scaling indicators and the historical call frequency of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequency both reach a first threshold, a deep learning algorithm is used to construct an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequency respectively;

[0145] The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

[0146] Since the system / device described in the above embodiments of the present invention is a system / device used to implement the method of the above embodiments of the present invention, a person skilled in the art can understand the specific structure and deformation of the system / device based on the method described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the method of the above embodiments of the present invention belong to the scope of protection of the present invention.

[0147] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0148] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.

[0149] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.

[0150] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0151] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.

[0152] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.

Claims

1. A method for dynamic container scheduling in a serverless architecture, characterized in that: include: Receive all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator, obtain first time series data of each scaling indicator, predict the indicator change value of each scaling indicator in the future time based on the first time series data by using a time series prediction method, calculate the number of scaling containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of scaling containers; Obtain a DAG description file of each function, calculate the initial importance corresponding to each function according to the DAG description file, obtain second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by a time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value; Allocating the total number of future containers according to the future weight of each function to achieve dynamic container scheduling; The obtaining of the DAG description file of each function and calculating the initial importance corresponding to each function according to the DAG description file comprises: Obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion; Summing all functions to obtain the total number of functions, obtaining the successor function of each function, and calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion; The first ratio and the second ratio are input into the importance formula to calculate, and the initial importance corresponding to each function is obtained, wherein the importance formula is: Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale; Calculating the future weight of each function according to the initial importance and the call change value includes: The initial importance and the call change value are input into the future weight prediction formula for calculation to obtain the future weight of each function, where the future weight prediction formula is: u=1-v Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

2. The method for dynamic container scheduling in a serverless architecture according to claim 1, characterized in that: The calculating the number of expansion and contraction containers according to the indicator change value and the corresponding indicator weight, and obtaining the total number of future containers according to the number of expansion and contraction containers includes: The indicator change value and the corresponding indicator weight are input into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is: Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time; The total number of current containers at the current time is obtained, and the total number of current containers and the weighted sum change value of the indicator are input into the expansion and contraction container quantity calculation formula for calculation to obtain the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is: sum(t)=K(t)*num(t-1)-num(t-1) Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time. The number of expansion and contraction containers is input into the future total number of container calculation formula to obtain the future total number of containers, wherein the future total number of containers calculation formula is: Sum(t)=sum(t)+num(t-1) Wherein, Sum(t) represents the total number of future containers at time point t in the future.

3. The method for dynamic container scheduling in a serverless architecture according to claim 1, characterized in that: Also includes: Obtain historical data of all scaling indicators and historical call frequencies of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequencies both reach a first threshold, use a deep learning algorithm to build an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequencies, respectively; The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

4. A system for dynamic container scheduling in a serverless architecture, characterized in that: include: A total number calculation module for scaling containers, used to receive all scaling indicators of the application selected by the user and the indicator weight corresponding to each scaling indicator, obtain the first time series data of each scaling indicator, predict the indicator change value of each scaling indicator in the future time based on the first time series data by using a time series prediction method, calculate the number of scaling containers according to the indicator change value and the corresponding indicator weight, and obtain the total number of containers in the future according to the number of scaling containers; A function future weight calculation module is used to obtain a DAG description file of each function, calculate the initial importance corresponding to each function according to the DAG description file, obtain second time series data of the call frequency of each function, predict the call change value of the call frequency of each function in the future time based on the second time series data by a time series prediction method, and calculate the future weight of each function according to the initial importance and the call change value; A container dynamic scheduling module is used to allocate the total number of future containers according to the future weight of each function to achieve dynamic container scheduling; The function future weight calculation module includes: An initial importance calculation module, used to obtain the number of workflows and the total number of workflows of each function from the DAG description file of each function, calculate the proportion of the number of workflows of each function to the total number of workflows, and obtain a first proportion; Summing all functions to obtain the total number of functions, obtaining the successor function of each function, and calculating the proportion of the successor function of each function in the total number of functions to obtain a second proportion; The first ratio and the second ratio are input into the importance formula to calculate, and the initial importance corresponding to each function is obtained, wherein the importance formula is: Among them, m l represents the initial importance of function l, represents the first ratio of the function l, c l represents the number of workflows where function l is located, C represents the total number of workflows, a represents the first adjustment parameter of the first ratio, represents the second ratio of the function l, d l represents the successor function of function l, D represents the total number of functions, and b represents the second adjustment parameter of the second scale; The function future weight calculation module is specifically used for: The initial importance and the call change value are input into the future weight prediction formula for calculation to obtain the future weight of each function, where the future weight prediction formula is: u=1-v Among them, the Q l represents the future weight of function l, m l represents the initial importance of function l, l = 1, 2, ..., D, D represents the total number of functions, t represents the time point in the future, P l (t) represents the call change value of function l at time point t in the future, t0 represents the time point when the application is deployed and the scaling indicators and the call frequency of the function are obtained, T represents the time window length of the time prediction method, u represents the adjustment parameter of the initial importance of the function, and v represents the adjustment parameter of the call change value of the call frequency of the function.

5. The system for dynamic container scheduling in a serverless architecture as claimed in claim 4, characterized in that: The total number of expansion and contraction containers calculation module is specifically used for: The indicator change value and the corresponding indicator weight are input into the indicator weighted sum change formula for calculation to obtain the indicator weighted sum change value of the expansion and contraction indicator, wherein the indicator weighted sum change formula is: Where t represents a time point in the future, K(t) represents the weighted sum of the change values ​​of the index at the time point t in the future, and zp i (t) represents the change value of the scaling index i at the future time point t, i = 1, 2, ..., j, j represents the total number of scaling indicators, w i Indicates the indicator weight corresponding to the expansion and contraction indicator i, zp i (t-1) represents the change value of the expansion / contraction index i at the current time; The total number of current containers at the current time is obtained, and the total number of current containers and the weighted sum change value of the indicator are input into the expansion and contraction container quantity calculation formula for calculation to obtain the expansion and contraction container quantity, wherein the expansion and contraction container quantity calculation formula is: sum(t)=K(t)*num(t-1)-num(t-1) Where sum(t) represents the number of expansion and contraction containers at time point t in the future, and num(t-1) represents the total number of current containers at the current time. The number of expansion and contraction containers is input into the future total number of container calculation formula to obtain the future total number of containers, wherein the future total number of containers calculation formula is: Sum(t)=sum(t)+num(t-1) Wherein, Sum(t) represents the total number of future containers at time point t in the future.

6. The system for dynamic container scheduling in a serverless architecture as claimed in claim 4, characterized in that: Also includes: An update module is used to obtain historical data of all scaling indicators and historical call frequencies of each function, and when the data quantity of the historical data and the frequency quantity of the historical call frequencies both reach a first threshold, a deep learning algorithm is used to construct an indicator prediction model and a frequency prediction model based on the historical data and the historical call frequencies respectively; The number of expansion and contraction containers and the future weight of each function are recalculated based on the indicator prediction model and the frequency prediction model to update the dynamic scheduling of the container.

Citation Information

Patent Citations

  • Container capacity expansion and shrinkage control method, device and equipment and computer readable storage medium

    CN115525429A

  • Capacity expansion and contraction method and device, electronic equipment and readable storage medium

    CN116244069A