Container dynamic arrangement scheduling method and system, electronic equipment and storage medium

By dynamically generating container orchestration solutions in embedded systems and utilizing vector coding and optimization algorithms, the problem of low resource utilization in embedded systems is solved, multi-objective optimization and adaptive scheduling are achieved, and system performance and reliability are improved.

CN120653361APending Publication Date: 2025-09-16CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510608002.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

The lack of dynamic scheduling mechanisms in embedded systems leads to low utilization of server resources and difficulty in adaptive multi-objective optimization, such as latency, energy consumption, and load balancing.

Method used

By obtaining server and container parameters, vector encoding is performed to generate the initial population, the fitness value is calculated using the fitness function, and the container orchestration plan is optimized by combining mutation, crossover and elimination strategies to dynamically adjust container deployment.

Benefits of technology

It improves server resource utilization, achieves dynamic trade-offs among multiple objectives such as latency, energy consumption, and load balancing, and improves system performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653361A_ABST
    Figure CN120653361A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a container dynamic arrangement scheduling method and system, electronic equipment and a storage medium, and belongs to the technical field of container arrangement. According to the scheme, server parameters and container parameters of a to-be-deployed application are obtained; performing vector coding on the individuals according to the server parameters and the container parameters to obtain an initial population meeting a resource deployment constraint condition; calculating fitness values of all individuals in the initial population through a fitness function; sorting all individuals in the initial population according to a descending order of the fitness values to obtain a sorting result; based on the sorting result, selecting an updating strategy according to the current iteration times to update the initial population; and judging whether an iteration termination condition is met or not according to the current iteration times and the fitness value, and when the iteration termination condition is met, taking the vector code corresponding to the individual with the maximum fitness value in the updated initial population as a container arrangement scheduling scheme. The container arrangement scheme can be dynamically generated, and the resource utilization rate of the server is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of container orchestration, and in particular to a method, system, electronic device, and storage medium for dynamic container orchestration and scheduling. Background Art

[0002] With the rapid development of the Internet of Things (IoT), edge computing, and intelligent terminal devices, embedded systems are gradually evolving from traditional single-function devices to scalable software platforms that support multiple applications. To enhance the flexibility, modularity, and maintainability of application deployment, container technology has been introduced into the embedded field, becoming a key software packaging and runtime mechanism. Container orchestration for embedded systems refers to the process of dynamically deploying multiple containerized applications on embedded devices with limited resources, heterogeneous runtime environments, and high real-time requirements to meet multiple requirements, including system performance, energy consumption, and reliability.

[0003] Currently, container orchestration and scheduling in embedded systems mainly rely on static manual configuration, simplified orchestration platforms (such as K3s and KubeEdge), or simple strategies based on fixed rules (such as polling and least load first). However, as the number of applications increases, the following problems gradually arise:

[0004] 1. The lack of a dynamic scheduling mechanism makes it difficult to adjust container deployment plans in real time based on changes in server resources, network conditions, and load fluctuations. 2. Manual orchestration may cause some server resources to be idle or partially overloaded, resulting in low overall server resource utilization. 3. Adaptive multi-objective optimization, that is, dynamically balancing multiple optimization objectives such as latency, energy consumption, and load balancing, is difficult. Summary of the Invention

[0005] The main purpose of the embodiments of the present application is to propose a container dynamic orchestration scheduling method, system, electronic device and storage medium, aiming to dynamically generate container orchestration plans and improve server resource utilization.

[0006] To achieve the above objectives, an embodiment of the present application provides a method for dynamic container orchestration and scheduling, the method comprising the following steps:

[0007] Get server parameters and container parameters of the application to be deployed;

[0008] Performing vector encoding on individuals according to the server parameters and the container parameters to obtain an initial population that meets resource deployment constraints, wherein the individuals represent a deployment plan from the container to the server;

[0009] Calculating the fitness values ​​of all individuals in the initial population using a fitness function;

[0010] Sorting all individuals in the initial population in descending order of fitness values ​​to obtain a sorting result;

[0011] Based on the sorting result, selecting an update strategy according to the current number of iterations to update the initial population;

[0012] Whether an iteration termination condition is satisfied is determined according to the current number of iterations and the fitness value. When the iteration termination condition is satisfied, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as a container orchestration scheduling scheme.

[0013] In some embodiments, vector encoding the individuals according to the server parameters and the container parameters to obtain an initial population that meets resource deployment constraints includes the following steps:

[0014] Determine the number of individual dimensions based on the number of containers of the application to be deployed;

[0015] Determining a legal server set for each container based on the server parameters and the container parameters, wherein the legal server set includes a plurality of legal servers, and the legal servers are servers that meet resource deployment constraints;

[0016] Randomly extract a legitimate server from the set of legitimate servers corresponding to each container, and use the server number of the legitimate server as the dimension value;

[0017] Obtaining a vector code for the individual according to the number of dimensions and the dimension value, and then returning to the step of randomly selecting a legitimate server from the set of legitimate servers corresponding to each container and using the server number of the legitimate server as the dimension value, until the number of individuals equals a preset number threshold;

[0018] An initial population is obtained based on all the individuals.

[0019] In some embodiments, the fitness function is obtained by the following steps:

