Container resource scheduling method and device, readable storage medium and program product

By constructing Gaussian distribution and pointer network models, container resource allocation is optimized, the problem of low container resource utilization is solved, more efficient resource utilization and personalized services are achieved, and system performance and user satisfaction are improved.

CN118550690APending Publication Date: 2024-08-27CHINA MOBILE GROUP ZHEJIANG +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410550432.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-06
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The existing container resource scheduling model results in idle resources and waste during idle times, resulting in low container resource utilization.

Method used

By obtaining the container resource requirements of multiple users within a preset time interval, a Gaussian distribution model and a pointer network model are constructed to optimize the allocation of container resources to achieve the highest resource utilization.

Benefits of technology

It improves the utilization rate of container resources, meets the personalized needs of users, reduces resource bottlenecks and congestion, and improves system performance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550690A
    Figure CN118550690A
Patent Text Reader

Abstract

The invention discloses a container resource scheduling method and device, a readable storage medium and a computer program product. The container resource scheduling method comprises the steps of obtaining container resource demands corresponding to multiple moments of multiple users in a preset time interval; inputting the container resource demand quantity into a scheduling model to obtain a scheduling result comprising containers correspondingly allocated by each user at a plurality of moments, the scheduling model being used for outputting a scheduling result with the highest container resource utilization rate; and based on the scheduling result, allocating the container resource demand quantity of each user at multiple moments to the corresponding container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a container resource scheduling method and device, a readable storage medium, and a computer program product. Background Art

[0002] By analyzing the usage of container resources for different services, we can see that users' demand for container resources usually shows a tidal effect, which means that users' demand for container resources is relatively concentrated in a certain time period, but relatively less in other time periods. The current sales strategy is to sell services in the form of monthly rent. When users activate services, they need to order resources based on the peak load, and allocate container resources that can support the peak load to users at all times to ensure that users' demand for container resources is met. However, this model leads to the idleness and waste of container resources during off-peak hours, thereby reducing the amount of services that can be accommodated per unit container and making the utilization rate of container resources low.

[0003] How to improve container resource utilization is a technical problem that needs to be solved at present. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a container resource scheduling method and device, a readable storage medium, and a computer program product to solve the problem of low container resource utilization in existing container resource scheduling.

[0005] In order to solve the above technical problems, this application is implemented as follows:

[0006] In a first aspect, a container resource scheduling method is provided, comprising:

[0007] Obtain container resource demands of multiple users at multiple times within a preset time interval;

[0008] Inputting the container resource demand into a scheduling model to obtain a scheduling result including containers corresponding to each user allocated at multiple times, wherein the scheduling model is used to output a scheduling result with the highest container resource utilization rate;

[0009] Based on the scheduling result, the container resource requirements of each user at multiple times are allocated to corresponding containers.

[0010] Optionally, before obtaining container resource demands of multiple users at multiple times within a preset time interval, the method includes:

[0011] Collect the historical container resource usage of each user at multiple times within a preset time interval;

[0012] Based on the historical container resource usage at each time point, a Gaussian distribution that meets the container resource requirements of each user is constructed;

[0013] Based on the constructed Gaussian distribution, the container resource demand corresponding to each user in the preset time interval is configured.

[0014] Optionally, the step of constructing a Gaussian distribution that meets the container resource demand of each user based on the collected historical container resource usage at each moment includes:

[0015] Based on the historical container resource usage at each moment collected by the target user, a Gaussian distribution probability density function corresponding to each historical container resource usage is constructed;

[0016] Construct the maximum likelihood estimation function corresponding to each Gaussian distribution probability density function;

[0017] Determining a mean and a standard deviation of a Gaussian distribution based on maximization of the maximum likelihood estimation function;

[0018] Based on the mean and the standard deviation, a Gaussian distribution of container resource requirements that meets the target user is determined.

[0019] Optionally, configuring the container resource demand corresponding to each user in a preset time interval based on the constructed Gaussian distribution includes:

[0020] Based on the Gaussian distribution 3σ principle, the moment when the container resource demand of the target user is within the 3σ interval is configured as the first container resource demand, and the moment when the container resource demand of the target user is outside the 3σ interval is configured as the second container resource demand, and the first container resource demand is different from the second container resource demand;

[0021] The container resource demand corresponding to the target user in the preset time interval is configured based on the first container resource demand and the second container resource demand.

[0022] Optionally, the scheduling model is a pointer network model, and before inputting the container resource demand into the scheduling model to obtain a scheduling result including the allocated containers corresponding to each user at multiple time points, the method further includes:

