Resource planning method, electronic equipment and storage medium
By simulating the resource utilization of machines under each candidate specification and using the ant colony model to optimize resource planning, the problem of insufficient timeliness and accuracy of resource planning in the existing technology is solved, and efficient resource utilization and cost reduction are achieved.
Patent Information
- Application Number
- CN202410913320.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-10-01
AI Technical Summary
Under the premise of determining the business volume, how to allocate appropriate specifications and number of machines to minimize resource fragmentation and costs, especially in the cloud service provider and container cloud service scenarios, existing technology has timeliness and accuracy and feasibility issues.
By determining multiple machine candidate specifications based on the specifications and quantity of a given container/application, simulating the minimum number and minimum total resource fragments required under each candidate specification, and then determining the target specifications and target quantity, using the ant colony model for simulation Scheduling to optimize resource planning.
It achieves reasonable planning of machine resources under a given business level, reduces resource waste and costs, and improves resource utilization efficiency and the accuracy and feasibility of planning.
Smart Images

Figure CN118733273A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a resource planning method, electronic equipment and storage medium. Background Art
[0002] Enterprises with machine resources often face a problem: given a certain business volume, how to decide what specifications of machines and how many machines to allocate in order to minimize resource fragmentation and costs.
[0003] For cloud service providers, especially in private cloud scenarios, the above problem is: when a customer's business volume in a certain region is determined, that is, the specifications and quantity of containers / applications are determined, how to select the specifications and quantity of machines, and how to schedule containers / applications to minimize resource fragmentation on the machines and reduce costs. For container cloud service providers, the above problem is: when the customer's business volume requirements are known, how to determine the specifications and quantity of machines to minimize resource fragmentation on the machines and reduce costs.
[0004] In short, for scenarios with resource requirements, resource planning issues must be resolved. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a resource planning method, an electronic device and a storage medium, which can provide reasonable machine resource planning for a given business volume, thereby minimizing resource fragmentation, avoiding resource waste and reducing costs.
[0006] To solve the above technical problems, an embodiment of the present invention provides a resource planning method, comprising:
[0007] Based on the specifications and quantity of a given container / application, determine a plurality of candidate specifications of machines for executing and scheduling the container / application;
[0008] For each candidate specification, simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled;
[0009] Based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, a target specification and a target number of machines for executing and scheduling the container / application are determined.
[0010] An embodiment of the present invention provides an electronic device, including:
[0011] at least one processor; and,
[0012] a memory communicatively connected to the at least one processor; wherein,
[0013] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the resource planning method as described above.
[0014] An embodiment of the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program implements the resource planning method described above when executed by a processor.
[0015] Compared with the prior art, the implementation method of the present invention determines multiple candidate specifications of machines for executing scheduled containers / applications based on the specifications and quantity of given containers / applications; for each candidate specification, simulates the minimum number of machines and the minimum total resource fragmentation required after the given container / application is scheduled; based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, determines the target specifications and target quantity of machines for executing scheduled containers / applications. In this solution, given the business volume, multiple candidate specifications of the required machines are first determined, and then the process of scheduling all given containers / applications with machines of each candidate specification is simulated, and the minimum number of machines under various candidate specifications and the minimum total resource fragmentation are sought during the scheduling process, thereby determining the target specifications and target quantity of the machines finally deployed, and realizing reasonable planning of machine resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0017] Figure 1 is a specific flow chart of the resource planning method according to the first embodiment of the present invention;
[0018] Figure 2 is a specific flow chart of a method for determining machine candidate specifications according to a second embodiment of the present invention;
[0019] Figure 3 is a specific flow chart of the ant colony model scheduling method according to the third embodiment of the present invention;
[0020] Figure 4 is a specific flow chart of a method for determining target specifications and quantities of machines according to a fourth embodiment of the present invention;
[0021] Figure 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the following will be described in detail with reference to the accompanying drawings. However, it will be appreciated by those skilled in the art that in the various embodiments of the present invention, many technical details are provided in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented.
[0023] In the prior art, when faced with how to plan machine resources for a given business volume, three main methods are used, namely: manual estimation, machine enumeration, and model calculation.
[0024] When the business volume is small, machine planning can be done through manual estimation. However, manual estimation can only be a rough estimate. Under multi-dimensional factors, such as considering the utilization rate of CPU and memory at the same time, the accuracy of manual estimation cannot be determined. Because there is no real simulation scheduling to verify it, the feasibility cannot be determined, and it is time-consuming.
[0025] The machine enumeration method can more accurately solve the scenarios of small business volume and multi-dimensional factors, and can output the scheduling results and determine the feasibility of the selected specifications. However, when the volume is large and involves combinatorial problems, even if the machine program automatically processes it, it will encounter a large amount of factorial calculations and cannot produce results.
[0026] Whether it is manual estimation or machine enumeration, there are some common problems involving timeliness, accuracy, feasibility, etc. The model calculation method based on modeling ideas or algorithms is more universal and can ensure timeliness, accuracy and feasibility. However, most of the models currently used in the model calculation method are relatively complex and there is still room for improvement.
[0027] The first embodiment of the present invention relates to a resource planning method, which simulates the process of scheduling all given containers / applications by machines of each candidate specification, and seeks the minimum number of machines to be deployed and the total minimum resource fragments during the simulation scheduling process, so as to conveniently and accurately plan the resources of the machines to be deployed for scheduling these containers / applications under the premise of the specifications and quantity of given containers / applications, that is, the business level, i.e., determine the specifications and quantity of the required machines. The application scenarios of this embodiment may include but are not limited to machine resource planning in cloud services or container cloud services.
[0028] like Figure 1 As shown, the resource planning method of this embodiment includes the following steps:
[0029] Step 101: Based on the specifications and quantity of a given container / application, determine candidate specifications of a plurality of machines for executing and scheduling the container / application.
[0030] In this embodiment, the definition of "specification" in the container / application specification and the machine specification is the same, both referring to the resource value size of different resource types, such as resource types may include but not limited to central processing unit (CPU), memory, etc. The container / application specification or machine specification refers to the resource value size of various resource types such as CPU, memory, etc. deployed in the container / application or machine.
[0031] In order to facilitate the determination of the candidate specifications of the machine used to execute the scheduling container / application, in this embodiment, the candidate specifications of all machines included in each deployment candidate scheme are uniformly set to the same specifications. Considering that the specifications of each container / application may be different in a given container / application, the overall distribution of the specifications of the container / application can be analyzed through the specific resource size of each specification and the number of corresponding containers / applications in the specifications of different containers / applications, and then the specifications that are compatible with it as a whole are selected as the specifications of the machine used to execute the scheduling container / application, that is, the specifications of the machine to be deployed. For example, according to the proportion of the specifications of each container / application, multiple specifications can be selected as candidate specifications of the machine, or the specifications of each container / application can be weighted and calculated, and multiple specifications can be selected as candidate specifications of the machine according to the weighted value. Or when there is a limited specification value requirement for a specific specification item in the candidate specification (such as CPU or memory), multiple candidate specifications can also be determined by enumeration. Through these candidate specifications, it is easier to find candidate specifications that are feasible and may achieve the minimum fragmentation rate.
[0032] In this embodiment, the method for determining candidate specifications of multiple machines based on the specifications and quantity of a given container / application is not limited.
[0033] In one embodiment, based on the specifications and quantity of given containers / applications, determining multiple candidate specifications of machines for executing scheduled containers / applications may include: formulating the candidate specifications of the machine as a linear superposition result of the specifications of the given container / application on the machine to obtain multiple candidate specifications of the machine for executing the scheduled containers / applications, or obtaining multiple candidate specifications of the machine for executing the scheduled containers / applications by enumeration.
[0034] Specifically, when machine redundancy is not considered, by assuming that each machine is just full of containers / applications, the resource fragmentation of the machine is 0, that is, the resource fragmentation value is the smallest. Therefore, when machine redundancy is not considered, the machine specification can be considered to be the result of the linear distribution of the container / application specifications on the machine. Therefore, the dot product formula of the vector can be used to solve the machine specification. That is, the machine specification is the linear superposition of the container / application specifications. By setting the linear distribution of the specifications of different containers / applications on the machine, a variety of distribution results can be obtained, and then based on these distribution results and other factors that need to be actually considered (such as the maximum specification value limit) and other constraints, multiple machine candidate specifications can be obtained. Alternatively, multiple candidate specifications of machines for executing scheduled containers / applications can be obtained by enumeration.
[0035] This embodiment exemplifies a specific processing method for obtaining multiple candidate specifications of machines for executing scheduled containers / applications by setting the candidate specifications of the proposed machine as the linear superposition result of the specifications of a given container / application on the machine, or obtaining multiple candidate specifications of machines for executing scheduled containers / applications by enumeration, that is, Figure 2 As shown, the method may include the following steps.
[0036] Step 1011: Set multiple linear superposition coefficient combinations, perform linear superposition on the specifications of a given container / application on the machine, and obtain multiple first candidate specifications of the machine for executing the scheduled container / application, or obtain multiple first candidate specifications of the machine for executing the scheduled container / application by enumeration.
[0037] Specifically, for the linear superposition method, the superposition coefficient of the corresponding specification can be determined randomly or according to the number of containers / applications corresponding to each specification in the specifications of a given container / application (for example, the more the number corresponding to a certain specification, the larger or smaller the corresponding superposition coefficient), thereby forming a coefficient combination. Then, the specifications of each container / application are linearly superimposed with each coefficient combination, and multiple superimposed candidate specification solutions can be obtained, and each of them is used as the first candidate specification of the machine.
[0038] For example, the following formula may be used to represent the first candidate specifications of the machine.
[0039] S=X·Y=(x1,x2,x3,...,x t )·(y1,y2,y3,...,y t );
[0040] Where S represents the first candidate specification of the machine, X represents the number of container / application specifications deployed on the machine, and Y represents the size of the container / application specification; t represents the number of containers / applications of the tth type deployed on the machine, y tIndicates the size of the specification of the t-th container / application.
[0041] With respect to the enumeration method, the specification value of a key specification item (such as CPU or memory) in the specifications of each machine may be enumerated according to the specifications of currently available machines, thereby determining a plurality of first candidate specifications.
[0042] Step 1012: For the first specification items included in each first candidate specification, extract each specification value that is less than the first threshold, and calculate the minimum number of machines with each specification value required to meet the total specification value of the first specification item in the container / application.
[0043] In real application scenarios, the maximum specifications of the machine are limited and are often limited by cost considerations. Given a maximum limit on the machine specification and a known container / application specification, it is possible to find all solutions for the machine specification within the limit, thereby obtaining all feasible machine specifications that may have the minimum fragmentation rate. The maximum specification limit in this embodiment can be a maximum limit on at least one specific specification item (same as "resource type") in the machine specification, such as CPU or memory.
[0044] In order to obtain a larger solution space, the specification values of a specific specification item with a specification maximum value limit contained in each first candidate specification, such as CPU, can be enumerated, where the specification maximum value limit can be recorded as the first threshold, and the specific specification item can be recorded as the first specification item; each specification value of the enumerated first specification item is the specification value of a single machine, and by dividing the total specification value of the first specification item in all the given containers / applications by the specification value of a single machine, the minimum number of machines required for each specification value to meet the scheduling of all containers / applications regarding the first specification item can be obtained. For example, when the first specification item is CPU, the corresponding calculation formula is as follows:
[0045] Num(CPU)=Sum(CPU) / Candidate(CPU);
[0046] Num(CPU) is the minimum number of machines of the current specification required to meet the total size of the CPU in the container / application, Sum(CPU) is the total size of the CPU in the container / application, and Candidate(CPU) is the size of the CPU in the machine of the current specification.
[0047] Step 1013: Calculate the average minimum specification value of the second specification item that each machine needs to have when the minimum number of machines meets the total specification value of the second specification item in the container / application.
[0048] After obtaining the minimum number of machines for each candidate specification that is required to meet the total specification value of the first specification item in the container / application, it is necessary to further determine if these minimum number of machines are to meet the total specification value of at least one other important specification item in the container / application as a whole, also known as the total specification value of the "second specification item", such as the minimum specification value of the second specification item in a single machine corresponding to the total specification value of memory. For example, when the second specification item is memory, the corresponding calculation formula is as follows:
[0049] Candidate(memory)=Sum(memory) / Num(CPU);
[0050] Among them, Candidate(memory) is the average minimum value of memory required by the machine of the current specification, Sum(memory) is the total size of memory in the container / application, and Num(CPU) is the minimum number of machines of the current specification required to meet the total size of CPU in the container / application.
[0051] Step 1014: Select a second candidate specification from each first candidate specification as a candidate specification for a machine for executing the scheduled container / application, wherein the specification value of the first specification item in the second candidate specification is less than the first threshold and the specification value of the second specification item is not less than the average minimum specification value.
[0052] Specifically, for the first candidate specification of each machine, while following the maximum specification value limit of the first specification item and the average minimum specification value limit of the second specification item, a specification value combination of all the first specification items and the second specification items that conform to the above dot product formula can be selected, and the first candidate specifications with these specification value combinations are respectively determined as the second candidate specifications, and the second candidate specifications are the candidate specifications of the machine used to execute the scheduling container / application.
[0053] As the number of machine specifications increases, the amount of calculation increases dramatically. The first candidate specifications of the machines corresponding to all solutions that meet the dot product formula will have a lot of overlap, and the calculation time is very long. Therefore, the process of finding all solutions can be weakened to only finding some solutions that meet the vector dot product formula, which greatly reduces the calculation and time consumption.
[0054] Step 102: For each candidate specification, simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled.
[0055] In this step, there is no limitation on the simulation process, the model, algorithm, simulation software, etc. used in the simulation process. Those skilled in the art can use existing models, such as ant colony models, to modify the scenario of the machine calling the container / application in this solution to complete the simulation scheduling, or use a custom model for simulation scheduling.
[0056] In some embodiments, the present application uses an ant colony model for adaptive modeling to simulate the process of scheduling a given container / application. The specific steps are: using each container / application as a vertex and machines as the edges connecting the vertices, constructing an ant colony model, and for each candidate specification, using the ant colony model to simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled; wherein, in the ant colony model, the process of ants walking to the vertex through the edge is regarded as the process of the container / application being scheduled by the machine, and the distance of the edge that the ant passes through to reach the vertex is regarded as the resource fragmentation after the machine completes the scheduling of the container / application.
[0057] Specifically, after the selection of candidate specifications of machines for executing the scheduling of containers / applications is completed, the minimum number of machines required for each candidate specification of each machine to complete the scheduling of all containers / applications is processed. The ant model is constructed by the following modeling ideas: any container / application is regarded as a point in space, all containers / applications are a group of points in space, and machines are regarded as the connection between containers / applications, that is, edges; completing the scheduling of a container / application is to put the container / application on a certain machine. This process can be regarded as an ant walking to a container / application through a machine in the ant colony model. The machine is regarded as the path for the ant to reach the container / application in the ant model. The container / application is the destination of the ant, similar to the vertex in the traveling salesman problem (TSP) in the ant colony algorithm; the distance traveled by the ant to reach a container / application is the remaining amount of resources after the machine completes the scheduling of the container / application. The larger the remainder, the greater the resource fragmentation, that is, the greater the distance.
[0058] For each candidate specification, the ant colony model is used to simulate the scheduling process of a given container / application. During the scheduling process, the remaining resource fragments and pheromones after the machine completes the scheduling of a container / application are calculated on the edge. When the scheduling process of all containers / applications is completed through the ant colony model, the minimum number of machines and the minimum total resource fragments required for each candidate specification can be calculated.
[0059] In some embodiments, Figure 3 As shown, for each candidate specification, an ant colony model is used to simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled, which may include the following steps.
[0060] Step 1021: Perform vector synthesis on the specification values of the first specification item and the second specification item, and set a synthetic vector.
[0061] Because when containers / applications are scheduled, specifications such as CPU and memory need to be considered simultaneously, rather than a single factor, which is not conducive to the calculation and solution of the ant colony model. Therefore, in this implementation, the specifications that have a greater impact on machine resource planning, such as CPU and memory, can be regarded as two vectors, where CPU can correspond to the first specification item and memory can correspond to the second specification item. Through vector summation operations, they are synthesized into a single vector, thereby reducing multi-dimensional calculation factors to a single calculation factor, simplifying the problem, and ultimately only needing to calculate the synthesized vector.
[0062] In some embodiments, vector synthesis is performed on the specification values of the first specification item and the second specification item to set the synthesis vector, which may include: setting vector synthesis coefficients for the first specification item and the second specification item respectively, and performing vector synthesis on the values obtained by multiplying the specification values of the first specification item and the second specification item by the corresponding vector synthesis coefficients respectively to set the synthesis vector.
[0063] Since there is a cost difference between CPU and memory in real applications, when taking the modulus of the synthetic vector, synthetic coefficients are added to the CPU and memory respectively to better control the cost.
[0064] Step 1022: For each candidate specification, when the ant colony model is used to simulate the convergence of the process of scheduling a given container / application, the corresponding number of machines is used as the minimum number of machines required.
[0065] When the calculation process of the ant colony model converges, the corresponding edges are the least and the sum of the distances between the edges is also the smallest. Based on this principle, in this embodiment, for each candidate specification, the ant colony model is used to simulate the scheduling process of a given container / application. When the calculation process of the ant colony model converges, the number of edges corresponding to the calculation, that is, the number of machines, can be used as the minimum number of machines required.
[0066] Step 1023: When the ant colony model is used to simulate the convergence of the process of scheduling a given container / application, the sum of the moduli of the synthetic vectors generated on the corresponding machines is used as the minimum total resource fragmentation of the required machine.
[0067] The purpose of scheduling containers / applications is to minimize the total resource fragmentation of the machine after all containers / applications are scheduled and deployed. The distance of the edge that the ant passes through after scheduling a container / application is the distance between the CPU and memory, and the CPU and memory are combined into a vector. When the ant colony model is used to simulate the convergence of the process of scheduling a given container / application, for a single machine, the scheduling distance for completing an application / container can be set as the vector sum of the vector CPU margin and the vector memory margin and take the modulus, and the modulus value is used as the resource fragmentation of the single machine. The minimum total resource fragmentation can be obtained by superimposing the resource fragments of all machines.
[0068] In addition, in order to make the ant colony model more general, for example, when the machine specifications and number, container / application specifications and number are known, how to avoid the machine's remaining resource fragmentation ratio being too unbalanced after completing the scheduling of containers / applications, resulting in complete waste of resources. For example: the CPU has 10 cores remaining, the memory has 0 cores remaining, or vice versa. This kind of resource surplus is completely meaningless; therefore, a custom deviation control parameter can be introduced. The deviation control parameter is the difference between the machine's CPU resource fragmentation and the memory resource fragmentation and the given expected ratio, and then the absolute value of the difference is taken, so as to achieve a two-way deviation control of the CPU and memory resource fragmentation ratio. Note: If the denominator is 0, it will be non-zero. At the same time, a weight coefficient is added to the deviation control parameter to facilitate flexible tuning of the final scheduling result.
[0069] Step 103: Based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, determine the target specification and target number of machines used to execute the scheduled container / application.
[0070] After obtaining the minimum number of machines and the minimum total resource fragmentation of each candidate specification based on the ant colony algorithm, this embodiment, based on the principle of minimum number of required machines and minimum fragmentation rate, can preferentially select candidate specifications with relatively small minimum number of required machines and relatively small fragmentation rate of minimum total resource fragmentation from various candidate specifications, and the corresponding minimum number of machines as the above-mentioned target specifications and target numbers. Alternatively, when redundancy is considered, that is, specification redundancy of a single machine and redundancy of the number of machines in the overall machine group are set, the specifications and number of machines with relatively small number of machines and fragmentation rate can be used as the above-mentioned target specifications and target number.
[0071] In some embodiments, Figure 4 As shown, based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, determining the target specification and target number of machines used to execute the scheduled container / application may include the following steps.
[0072] Step 1031: setting the specification redundancy and quantity redundancy corresponding to each candidate specification machine, and calculating the total resource fragmentation of each candidate specification machine relative to the fragmentation rate corresponding to each candidate specification after setting the redundancy.
[0073] Specifically, in order to ensure that the size of the machine or the number of machines is sufficient so that the planned machine resources can successfully complete the scheduling process of a given business volume, resource disaster recovery is considered in this embodiment, and the specification redundancy and quantity redundancy corresponding to the machine are set for each candidate specification of the machine. The specification redundancy mainly sets the redundancy of important specification items such as CPU and memory in a single machine, and sets the quantity redundancy of the number of machines in the machine group. For machines of different specifications, the corresponding specification redundancy and quantity redundancy can be the same or different.
[0074] Based on this, after calculating the minimum number of machines and the minimum total resource fragmentation required for each candidate specification after the ant colony model is used to simulate the scheduling of a given container / application in step 102, the fragmentation rate corresponding to each candidate specification with respect to the minimum total resource fragmentation can be calculated. That is, the ratio of the minimum total resource fragmentation to all resources of the machine corresponding to the candidate specification after redundancy is set is calculated, and the fragmentation rate is obtained.
[0075] Step 1032: Select a candidate size according to the fragmentation rates corresponding to the candidate sizes.
[0076] Specifically, a candidate specification is selected from each candidate specification according to the principle that the lower the fragmentation rate, the higher the probability of being selected. When actually selecting a candidate specification, the preset limit value of resource fragmentation of each specification item in the candidate specification can also be considered to complete the selection of the candidate specification.
[0077] In some embodiments, selecting a candidate specification based on the fragmentation rate corresponding to each candidate specification may include: selecting a candidate specification from each candidate specification with the smallest corresponding fragmentation rate and a ratio of resource fragments between the first specification item and the second specification item that satisfies a preset ratio range.
[0078] Specifically, after obtaining the fragmentation rate corresponding to each candidate specification, the fragmentation rate and the ratio of resource fragments between the first specification item and the second specification item can be considered, and a candidate specification with a small fragmentation rate and a ratio of resource fragments between the first specification item and the second specification item that meets a preset ratio range can be selected to avoid an imbalance of resource fragments between different specification items and avoid complete waste.
[0079] Step 1033: Superimpose the selected candidate specifications with the corresponding specification redundancy to obtain the target specifications. Specifically, the specification value of each specification item in the selected candidate specifications and the redundancy of each specification item in the specification redundancy may be superimposed to obtain the target specifications of the machine for executing the scheduled container / application.
[0080] Step 1034: The minimum number of machines of the selected candidate specification is added to the quantity redundancy corresponding to the candidate specification to obtain the target number.
[0081] Specifically, the number of machines corresponding to the selected candidate specifications when the process of scheduling a given container / application is converged using the ant colony model to simulate the convergence can be superimposed with the number redundancy corresponding to the candidate specifications to obtain the target number of machines used to execute the scheduling container / application.
[0082] In this embodiment, by adding the specification redundancy of a single machine itself (and even-numbering the CPU) to the optimal scheduling result of each candidate machine specification obtained by the ant colony algorithm, resources are reserved for the system or other processes; in addition, the number of machines is additionally increased for disaster recovery in the computer room. By combining the redundancy setting with the minimum fragmentation rate of each candidate machine specification calculated by the ant colony model, a more preferred target specification and target number of machines are obtained, achieving high-quality machine resource optimization.
[0083] In addition, in this embodiment, after the ant colony model completes the scheduling, the processing process of triggering the control of the subsequent steps is added based on the authenticity of the scheduling result. That is, in step 102, after the ant colony model is constructed with each container / application as a vertex and the machine as the edge connecting the vertices, and for each candidate specification, the ant colony model is used to simulate the minimum number of machines and the minimum total resource fragmentation required after the given container / application is scheduled, the following processing steps are also included.
[0084] Step a: Obtain the scheduling arrangement result of each candidate specification after simulating the scheduling of a given container / application using the ant colony model.
[0085] Specifically, the constructed ant colony model can generate corresponding scheduling results and save them to a specified file after completing the specific scheduling of all containers / applications for the candidate specifications of each machine.
[0086] Step b: Based on the scheduling results, verify the authenticity of each container / application being scheduled by the machine.
[0087] Based on the generated scheduling result file, the authenticity of each machine scheduling container / application is verified to confirm whether each container / application has actually completed the scheduling process. When it is verified that all containers / applications have actually completed the process of being scheduled by the machine, the output result is verification success, otherwise the output result is verification success.
[0088] Step c: When the verification is successful, confirm to execute step 103, that is, based on the total resource fragmentation generated by each candidate specification, determine the minimum number of machines and the minimum total resource fragmentation to execute based on each candidate specification, and determine the target specifications and target number of machines used to execute the scheduled container / application.
[0089] Output all scheduling results of each container / application on a certain machine to a file for data accuracy verification, thereby ensuring that all containers / applications are actually scheduled and that the candidate machine resource planning results are valid.
[0090] Compared with related technologies, in this embodiment, given a business volume, multiple candidate specifications of the required machines are first determined, and then the process of scheduling all given containers / applications with machines of each candidate specification is simulated. In the scheduling process, the minimum number of machines under various candidate specifications and the minimum total resource fragmentation are sought, so as to determine the target specifications and target number of the machines finally deployed, and realize reasonable planning of machine resources.
[0091] Another embodiment of the present invention relates to an electronic device, such as Figure 5 As shown, the system comprises at least one processor 202; and a memory 201 in communication with the at least one processor 202; wherein the memory 201 stores instructions executable by the at least one processor 202, and the instructions are executed by the at least one processor 202 so that the at least one processor 202 can execute the above Figure 1 to Figure 4 Method embodiment.
[0092] Among them, the memory 201 and the processor 202 are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors 202 and various circuits of the memory 201 together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art, and therefore, are not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor 202 is transmitted on a wireless medium through an antenna, and further, the antenna also receives data and transmits the data to the processor 202.
[0093] The processor 202 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 201 can be used to store data used by the processor 202 when performing operations.
[0094] Another embodiment of the present invention relates to a computer-readable storage medium storing a computer program, which implements any of the above method embodiments when executed by a processor.
[0095] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0096] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. A resource planning method, characterized in that: include: Based on the specifications and quantity of a given container / application, determine a plurality of candidate specifications of machines for executing and scheduling the container / application; For each candidate specification, simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled; Based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, a target specification and a target number of machines for executing and scheduling the container / application are determined.
2. The method according to claim 1, characterized in that For each candidate specification, the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled are simulated, including: An ant colony model is constructed with each container / application as a vertex and the machine as an edge connecting the vertices. For each candidate specification, the ant colony model is used to simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled. The process of ants walking to the vertex through the edge in the ant colony model is regarded as the process of the container / application being scheduled by the machine, and the distance of the edge passed by the ant to reach the vertex is regarded as the resource fragmentation after the machine completes the scheduling of the container / application.
3. The method according to claim 2, characterized in that The step of determining, based on the specification and quantity of a given container / application, a plurality of candidate specifications of machines for executing and scheduling the container / application comprises: The candidate specifications of the machine are proposed to be the linear superposition result of the specifications of the given container / application on the machine, and multiple candidate specifications of the machine for executing the scheduling of the container / application are obtained, or multiple candidate specifications of the machine for executing the scheduling of the container / application are obtained by enumeration.
4. The method according to claim 3, characterized in that The specification of the proposed machine is a linear superposition result of the specification of the given container / application on the machine, and multiple candidate specifications of the machine for executing the scheduling of the container / application are obtained, or multiple candidate specifications of the machine for executing the scheduling of the container / application are obtained by enumeration, including: Setting multiple linear superposition coefficient combinations, linearly superimposing the specifications of the given container / application on the machine, and obtaining multiple first candidate specifications of the machine for executing the scheduling of the container / application, or obtaining multiple first candidate specifications of the machine for executing the scheduling of the container / application by enumeration; For each first specification item included in each first candidate specification, extract each specification value that is less than a first threshold, and respectively calculate the minimum number of machines required for each specification value to meet the total specification value of the first specification item in the container / application; Calculating an average minimum specification value of the second specification item that each machine needs to have when the minimum number of machines meets the total specification value of the second specification item in the container / application; A second candidate specification is selected from each of the first candidate specifications as a candidate specification for a machine for executing scheduling of the container / application, wherein the specification value of the first specification item in the second candidate specification is less than the first threshold and the specification value of the second specification item is not less than the average minimum specification value.
5. The method according to claim 4, characterized in that For each candidate specification, the ant colony model is used to simulate the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled, including: Performing vector synthesis on the specification values of the first specification item and the second specification item to set a synthesis vector; For each candidate specification, the number of machines corresponding to the convergence of the process of simulating the scheduling of a given container / application using the ant colony model is used as the minimum number of required machines; When the ant colony model is used to simulate the convergence of the process of scheduling a given container / application, the sum of the modules of the synthetic vectors generated on the corresponding machines is used as the minimum total resource fragmentation of the required machine.
6. The method according to claim 5, characterized in that The step of performing vector synthesis on the specification values of the first specification item and the second specification item to set a synthesis vector includes: Vector synthesis coefficients are set for the first specification item and the second specification item respectively, and the specification values of the first specification item and the second specification item are multiplied by the corresponding vector synthesis coefficients to perform vector synthesis, and the synthesized vector is set.
7. The method according to claim 5, characterized in that The determining, based on the minimum number of machines of each candidate specification and the minimum total resource fragmentation, a target specification and a target number of machines for executing the scheduling of the container / application comprises: Setting the specification redundancy and quantity redundancy corresponding to each candidate specification machine, and calculating the total resource fragmentation of each candidate specification machine relative to the fragmentation rate corresponding to each candidate specification after setting the redundancy; Selecting one of the candidate specifications according to the fragmentation rates corresponding to the candidate specifications; Superimposing the selected candidate specifications with the corresponding specification redundancy to obtain the target specifications; The minimum number of machines of the selected candidate specification is superimposed on the quantity redundancy corresponding to the candidate specification to obtain the target number.
8. The method according to claim 7, characterized in that Selecting one of the candidate specifications according to the fragmentation rates corresponding to the candidate specifications includes: From the candidate specifications, a candidate specification is selected, the corresponding fragmentation rate being the smallest and the ratio of the resource fragments of the first specification item to the second specification item satisfying a preset ratio range.
9. The method according to any one of claims 2 to 8, characterized in that: After constructing an ant colony model with each container / application as a vertex and the machine as an edge connecting the vertices, and simulating the minimum number of machines and the minimum total resource fragmentation required after a given container / application is scheduled by using the ant colony model for each candidate specification, the method further includes: Obtaining a scheduling arrangement result of each candidate specification after a given container / application is scheduled by simulating the scheduling using the ant colony model; According to the scheduling result, verify the authenticity of each container / application being scheduled by the machine; When the verification is successful, confirm the total resource fragmentation generated based on each of the candidate specifications, determine the minimum number of machines based on each of the candidate specifications and the minimum total resource fragmentation, and determine the target specifications and target number of machines used to execute the scheduling of the container / application.
10. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the resource planning method according to any one of claims 1 to 9.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the resource planning method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Resource defragmentation method, controller, control node and computer cluster
CN120950224A