[0020] Obtaining a total communication delay coefficient based on bandwidth requirements of a communication container pair using a communication delay function, wherein the communication container pair represents two containers that need to complete a communication task;

[0021] The total operating power consumption coefficient is obtained based on the server's current power consumption, available CPU capacity, and the CPU demand of all containers deployed on the server;

[0022] The total load balancing coefficient is obtained based on the current load of the server and the load scores of all containers deployed on the server;

[0023] A fitness function is obtained according to the total communication delay coefficient, the total operation power consumption coefficient and the total load balancing coefficient.

[0024] In some embodiments, the updating of the initial population by selecting an update strategy based on the sorting result and according to the current number of iterations includes the following steps:

[0025] Get the evolution factor based on the current number of iterations and the maximum number of iterations;

[0026] Determining whether the evolution factor is less than a preset strategy threshold; if the evolution factor is less than the strategy threshold, screening individuals whose fitness values ​​are ranked within a preset mutation ratio range from the initial population based on the ranking result to obtain a candidate mutation set;

[0027] Randomly extracting a number of target individuals from the candidate mutation set;

[0028] Updating the vector code of each target individual through a mutation strategy to obtain a mutant population;

[0029] The mutant population is updated through an elimination strategy based on an elimination cycle to obtain the updated initial population.

[0030] In some embodiments, the container dynamic orchestration and scheduling method further includes the following steps:

[0031] When the evolution factor is greater than or equal to the strategy threshold, the vector codes of all individuals in the initial population are updated by a crossover strategy to obtain a crossover population;

[0032] The cross population is updated through an elimination strategy based on an elimination cycle to obtain the updated initial population.

[0033] In some embodiments, updating the vector code of each target individual using a mutation strategy to obtain a mutant population includes the following steps:

[0034] Randomly extracting two dimensions at different positions from the vector code of the target individual;

[0035] Under the premise of meeting the resource deployment constraint condition, the dimension values ​​of the two dimensions are exchanged to obtain the vector code of the mutant individual;

[0036] updating the vector code of the target individual according to the vector code of the mutant individual, and then returning to the step of randomly extracting two dimensions at different positions from the vector code of one target individual, until the vector codes of all target individuals are updated;

[0037] The initial population after the target individual is updated is used as the mutation population.

[0038] In some embodiments, updating the vector codes of all individuals in the initial population using a crossover strategy to obtain a crossover population comprises the following steps:

[0039] Randomly sampling two different individuals from the initial population without replacement to obtain a first individual and a second individual;

[0040] Randomly extracting two dimensions at different positions from the vector codes of the first individual and the second individual respectively;

[0041] Under the premise of meeting the resource deployment constraint condition, swapping the dimension values ​​of the two dimensions on the first individual with the dimension values ​​of the two dimensions on the second individual to obtain the vector codes of the two crossed individuals;

[0042] updating the vector codes of the first individual and the second individual according to the vector code of the crossover individual, and then returning to the step of randomly sampling two different individuals from the initial population without replacement to obtain the first individual and the second individual, until the vector codes of all individuals in the initial population are updated;

[0043] The initial population after all the individuals are updated is used as the crossover population.

[0044] To achieve the above objectives, another aspect of the present application provides a container dynamic orchestration and scheduling system, the system comprising:

[0045] The first module is used to obtain server parameters and container parameters of the application to be deployed;

[0046] A second module is configured to perform vector encoding on individuals according to the server parameters and the container parameters to obtain an initial population that meets resource deployment constraints, wherein the individuals represent a deployment plan from the container to the server;

[0047] The third module is used to calculate the fitness values ​​of all individuals in the initial population through a fitness function;

[0048] The fourth module is used to sort all individuals in the initial population in descending order of the fitness values ​​to obtain a sorting result;

[0049] A fifth module is configured to update the initial population by selecting an update strategy based on the sorting result and the current number of iterations;

[0050] The sixth module is used to determine whether the iteration termination condition is met based on the current number of iterations and the fitness value. When the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container orchestration scheduling scheme.

[0051] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method when executing the computer program.

[0052] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above-mentioned method when executed by a processor.

[0053] The embodiments of the present application include at least the following beneficial effects: The present application provides a method, system, electronic device, and storage medium for dynamic container orchestration scheduling. The scheme obtains server parameters and container parameters of the application to be deployed; vector encodes individuals according to the server parameters and container parameters to obtain an initial population that meets resource deployment constraints; calculates the fitness values ​​of all individuals in the initial population using a fitness function; sorts all individuals in the initial population in descending order of fitness values ​​to obtain a sorting result; based on the sorting result, selects an update strategy to update the initial population according to the current number of iterations; determines whether the iteration termination condition is met according to the current number of iterations and the fitness value. When the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container orchestration scheduling scheme. The present application can dynamically generate a container orchestration scheme based on dynamic server parameters and container parameters of the application to be deployed through an optimization algorithm, thereby improving server resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 This is a flowchart of the container dynamic orchestration and scheduling method provided by an embodiment of the present application;

[0055] Figure 2 This is a flowchart of a method for dynamic container orchestration and scheduling provided by another embodiment of the present application;

[0056] Figure 3 This is a schematic diagram of the structure of the container dynamic orchestration and scheduling system provided by an embodiment of the present application;