[0023] Based on the container resource requirements of a predetermined number of user samples at multiple times within the preset time interval and a predetermined number of containers to be scheduled, construct a function for representing the resource utilization of the corresponding containers after the corresponding containers are allocated to each user sample at multiple times;

[0024] Using the pointer network model to learn a mapping strategy from input to output to train the pointer network model, the input is the container resource demand of each user sample at multiple times within the preset time interval, and the output is an output pointer for pointing to the container corresponding to each user sample allocated at multiple times;

[0025] When the container allocated corresponding to the output pointer makes the value of the function of the container resource utilization rate maximum, the training of the pointer network model is completed.

[0026] Optionally, the constructing of a function for representing the resource utilization of corresponding containers after the corresponding containers are allocated to each user sample at multiple times based on the container resource requirements of the predetermined number of user samples at multiple times within the preset time interval and the predetermined number of containers to be scheduled includes:

[0027] Based on the constraint that the sum of the container resource requirements of each container to be scheduled cannot exceed the resource upper limit of the corresponding container to be scheduled and the constraint that the container resource requirements of each user sample must be met, the container resource utilization rate of each container to be scheduled is determined Where E k represents the container resource utilization rate of the container k to be scheduled, T represents the number of the multiple time points, W represents the upper limit of the resources of each container to be scheduled, Z represents the number of containers to be scheduled, D represents the number of user samples, and C ij represents the container resource demand of user sample i at time j, Y ik Indicates whether user sample i is allocated to container k;

[0028] Based on the container resource utilization of each container to be scheduled and whether it is used, determine the function of the container resource utilization Among them U k Indicates whether the container k to be scheduled is used.

[0029] Optionally, the pointer network model is obtained by unsupervised learning training based on a reinforcement learning Actor-Critic algorithm, wherein the Actor network in the Actor-Critic algorithm corresponds to the pointer network model, and the Critic network in the Actor-Critic algorithm is used to score the output of the pointer network model.

[0030] Optionally, the pointer network model includes a long short-term memory network model, and before using the pointer network model to learn the mapping strategy from input to output, the method further includes:

[0031] Based on preset parameters with unique sorting results, the sequence of container resource requirements of each user sample included in the input at each moment in the preset time interval is sorted, wherein the preset parameters include the total container resource requirements of each user sample in the preset time interval, the container resource requirements of each user sample at the target moment, or the surname of each user sample.

[0032] In a second aspect, a container resource scheduling device is provided, comprising a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.

[0033] In a third aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0034] According to a fourth aspect, a computer program product is provided, the computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute the steps of the method according to the first aspect.

[0035] In an embodiment of the present application, container resource demands corresponding to multiple users at multiple times within a preset time interval are obtained; the container resource demands are input into a scheduling model to obtain scheduling results including containers corresponding to each user at multiple times, and the scheduling model is used to output a scheduling result with the highest container resource utilization; based on the scheduling results, the container resource demands of each user at multiple times are allocated to the corresponding containers, thereby performing container resource scheduling at different times according to the container resource demands at different times and the maximum containerized resource utilization, so that the container resource demands of users at different time periods can be met, and excess container resources are released for use by other users during idle time periods, so that users can not only obtain personalized services that better meet their needs and improve user satisfaction, but also reduce resource bottlenecks and congestion, improve system performance and stability, and improve container resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0037] Figure 1 This is one of the flow charts of the container resource scheduling method according to an embodiment of the present application.

[0038] Figure 2 This is the second flowchart of the container resource scheduling method according to the embodiment of the present application.

[0039] Figure 3 This is the third flow chart of the container resource scheduling method according to the embodiment of the present application.

[0040] Figure 4 It is a structural block diagram of a container resource scheduling device according to an embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application. The numbering of the drawings in this application is only used to distinguish the various steps in the scheme, and is not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.

[0042] In order to solve the problems existing in the prior art, embodiments of the present application provide a container resource scheduling method and device, a readable storage medium, and a computer program product.

[0043] Figure 1 is a schematic diagram of the overall process of the container resource scheduling method according to an embodiment of the present application. Figure 1 As shown, the following steps 102 to 106 are included.

[0044] Step 102: Obtain container resource demands corresponding to multiple users at multiple times within a preset time interval.

[0045] The preset time interval can reflect the demand of each user for container resources. For example, the demand of users for container resources in the preset time interval presents a periodic tidal effect. The demand for container resources is relatively concentrated or large in some time periods of the preset time interval, and the demand for container resources is relatively small in other time periods of the preset time interval. The preset time interval can be in units of days, such as 1 day, and the multiple moments in the preset time interval can be in units of hours, such as 1 hour. Correspondingly, the multiple moments can be 24 moments including 0, 1, 2, ... 23 o'clock.

