Kubernetes container scheduling method based on service level agreement and energy consumption perception
By building a scheduling management model and using the Sparrow search algorithm, combined with service level agreement and energy consumption awareness, the problem of high energy consumption in Kubernetes microservice scheduling is solved, and it is possible to reduce energy consumption and improve scheduling efficiency while meeting the service level agreement.
Patent Information
- Application Number
- CN202410810705.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-25
Smart Images

Figure CN118842831A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of cloud computing container scheduling, and in particular relates to a Kubernetes container scheduling method based on service level agreement and energy consumption perception. Background Art
[0002] Cloud computing is an Internet-based computing method that provides computing power, storage space, and application services on demand through shared computing resources and services. One of its foundations is virtualization technology, which divides a physical server into multiple virtual servers, namely virtual machines (VMs), to achieve flexible allocation and utilization of resources. Containers are a virtualization technology used to package and run software packages for applications and all their dependencies. With the evolution of application architecture, large monolithic applications in virtual machines are gradually decomposed into small, independently running components, namely microservices. Microservices are decoupled and can be independently developed, deployed, upgraded, and expanded. As the number of deployed microservices increases, it becomes increasingly difficult to deploy microservices in containers. Therefore, automated measures such as automatic scheduling, configuration, supervision, and fault handling become indispensable.
[0003] Kubernetes is an open source container orchestration platform for automating the deployment, expansion, and management of containerized applications. It is widely used as a container cluster management platform. The only container type it initially supported was Docker containers, which happened to be the preferred way to run applications on different cluster servers. Currently, the default scheduler of Kubernetes cannot meet the performance constraints of each Pod (container group) while reducing the energy consumption of virtual machines in the cluster. Existing energy scheduling research usually focuses on a single local data center, and the microservice scheduling strategy for multi-layer grid structures has not been fully considered, resulting in low efficiency and high energy consumption in the existing scheduling methods when scheduling microservices. Summary of the invention
[0004] In order to solve the problems existing in the above prior art, the present invention proposes a Kubernetes container scheduling method based on service level agreement and energy consumption awareness, which includes:
[0005] S1. Build a scheduling management model based on the Kubernetes container management platform; the scheduling management model includes a scheduler, a scheduling management model database, a master node and a working node.
[0006] S2. Submit a YAML (portable object file) task and determine whether the scheduling management model database has priority information between the Pods in the YAML task; if so, execute step S3; if not, calculate the priority information between the Pods in the YAML task, and then execute step S3; the YAML task includes multiple microservices, and each microservice is deployed as one or more Pods.
[0007] S3. Based on the priority information between Pods, an energy consumption model is established with the goal of reducing the total energy consumption of Pod scheduling.
[0008] S4. Use the sparrow search algorithm to perform iterative search to optimize the energy consumption model and obtain the corresponding optimal energy consumption value.
[0009] S5. Determine an optimal scheduling plan according to the optimal energy consumption value, and perform Pod scheduling according to the optimal scheduling plan.
[0010] Furthermore, in step S2, the process of calculating the priority information between the Pods in the YAML task includes:
[0011] S21. Randomly select a working node, place all Pods on the working node, and record the power consumption per unit time of each Pod;
[0012] S22. Arrange all Pods in descending order according to their power consumption per unit time to obtain a Pod priority queue.
[0013] Furthermore, in step S3, based on the priority information between the Pods, an energy consumption model is established with the goal of reducing the total energy consumption of Pod scheduling. The energy consumption model is expressed as:
[0014]
[0015]
[0016] stScore total <=Score given
[0017] Among them, f best It represents the optimal function of the energy consumption model, and min() represents the minimum function; represents the power usage efficiency of the i-th working node; M i Represents the resource consumption priority and of all microservices on the i-th worker node. Indicates the resource consumption priority of the kth microservice on the i-th working node; Score total Represents the total score of the working node response time; Score given Represents the worker node response time score threshold, Ns Indicates the number of working nodes, N i,m Indicates the number of microservices on the i-th working node.
[0018] Furthermore, the process of calculating the resource consumption priority of the microservice based on the CPU utilization of the Pod is as follows:
[0019] Calculate the CPU utilization of each microservice on each working node, expressed as:
[0020]
[0021] in, represents the CPU utilization of the kth microservice on the i-th worker node, N pod Indicates the number of Pods of the k-th microservice deployed on the i-th worker node, Indicates the CPU utilization of the jth Pod in the kth microservice.
[0022] Calculate the energy consumption P of each microservice based on CPU utilization k , expressed as:
[0023]
[0024] Among them, N k Indicates the number of working nodes where the kth microservice is located, represents the peak power consumption of the i-th working node, represents the power consumption of the i-th working node when it is idle;
[0025] Arrange all microservices in descending order according to their energy consumption, and mark each microservice with a corresponding arrangement number as its own resource consumption priority.
[0026] Furthermore, the worker node response time score Score total The sum is expressed as:
[0027]
[0028] Among them, Score(k) represents the response time score of the kth microservice, P all Represents all microservices in the YAML task.
[0029] Furthermore, the response time score of the kth microservice is expressed as:
[0030]
[0031] Among them, NetFlow(k,m) represents the network traffic between the kth microservice and the mth microservice, δ(k,m) represents the sum of the propagation delays between the working node where the kth microservice is located and the working node where the mth microservice is located, and A represents the set of microservices that have a communication relationship with the kth microservice.
[0032] Furthermore, the network traffic between the kth microservice and the mth microservice is expressed as:
[0033]
[0034] Among them, NetFlowPod (Pod k,a ,Pod m,b ) represents the network traffic between two Pods, Podk,a represents the ath Pod of the kth microservice, and Pod m,b It represents the bth Pod in the mth microservice, ck represents the number of Pods in the kth microservice, and cm represents the number of Pods in the mth microservice.
[0035] Furthermore, in step S4, an iterative search is performed using a sparrow search algorithm, including:
[0036] S41. Initialize the sparrow population, and divide the initialized sparrow population into a discoverer population and a follower population;
[0037] S42. Obtain an initial scheduling plan, initialize the position of each sparrow in the discoverer population according to the initial scheduling plan, and then calculate the fitness value of each sparrow in the discoverer population according to the energy consumption model;
[0038] S43. Randomly initialize the position of each sparrow in the follower population, and calculate the fitness value of each sparrow in the follower population according to the energy consumption model; set the maximum number of iterations;
[0039] S44. Obtain the current optimal fitness value as the target fitness value;
[0040] S45. Update the position of each sparrow, and then randomly select a sparrow as a sentinel to update the position again;
[0041] S46. Calculate and update the fitness value of each sparrow, and select the current optimal fitness value;
[0042] S47. Determine whether the current optimal fitness value is better than the target fitness value. If so, use the current optimal fitness value as the target fitness value; if not, keep the target fitness value unchanged;
[0043] S48. Determine whether the maximum number of iterations has been reached. If so, output the target fitness value and its corresponding scheduling plan. If not, increase the number of iterations by one and then return to step S45.
[0044] Furthermore, in step S42, the specific process of obtaining the initial scheduling solution includes:
[0045] S421. Arrange all working nodes in ascending order according to the power usage efficiency PUE to obtain a working node priority queue;
[0046] S422. Determine whether i>N is satisfied. If so, output the initial scheduling plan. If not, extract the i-th Pod in the Pod priority queue.
[0047] S423. Extract the jth working node from the working node priority queue, and determine whether the remaining resources of the jth working node are greater than or equal to the resources required by the i-th Pod. If so, execute step S424; if not, execute step S425;
[0048] S424. Schedule the i-th Pod to the j-th working node, set i=i+1 and return to step S422;
[0049] S425.j=j+1, and return to step S423;
[0050] Here, i represents the Pod number, j represents the worker node number, i∈{1,...,N}, j∈{1,...,M}, N represents the number of Pods in the Pod priority queue, and M represents the number of worker nodes in the worker node priority queue.
[0051] Advantages and beneficial effects of the present invention:
[0052] 1) The method of the present invention takes into account the different energy consumption characteristics of the Pods combined into microservices, and combines the different power usage efficiency (PUE) factors of servers (work nodes) in different locations. On the premise of meeting the basic service level agreement, the Pods with high energy consumption are scheduled to the servers with low PUE to achieve energy consumption reduction.
[0053] 2) Combine the sparrow search algorithm (SSA) to deal with the microservice placement problem in Kubernetes cloud computing. The SSA algorithm is relatively novel and has the advantages of strong optimization ability and fast convergence speed. It can effectively solve the energy consumption and service level agreement problems in task offloading problems, so that tasks can be reasonably offloaded.
[0054] 3) This strategy is based on the energy efficiency model and the sparrow search algorithm. On the basis of the sparrow search algorithm, a heuristic algorithm (HPP) is used to initialize the sparrow discoverer population, and the location of the initial generation of discoverer sparrow population is placed as close as possible to the server location with low PUE, so that the convergence speed of SSA is accelerated and eventually tends to the global optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is the Kubernetes cloud structure diagram of the present invention;
[0056] Figure 2 The present invention is a flowchart of the Kubernetes cloud microservice Pod placement method. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] like Figure 1 As described above, the Kubernetes cloud is composed of servers located in different cities. The microservice monitor is a component in a cluster, which is responsible for periodically collecting the indicator information of the Pods and servers corresponding to the microservices in Kubernetes. The microservice monitor collects the indicator information of the application through a message agent. The Kubernetes Master server will allocate the Pods to the appropriate servers through a custom scheduler. In the Kubernetes cloud, servers located in different cities have different power usage efficiency (PUE) because the external temperature will affect the effect of the data center's cooling equipment. Since the Pods that make up the microservices have different energy consumption, when scheduling microservices, while meeting the basic service level agreement of the microservices, Pods with high energy consumption can be scheduled to servers with low PUE to save energy.
[0059] The default scheduling strategy of Kubernetes mainly considers whether the CPU and memory can meet the operation of the Pod. This approach will cause a waste of energy consumption. Based on this, the present invention will now add new considerations for the Pod energy consumption priority and the PUE value of the server in stages. Based on the newly added factors of the present invention, while meeting the basic service level agreement, Pods with high priority can be placed on servers with low PUE, so energy consumption can be saved to a certain extent. In addition, the present invention also takes into account that when SSA is used alone to solve the pod scheduling target, there will be too many iterations. Therefore, a heuristic algorithm (HPP) is used to initialize the sparrow population, and the position of the initial sparrow population is as close as possible to the server position with low PUE, so that the convergence speed of SSA is accelerated, and eventually tends to the global optimal solution.
[0060] In order to solve the above technical problems, the present invention proposes a Kubernetes container scheduling method based on service level agreement and energy consumption awareness, such as Figure 2 As shown, the method includes:
[0061] S1. Build a scheduling management model based on the Kubernetes container management platform; the scheduling management model includes a scheduler, a scheduling management model database, a master node and a working node.
[0062] S2. Submit the YAML task; determine whether the scheduling management model database has priority information between the Pods in the YAML task; if so, execute step S3; if not, calculate the priority information between the Pods in the YAML task, and then execute step S3; the YAML task includes multiple microservices, and each microservice is deployed as one or more Pods.
[0063] Furthermore, calculating the priority information between each Pod includes the following steps:
[0064] S21. Randomly select a working node, place all Pods on the working node, and record the power consumption per unit time of each Pod;
[0065] S22. Arrange all Pods in descending order according to their power consumption per unit time to obtain a Pod priority queue.
[0066] S3. Based on the priority information between Pods, an energy consumption model is established with the goal of reducing the total energy consumption of Pod scheduling.
[0067] In the embodiment of the present invention, the present invention improves the default method of Pod scheduling based on the principle of working node scoring in the traditional Kubernetes container management platform. Under the premise of meeting the basic service level agreement of microservices, several Pods with high energy consumption priority are located on servers with low PUE, thereby achieving the purpose of saving energy consumption, in order to avoid all Pods being scheduled to the same server. The present invention selects to use response time as the measurement indicator of the service level agreement, and establishes an energy consumption model with the goal of reducing the total energy consumption of Pod scheduling. The energy consumption model is expressed as:
[0068]
[0069]
[0070] stScore total <=Score given
[0071] Among them, f best It represents the optimal function of the energy consumption model, and min() represents the minimum function; represents the power usage efficiency of the i-th working node; M i Represents the resource consumption priority and of all microservices on the i-th worker node. Indicates the resource consumption priority of the kth microservice on the i-th working node; Score total Represents the total score of the working node response time; Score given Represents the worker node response time score threshold, N s Indicates the number of working nodes, N i,m Indicates the number of microservices on the i-th working node.
[0072] It should be noted that a microservice can be deployed as multiple pods placed on different working nodes, that is, a microservice can be deployed on different working nodes; as long as one or more pods of a microservice are placed on a working node, it means that the microservice is deployed on the working node. Specifically, the microservice deployed on a working node or a microservice on a working node mentioned in the present invention means that the microservice has a pod placed on the working node.
[0073] Furthermore, the process of calculating the resource consumption priority of the microservice based on the CPU utilization of the Pod is as follows:
[0074]
[0075] in, represents the CPU utilization of the kth microservice on the i-th worker node, Npod Indicates the number of Pods of the k-th microservice deployed on the i-th worker node, Indicates the CPU utilization of the jth Pod in the kth microservice.
[0076] Calculate the energy consumption P of each microservice based on CPU utilization k , expressed as:
[0077]
[0078] Among them, N k Indicates the number of working nodes where the kth microservice is located, represents the peak power consumption of the i-th working node, represents the power consumption of the i-th working node when it is idle;
[0079] Arrange all microservices in descending order according to their energy consumption, and mark each microservice with a corresponding arrangement number as its own resource consumption priority.
[0080] Furthermore, the total score of the working node response time is Score total It is expressed as:
[0081]
[0082] Among them, Score(k) represents the response time score of the kth microservice, P all Represents all microservices in the YAML task.
[0083] Furthermore, the response time score of the kth microservice is expressed as:
[0084]
[0085] Among them, NetFlow(k,m) represents the network traffic between the kth microservice and the mth microservice, δ(k,m) represents the sum of the propagation delays between the working node where the kth microservice is located and the working node where the mth microservice is located, and A represents the set of microservices that have a communication relationship with the kth microservice.
[0086] Furthermore, the network traffic between the kth microservice and the mth microservice is expressed as:
[0087]
[0088] Among them, NetFlowPod (Pod k,a ,Pod m,b ) represents the network traffic between two Pods. k,a Represents the ath Pod of the kth microservice, Pod m,bIt represents the bth Pod in the mth microservice, ck represents the number of Pods in the kth microservice, and cm represents the number of Pods in the mth microservice.
[0089] S4. Use the sparrow search algorithm to perform iterative search to optimize the energy consumption model and obtain the corresponding optimal energy consumption value.
[0090] In an embodiment of the present invention, it is considered that reducing energy consumption while meeting the basic service level agreement is a multi-objective problem, and the placement problem of microservices is a container problem. There are three traditional solutions to the placement problem of applications: heuristic algorithms, greedy algorithms, and mathematical programming. Among them, heuristic algorithms and greedy algorithms cannot solve multi-objective problems, and mathematical programming methods are only applicable to problems with a small search space, and are not applicable to the placement problem of batch tasks. The sparrow search algorithm can solve multi-objective problems and container problems. The traditional sparrow search algorithm includes a discoverer model, a follower model, and a sentinel model. When the sparrow search algorithm is used to optimize the optimization objective function, the sparrow population is first initialized, and the maximum number of iterations, the number of discoverers, the number of followers, the ratio of sentinels, and the safety threshold parameters are set. In the present invention, each sparrow position represents a complete placement plan for the Pod on the working node.
[0091] Therefore, the present invention proposes a sparrow search algorithm combined with a heuristic algorithm, optimizes the traditional sparrow search algorithm, and uses the Pod initial scheduling scheme obtained by the heuristic algorithm to initialize the discoverer sparrow population, so that the convergence speed of the sparrow population is accelerated and it avoids falling into the local optimum.
[0092] Further, the iterative process using the sparrow search algorithm includes the following steps:
[0093] S41. Initialize the sparrow population, and divide the initialized sparrow population into a discoverer population and a follower population;
[0094] S42. Obtain an initial scheduling plan, initialize the position of each sparrow in the discoverer population according to the initial scheduling plan, and then calculate the fitness value of each sparrow in the discoverer population according to the energy consumption model;
[0095] Furthermore, the energy consumption model is:
[0096]
[0097]
[0098] stScore total <=Score given
[0099] Furthermore, the specific steps of using the heuristic algorithm to obtain the initial scheduling solution are:
[0100] S421. Arrange all working nodes in ascending order according to the power usage efficiency PUE to obtain a working node priority queue;
[0101] S422. Determine whether i>N is satisfied. If so, output the initial scheduling plan. If not, extract the i-th Pod in the Pod priority queue.
[0102] S423. Extract the jth working node from the working node priority queue, and determine whether the remaining resources of the jth working node are greater than or equal to the resources required by the i-th Pod. If so, execute step S424; if not, execute step S425;
[0103] S424. Schedule the i-th Pod to the j-th working node, set i=i+1 and return to step S422;
[0104] S425.j=j+1, and return to step S423;
[0105] Here, i represents the Pod number, j represents the worker node number, i∈{1,...,N}, j∈{1,...,M}, N represents the number of Pods in the Pod priority queue, and M represents the number of worker nodes in the worker node priority queue.
[0106] S43. Randomly initialize the position of each sparrow in the follower population, calculate the fitness value of each sparrow in the follower population according to the energy consumption model, and set the maximum number of iterations;
[0107] S44. Obtain the current optimal fitness value as the target fitness value;
[0108] S45. Update the positions of the discoverer and the follower, and then randomly select a sparrow as a sentinel to update the position again;
[0109] S46. Calculate and update the fitness value of each sparrow, and select the current optimal fitness value;
[0110] S47. Determine whether the current optimal fitness value is better than the target fitness value. If so, use the current optimal fitness value as the target fitness value; if not, keep the target fitness value unchanged;
[0111] S48. Determine whether the maximum number of iterations has been reached. If so, output the target fitness value and its corresponding scheduling plan. If not, increase the number of iterations by one and then return to step S45.
[0112] S5. Determine an optimal scheduling plan according to the optimal energy consumption value, and perform Pod scheduling according to the optimal scheduling plan.
[0113] In the sparrow search algorithm, because the discoverer in the discoverer model has a higher energy reserve and is responsible for searching for areas with abundant food in the entire population, while the followers search around the area and direction provided by the discoverer for foraging. Therefore, the results obtained by the heuristic algorithm are used to initialize the position of the discoverer population, and the follower population uses a random method to initialize the position. In the model establishment, the level of energy reserve depends on the fitness value corresponding to the individual sparrow. Once the sparrow finds a predator, the individual begins to chirp as an alarm signal. When the alarm value is greater than the safety value, the discoverer will take the follower to other safe areas for foraging.
[0114] During each iteration, the finder's position is updated as follows:
[0115]
[0116] Where t represents the current iteration number; i = 1, 2, 3, ... p; j = 1, 2, 3, ..., d; iter max represents the number of iterations, represents the position information of the i-th sparrow in the j-th dimension in the t-th iteration, R1 represents a random number, R2 represents the warning value, Q is a random sample value that obeys the standard normal distribution, and L represents a 1×d matrix, in which all elements are 1.
[0117] The lower the energy of the followers, the worse their position in the entire population, that is, the worse the value of the fitness function. Some followers with poor fitness are more likely to fly to other places to forage for more energy. During the foraging process, followers can always search for the finder that provides the best food, and then get food from the best position or forage around the finder. At the same time, some followers may constantly monitor the finder to compete for food resources in order to increase their predation rate.
[0118] During each iteration, the position of the follower is updated as follows:
[0119]
[0120] in, represents the position information of the i-th sparrow in the j-th dimension in the t-th iteration, represents the optimal position currently occupied by the discoverer, represents the current global worst position, A represents a 1×d matrix, in which each element is randomly assigned a value of 1 or -1, A + =A Τ (AA Τ ) -1 ; n represents the number of sparrow populations, L represents a 1×d matrix, and all elements are 1.
[0121] The Sentinel's position is updated to:
[0122]
[0123] in, is the optimal position among all sparrows in the current iteration. β is a step size control parameter, which is a random number that obeys a normal distribution with a mean of 0 and a variance of 1. K∈[0,1] is a random number, f i is the fitness value of the current sparrow individual; f g and f w are the global best and worst fitness values in the current iteration, respectively; ε is a very small constant to avoid zero in the denominator.
[0124] When f i >f g This means that the sparrows are at the edge of their population and are extremely vulnerable to predators. b t est This means that the sparrow in this position is the best position in the population and is also very safe. i =f g This suggests that sparrows in the middle of the population are aware of the danger and need to move closer to other sparrows to minimize their risk of being preyed upon.
[0125] The ultimate goal of the present invention is to reduce the energy consumption of Kubernetes during service operation while meeting basic service level agreements.
[0126] The present invention proposes the problem of reducing the energy consumption of Kubernetes operation while meeting the basic service level agreement of microservices based on the Pod energy consumption priority and the server's PUE. By adding the Pod priority and the server's PUE as considerations in the optimization stage, the Pod is scheduled in a manner with lower energy consumption. At the same time, the service level agreement is added as a consideration to avoid the extreme situation in which all Pods are centrally scheduled to several servers with the lowest PUE in order to minimize energy consumption during scheduling; the advantage of this method is that: SSA is used to optimize the solution of the energy efficiency function, determine the best server for Pod scheduling, and reduce Kubernetes energy consumption. At the same time, SSA is optimized, and the position of the finder in the sparrow search algorithm is initialized by using the Pod placement position obtained by the HPP algorithm, so that the convergence speed of the sparrow search algorithm is accelerated and the possibility of falling into the local optimum is reduced.
[0127] In the present invention, unless otherwise clearly stipulated and limited, the terms such as "installation", "setting", "connection", "fixation" and "rotation" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. Unless otherwise clearly defined, ordinary technicians in this field can understand the specific meanings of the above terms in the present invention according to the specific circumstances.
[0128] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A Kubernetes container scheduling method based on service level agreement and energy consumption awareness, characterized in that: The method includes: S1. Build a scheduling management model based on the Kubernetes container management platform; the scheduling management model includes a scheduler, a scheduling management model database, a master node and a working node; S2. Submit the YAML task and determine whether the priority information between the Pods in the YAML task exists in the scheduling management model database; if so, execute step S3; if not, calculate the priority information between the Pods in the YAML task and then execute step S3; the YAML task includes multiple microservices, and each microservice is deployed as one or more Pods; S3. Based on the priority information between Pods, an energy consumption model is established with the goal of reducing the total energy consumption of Pod scheduling; S4. Use the sparrow search algorithm to perform iterative search to optimize the energy consumption model and obtain the corresponding optimal energy consumption value; S5. Determine an optimal scheduling plan according to the optimal energy consumption value, and perform Pod scheduling according to the optimal scheduling plan.
2. According to a Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 1, it is characterized in that: In step S2, the process of calculating the priority information between the Pods in the YAML task includes: S21. Randomly select a working node, place all Pods on the working node, and record the power consumption per unit time of each Pod; S22. Arrange all Pods in descending order according to their power consumption per unit time to obtain a Pod priority queue.
3. According to a Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 1, it is characterized in that: Step S3 establishes an energy consumption model based on the priority information between the Pods with the goal of reducing the total energy consumption of Pod scheduling. The energy consumption model is expressed as: s.t.Score total <=Score given Among them, f best It represents the optimal function of the energy consumption model, and min() represents the minimum function; represents the power usage efficiency of the i-th working node; M i Represents the resource consumption priority and of all microservices on the i-th worker node. Indicates the resource consumption priority of the kth microservice on the i-th working node; Score total Represents the total score of the working node response time; Score given Represents the worker node response time score threshold, N s Indicates the number of working nodes, N i,m Indicates the number of microservices on the i-th working node.
4. According to claim 3, a Kubernetes container scheduling method based on service level agreement and energy consumption awareness is characterized in that: The resource consumption priority of the microservice is calculated based on the CPU utilization of the Pod. The specific process is as follows: Calculate the CPU utilization of each microservice on each working node, expressed as: in, represents the CPU utilization of the kth microservice on the i-th worker node, N pod Indicates the number of Pods of the k-th microservice deployed on the i-th worker node, Indicates the CPU utilization of the jth Pod in the kth microservice; Calculate the energy consumption P of each microservice based on CPU utilization k , expressed as: Among them, N k Indicates the number of working nodes where the kth microservice is located, represents the peak power consumption of the i-th working node, represents the power consumption of the i-th working node when it is idle; Arrange all microservices in descending order according to their energy consumption, and mark each microservice with a corresponding arrangement number as its own resource consumption priority.
5. According to a Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 3, it is characterized in that: Score of the total response time of the working nodes total It is expressed as: Among them, Score(k) represents the response time score of the kth microservice, P all Represents all microservices in the YAML task.
6. A Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 5, characterized in that: The response time score of the kth microservice is expressed as: Among them, NetFlow(k,m) represents the network traffic between the kth microservice and the mth microservice, δ(k,m) represents the sum of the propagation delays between the working node where the kth microservice is located and the working node where the mth microservice is located, and A represents the set of microservices that have a communication relationship with the kth microservice.
7. A Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 6, characterized in that: The network traffic between the kth microservice and the mth microservice is expressed as: Among them, NetFlowPod (Pod k,a ,Pod m,b ) represents the network traffic between two Pods. k,a Represents the ath Pod of the kth microservice, Pod m,b It represents the bth Pod in the mth microservice, ck represents the number of Pods in the kth microservice, and cm represents the number of Pods in the mth microservice.
8. According to a Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 1, it is characterized in that: In step S4, an iterative search is performed using a sparrow search algorithm, including: S41. Initialize the sparrow population, and divide the initialized sparrow population into a discoverer population and a follower population; S42. Obtain an initial scheduling plan, initialize the position of each sparrow in the discoverer population according to the initial scheduling plan, and then calculate the fitness value of each sparrow in the discoverer population according to the energy consumption model; S43. Randomly initialize the position of each sparrow in the follower population, calculate the fitness value of each sparrow in the follower population according to the energy consumption model, and set the maximum number of iterations; S44. Obtain the current optimal fitness value as the target fitness value; S45. Update the positions of the discoverer and the follower, and then randomly select a sparrow as a sentinel to update the position again; S46. Calculate and update the fitness value of each sparrow, and select the current optimal fitness value; S47. Determine whether the current optimal fitness value is better than the target fitness value. If so, use the current optimal fitness value as the target fitness value; if not, keep the target fitness value unchanged; S48. Determine whether the maximum number of iterations has been reached. If so, output the target fitness value and its corresponding scheduling plan. If not, increase the number of iterations by one and then return to step S45.
9. A Kubernetes container scheduling method based on service level agreement and energy consumption awareness according to claim 8, characterized in that: In step S42, the specific process of obtaining the initial scheduling solution includes: S421. Arrange all working nodes in ascending order according to the power usage efficiency PUE to obtain a working node priority queue; S422. Determine whether i>N is satisfied. If so, output the initial scheduling plan. If not, extract the i-th Pod in the Pod priority queue. S423. Extract the jth working node from the working node priority queue, and determine whether the remaining resources of the jth working node are greater than or equal to the resources required by the i-th Pod. If so, execute step S424; if not, execute step S425; S424. Schedule the i-th Pod to the j-th working node, set i=i+1 and return to step S422; S425.j=j+1, and return to step S423; Here, i represents the Pod number, j represents the worker node number, i∈{1,...,N}, j∈{1,...,M}, N represents the number of Pods in the Pod priority queue, and M represents the number of worker nodes in the worker node priority queue.