[0057] Figure 4 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0059] It will be understood that the terms "first", "second", etc. used in this application may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0060] The terms "at least one", "plurality", "each", "any", etc. used in this application include "at least one", "two" or more, "plurality" or "each", "any" or "any one", "each" or "any one" as used herein.

[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0062] The container dynamic orchestration and scheduling method provided in the embodiment of the present application relates to the field of container orchestration technology. The container dynamic orchestration and scheduling method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the container dynamic orchestration and scheduling method, etc., but is not limited to the above forms.

[0063] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.

[0064] Figure 1 This is an optional flowchart of the container dynamic orchestration and scheduling method provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.

[0065] Step S101: Obtain server parameters and container parameters of the application to be deployed.

[0066] Step S102 , vector encoding is performed on individuals according to server parameters and container parameters to obtain an initial population that meets resource deployment constraints, wherein the individuals represent a deployment solution from the container to the server.

[0067] Step S103: Calculate the fitness values ​​of all individuals in the initial population using a fitness function.

[0068] Step S104: sort all individuals in the initial population in descending order of fitness values ​​to obtain a sorting result.

[0069] Step S105 : Based on the sorting result, an update strategy is selected according to the current number of iterations to update the initial population.

[0070] Step S106: Determine whether the iteration termination condition is met based on the current number of iterations and the fitness value. If the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container orchestration scheduling solution.

[0071] In this embodiment, server parameters include the server's available CPU capacity, available memory capacity, available bandwidth capacity, current power consumption, current load, and current network latency. Container parameters for the application to be deployed include the container's CPU requirements, memory requirements, and bandwidth requirements. Real-time collection of server and container parameters allows for dynamic adjustment of container deployment based on changes in server resources, network conditions, and load fluctuations.

[0072] Based on the collected server and container parameters, the container orchestration problem is transformed into an evolvable solution space search problem. Individuals are the basic optimization units in the genetic algorithm, representing a possible container-to-server deployment solution. Each individual is represented by a vector encoding.

[0073] It is understandable that the number of dimensions of the vector code is the same as the number of containers of the application to be deployed, and the dimension value of the vector code is represented by the unique server number of the server.

[0074] For example, assuming the total number of containers to be deployed is N, each individual is a vector of length N, and the value of each dimension in the vector corresponds to the deployment location (i.e., server) of a container. For example, the value of the first dimension is 3, which means that the first container is deployed to server 3.

[0075] The initial population is constructed by generating multiple individuals through random initialization. Random initialization is the simplest and most commonly used population initialization strategy. The initial population is created by randomly generating individuals from a given range or distribution in order to explore a wider solution space during the evolution process.

[0076] It should be noted that the generation of the initial population needs to meet the resource deployment constraints. The resource deployment constraints are a set of rules used to determine the legitimacy of the container orchestration plan. They cover the matching of container resource requirements with the available server resources and the container deployment restrictions defined according to the business logic. The resource deployment constraints enable the solution generated by the algorithm to adapt to the real-time changing business environment.

[0077] Next, the fitness function is used to integrate multiple objectives (such as delay, power consumption, and load) to quantify the pros and cons of individuals, and the fitness values ​​corresponding to all individuals in the initial population are calculated. Based on the calculated fitness values, all individuals in the initial population are sorted in descending order to obtain the sorting results.

[0078] It can be understood that a higher fitness value indicates a better deployment solution for the individual (such as low latency, load balancing, etc.).

[0079] Based on the sorting results, multiple iterations are performed. During the iteration process, a dynamic update strategy is selected to update some individuals in the initial population. Individuals can be modified or replaced through mutation, crossover or elimination during evolution.

[0080] Specifically, the mutation strategy focuses on local perturbations of individuals with low fitness in the sorting results; the crossover strategy focuses on global reorganization of all individuals in the entire population; the elimination strategy focuses on periodically deleting individuals with low fitness values ​​in the sorting results and re-adding random individuals to prevent the optimization algorithm from falling into local optimality. At the same time, the mutation strategy and crossover strategy have greater randomness, while the elimination strategy can retain individuals with higher fitness values ​​and accelerate the convergence of the algorithm.

[0081] The iteration termination condition is determined based on the current number of iterations and the fitness value. The termination condition consists of a first sub-condition and a second sub-condition. The termination condition is met when at least one of these sub-conditions is met. The first sub-condition is that the current number of iterations exceeds the maximum number of iterations, and the second sub-condition is that the change in the maximum fitness value within G consecutive iterations is within a preset range. Both the number of consecutive iterations and the preset change threshold are custom parameters.

[0082] Preferably, the number of consecutive iterations may be set to 3, and the preset change threshold may be set to 0.05.

[0083] It is understandable that the interval and threshold size are set to facilitate comparison, where the size of the threshold depends on the amount of sample data and the cardinality set by technical personnel in this field for each set of sample data, as long as it does not affect the proportional relationship between the parameter and the quantized value.

[0084] When the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container scheduling solution. Otherwise, the current number of iterations is increased by 1, and the process returns to step S103 to continue execution.

[0085] In some embodiments, step S102 may include but is not limited to steps S201 to S205.

[0086] Step S201: Determine the number of individual dimensions according to the number of containers of the application to be deployed.