[0046] The resource requirements of users at different times within the preset time interval may be different. For example, the resource requirements of the time periods corresponding to certain times are large, while the resource requirements of the time periods corresponding to other times are small. Here, the container resource requirements of multiple times refer to the unchanged container resource requirements in the time period between the target time and the adjacent time. The container resource requirements of the time period corresponding to the next time may be the same as or different from the previous time period, which is related to the container resource requirements of the corresponding user.

[0047] In the embodiment of the present application, the resource demand of the user at multiple times can be pre-configured in combination with the user's actual container resource usage.

[0048] Based on the solution provided by the above embodiment, optionally, in the above step 102, before obtaining the container resource demands corresponding to multiple users at multiple times within a preset time interval, the steps include: collecting historical container resource usage of each user at multiple times within the preset time interval; constructing a Gaussian distribution that meets the container resource demands of each user based on the collected historical container resource usage at each time; and configuring the container resource demands corresponding to each user in the preset time interval based on the constructed Gaussian distribution.

[0049] By analyzing the historical container resource usage data collected from different users, it can be found that the container resource usage curve of the user in a specific time interval presents a Gaussian distribution, which has a tidal effect. In the embodiment of the present application, a corresponding Gaussian distribution model is established to describe the container resource usage of different users, and a statistical analysis method is used to estimate and infer the constructed Gaussian distribution model to determine the container resource demand corresponding to the user in different time intervals.

[0050] The specific time intervals of the Gaussian distribution corresponding to the container resource usage of different users may be different. For example, the container resource usage of user A is periodically large from 0 to 6 o'clock in 24 hours a day, while the container resource usage of user B is relatively large from 9 to 12 o'clock in 24 hours a day. For different users, the corresponding Gaussian distribution needs to be constructed separately. The container resource demand of the corresponding user in the preset time interval presented by the constructed Gaussian distribution is used to configure the container resource demand of the user at multiple moments in the preset time interval.

[0051] Specifically, the method of constructing a Gaussian distribution that meets the container resource demand of each user based on the historical container resource usage collected at each moment includes: constructing a Gaussian distribution probability density function corresponding to each historical container resource usage based on the historical container resource usage collected by the target user at each moment; constructing a maximum likelihood estimation function corresponding to each Gaussian distribution probability density function; determining the mean and standard deviation of the Gaussian distribution based on maximization of the maximum likelihood estimation function; and determining a Gaussian distribution that meets the container resource demand of the target user based on the mean and standard deviation.

[0052] Gaussian distribution is a common probability distribution that presents a bell-shaped curve. Many natural and random phenomena conform to this distribution. Its probability distribution function is determined by two parameters: mean μ and standard deviation σ.

[0053] The probability density function of Gaussian distribution is shown in formula (1):

[0054]

[0055] Where μ and σ are the mean and standard deviation of the Gaussian distribution, respectively. When both μ and σ are unknown, the maximum likelihood estimation method is needed to calculate the historical container resource usage of the target user collected as sampling points at N moments, and estimate the parameters μ and σ so that the probability of these N sampling points occurring under this Gaussian distribution is maximized, that is, the constructed Gaussian distribution can best reflect the container resource usage of the target user at N moments.

[0056] Based on the maximum likelihood estimation method, the process of estimating the Gaussian distribution corresponding to the target user container resource demand is as follows: Figure 2 As shown. The following steps are included:

[0057] Step 202, first collect the historical observation data of the target user on the container resource usage, including the resource usage of the target user in the corresponding time segment at each moment. Assume that the target user collects X observation data samples, and records the historical container resource usage at N moments. The target user's observation data sample at a certain moment (i.e., the historical container resource usage at the corresponding moment) is x. i The time interval corresponding to the collected historical observation data may include multiple preset time intervals to accurately reflect the historical container resource usage of the target user. For example, if the preset time interval of step 102 is 1 day, then 7 days of historical observation data may be collected here for estimating Gaussian distribution.

[0058] Step 204, constructing a likelihood function.

[0059] Since the observation data samples collected at each time are independent of each other, the maximum likelihood estimation can be expressed as the multiplication of the probabilities of each observation data sample, as shown in formula (2):

[0060]

[0061] where x1,x2,...,x n is the actual historical container resource usage of the target user observed at each moment, and 1 to n belong to N. For the convenience of calculation, the logarithm of formula (2) is taken, as shown in formula (3):