[0087] Step S202 : determining a legal server set for each container based on server parameters and container parameters, wherein the legal server set includes a plurality of legal servers, and the legal servers are servers that meet resource deployment constraints.

[0088] Step S203: randomly select a legitimate server from the set of legitimate servers corresponding to each container, and use the server number of the legitimate server as the dimension value.

[0089] In step S204, a vector code of the individual is obtained according to the number of dimensions and the dimension value, and then a step of randomly selecting a legal server from the set of legal servers corresponding to each container and using the server number of the legal server as the dimension value is returned until the number of individuals is equal to the preset number threshold.

[0090] Step S205: obtaining an initial population based on all individuals.

[0091] In this embodiment, each individual is assigned a vector with the same number of dimensions as the number of containers, based on the number of containers in the application to be deployed. Each dimension of the vector is initially empty. For each individual, servers that meet the resource deployment constraints are selected for each container based on server and container parameters, resulting in a set of valid servers.

[0092] Specifically, the resource deployment constraint condition includes the first sub-constraint, the second sub-constraint, the third sub-constraint and the fourth sub-constraint. When all sub-constraints are met, the resource deployment constraint condition is met. The first sub-constraint is that the CPU demand and bandwidth demand of a single container do not exceed the available CPU capacity and available bandwidth capacity of the server. The second sub-constraint is that the sum of the memory demand of all containers deployed on the server does not exceed the available memory capacity of the server. The third sub-constraint is that each container can only be deployed on one server. The fourth sub-constraint is that the container and the server meet the preset deployment relationship.

[0093] It should be noted that the preset deployment relationship between containers and servers includes affinity relationship, anti-affinity relationship and key business relationship. Among them, affinity relationship means that the specified container must be deployed on one server, anti-affinity relationship means that the specified container cannot be deployed on the same server at the same time, and key business relationship means that the specified container must be deployed on the specified server. Affinity relationship, anti-affinity relationship and endpoint business relationship are all custom parameters. Affinity relationship is suitable for container groups that require efficient local communication, strong data consistency and the same lifecycle management. For example, the main program and database copy of a service component must be deployed together to avoid cross-server communication delays. Anti-affinity relationship is suitable for load balancing, fault isolation, and high availability scenarios to avoid single point failure. Key business relationship ensures that mission-critical containers are supported by optimal hardware resources and reduces the probability of operational failures.

[0094] A legitimate server is randomly selected from the set of legitimate servers corresponding to each container, and the server number of the legitimate server is used as the dimension value.

[0095] It should be noted that the server number of each server can be generated using a positive integer encoding to generate a unique number, and a snowflake algorithm can also be used to generate a unique number, which is not described in detail here. In this embodiment, as long as the server number of the server can unambiguously locate the container deployment location, the embodiment of this application does not impose specific restrictions.

[0096] Write each dimension value into the corresponding dimension of the vector to obtain the complete vector encoding, and check whether the complete vector also meets the resource deployment constraints.

[0097] If the resource deployment constraint condition is not met, the vector code is cleared and the process returns to step S203 to regenerate the individual vector code.

[0098] If the resource deployment constraints are met, it is further determined whether the current cumulative number of generated individuals is equal to the preset number threshold of the initial population.

[0099] If the cumulative number of individuals generated is less than the preset number threshold, return to step S203 to continue generating vector codes for new individuals until the cumulative number of individuals generated is equal to the preset number threshold, and combine all generated individuals that meet the resource deployment constraints to form the initial population.

[0100] In some embodiments, the fitness function may be obtained through steps S301 to S304.

[0101] Step S301 : obtaining a total communication delay coefficient according to the bandwidth requirement of a communication container pair through a communication delay function, wherein the communication container pair represents two containers that need to complete a communication task.

[0102] Step S302 : obtaining a total operation power consumption coefficient according to the current power consumption of the server, the available CPU capacity, and the CPU demand of all containers deployed on the server.

[0103] Step S303: Obtain a total load balancing coefficient based on the current load of the server and the load scores of all containers deployed on the server.

[0104] Step S304: Obtain a fitness function according to the total communication delay coefficient, the total operation power consumption coefficient, and the total load balancing coefficient.

[0105] In this embodiment, the communication delay function can be constructed based on a multilayer perceptron or convolutional neural network model. The inputs are server parameters and container parameters, and the output is a communication delay score. The communication delay score can range from 0 to 100, and the corresponding training sample labels can be manually annotated. The communication container pair is a custom parameter representing the two containers required to complete the communication task. The communication delay function calculates the total delay based on the bandwidth requirements of the communication container pair to obtain the total communication delay coefficient. The calculation formula for the total communication delay coefficient is as follows:

[0106]

[0107] Among them, TotalLate represents the total communication delay coefficient, Pairs represents the communication container pair, c i and c j Represent the i-th and j-th containers respectively, S(c i ) and S(c j ) represent the servers where the i-th and j-th containers are deployed, bw i represents the bandwidth requirement of the i-th container, and late represents the communication delay function.

[0108] Next, the total operating power consumption coefficient is calculated based on the server's current power consumption, available CPU capacity, and the CPU demand of all containers deployed on the server. The total operating power consumption coefficient is calculated as follows:

[0109]