[0062]

[0063] Step 206, maximizing the log-likelihood function.

[0064] In order to find the parameter value that maximizes the log-likelihood function of formula (3), it is necessary to derive the log-likelihood function and make its derivative equal to 0. First, the partial derivative of μ is calculated and made equal to 0, as shown in formula (4):

[0065]

[0066] σ is a variable independent of μ, so the derivative can be expressed as formula (5):

[0067]

[0068] Step 208, find the parameters μ and σ of the Gaussian distribution.

[0069] We can get formula (6):

[0070]

[0071] Find the partial derivative of σ and make it equal to 0, and substitute it into the obtained μ to get formula (7):

[0072]

[0073] Based on the above steps, the values ​​of the parameters μ and σ of the Gaussian distribution can be obtained, so that a Gaussian distribution reflecting the container resource demand of the target user in the preset time interval can be obtained.

[0074] The configuring of the container resource demand corresponding to each user in the preset time interval based on the constructed Gaussian distribution includes: configuring the container resource demand of the target user within the 3σ interval as a first container resource demand based on the Gaussian distribution 3σ principle, and configuring the container resource demand of the target user outside the 3σ interval as a second container resource demand, wherein the first container resource demand is different from the second container resource demand; configuring the container resource demand corresponding to the target user in the preset time interval based on the first container resource demand and the second container resource demand.

[0075] The 3σ principle means that in a Gaussian distribution, approximately 99.7% of the observations fall within the range of the mean plus or minus three standard deviations. This principle is often used in practical applications to determine whether there are outliers or observations that exceed the expected range.

[0076] Combination Figure 2 In step 210, according to the Gaussian distribution 3σ principle, the time intervals corresponding to the idle time and the busy time are divided, that is, the interval within the 3σ range is defined as the busy time, and the interval outside the 3σ range is defined as the idle time.

[0077] In step 212, the first container resource requirement is set by keeping the container resource allocation amount unchanged during busy hours; the second container resource requirement is set by reducing the container resource allocation amount during idle hours, thereby customizing a personalized package service for the target user with differentiated allocation of container resource requirements during busy and idle hours. Thus, by deeply analyzing the container resource requirements of different users, customizing personalized services for different users can reduce the waste of users' idle resources, thereby improving the overall utilization of container resources.

[0078] Through the above method, the container resource requirements corresponding to different users at multiple times within a preset time interval can be configured, and the container resource requirement data corresponding to each user can be saved in the database.

[0079] When executing container resource scheduling, only the container resource demand data of each user related to the scheduling is obtained from the database and used for subsequent container resource scheduling.

[0080] Step 104: input the container resource demand into a scheduling model to obtain a scheduling result including containers corresponding to each user allocated at multiple times, wherein the scheduling model is used to output a scheduling result with the highest container resource utilization.

[0081] After obtaining the container resource requirements of the corresponding multiple users, the container resource requirement sequence data of the multiple users at multiple times are input into a pre-trained scheduling model. The scheduling model can output a scheduling result that allocates each user to the corresponding container at multiple times based on the input container resource requirement sequence data, and the scheduling result can maximize the container resource utilization.

[0082] Specifically, the scheduling model is a pointer network model. Before the container resource demand is input into the scheduling model to obtain the scheduling results including the allocated containers corresponding to each user at multiple times, it also includes: based on the container resource demand of a predetermined number of user samples at multiple times within the preset time interval and a predetermined number of containers to be scheduled, constructing a function for representing the corresponding container resource utilization after the corresponding containers are allocated to each user sample at multiple times; using the pointer network model to learn the mapping strategy from input to output to train the pointer network model, the input is the container resource demand of each user sample at multiple times within the preset time interval, and the output is an output pointer for pointing to the container corresponding to each user sample at multiple times; when the container allocated corresponding to the output pointer makes the value of the function of the container resource utilization maximum, the training of the pointer network model is completed.

[0083] Pointer Networks (PtrNet) is a variant of a sequence-to-sequence (seq2seq) model that is designed to learn the correspondence between input sequences and output sequences. The pointer network generates a series of pointers to the elements of the input sequence, which can help the indicator network directly operate on the elements of the input sequence. In an embodiment of the present application, the input sequence corresponds to the container resource requirements corresponding to multiple users at multiple times within a preset time interval obtained in step 102, and the output sequence corresponds to the number or value of the container allocated to each user at multiple times.

[0084] Specifically, the function for representing the corresponding container resource utilization rate after the corresponding containers are allocated to each user sample at multiple times based on the container resource demand of the predetermined number of user samples at multiple times within the preset time interval and the predetermined number of containers to be scheduled is constructed, including: determining the container resource utilization rate of each container to be scheduled based on the constraint that the sum of the container resource demand of each container to be scheduled cannot exceed the upper limit of the corresponding container resource to be scheduled and the constraint that the container resource demand of each user sample must be satisfied Where E k represents the container resource utilization rate of the container k to be scheduled, T represents the number of the multiple time points, W represents the upper limit of the resources of each container to be scheduled, Z represents the number of containers to be scheduled, D represents the number of user samples, and C ij represents the container resource demand of user sample i at time j, Y ik Indicates whether user sample i is allocated to container k; based on the container resource utilization of each container to be scheduled and whether it is used, determines the function of the container resource utilization Among them U k Indicates whether the container k to be scheduled is used.

[0085] Assume that there are Z containers to be scheduled, the upper limit of resources that a single container can accommodate is W, and there are a total of D user samples; U k Indicates whether container k is used, U k =1 means container k is used, U k =0 means container k is not used; Y ik Indicates whether the container resources of user sample i are deployed on container k, Y ik =1 means that the container resources of user sample i are deployed on container k, otherwise Y ik =0; the daily container resource demand of each user sample is divided into T time intervals, and the usage of user sample i in time interval j is represented by C ij .

[0086] When coordinating the sample requirements of each user, the following constraints need to be met:

[0087] (1) The sum of container resource requirements of all users on a single container cannot exceed the resource upper limit of the container, as shown in formula (8):

[0088]

[0089] (2) The container resource requirements of each user must be met, as shown in formula (9):

[0090]

[0091] Then the container resource utilization of container k can be determined as shown in formula (10):

[0092]

[0093] The container resource demand of each user sample is fixed, for example, pre-configured according to the corresponding Gaussian distribution. Therefore, after the container resource demand of the user samples is coordinated and scheduled, the higher the benefit rate of the used container resources, the more containers are released.

[0094] The container resource utilization of the entire scheduling scheme for Z containers and D user samples can be determined as shown in formula (11):

[0095]

[0096] The pointer network model combines the container resource utilization of the above formula (11) to learn the corresponding relationship between the input sequence and the output sequence to train the pointer network model.

[0097] The pointer network model learns a sequence of user container resource requirements x = {x1, x2, ..., x N} to the output container resource allocation scheme y = {y1, y2, ..., y N}, so that the container resource utilization rate of the container resource allocation scheme corresponding to the output sequence y is the highest. i is the output pointer of user sample i, y i =j indicates that user sample i is allocated to the to-be-scheduled container j. The output pointers of different user samples can point to the same container, indicating that these users are allocated to the same container.

[0098] When the output pointer corresponds to the allocated container so that the value of the function of the container resource utilization rate of formula (11) is maximized, the training of the pointer network model is completed. The trained pointer network model can be directly used in step 104, and based on the input user's container resource demand corresponding to multiple moments within a preset time interval, the scheduling results of the containers allocated to the corresponding user at multiple moments are output, and the container resource utilization rate corresponding to the scheduling results is the highest.

[0099] The output sequence length of the pointer network model is equal to the input sequence length. Therefore, no matter how much data is input, the corresponding solution result can be obtained by passing it forward once into the pointer network model without any additional calculation, which is suitable for processing large-scale calculations.

[0100] This application uses the pointer mechanism of the pointer network to solve the user container resource allocation, which can achieve end-to-end fast solution, and is not easy to fall into the local optimum, with the advantages of fast solution speed and good solution effect. In addition, there is no need to manually perform feature engineering or design intermediate steps, which greatly simplifies the model construction and use process and improves efficiency.

[0101] In one embodiment, the pointer network model is obtained by unsupervised learning training based on the reinforcement learning Actor-Critic algorithm, wherein the Actor network in the Actor-Critic algorithm corresponds to the pointer network model, and the Critic network in the Actor-Critic algorithm is used to score the output of the pointer network model.

[0102] The Actor-Critic algorithm is a reinforcement learning algorithm that combines the value function method and the policy gradient method. It consists of two parts: the Actor network and the Critic network. The Actor network is responsible for selecting an action based on the current state, and the Critic network is responsible for evaluating the value function of the current state. During the training process, the Actor network and the Critic network are updated alternately, fixing one of the network parameters and optimizing the other network parameters to maximize the expected reward or minimize the value function error. In this way, the Actor-Critic algorithm can strike a balance between exploration and exploitation and improve the performance of reinforcement learning.