[0110] Among them, TotalEnergy represents the total operating power consumption coefficient, Server represents the set of all servers, P S Indicates the current power consumption of the Sth server, CPU S Indicates the available CPU capacity of the Sth server, useCPU S represents the CPU demand of all containers deployed on the Sth server, α S is a custom parameter representing the power consumption coefficient of the Sth server.

[0111] At the same time, the total load balancing coefficient is calculated based on the current load of the server and the load scores of all containers deployed on the server. The load score can be implemented using the idea of ​​deriving the communication delay score, which will not be explained here. The formula for calculating the total load balancing coefficient is as follows:

[0112]

[0113] Among them, TotalBalance represents the total load balancing coefficient, Load S Indicates the current load of the Sth server, useLoadS Represents the load score of all containers deployed on the Sth server.

[0114] Finally, the fitness function is constructed by weighted summing the total communication delay coefficient, the total operating power consumption coefficient, and the total load balancing coefficient. The calculation formula of the fitness function is as follows:

[0115]

[0116] Wherein, Fit represents a fitness function, W1, W2, and W3 represent the first weight parameter, the second weight parameter, and the third weight parameter, respectively, whose sum values ​​are 1, and e represents a natural constant.

[0117] Preferably, the first weight parameter W1 can be set to 0.6, the second weight parameter W2 can be set to 0.2, and the third weight parameter W3 can be set to 0.2.

[0118] It should be noted that the above formulas are all calculations that remove dimensions and take their numerical values. The formulas are all formulas for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formulas can be set according to actual conditions. The embodiments of this application are only exemplary and are not specifically limited.

[0119] In some embodiments, step S105 may include but is not limited to steps S401 to S405.

[0120] Step S401: Obtain an evolution factor according to the current number of iterations and the maximum number of iterations.

[0121] Step S402, determining whether the evolution factor is less than a preset strategy threshold. If the evolution factor is less than the strategy threshold, based on the sorting result, individuals whose fitness values ​​are within a preset variation ratio range are selected from the initial population to obtain a candidate variation set.

[0122] Step S403: randomly select several target individuals from the candidate variation set.

[0123] Step S404: update the vector code of each target individual through the mutation strategy to obtain a mutant population.

[0124] Step S405 : updating the mutant population through an elimination strategy based on the elimination cycle to obtain an updated initial population.

[0125] In this embodiment, the iteration progress is determined according to the current number of iterations and the maximum number of iterations. An adaptive evolution factor is dynamically generated based on the iteration progress to control strategy switching. The evolution factor may change periodically with the current number of iterations.

[0126] Exemplarily, based on the sine function, the evolution factor is constructed according to the current number of iterations and the maximum number of iterations. The calculation formula of the evolution factor when the current number of iterations is t is as follows:

[0127]

[0128] Where T represents the maximum number of iterations, and k represents the cycle factor, which is a custom parameter.

[0129] Preferably, the cycle factor can be set to 1 / 10 of the maximum number of iterations. For example, if the maximum number of iterations is set to 200, the cycle factor is set to 20.

[0130] The preset strategy threshold is used to automatically adjust the weights of the mutation strategy and the crossover strategy during the algorithm operation. When the evolution factor is less than the preset strategy threshold, it indicates that the current stage needs to expand the search range through the mutation strategy. In the sorting results, the individuals ranked higher have higher fitness and are closer to the optimal solution, while the individuals ranked lower usually have defects. Only mutating the individuals ranked lower in the sorting results can quickly improve the exploration direction, optimize low-quality solutions, and avoid blind search.

[0131] Specifically, individuals with lower ranking results are screened from the initial population. During the screening process, individuals with lower ranking results can be screened from the initial population based on a preset mutation ratio range to obtain a candidate mutation set to be mutated. For example, the lowest 1 / 3 of the individuals in the initial population can be selected as the candidate mutation set. It will be appreciated that the preset mutation ratio range can be set based on actual circumstances, and 1 / 3 is merely illustrative and is not a specific limitation in this embodiment of the present application.

[0132] In order to prevent excessive destruction of the population structure and reduce population diversity, several individuals are randomly selected from the candidate mutation set as target individuals. The vector encoding of the target individuals is updated through the mutation strategy. For each target individual, a position is randomly selected from the vector encoding for mutation. The mutated target individual is re-added to the initial population to obtain the mutant population.

[0133] To accelerate the algorithm's convergence, the mutant population is updated using an elimination strategy based on an elimination cycle to produce an updated initial population. This elimination cycle controls the pace of population elimination. After a certain number of iterations, individuals with low fitness are removed from the mutant population according to a preset elimination rate. The same number of individuals that meet resource deployment constraints are randomly generated to replace the removed individuals, resulting in an updated initial population. If the current number of iterations does not meet the elimination cycle, the mutant population is used as the updated initial population.

[0134] In some embodiments, the container dynamic orchestration and scheduling method may further include but is not limited to steps S501 to S502.

[0135] Step S501: When the evolution factor is greater than or equal to the strategy threshold, the vector codes of all individuals in the initial population are updated through a crossover strategy to obtain a crossover population.

[0136] Step S502: updating the crossover population through an elimination strategy based on the elimination cycle to obtain an updated initial population.