[0103] Through unsupervised learning training of the pointer network model based on the reinforcement learning Actor-Critic algorithm, the container resource demands corresponding to multiple users at multiple times within a preset time interval are provided as input to the pointer network model as an Actor network, and the output pointer pointing to the containers corresponding to each user sample at multiple times is output. The output pointer is provided as input to the Critic network, which scores the output pointer and adjusts the network parameters accordingly. Through repeated iterations, the expected reward is maximized or the value function error is minimized, and the optimal pointer network model with corresponding parameters is finally obtained.

[0104] Specifically, for the container resource demand sequence x of multiple users, the training goal of the pointer network model is to learn the optimal allocation strategy of container resources to obtain the optimal container allocation solution, as shown in formula (12):

[0105]

[0106] The training objective can be optimized by the gradient descent method. In order to solve the problem of reducing the large gradient variance of the policy gradient method, a baseline function is added to the gradient calculation. This function reduces the variance of the gradient while keeping the expectation unchanged, making the algorithm more stable. After the baseline function is introduced, the gradient of the policy gradient method can be expressed as formula (13):

[0107]

[0108] The baseline function b(x) is a function that is independent of the policy π and represents the expectation of the container resource utilization under the current policy. It can be seen from the formula that F(y|x)-b(x) controls the direction of the policy gradient. When the value is positive, it means that the result obtained by the current policy is worse than the baseline value, and the parameters should be updated in the direction of reducing the policy; when the value is negative, it means that the result obtained by the current policy is worse than the baseline value, and the parameters should be updated in the direction of reducing the policy. The Critic network is introduced as the baseline function b(x), and the reinforcement learning Actor-Critic algorithm is used to solve the container resource scheduling problem.

[0109] The Actor network of the Actor-Critic model is a pointer network. During the training process, the Actor network reads the input user container resource demand sequence, extracts the features of the user container resource demand sequence through the encoder, and constructs a complete output sequence through the decoder's operation iteration. The Critic network estimates the output sequence generated by the Actor network and participates in the gradient update of the Actor network as a baseline function, thereby reducing the variance of the Actor network gradient update and improving the Actor network training effect.

[0110] The expectation in formula (13) cannot be calculated directly, so the round update strategy is adopted. First, the Actor network is used to construct a complete output sequence, and the gradient is estimated by the Monte Carlo sampling method to transform formula (13) into formula (14):

[0111]

[0112] Where B is the number of samples in Monte Carlo sampling. The Critic network is trained using the stochastic gradient descent method, with the mean square error as the loss function. Its calculation formula (15) is as follows:

[0113]

[0114] When the above loss function reaches the minimum or meets the threshold, stop training.

[0115] The pointer network model is trained based on the reinforcement learning Actor-Critic algorithm, and the parameters of the pointer network model are trained through self-exploration and learning of the intelligent agent using methods such as gradient descent. This can avoid the need for a large number of data samples with optimal solution labels as training sets when training using supervised learning. These optimal solution labels are often impossible to obtain or require huge costs. Therefore, the present application uses the reinforcement learning Actor-Critic algorithm to perform unsupervised learning to train the pointer network model. There is no need to collect a large number of data sets with optimal labels, the training cost is low, and the robustness and generalization of the model are improved.

[0116] In one embodiment, the pointer network model includes a long short-term memory network model. Before using the pointer network model to learn the mapping strategy from input to output, it also includes: sorting the container resource demand sequence of each user sample included in the input at each moment in the preset time interval based on preset parameters with unique sorting results, wherein the preset parameters include the total container resource demand of each user sample in the preset time interval, the container resource demand of each user sample at the target moment, or the surname of each user sample.

[0117] In an embodiment of the present application, an end-to-end pointer network model is formed by a long short-term memory (LSTM) network, and on this basis, an attention mechanism suitable for combinatorial optimization is introduced.

[0118] Before solving the optimal solution for user container resource allocation, the input sequence must be preprocessed. There is no sequential relationship between the users in the input sequence, but when using the LSTM network to extract features, it is assumed that each element of the input sequence has a sequential relationship. The same user group may have different solution results when input in different orders. Therefore, the user's container resource demand sequence needs to be preprocessed before it is input into the LSTM network.

[0119] The input sequences of multiple users can be sorted in descending order according to preset parameters with unique sorting results to eliminate the influence of input order on the results. The preset parameter sorting of the unique sorting results includes, for example, ascending / descending sorting of the total container resource demand of each user in a day, or ascending / descending sorting of the container resource demand at the target time, or sorting of the user samples by surname.

[0120] In addition, since the resource upper limit size of all containers is W, the input sequence is normalized, and the container resource usage of user sample i at time j can be converted into resource utilization rate, as shown in formula (16):

[0121] x ij =xij / W (16)

[0122] The input sequence x needs to be mapped to a high dimension through the embedding layer before entering the encoder of the LSTM network. The encoder reads the high-dimensional vector and integrates the information of the input sequence context to obtain the hidden layer state e of each input element. i As shown in formula (17):

[0123] e i =h(x i ,e i-1 ) (17)

[0124] The function h is the calculation function of the encoder hidden layer state. After the encoder is encoded, the input hidden layer state sequence can be obtained. The sequence e={e1,e2,...,e n}. In the decoding stage, at any time step i, the decoder calculates the output y of the previous time step i-1 i-1 and the hidden state d i-1 Calculate the hidden state d of the current time step through the LSTM network i , and combined with the encoder’s hidden state sequence e={e1,e2,...,e n}. The attention mechanism is a mechanism that can flexibly assign more weight to more important features, which is essentially a measure of similarity.

[0125] In the embodiment of the present application, the attention mechanism is used to calculate the hidden state ej of each input at this time step and the hidden state d of the decoded part i The degree of relevance u ij , as shown in formula (18):

[0126] u ij =V T tanh(W1e j +W2d i ) (18)

[0127] V, W1, and W2 are all parameters that need to be trained. After obtaining the relevance of time step i to each input, the probability distribution of the output result of the time step pointing to each input can be calculated. Based on the probability size, the result with the largest probability is selected as the output y of the current time step through the greedy algorithm. i ,After getting the output pointers of all time steps, we can know the container assigned to each user.

[0128] Step 106: Based on the scheduling result, the container resource requirements of each user at multiple times are allocated to corresponding containers.

[0129] The scheduling result can take into account the different container resource demands of different users at the target time, reasonably combine the container resource demands of users, and allocate corresponding containers to each user, so as to achieve the highest utilization rate of the entire container resources.

[0130] refer to Figure 3 , Figure 3 FIG. 1 is a flow chart of a method for scheduling container resources according to a specific embodiment of the present application. Figure 3 As shown, the following steps are included:

[0131] Step 302: construct a Gaussian distribution based on the target user's historical usage of container resources, divide the target user's usage of container resources into idle time and busy time, and formulate personalized services for the target user's container resource needs;

[0132] Step 304, determining whether the target user accepts personalized service, that is, whether the target user accepts container resource allocation according to the container resource demand during busy and idle hours. If yes, proceed to step 306, otherwise, end;

[0133] Step 306, adding the container resource requirements of the target user at multiple times to the scheduling pool;

[0134] Step 308, establishing a mathematical model for scheduling, such as a pointer network model;

[0135] Step 310, determining whether it is necessary to perform enhanced training and updating on the established pointer network model in combination with the container resource demand of the current target user, if yes, proceed to step 312, otherwise proceed to step 314;

[0136] Step 312, reinforcement learning training pointer network model;

[0137] Step 314, solving a scheduling solution based on the pointer network model and the container resource requirements of each user in the scheduling pool at multiple times;

[0138] Step 316, executing the scheduling plan according to the scheduling result.

[0139] In an embodiment of the present application, container resource demands corresponding to multiple users at multiple times within a preset time interval are obtained; the container resource demands are input into a scheduling model to obtain scheduling results including containers corresponding to each user at multiple times, and the scheduling model is used to output a scheduling result with the highest container resource utilization; based on the scheduling results, the container resource demands of each user at multiple times are allocated to the corresponding containers, thereby performing container resource scheduling at different times according to the container resource demands at different times and the maximum containerized resource utilization, so that the container resource demands of users at different time periods can be met, and excess container resources are released for use by other users during idle time periods, so that users can not only obtain personalized services that better meet their needs and improve user satisfaction, but also reduce resource bottlenecks and congestion, improve system performance and stability, and improve container resource utilization.

[0140] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides a container resource scheduling device 2000, including a processor 2400 and a memory 2200, and the memory 2200 stores a program or instruction that can be executed on the processor 2400. When the program or instruction is executed by the processor 2400, the various steps of the above-mentioned container resource scheduling method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0141] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of any of the above container resource scheduling method embodiments is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The readable storage medium includes a computer-readable storage medium, such as a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0142] An embodiment of the present application further provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program can be operated to enable a computer to implement each process of any of the above container resource scheduling method embodiments when executed, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0143] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A container resource scheduling method, characterized in that: include: Obtain container resource demands of multiple users at multiple times within a preset time interval; Inputting the container resource demand into a scheduling model to obtain a scheduling result including containers corresponding to each user allocated at multiple times, wherein the scheduling model is used to output a scheduling result with the highest container resource utilization rate; Based on the scheduling result, the container resource requirements of each user at multiple times are allocated to corresponding containers.