[0137] In this embodiment, when the evolution factor is greater than or equal to the strategy threshold, the vector encoding of all individuals in the initial population is updated through the crossover strategy. Two individuals are selected from the initial population each time to exchange some dimension values ​​to avoid premature homogenization of the population. During the exchange process, each individual independently and randomly selects the position for exchange. When all individuals in the initial population have undergone one exchange, a crossover population is obtained.

[0138] Next, the crossover population is updated using an elimination strategy based on the elimination cycle. Every certain number of iterations, individuals with low fitness are removed from the crossover population according to a preset elimination rate. The same number of individuals that meet the resource deployment constraints are randomly generated to replace the removed individuals, resulting in an updated initial population. If the current number of iterations does not meet the elimination cycle, the crossover population is used as the updated initial population.

[0139] In some embodiments, step S404 may include but is not limited to steps S601 to S604.

[0140] Step S601: randomly extract two dimensions at different positions from the vector code of a target individual.

[0141] Step S602: Under the premise of meeting the resource deployment constraint condition, the dimension values ​​of the two dimensions are exchanged to obtain the vector code of the mutant individual.

[0142] Step S603: update the vector code of the target individual according to the vector code of the mutant individual, and then return to the step of randomly extracting two dimensions at different positions from the vector code of one target individual, until the vector codes of all target individuals are updated.

[0143] Step S604: The initial population after the target individual is updated is used as the mutation population.

[0144] In this embodiment, the mutation strategy indicates that, under the premise of meeting the resource deployment constraint conditions, two dimension values ​​at different positions are randomly extracted from the vector code of a target individual and exchanged. If the two dimension values ​​at the currently extracted positions do not meet the resource deployment constraint conditions after being exchanged, step S601 is re-executed until a mutant individual that meets the resource deployment constraint conditions is obtained.

[0145] For example, assuming that the vector code of the target individual is {1, 2, 3}, by randomly selecting the first and third dimensions in the vector code and exchanging the dimension values ​​of the two dimensions (i.e., server numbers), the vector code of the mutant individual can be obtained as {3, 2, 1}.

[0146] The vector codes of the target individuals in the initial population are updated according to the vector codes of the mutant individuals. Then, a target individual is selected from the remaining target individuals extracted in step S403, and steps S601 to S603 are continued to be executed until the vector codes of all target individuals are updated. The updated initial population is the mutant population.

[0147] In some embodiments, step S501 may include but is not limited to steps S701 to S705.

[0148] Step S701: randomly select two different individuals from the initial population without replacement to obtain a first individual and a second individual.

[0149] Step S702: randomly extract two dimensions at different positions from the vector codes of the first individual and the second individual respectively.

[0150] Step S703: Under the premise of meeting the resource deployment constraint conditions, the dimension values ​​of the two dimensions on the first individual are exchanged with the dimension values ​​of the two dimensions on the second individual to obtain vector codes of the two cross individuals.

[0151] In step S704, the vector codes of the first and second individuals are updated based on the vector code of the crossover individual. The process then returns to the step of randomly sampling two different individuals from the initial population without replacement to obtain the first and second individuals, until the vector codes of all individuals in the initial population have been updated.

[0152] Step S705: The initial population after all individuals are updated is used as the crossover population.

[0153] In this embodiment, the crossover strategy means that, under the premise of meeting the resource deployment constraints, two different individuals are arbitrarily selected from the initialized population without replacement, and the dimension values ​​of two different positions are randomly extracted from the vector codes of these two individuals and exchanged between them.

[0154] Specifically, two different individuals are randomly selected from the initial population without replacement to obtain the first individual and the second individual. The selection without replacement ensures that each individual only participates in one crossover in one iteration to avoid over-convergence.

[0155] Two dimensions at different positions are randomly selected from the first individual and the second individual respectively, and the dimension values ​​of the two dimensions on the first individual are swapped with the dimension values ​​of the two dimensions on the second individual. If the vector encoding after the swap does not meet the resource deployment constraints, the crossover individual obtained by this crossover is abandoned, and the swapped position or individual is reselected until the vector encoding of the two crossover individuals that meet the resource deployment constraints is obtained.

[0156] For example, before the swap, the vector encoding of the first individual is {1, 2, 3, 4, 5}, and the vector encoding of the second individual is {6, 7, 8, 9, 10}. Assuming that the first position randomly drawn on the first individual is the 1st dimension and the second position is the 3rd dimension, and the first position randomly drawn on the second individual is the 2nd dimension and the second position is the 4th dimension, then the pairwise swap can be to swap the first position of the first individual with the first position of the second individual, and the second position of the first individual with the second position of the second individual, or to swap the first position of the first individual with the second position of the second individual, and the second position of the first individual with the first position of the second individual. Taking the example of swapping the first position of the first individual with the first position of the second individual, and swapping the dimension values ​​of the first position of the first individual with the second position of the second individual, after the swap, the vector encoding of the first individual is {7, 2, 9, 4, 5}, and the vector encoding of the second individual is {6, 1, 8, 3, 10}.

[0157] It should be noted that the dimension value after the swap may be the same as the existing dimension value. In this case, the existing dimension value is replaced with a dimension value that meets the resource deployment constraints. For example, the vector encoding before the swap is {1,2,3,4,5}, and the vector encoding after the swap is {1,3,4,4,5}. The dimension values ​​of the second and third positions have changed, and the dimension value of the third position is the same as the fourth dimension value. Then the final vector encoding after the swap is {1,3,2,4,5}.