2. The method according to claim 1, characterized in that: Before obtaining the container resource demands of multiple users at multiple times within a preset time interval, the method includes: Collect the historical container resource usage of each user at multiple times within a preset time interval; Based on the historical container resource usage at each time point, a Gaussian distribution that meets the container resource requirements of each user is constructed; Based on the constructed Gaussian distribution, the container resource demand corresponding to each user in the preset time interval is configured.

3. The method according to claim 2, characterized in that The method of constructing a Gaussian distribution that meets the container resource requirements of each user based on the collected historical container resource usage at each moment includes: Based on the historical container resource usage at each moment collected by the target user, a Gaussian distribution probability density function corresponding to each historical container resource usage is constructed; Construct the maximum likelihood estimation function corresponding to each Gaussian distribution probability density function; Determining a mean and a standard deviation of a Gaussian distribution based on maximization of the maximum likelihood estimation function; Based on the mean and the standard deviation, a Gaussian distribution of container resource requirements that meets the target user is determined.

4. The method according to claim 2, characterized in that: The configuration of the container resource demand corresponding to each user in the preset time interval based on the constructed Gaussian distribution includes: Based on the Gaussian distribution 3σ principle, the moment when the container resource demand of the target user is within the 3σ interval is configured as the first container resource demand, and the moment when the container resource demand of the target user is outside the 3σ interval is configured as the second container resource demand, and the first container resource demand is different from the second container resource demand; The container resource demand corresponding to the target user in the preset time interval is configured based on the first container resource demand and the second container resource demand.

5. The method according to claim 1, characterized in that The scheduling model is a pointer network model. Before inputting the container resource demand into the scheduling model to obtain the scheduling result including the allocated containers corresponding to each user at multiple times, the method further includes: Based on the container resource requirements of a predetermined number of user samples at multiple times within the preset time interval and a predetermined number of containers to be scheduled, construct a function for representing the resource utilization of the corresponding containers after the corresponding containers are allocated to each user sample at multiple times; Using the pointer network model to learn a mapping strategy from input to output to train the pointer network model, the input is the container resource demand of each user sample at multiple times within the preset time interval, and the output is an output pointer for pointing to the container corresponding to each user sample allocated at multiple times; When the container allocated corresponding to the output pointer makes the value of the function of the container resource utilization rate maximum, the training of the pointer network model is completed.

6. The method according to claim 5, characterized in that The method of constructing a function for representing the resource utilization rate of corresponding containers after the user samples are allocated corresponding containers at multiple times within the preset time interval based on the container resource requirements of the predetermined number of user samples at multiple times and the predetermined number of containers to be scheduled includes: Based on the constraint that the sum of the container resource requirements of each container to be scheduled cannot exceed the resource upper limit of the corresponding container to be scheduled and the constraint that the container resource requirements of each user sample must be met, the container resource utilization rate of each container to be scheduled is determined Where E k represents the container resource utilization rate of the container k to be scheduled, T represents the number of the multiple time points, W represents the upper limit of the resources of each container to be scheduled, Z represents the number of containers to be scheduled, D represents the number of user samples, and C ij represents the container resource demand of user sample i at time j, Y ik Indicates whether user sample i is allocated to container k; Based on the container resource utilization of each container to be scheduled and whether it is used, determine the function of the container resource utilization Among them U k Indicates whether the container k to be scheduled is used.

7. The method according to claim 5, characterized in that The pointer network model is obtained by unsupervised learning training based on the reinforcement learning Actor-Critic algorithm, wherein the Actor network in the Actor-Critic algorithm corresponds to the pointer network model, and the Critic network in the Actor-Critic algorithm is used to score the output of the pointer network model.

8. The method according to claim 5, characterized in that The pointer network model includes a long short-term memory network model. Before using the pointer network model to learn the mapping strategy from input to output, the method further includes: Based on preset parameters with unique sorting results, the sequence of container resource requirements of each user sample included in the input at each moment in the preset time interval is sorted, wherein the preset parameters include the total container resource requirements of each user sample in the preset time interval, the container resource requirements of each user sample at the target moment, or the surname of each user sample.

9. A container resource scheduling device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer program product, characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, the computer program being operable to cause a computer to perform the steps of the method according to any one of claims 1 to 8.