[0158] The vector codes of the first and second individuals in the initial population are updated according to the vector code of the crossover individual, and then steps S701 to S704 are repeated until the vector codes of all individuals in the initial population are updated. The updated initial population is the crossover population.

[0159] The following describes and explains the solution of the embodiment of the present invention in detail with reference to specific application examples.

[0160] Reference Figure 2 , Figure 2 A flowchart of a method for dynamic container orchestration and scheduling provided in another embodiment of the present application can be applied to embedded systems.

[0161] In this embodiment, the number of individuals in the initialization population, the maximum number of iterations, the preset strategy threshold, the number of randomly selected individuals K, and the interval iteration number R are all custom parameters, and the starting value of the current iteration number is 1. Preferably, the number of individuals in the initialization population is set to 50, the maximum number of iterations is set to 200, the preset threshold is set to 0.2, the number of randomly selected individuals K is set to 2, and the interval iteration number R is set to 4.

[0162] Obtain server parameters (available CPU capacity, available memory capacity, available bandwidth capacity, current power consumption, current load, and current network latency) and the container parameters of the application to be deployed (CPU requirement, memory requirement, and bandwidth requirement). Randomly generate codes for individuals in the initial population that meet the resource deployment constraints. The codes for each individual are represented by vector codes. The number of dimensions in the vector codes is the same as the number of containers in the application to be deployed. The dimension values ​​of the vector codes are represented by the unique server number. The number of containers corresponding to each application to be deployed is a custom parameter.

[0163] For example, the number of containers corresponding to application A is 3, and the number of containers corresponding to application B is 5, so the number of dimensions of the individual vector encoding is 8. For another example, if the value of the first dimension is 3, it means that the first container of application A is deployed on the server with the unique number 3. For another example, if the value of the fifth dimension is 2, it means that the second container of application B is deployed on the server with the unique number 2.

[0164] The fitness function of formula (4) is used to calculate the fitness values ​​of all individuals in the initialized population, and the individuals are sorted in descending order according to their fitness values.

[0165] An evolution factor is generated according to the current number of iterations and the maximum number of iterations. If the evolution factor is less than the preset threshold, K individuals are randomly selected from the last 1 / 4 of the individuals in the initialized population and their codes are updated through the mutation strategy. Otherwise, the codes of all individuals in the initialized population are updated through the crossover strategy.

[0166] At the same time, the last 1 / 2 individuals of the initialized population are deleted through the elimination strategy every R iterations, and the codes of individuals that meet the resource deployment constraints are randomly regenerated to supplement the deleted individuals, so as to update the codes of the individuals in the initialized population.

[0167] If the iteration termination condition is met, the code of the individual with the largest fitness value in the initialization population is used as the container arrangement scheme. Otherwise, the current iteration number is increased by 1, and the fitness values ​​of all individuals in the initialization population are calculated by the fitness function and sorted in descending order of fitness values. This step is continued.

[0168] This embodiment automatically generates a container orchestration solution based on dynamic server parameters and container parameters of the application to be deployed through an optimization algorithm, and takes communication delay, operating power consumption, and load balancing as optimization targets, thereby improving server resource utilization.

[0169] Reference Figure 3 The present application also provides a container dynamic orchestration and scheduling system that can implement the above container dynamic orchestration and scheduling method. The system includes:

[0170] The first module is used to obtain server parameters and container parameters of the application to be deployed.

[0171] The second module is used to vector encode individuals according to server parameters and container parameters to obtain an initial population that meets resource deployment constraints, where individuals represent the deployment plan from container to server.

[0172] The third module is used to calculate the fitness values ​​of all individuals in the initial population through the fitness function.

[0173] The fourth module is used to sort all individuals in the initial population in descending order of fitness values ​​to obtain the sorting results.

[0174] The fifth module is used to update the initial population based on the sorting results and the current number of iterations.

[0175] The sixth module is used to determine whether the iteration termination condition is met based on the current number of iterations and the fitness value. When the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container orchestration scheduling plan.

[0176] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0177] The present application also provides an electronic device comprising a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method for dynamic container orchestration and scheduling. The electronic device can be any smart terminal, including a tablet computer and an in-vehicle computer.

[0178] It can be understood that the contents of the above method embodiments are applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0179] Reference Figure 4 , Figure 4The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:

[0180] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.

[0181] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called by the processor 901 to execute the container dynamic orchestration and scheduling method of the embodiments of this application.

[0182] The input / output interface 903 is used to implement information input and output.

[0183] The communication interface 904 is used to realize communication interaction between this device and other devices. Communication can be realized through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0184] The bus 905 transmits information between various components of the device (eg, the processor 901 , the memory 902 , the input / output interface 903 , and the communication interface 904 ).

[0185] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0186] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned container dynamic orchestration and scheduling method.

[0187] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiment, the functions specifically implemented by the present storage medium embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0188] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0189] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0190] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0191] The system embodiment described above is merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0192] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.

[0193] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0194] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.

Claims

1. A container dynamic orchestration and scheduling method, characterized in that: The method comprises the following steps: Get server parameters and container parameters of the application to be deployed; Performing vector encoding on individuals according to the server parameters and the container parameters to obtain an initial population that meets resource deployment constraints, wherein the individuals represent a deployment plan from the container to the server; Calculating the fitness values ​​of all individuals in the initial population using a fitness function; Sorting all individuals in the initial population in descending order of fitness values ​​to obtain a sorting result; Based on the sorting result, selecting an update strategy according to the current number of iterations to update the initial population; Whether an iteration termination condition is satisfied is determined according to the current number of iterations and the fitness value. When the iteration termination condition is satisfied, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as a container orchestration scheduling scheme.

2. The method according to claim 1, characterized in that The vector encoding of individuals according to the server parameters and the container parameters to obtain an initial population that meets the resource deployment constraint conditions includes the following steps: Determine the number of individual dimensions based on the number of containers of the application to be deployed; Determining a legal server set for each container based on the server parameters and the container parameters, wherein the legal server set includes a plurality of legal servers, and the legal servers are servers that meet resource deployment constraints; Randomly extract a legitimate server from the set of legitimate servers corresponding to each container, and use the server number of the legitimate server as the dimension value; Obtaining a vector code for the individual according to the number of dimensions and the dimension value, and then returning to the step of randomly selecting a legitimate server from the set of legitimate servers corresponding to each container and using the server number of the legitimate server as the dimension value, until the number of individuals equals a preset number threshold; An initial population is obtained based on all the individuals.

3. The method according to claim 1, characterized in that The fitness function is obtained by the following steps: Obtaining a total communication delay coefficient based on bandwidth requirements of a communication container pair using a communication delay function, wherein the communication container pair represents two containers that need to complete a communication task; The total operating power consumption coefficient is obtained based on the server's current power consumption, available CPU capacity, and the CPU demand of all containers deployed on the server; The total load balancing coefficient is obtained based on the current load of the server and the load scores of all containers deployed on the server; A fitness function is obtained according to the total communication delay coefficient, the total operation power consumption coefficient and the total load balancing coefficient.

4. The method according to claim 2, characterized in that The updating of the initial population by selecting an update strategy based on the sorting result and according to the current number of iterations comprises the following steps: Get the evolution factor based on the current number of iterations and the maximum number of iterations; Determining whether the evolution factor is less than a preset strategy threshold; if the evolution factor is less than the strategy threshold, screening individuals whose fitness values ​​are ranked within a preset mutation ratio range from the initial population based on the ranking result to obtain a candidate mutation set; Randomly extracting a number of target individuals from the candidate mutation set; Updating the vector code of each target individual through a mutation strategy to obtain a mutant population; The mutant population is updated through an elimination strategy based on an elimination cycle to obtain the updated initial population.

5. The method according to claim 4, characterized in that The container dynamic orchestration and scheduling method further includes the following steps: When the evolution factor is greater than or equal to the strategy threshold, the vector codes of all individuals in the initial population are updated by a crossover strategy to obtain a crossover population; The cross population is updated through an elimination strategy based on an elimination cycle to obtain the updated initial population.

6. The method according to claim 4, characterized in that Updating the vector code of each target individual by a mutation strategy to obtain a mutant population includes the following steps: Randomly extracting two dimensions at different positions from the vector code of the target individual; Under the premise of meeting the resource deployment constraint condition, the dimension values ​​of the two dimensions are exchanged to obtain the vector code of the mutant individual; updating the vector code of the target individual according to the vector code of the mutant individual, and then returning to the step of randomly extracting two dimensions at different positions from the vector code of one target individual, until the vector codes of all target individuals are updated; The initial population after the target individual is updated is used as the mutation population.

7. The method according to claim 5, characterized in that The method of updating the vector codes of all individuals in the initial population by a crossover strategy to obtain a crossover population includes the following steps: Randomly sampling two different individuals from the initial population without replacement to obtain a first individual and a second individual; Randomly extracting two dimensions at different positions from the vector codes of the first individual and the second individual respectively; Under the premise of meeting the resource deployment constraint condition, swapping the dimension values ​​of the two dimensions on the first individual with the dimension values ​​of the two dimensions on the second individual to obtain the vector codes of the two crossed individuals; updating the vector codes of the first individual and the second individual according to the vector code of the crossover individual, and then returning to the step of randomly sampling two different individuals from the initial population without replacement to obtain the first individual and the second individual, until the vector codes of all individuals in the initial population are updated; The initial population after all the individuals are updated is used as the crossover population.

8. A container dynamic orchestration and scheduling system, characterized in that: The system comprises: The first module is used to obtain server parameters and container parameters of the application to be deployed; A second module is configured to perform vector encoding on individuals according to the server parameters and the container parameters to obtain an initial population that meets resource deployment constraints, wherein the individuals represent a deployment plan from the container to the server; The third module is used to calculate the fitness values ​​of all individuals in the initial population through a fitness function; The fourth module is used to sort all individuals in the initial population in descending order of the fitness values ​​to obtain a sorting result; A fifth module is configured to update the initial population by selecting an update strategy based on the sorting result and the current number of iterations; The sixth module is used to determine whether the iteration termination condition is met based on the current number of iterations and the fitness value. When the iteration termination condition is met, the vector encoding corresponding to the individual with the largest fitness value in the updated initial population is used as the container orchestration scheduling scheme.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Memory access time delay acquisition method and electronic equipment

    CN120909894A