CN115373828A - Resource scheduling method, device, equipment and computer storage medium - Google Patents

Resource scheduling method, device, equipment and computer storage medium Download PDF

Info

Publication number
CN115373828A
CN115373828A CN202110547949.3A CN202110547949A CN115373828A CN 115373828 A CN115373828 A CN 115373828A CN 202110547949 A CN202110547949 A CN 202110547949A CN 115373828 A CN115373828 A CN 115373828A
Authority
CN
China
Prior art keywords
virtual machine
server
planning
server cluster
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110547949.3A
Other languages
Chinese (zh)
Inventor
丁丽敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110547949.3A priority Critical patent/CN115373828A/en
Publication of CN115373828A publication Critical patent/CN115373828A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Abstract

The application discloses a resource scheduling method, a device, equipment and a computer storage medium, wherein the method comprises the following steps: acquiring a virtual machine creation request; according to the virtual machine establishing request, utilizing a preset planning model to plan resources of the server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value; and according to the planning strategy, carrying out virtual machine resource scheduling in the server cluster. Therefore, resource planning is carried out on the server cluster through the preset planning model, the planning strategy is determined when the resource utilization rate of the server cluster reaches the maximum, and then the virtual machine resource scheduling is carried out according to the planning strategy, so that not only can the server resources in the server cluster be fully utilized and the resource utilization rate of the server be improved, but also the calculation accuracy of the virtual machine capacity which can be provided by the existing resources in the server cluster can be improved, and the aim of reducing the hardware cost is further achieved.

Description

Resource scheduling method, device, equipment and computer storage medium
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a resource scheduling method, apparatus, device, and computer storage medium.
Background
OpenStack is the most popular open source cloud computing technology at present, and a scheduling scheme is created by a virtual machine based on a type template (browser), so that a user can enjoy convenience brought by cloud computing in a resource pool as much as possible. Here, each virtual machine consumes a Central Processing Unit (CPU), a memory, and a hard disk of the resource pool. Generally, a cloud service provider will have a complete set of monitoring tools for monitoring the usage of an existing resource pool, or predicting the trend of the future three months according to a historical trend, or ensuring sufficient resource response requirements according to the usage amount applied by a user in advance.
In the related art, there is currently an important concern about how to ensure that the resource pool is large enough to accommodate possible requests, or to distribute virtual machines relatively dispersedly in order not to overload the physical servers. However, in these schemes, on one hand, because the resource fragments and the scheduling of the virtual machine are not controllable, the capacity of the virtual machine that can be provided by the existing resources cannot be accurately calculated; on the other hand, the resource utilization rate is low due to the unbalanced resource utilization and resource waste.
Disclosure of Invention
The application provides a resource scheduling method, a resource scheduling device and a computer storage medium, which can improve the resource utilization rate of a server.
The technical scheme of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a resource scheduling method, where the method includes:
acquiring a virtual machine creation request;
according to the virtual machine establishing request, utilizing a preset planning model to plan resources of a server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and scheduling the resources of the virtual machine in the server cluster according to the planning strategy.
In a second aspect, an embodiment of the present application provides a resource scheduling apparatus, which includes an obtaining unit, a determining unit, and a scheduling unit, wherein,
the acquisition unit is configured to acquire a virtual machine creation request;
the determining unit is configured to perform resource planning on the server cluster by using a preset planning model according to the virtual machine creating request, and determine a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and the scheduling unit is configured to perform virtual machine resource scheduling in the server cluster according to the planning strategy.
In a third aspect, embodiments of the present application provide an electronic device, which includes a memory and a processor, wherein,
the memory for storing a computer program operable on the processor;
the processor is configured to execute the resource scheduling method according to the first aspect when the computer program is executed.
In a fourth aspect, an embodiment of the present application provides a computer storage medium, where a computer program is stored, and when executed by at least one processor, the computer program implements the resource scheduling method according to the first aspect.
According to the resource scheduling method, the resource scheduling device, the resource scheduling equipment and the computer storage medium, a virtual machine creation request is obtained; according to the virtual machine creation request, performing resource planning on the server cluster by using a preset planning model, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value; and according to the planning strategy, carrying out virtual machine resource scheduling in the server cluster. Therefore, the server cluster is subjected to resource planning through the preset planning model, the planning strategy is determined when the resource utilization rate of the server cluster reaches the maximum, and then the virtual machine resource scheduling is carried out according to the planning strategy, so that the server resources in the server cluster can be fully utilized, the resource utilization rate of the server is improved, the calculation accuracy of the virtual machine capacity which can be provided by the existing resources in the server cluster can be improved through the preset planning model, and the purpose of reducing the hardware cost is further achieved.
Drawings
Fig. 1 is a schematic tetris diagram of an analog virtual machine distribution according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another resource scheduling method according to an embodiment of the present application;
fig. 4 is a schematic detailed flowchart of a resource scheduling method according to an embodiment of the present application;
fig. 5 is a detailed flowchart of another resource scheduling method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a resource scheduling apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a specific hardware structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant application and are not limiting of the application. It should be noted that, for the convenience of description, only the parts related to the related applications are shown in the drawings.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
It should be noted that the terms "first \ second \ third" referred to in the embodiments of the present application are only used for distinguishing similar objects and do not represent a specific ordering for the objects, and it should be understood that "first \ second \ third" may be interchanged under specific ordering or sequence if allowed, so that the embodiments of the present application described herein can be implemented in other orders than illustrated or described herein.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application are explained, and the terms and expressions referred to in the embodiments of the present application are applicable to the following explanations:
resource fragmentation: the remaining resources of a physical server, such as a CPU, a memory, a hard disk, and the like, cannot be provided for a complete virtual machine, and are only forced to be wasted, but cannot provide any service. Assuming that a virtual machine requests 4CPU resources, and there are 2 physical servers each with 2 remaining CPUs, none of the 2 physical servers can meet the requirement of the virtual machine, resulting in a total of 4 CPUs on the 2 physical servers being wasted, instead of providing a 4-CPU virtual machine capacity through the two physical servers. It is therefore difficult to determine whether the user's upcoming needs are met, even with complete monitoring.
A flavour: in OpenStack, a virtual machine hardware template is called a type template (navigator). When a virtual machine is created, the template Identity identification number (ID) is appointed, and then the mirror image ID is added, so that a virtual machine which uses the attribute in the browser and is created by using the mirror image can be created.
Resource usage is unbalanced: the scheduling of the virtual machine creation is uncontrollable, and the situation that a user uses the virtual machine cannot be predicted (the user may apply for different virtual machine models), so that different types of virtual machines are scheduled to different physical servers, and certain resources on the physical servers are consumed first (for example, a CPU consumes 100% first, and a memory and a hard disk are used rarely, if the usage is less than 30%), and the rest resources cannot provide services.
Huge cloud service providers, such as Amazon WEB Services (AWS), have their own deep hardware resources available for dynamic deployment, and even in the event of a shortage of a set of resource pools, can react quickly to ensure that Services are not affected. However, the method is mainly supported by huge hardware resources, and how to improve the resource utilization rate of the existing server as much as possible is not considered in an important way.
In other words, the focus of the related art is how to ensure that the resource pool is large enough to accommodate possible requests, or to not overload the physical servers, relatively decentralized distributed virtual machines. But lack the following considerations: due to resource fragmentation, scheduling based on a navigator is uncontrollable, and the capacity of a virtual machine which can be provided by existing resources cannot be accurately calculated; in addition, the resource is unbalanced, which easily causes the waste of resources to be serious.
That is, what virtual machines the user needs to create is unpredictable and this process can be thought of as a tetris game. For example, fig. 1 shows a tetris schematic diagram of a class-to-virtual machine distribution provided in an embodiment of the present application. As shown in FIG. 1, during the course of the tetris game, each falling dice is unknown.
Therefore, the scheduling policy for the virtual machine needs to adapt to the following scenario:
(1) And planning the next virtual machine creation request in real time according to the distribution use condition of the current virtual machine. Since the unpredictability of the next virtual machine creation request affects the planning result even by different orders of the previous and next 2 requests, a wide optimal solution set is necessary for dynamic planning.
(2) At intervals, the virtual machines that have been created may be redistributed. For example, in the tetris in fig. 1, if the underlying dice are not placed reasonably, the unreasonable dice (virtual machines) can be migrated out by a migration means, and the more suitable dice (virtual machines) can be migrated in.
Based on this, the present application provides a resource scheduling method, and the basic idea of the method is: acquiring a virtual machine creation request; according to the virtual machine establishing request, utilizing a preset planning model to plan resources of a server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value; and scheduling the resources of the virtual machine in the server cluster according to the planning strategy. Therefore, resource planning is carried out on the server cluster through the preset planning model, the planning strategy is determined when the resource utilization rate of the server cluster reaches the maximum, and then virtual machine resource scheduling is carried out according to the planning strategy, so that not only can the server resources in the server cluster be fully utilized and the resource utilization rate of the server be improved, but also the calculation accuracy of the virtual machine capacity which can be provided by the existing resources in the server cluster can be improved through the preset planning model, and the purpose of reducing the hardware cost is further achieved.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
In an embodiment of the present application, referring to fig. 2, a flowchart of a resource scheduling method provided in the embodiment of the present application is shown. As shown in fig. 2, the method may include:
s201, acquiring a virtual machine creating request.
It should be noted that the resource scheduling method provided in the embodiment of the present application may be applied to a device for performing resource scheduling, or an electronic device integrated with the device. Here, the electronic device may be a computer, a smart phone, a tablet computer, a notebook computer, a palm top computer, a Personal Digital Assistant (PDA), a navigation device, and the like, which is not limited in this embodiment.
It should be further noted that, obtaining the virtual machine creation request is typically a step performed after the cloud service provider receives the virtual machine requirement of the user, where the virtual machine creation request is used to indicate what type of virtual machine the user requires and the number of corresponding types of virtual machines.
Exemplarily, the resource scheduling method provided by the embodiment of the present application is described in detail by taking OpenStack as an example for creating a virtual machine, where in OpenStack, a type template (browser) including a set CPU number, a set memory size, and a set hard disk size is created to create the virtual machine. Specifically, when creating a virtual machine, it is only necessary to specify a template ID and an image ID, and a virtual machine that uses the attribute of the browser and is created using the image can be created. But before creating the virtual machine, a virtual machine creation request needs to be obtained first.
S202, according to the virtual machine creation request, resource planning is carried out on the server cluster by using a preset planning model, and a planning strategy when the resource utilization rate of the server cluster reaches a target value is determined.
It should be noted that after the virtual machine creation request is obtained, the resource planning may be performed on the server cluster by using a preset planning model according to the virtual machine creation request, so as to determine a planning policy when the resource utilization rate of the server cluster reaches a target value. Here, the target value is a value when the resource utilization rate of the server cluster can reach the optimum or maximum when the resource planning is performed on the server cluster through a preset planning model and the virtual machine creation request is satisfied, so that resources in the server cluster can be reasonably utilized. The target value is not a fixed value, but a value when the resource utilization rate reaches the optimum or maximum; in general, the target value may be a value when the resource utilization of the server cluster is maximized, but this is not specifically limited in this embodiment of the present application.
It should also be noted that the planning strategy is to determine how many virtual machines of a certain type are deployed on each server in the server cluster. Through calculation of the preset planning model, the virtual machine creation request can be met, and meanwhile resources of the server cluster can be utilized to the maximum extent and the most reasonably.
In addition, a server cluster may be a resource pool that includes a plurality (e.g., 20, 30, etc.) of physical servers. Here, the physical server provides resources such as CPU, memory, hard disk, etc. required to create the virtual machine. It should also be noted that the servers referred to in the embodiments of the present application all refer to physical servers.
And S203, carrying out virtual machine resource scheduling in the server cluster according to the planning strategy.
It should be noted that after the planning strategy is determined, the virtual machine resource scheduling may be performed in the server cluster according to the planning strategy, that is, the virtual machine is created on the most appropriate server in the server cluster, so as to ensure that each resource of each server in the server cluster can be reasonably utilized, thereby greatly reducing the value waste caused by resource fragments.
In this way, after the planning policy is determined, a target server in the server cluster and information of virtual machines deployed on the target server, such as the number of virtual machines, the types of virtual machines, and the like, may be selected, and then virtual machines are created on corresponding servers, so as to implement resource scheduling of the virtual machines.
The embodiment provides a resource scheduling method, which comprises the steps of obtaining a virtual machine creation request; according to the virtual machine establishing request, utilizing a preset planning model to plan resources of a server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value; and scheduling the resources of the virtual machine in the server cluster according to the planning strategy. Therefore, resource planning is carried out on the server cluster through the preset planning model, the planning strategy is determined when the resource utilization rate of the server cluster reaches the maximum, and then virtual machine resource scheduling is carried out according to the planning strategy, so that not only can the server resources in the server cluster be fully utilized and the resource utilization rate of the server be improved, but also the calculation accuracy of the virtual machine capacity which can be provided by the existing resources in the server cluster can be improved through the preset planning model, and the purpose of reducing the hardware cost is further achieved.
In another embodiment of the present application, in the resource scheduling method, a description may be further performed with respect to an establishment process of a preset planning model. As shown in fig. 3, the method may further include:
s301, acquiring server definition information and virtual machine definition information.
It should be noted that the server definition information may include at least the number of servers in the server cluster, a set of performance parameters of each server, and a set of price parameters of each server, and the virtual machine definition information may include at least the number of types of virtual machines, a set of performance parameters of each type of virtual machines, and a set of price parameters of each type of virtual machines.
It should be further noted that the preset planning model provided in the embodiment of the present application generates the planning strategy by performing relevant calculation on definition information of the server and the virtual machine. Here, the planning strategy includes the type and number of virtual machines that can be created on each server in the server cluster, that is, the capacity of the virtual machines that can be provided by the server cluster can be accurately calculated through a preset planning model.
In some embodiments, the set of performance parameters may include: the number of Central Processing Units (CPU), the memory capacity and the hard disk capacity; the set of price parameters may include: unit CPU price, unit memory price and unit hard disk price.
That is, for any one server, the set of performance parameters includes: the number of CPU of the server, the memory capacity of the server and the capacity of a hard disk of the server; the price parameter set comprises: the price per unit of CPU, the price per unit of memory and the price per unit of hard disk.
For any virtual machine, the performance parameter set comprises: the number of virtual CPUs, the virtual memory capacity and the virtual hard disk capacity; the price parameter set comprises: unit virtual CPU price, unit virtual memory price, and unit virtual hard disk price.
In short, the performance parameter set represents the number or capacity of basic configuration information such as a CPU, a memory, and a hard disk of a server or a virtual machine; the price parameter set represents the unit price of the basic configuration information of the server or the virtual machine.
It should also be noted that there is also a potential for over-scoring when deploying virtual machines on servers. The hyper-partition refers to a Kernel-based Virtual Machine (KVM), which is an open-source system virtualization module, and may also be referred to as a KVM Virtual Machine, where the number/capacity of Virtual CPUs, virtual memories, or Virtual hard disks that can be allocated to the Virtual Machine is greater than the number/capacity of actual CPUs, memories, or hard disks of the server.
Here, the CPU super-resolution, the memory super-resolution, and the hard disk super-resolution of each server may be defined. In this way, the number of virtual CPUs that the server can actually provide to the virtual machine is the product of the number of server CPUs and the hyper-resolution ratio; the virtual memory capacity which can be actually provided for the virtual machine by the server is the product of the server memory capacity and the memory overcapacity; the virtual hard disk capacity that the server can actually provide to the virtual machine is the product of the server hard disk capacity and the hard disk overcapacity.
Therefore, for a virtual machine created on a certain server, the unit virtual CPU price is a quotient obtained by dividing the server unit CPU price by the CPU over-fraction; the unit virtual memory price is a quotient obtained by dividing the unit memory price of the server by the memory overcapacity; the unit virtual hard disk price is a quotient obtained by dividing the unit hard disk price of the server by the hard disk overcentre.
Thus, the server definition information and the virtual machine definition information are acquired through the above steps so as to perform subsequent calculation.
S302, determining constraint conditions according to the server definition information and the virtual machine definition information.
It should be noted that, according to the obtained server definition information and virtual machine definition information, constraint conditions of the preset planning model can be determined.
In some specific embodiments, the constraint may be: the sum of the virtual CPU number of all the virtual machines on each server is less than or equal to the product of the CPU number of the server and the CPU over-partition rate; the sum of the virtual memory capacity of all the virtual machines on each server is less than or equal to the product of the memory capacity of the server and the memory overcapacity; the sum of the virtual hard disk capacities of all the virtual machines on each server is less than or equal to the product of the hard disk capacity of the server and the hard disk overcenter; and the sum of consumption of all the virtual machines in the server cluster is greater than or equal to the product of the sum of the values of all the servers in the server cluster and a preset ratio.
Specifically, the value of each server is defined as: (number of server CPUs × unit CPU price) + (server memory capacity × unit memory price) + (server hard disk capacity × unit hard disk price).
Defining the value of each virtual machine as: (number of virtual CPUs × price of virtual CPUs) + (virtual memory capacity × price of virtual memory) + (virtual hard disk capacity × price of virtual hard disk).
Thus, the sum of the consumption of all virtual machines in the server cluster can be calculated by:
first, the consumption of a certain kind of virtual machine on a single server is defined as: the product of the number of virtual machines of the class on a single server and the value of the class of virtual machines; then, the consumption of all virtual machines on a single server is defined as: the consumption of each kind of virtual machine on a single server is subjected to addition calculation to obtain a sum value; finally, the total consumption of all virtual machines on all servers in the server cluster is defined as: the sum is calculated by adding the consumption of all virtual machines on all servers.
The sum of the values of all servers in the server cluster can be calculated as follows:
and determining the sum value obtained by adding the value of each server in the server cluster as the sum of the values of all the servers in the server cluster.
It should be noted that when the preset planning model is used to plan resources of the server cluster, a new virtual machine may be planned on a completely idle server; planning a new virtual machine on the residual resources of the server for the created virtual machine on the server; it may also be the case that the virtual machine already created on the server is re-planned, etc. That is to say, the virtual machine for performing parameter calculation may include one or more of virtual machines that have been created on the server, virtual machines that have requested to be created, virtual machines that plan only according to the resource state of the server, and virtual machines that have been created actually, have requested to be created, or have not yet requested to be created, and specific calculation needs to be performed in combination with actual resource planning requirements.
Therefore, when planning resources of the server cluster, the constraint condition should also include that at least one kind of virtual machine needs to be created. If a created virtual machine already exists in the server cluster before a new virtual machine is requested to be created, the number of the types of the virtual machines needing to be created is one more than the number of the created types of the virtual machines. That is, when a new virtual machine is requested to be created for resource planning, not only the creation request of the current virtual machine needs to be satisfied, but also the resource situation that the virtual machine created on the server already occupies is considered.
It should be noted that the constraint that the sum of the performance parameters of all the virtual machines on each server is less than or equal to the product of the performance parameter and the hyper-resolution ratio of the server is to ensure that the actually available resources of the server can meet the request for creating the virtual machine on the server, and simultaneously, the server resources are maximally utilized.
For example, in the case of considering the super-score, one server can provide 48 virtual CPUs at most (assuming that both the memory capacity and the hard disk capacity can meet the requirements), at this time, 6 virtual machines of the shader F type need to be created, and one virtual machine of the shader F type needs 10 virtual CPUs, so that if all the 6 virtual machines of the shader F type are created on the server, the number of the required virtual CPUs is 6 × 10=60, while the server can only provide 48 virtual CPUs, and the number of the virtual CPUs is smaller than the number of the CPUs required by the virtual machine, which obviously cannot meet the requirements for creating the virtual machine, and the same applies to the memory, the hard disk, and the like.
For another example, a server can provide 48 virtual machine CPUs and 384G virtual machine memories at most (assuming that the hard disk capacity can always meet the requirement), at this time, 6 virtual machines of a browser K type need to be created, one virtual machine of a browser K type needs 8 virtual CPUs and 96G virtual memories, so that if the 6 virtual machines of the browser K type are all created on the server, the number of the needed virtual CPUs is 6 × 8=48, and the required virtual memory capacity is 8 × 96=768g, although the CPUs can just meet the requirement, the memories obviously cannot meet the requirement.
It should be further noted that, in the embodiment of the present application, the preset ratio represents a threshold value of a ratio of virtual machines consuming physical server values in various possible planning manners when the preset planning model is used to plan resources of the server cluster, that is, a value of how much ratio of the virtual machines at least consume the server cluster. Illustratively, the preset ratio may be set to 80%,70%,60%,90%, etc. The actual experience or the current resource state of the server cluster may be combined to perform specific setting, and the value of the preset ratio is not specifically limited in the embodiment of the present application.
In this way, constraint conditions are determined according to the server definition information and the virtual machine definition information so as to construct the preset planning model.
And S303, constructing a preset planning model under the constraint condition.
It should be noted that, under the constraint condition, when resource planning is performed on a server cluster in combination with the current actual demand, there may be a plurality of different planning manners, and the purpose of the embodiment of the present application is to simulate various possible resource planning manners created by virtual machines on each server, and find out a resource planning manner in which the virtual machine consumes the highest amount under the constraint condition.
Therefore, based on the steps, a preset planning model can be constructed, and then a resource planning mode with the largest consumption value is selected from various resource planning modes to carry out virtual machine resource scheduling.
In a specific example, refer to fig. 4, which illustrates a detailed flowchart of a resource scheduling method provided in an embodiment of the present application. As shown in fig. 4, the detailed flow may include:
s401, acquiring a virtual machine creating request.
S402, performing resource planning on the server cluster by using a preset planning model according to the virtual machine creation request.
It should be noted that there may be a plurality of different resource planning ways when creating a virtual machine on a server. For example, assuming that there are 4 servers in the server cluster, after acquiring several virtual machine creation requests, in the case that the server resources are sufficient, it is possible to create virtual machines on only two servers, it is also possible to create virtual machines on each server, or create virtual machines on three servers; and the types of virtual machines created on the servers are not necessarily the same. Therefore, the resource utilization rate of the server cluster is different under different resource planning modes.
According to the embodiment of the application, various possible resource planning modes of the virtual machine established on the server are simulated through the preset planning model, and the optimal planning mode is selected as the planning strategy of the embodiment of the application. It can be understood that the resource utilization of the server cluster is different in different planning manners.
S403, judging whether a planning strategy that the resource utilization rate of the server cluster reaches a target value exists;
s404, if the judgment result is yes, determining a planning strategy when the resource utilization rate of the server cluster reaches a target value.
It should be noted that the purpose of the embodiments of the present application is: when the virtual machine is created in the server cluster, the resources of each server can be utilized to the maximum extent, and the waste of the resources is minimized. That is, when resource planning of a server cluster is performed, resources of a single server are utilized to the utmost extent as much as possible. For a single server, the resource being utilized to the utmost point means: when the server has reached the "barrel effect," a resource of the server has been fully utilized.
It can be understood that if the most appropriate kind of virtual machine is deployed on the server, when one resource is used up, the other two resources can be close to the used-up state, and waste is reduced. In this way, for a single server, its resources can be fully utilized.
Specifically, in some embodiments, for step S404, determining the planning strategy when the resource utilization of the server cluster reaches the target value may include:
when the resource utilization rate of the server cluster reaches a target value, determining a target server selected from the server cluster and virtual machine information deployed by the target server;
and determining the target server and the information of the virtual machine deployed by the target server as a planning strategy.
That is to say, according to the virtual machine creation request, the resource planning is performed on the server cluster by using the preset planning model, at this time, there may be multiple resource planning manners, but the resource utilization rate of each planning manner is necessarily high or low. In this embodiment of the present application, when the resource utilization rate of the server reaches a target value, that is, the resource utilization rate of the server is the maximum, for example, for a virtual machine creation request, according to a preset planning model, there are three resource planning manners: the resource utilization rates of the server cluster are respectively 80.2%, 85.3% and 90.5% by the first planning mode, the second planning mode and the third planning mode, and the third planning mode is the planning mode with the maximum resource utilization rate. At this time, the third planning method may be determined as the planning policy of the embodiment of the present application, and the target server and the information of the virtual machine deployed on the target server are determined from the server cluster.
And S405, according to the planning strategy, carrying out virtual machine resource scheduling in the server cluster.
It should be noted that, after the planning strategy is determined, the virtual machine resource scheduling may be performed in the server cluster according to the determined planning strategy.
It should be further noted that the preset planning model provided in the embodiment of the present application may simulate various possible distribution conditions of the virtual machine in the server cluster, and accurately calculate the capacity of the virtual machine that can be provided by the existing resources of the server cluster. In some embodiments, when the resource planning is performed on the server cluster by using the preset planning model according to the virtual machine creation request, not only the distribution situation of the virtual machine that is requested to be created on the server is planned, but also the virtual machine capacity of each type of virtual machine that can be provided by the existing resource of the server in the current resource state can be accurately calculated.
Exemplarily, it is assumed that there are 4 servers H1, H2, H3, and H4 in the server cluster, and 2 browser 1 virtual machines have been created on H1. Then 2 virtual machines of the browser 1 and 2 virtual machines of the browser 2 are received to establish requests, after planning, the 2 virtual machines of the browser 1 are established on H2, one virtual machine of the browser 2 is respectively established on the H1 and the H2, and meanwhile, the optimal planning is carried out on the idle resources. That is, at this time, 2 virtual machines of the viewer 1 and one virtual machine of the viewer 2 have been created on H1 and H2, respectively, and H3 and H4 are optimally planned, and H3 and H4 can provide capacities of the 2 virtual machines of the viewer 1 and the virtual machines of the viewer 2, respectively. Then, if a virtual machine creation request is received next time, if less than 4 of the scalers 1 and/or less than 2 of the scalers 2 are/is received, resource scheduling can be directly performed on the server cluster, and the virtual machine is created.
In addition, the created virtual machines can be redistributed at intervals to keep the resource utilization state of the server optimal. Thus, in some embodiments, the method may further comprise:
starting a timer and timing;
when the timing of the timer reaches a preset duration, re-planning resources of the created virtual machines in the server cluster by using a preset planning model, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and according to the planning strategy, carrying out virtual machine resource scheduling in the server cluster.
It should be noted that, in the process of creating a virtual machine, each virtual machine creation request is unknown to the cloud service provider before receiving a virtual machine creation requirement of a customer. Therefore, in this case, the planning policy is the optimal planning method for the current resource planning, and can maximize the current resource utilization rate of the server cluster, but after a new virtual machine creation request is received, the current planning policy is not necessarily the optimal for the next virtual machine creation request.
In addition, in practical applications, when resource planning is performed according to a virtual machine creation request, the maximum utilization of server cluster resources may not be achieved temporarily, and a planner may temporarily create a virtual machine with a small resource requirement on an appropriate server in combination with the virtual machine.
Based on the above description of fig. 1, the blocks already existing in the figure are regarded as the created virtual machines, and it can be seen that the positions of some blocks at the bottom are not reasonable, and then unreasonable blocks (virtual machines) can be migrated out by the migration means, and more suitable blocks (virtual machines) can be migrated in.
For example, as shown in fig. 1, a virtual machine a is formed by a box AAA, and a virtual machine B is formed by a box BBBB, and it can be seen that two pieces of resource waste exist beside the virtual machine a, at this time, the virtual machine a can be migrated to other positions, and the virtual machine B is migrated to the original position of the virtual machine a, so that a box which is originally vacant on the right side of the virtual machine a is also utilized by the virtual machine B, thereby improving the utilization rate of resources.
It should be further noted that the preset duration is a time interval for re-planning resources of the virtual machines created on the server cluster, and in practice, the preset duration may be customized through experience or calculation and other manners; in addition, the resource planning may be performed again at a fixed time point, or the virtual machine may be manually started by a planner at any time, which is not specifically limited in this embodiment of the application.
When the preset planning model is used for resource planning on the virtual machines established on the server cluster, because no new virtual machine establishing request exists at the moment, calculation is carried out only through the preset planning model according to various parameters of each server and each established virtual machine, and a planning strategy with the highest consumption sum of the virtual machines is determined.
That is, the only difference from the foregoing steps is that all virtual machines have been successfully created on the server cluster, and only need to be calculated and resource planned again according to the preset planning model. After the planning strategy is obtained, virtual machine resource scheduling is carried out again according to the planning strategy, and migration processing is carried out on the virtual machine which needs to be migrated.
It should be further noted that, in the embodiment of the present application, migrating a virtual machine may be implemented by an OpenStack API; creating a new virtual machine can be realized by nova scheduler; when the resource planning is performed on the server cluster by using the preset planning model, the resource planning may be implemented by using a dynamic planning tool (e.g., matlab, cplex, etc.).
S406, if the judgment result is negative, judging whether the count value is less than or equal to a preset threshold value.
And S407, when the count value is less than or equal to the preset threshold value, performing resource migration processing on the created virtual machines in the server cluster, executing an operation on the count value, and returning to execute the step of performing resource planning on the server cluster by using the preset planning model according to the virtual machine creation request.
It should be noted that, for step S403, if there is a planning policy that the resource utilization of the server cluster reaches the target value, that is, if the determination result is yes, step S404 may be executed; if there is no planning strategy for the resource utilization of the server cluster reaching the target value, that is, if the determination result is no, step S406 may be executed.
It should be further noted that, when it is determined that there is no planning policy that makes the resource utilization rate of the server cluster reach the target value, at this time, for the current virtual machine creation request, it means that a planning policy that satisfies the virtual machine creation request cannot be obtained according to the preset planning model, which indicates that the existing resource allocation in the server cluster is unreasonable at this time, that is, the distribution of the created virtual machine may be unreasonable, and then resource migration processing needs to be performed on the created virtual machine in the server cluster, so as to perform resource planning again. In practical application, however, unlimited resource migration processing cannot be performed to re-plan resources; therefore, the embodiment of the present application needs to count the number of times of executing the resource migration processing, and a count value may be set at this time.
For this count value, in some embodiments, the initial value of the count value is set to zero.
That is, the initial value of the count value is zero before the loop count. Only when the resource migration process is performed again, the count value performs the operation of adding 1, and then returns to perform step S402 until the count value is greater than the preset threshold.
It should be noted that, when resource planning is performed on a server cluster according to a virtual machine creation request, a planning policy may not be obtained no matter how resource migration is performed because server resources do not satisfy the request for creating a virtual machine. Therefore, in the embodiment of the present application, the number of times of performing resource migration processing on the virtual machine needs to be limited, for example, a preset threshold is set. The upper limit value of the number of times of resource migration performed on the virtual machine is set as a preset threshold, for example, the preset threshold may be 6 times, 8 times, 10 times, or more times, that is, the preset threshold may be a custom value set by a planner according to actual experience, or an adaptive value set according to server clusters of different scales or different resource states, which is not specifically limited in this embodiment of the application.
Thus, by comparing the count value with the preset threshold value, for step S406, when the count value is less than or equal to the preset threshold value, that is, the judgment result is yes, step S407 may be performed; when the count value is greater than the preset threshold, that is, the judgment result is no, step S408 may be performed.
Specifically, if the count value is less than or equal to the preset threshold, the resource migration process needs to be performed on the virtual machines created in the server cluster, and an add operation is performed on the count value. That is, the count value represents the number of times of resource migration processing on the virtual machine that has been created in the server cluster; alternatively, the count value represents the number of times of the planning strategy when the resource utilization rate of the server cluster is determined to reach the target value according to the preset planning model.
That is, after the virtual machine creation request is obtained, when the resource planning is performed on the server cluster, it may be that the created virtual machines are distributed unreasonably, and the planning policy cannot be determined, and at this time, some unreasonable virtual machines may be migrated by performing resource migration processing on the created virtual machines in the server cluster, and then the resource planning is performed on the server cluster again. Taking fig. 1 as an example, it may be that the bottom square (virtual machine) is not distributed reasonably, so that a server has spare resources but cannot be provided for a complete virtual machine. Therefore, the embodiment of the application can perform resource migration processing on the virtual machine created on the server, for example, migrating the virtual machine which is not reasonably distributed to other servers.
Exemplarily, it is assumed that two servers exist in a server cluster, where server 1 and server 2 may provide 24 CPUs (assuming that there is no super-resolution and both a hard disk and a memory can meet the requirements of virtual machines), 3 virtual machines of a browser G type have been deployed on server 1 and server 2, and assuming that one virtual machine of a browser G type needs 6 CPUs, CPU on server 1 and server 2 have already used 18 CPUs, and they have 6 CPUs for use respectively. At this time, when a virtual machine creation request is received, a virtual machine of a browser H type needs to be created, and one virtual machine of a browser H type needs 8 CPUs. It can be seen that, neither the server 1 nor the server 2 can satisfy the virtual machine creation request alone at this time, but if a virtual machine of a browser G type on the server 1 is migrated to the server 2, then the server 1 has 12 available CPUs at this time, and the server 2 has 2 available CPUs, then the server 1 can satisfy the creation request of a virtual machine of a browser H type at this time.
That is to say, when there is no planning policy in which the resource utilization rate of the server cluster reaches the target value, the resource of the server is not necessarily insufficient, but may not be reasonably utilized due to the fragmentation of the resource, and at this time, the resource is zeroed by performing the resource migration processing on the created virtual machine, so that the resource planning is performed again, and there is a possibility that the planning policy may be obtained.
In this embodiment of the present application, when the preset parameter value is less than or equal to the preset threshold value, the resource migration processing is performed on the created virtual machine in the server cluster, and then the step of performing resource planning on the server cluster by using the preset planning model according to the virtual machine creation request is returned, that is, the step S302 is returned to be performed.
And S408, generating alarm information when the count value is larger than a preset threshold value.
The alarm information is used for indicating that the hardware information of the server cluster is not matched with the virtual machine resource, so that the resource utilization rate of the server cluster cannot reach a target value.
It should be noted that, if the count value is greater than the preset threshold, it indicates that the number of times of performing resource migration processing on the created virtual machine has reached the preset threshold, but a planning policy for making the resource utilization rate of the server cluster reach the target value still cannot be obtained. For example, because the resources of the server are insufficient and the resources required by the virtual machine creation request are more, no matter how the created virtual machine is subjected to resource migration, a planning strategy for making the resource utilization rate of the server cluster reach a target value cannot be obtained. That is, the hardware information of the server cluster is not matched with the virtual machine resource, so that the resource utilization rate of the server cluster cannot reach a target value, and at the moment, alarm information is generated.
It should be noted that the alarm information is used to inform the planner that the maximum utilization of the server resources cannot be achieved, and manual intervention is required, for example, to perform processing such as expanding a server cluster, purchasing a new server, or migrating a temporarily unused virtual machine.
The embodiment provides a resource scheduling method, the specific implementation of the foregoing embodiment is elaborated through the foregoing embodiment, and it can be seen that, by calculating performance parameters and price parameters of a server and a virtual machine, constraint conditions are determined and a preset planning model is constructed; therefore, the preset planning model is used for scheduling the resources of the virtual machine, so that the capacity of the virtual machine which can be provided by the server can be accurately calculated according to the preset planning model, and the established virtual machine in the server cluster can be regularly/irregularly re-planned, so that under the condition that the types and data of the provided virtual machines are the same, physical server fragments are compressed through reasonable scheduling, the resources are utilized to the maximum extent, and the total cost of hardware is reduced.
In another embodiment of the present application, refer to fig. 5, which shows a detailed flowchart of another resource scheduling method provided in this application embodiment. As shown in fig. 5, the detailed flow may include:
s501, constructing a preset planning model.
It should be noted that, in the embodiment of the present application, the preset planning model may also be referred to as a value model. The following will describe in detail a construction process of the preset planning model (i.e., the value model):
(a) And defining the number of physical servers and the number of types of the browser in the resource pool.
The number of the physical servers in the resource pool is determined as N, and the number of the types of the browser is determined as M.
(b) The elements of each physical server are defined.
Where Pc represents the price per core (price per core) of the unit CPU of the physical server; pd represents the price (price per GB/MB) of the unit hard disk of the physical server; pm represents the price per unit memory (price per GB/MB) of the physical server; c represents the number of CPUs of the physical server; d represents the hard disk capacity (GB/MB) of the physical server; r represents the memory capacity (GB/MB) of the physical server;
thus, the value Ph of each physical server is calculated as follows:
Ph=Pc×C+Pd×d+Pm×R (1)
(c) Information defining a navigator.
Wherein, fi represents the ith flavour; fic represents the number of CPUs on Fi; fim represents the size of the memory on Fi; fid denotes the hard disk size on Fi.
(d) Information defining the super-score.
Here, the hyper-division means that the total number of CPUs, memories, and hard disks that can be allocated to the virtual machine is greater than the total number of actual CPUs, memories, and disks of the physical server, and the physical server may set the hyper-division ratio of the CPUs, memories, and hard disks. Namely:
the total number of CPUs (central processing units) used by the virtual machines can be actually distributed, namely the total number of physical CPUs (central processing units) multiplied by CPU _ ratio, wherein the CPU _ ratio refers to the CPU super-fraction of the physical servers;
the total memory used by the virtual machines can be actually allocated = the total physical memory × memory _ ratio, wherein the memory _ ratio refers to the memory overcapacity of the physical server;
the total number of hard disks used by the virtual machine = the total number of physical hard disks × disk _ ratio, where disk ratio refers to the hard disk super-fraction of the physical server.
Thus, the price of the actual unit CPU in the shader is
Figure BDA0003074325830000131
The actual unit memory price in the navigator is
Figure BDA0003074325830000132
The price of the actual unit hard disk in the navigator is
Figure BDA0003074325830000133
Thus, the information determined by (a), (b), (c), and (d) is the server definition information and the virtual machine definition information in the foregoing embodiment.
(e) The price of the flavour is defined.
Here, the calculation method of the price P (Fi) of the ith flavour is as follows:
Figure BDA0003074325830000134
wherein the price P (Fi) of each reflector is a constant.
(f) The types and number of flavors on a single physical server are defined.
Wherein Hn represents the nth physical server; xin represents the number of Fi on the nth physical server.
Here, the total number of M types of directors on the nth physical server is:
Figure BDA0003074325830000135
it should be noted that each physical server does not necessarily include M types of directors, and may include only a part of the M types of directors.
(g) Consumption of a flavour on a single physical server is defined.
Wherein, the total consumption of the ith type of slave on the nth physical server is Xin × P (Fi), and then the calculation method of the total consumption cost _ per _ host of the M types of slaves on the nth physical server is as follows:
Figure BDA0003074325830000136
(h) The consumption of all the shaders on all the physical servers (N stations) is defined.
The calculation method of the consumption cost _ total _ host of all the browsers on the N physical servers is as follows:
Figure BDA0003074325830000137
thus, the sum of the consumption of all the scalers planned on all the physical servers in a certain resource planning mode can be calculated according to the formula (4).
(i) A constraint is determined.
Firstly, presetting constants of P (Fi), C, D, R, M, N, fic, fid, fim, ph, pc, pd and Pm in a planning model;
secondly, xin represents the number of Fi on the nth physical server, and needs to satisfy:
the total number of the CPUs of the M types of shaders on the nth physical server is less than or equal to the total number of the CPUs used by the actual distributable virtual machines;
the total memory of the M types of shaders on the nth physical server is less than or equal to the total memory used by the actual allocable virtual machine;
the total number of the hard disks of the M types of the flavors on the nth physical server is less than or equal to the total number of the hard disks used by the actual allocable virtual machine. Namely, the following needs are satisfied:
Figure BDA0003074325830000141
Figure BDA0003074325830000142
Figure BDA0003074325830000143
and, the sum of the consumption on all servers needs to satisfy:
Figure BDA0003074325830000144
here, the expression (8) indicates that, under the preset planning model, the ratio of the value of the virtual consumption physical server to the value of the server itself is α, and the α value may be any value that meets the requirement, such as 80%,70%,60%,90%, and the like, which is not specifically limited in this embodiment of the present application.
It is to be understood that, when the specification of each physical server is the same, the above equation (8) can also be expressed as follows:
Figure BDA0003074325830000145
(j) Objective function (find the actual consumption maximum, i.e. least waste).
Under the constraints, the objective function is as follows:
Figure BDA0003074325830000146
here, equation (10) is the preset planning model constructed in the embodiment of the present application. Based on this model, it is possible to "simulate the various possible schedules that a virtual machine creates on each physical server, finding the optimal solution for the least waste (the cost of consuming a physical server exceeds a).
S502, receiving a virtual machine creation request.
S503, calculating the optimal solution set with the maximum utilization resources according to the hardware and the navigator.
S504, under the condition that the optimal solution set exists in the preset planning model, the virtual machine is established according to the optimal solution set.
That is to say, after the optimal solution set of the preset planning model is obtained, the virtual machine is directly scheduled according to the optimal solution set, so that deployment on the physical server is realized according to an optimal mode. Here, the optimal solution set is: and under the constraint condition, calculating according to a preset planning model to obtain a planning strategy which enables the consumption sum of the virtual machines planned on the physical server to be maximum.
And S505, under the condition that the optimal solution set does not exist in the preset planning model, judging whether N is smaller than or equal to N.
S506, resource scheduling is carried out on the created virtual machine again.
And S507, adding 1 to n.
And S508, generating alarm information when the current hardware is not matched with the navigator.
N represents a count value in the foregoing embodiment, and an initial value thereof is 0; n represents a preset threshold in the foregoing embodiment, and N are both positive integers greater than zero. In addition, each time the resource scheduling is performed again, n needs to be added by 1, and then the process returns to step S503, so as to recalculate whether the preset planning model has the optimal solution.
It should be noted that, for step S505, if N is less than or equal to N, that is, the determination result is yes, then steps S506 and S507 may be executed, and step S503 is executed again; if N is greater than N, i.e., the determination is no, step S508 may be performed.
In addition, when the preset planning model does not have the optimal solution, for step S506, it describes that N is less than or equal to N, which means that the resource allocation of the current server is unreasonable, and at this time, resource scheduling needs to be performed again on the current virtual machine (for example, resource migration is performed on an unreasonable virtual machine) on the server.
For step S508, it describes that N is greater than N, which means that after N times of resource scheduling is performed on the created virtual machine again, the preset planning model still cannot obtain an optimal solution set, which indicates that the current hardware is not matched with the navigator and cannot maximally utilize resources, at this time, an alarm needs to be sent, and then the planner may expand the capacity of the server or migrate the temporarily unused virtual machine in combination with the actual demand.
It should be noted that the preset planning model is actually a multi-stage decision process, and each scheduling of the virtual machine depends on the current state and causes a state transition. This is a typical dynamic planning problem. It is desirable to derive an optimal solution for the final decision, which may be embodied as a general algorithm (which may be referred to herein as a "dynamic programming algorithm").
The constants are: p (Fi), C, D, R, M, N, fic, fid, fim, ph.
(ii) the variables are: xin.
(iii) the constraint (boundary condition) is as follows:
Figure BDA0003074325830000151
Figure BDA0003074325830000152
Figure BDA0003074325830000153
Figure BDA0003074325830000154
Figure BDA0003074325830000155
wherein, in formula (15), at least one of the fiavors used is present.
Further, if there are several virtual machines already created in the server before this virtual machine creation request, e.g. there are already x Fi, then the boundary condition is
Figure BDA0003074325830000161
As shown in equation (16), when performing resource planning, not only the virtual machine creation request but also the resource situation occupied by the created virtual machine need to be considered.
Figure BDA0003074325830000162
(iv) solving the objective function as shown in the formula (17).
Figure BDA0003074325830000163
That is, on the premise that the boundary condition is satisfied, the deployment number Xin of each navigator on each server is obtained, so that an optimal solution, that is, a resource scheduling mode with least waste, that is, a planning strategy finally adopted is obtained.
And (v) realizing. The algorithm of the preset planning model can be directly substituted into some conventional dynamic planning tools such as matlab, cplex and the like for calculation, and the calculated result is an expected scheduling scheme, namely a final planning strategy.
Exemplarily, the following takes an OpenStack cloud environment as an example: there are several physical servers (e.g. 4) in the environment, and each physical server has the following specifications: 48 CPUs (total price 4800, unit price 100/core), 384G memory (total price 1920, unit price 5/G) and 2T hard disk (total price 1000, unit price 0.5/G), and the value of each server is 7720.
There are 2 specifications of the flavors (assuming no superscoring), flavor a:8vCPU,128G memory, 400G hard disk; a flavour B: 1697V CPU,32G memory and 200G hard disk. Wherein vCPU is a virtual machine CPU.
And calculating by combining the preset planning model to obtain: the value of flavor A is (8 × 100+128 × 5+400 × 0.5) =1640; the value of flavor B is (16 × 100+32 × 5+200 × 0.5) =1860.
Suppose a user needs 6 shaders A and 6 shaders B; the total value required by the user is then: (1640 + 1860). Times.6 =21000.
In the case that the preset planning model provided in the embodiment of the present application is not used for calculation, possible scheduling manners are shown in table 1.
TABLE 1
Figure BDA0003074325830000164
Figure BDA0003074325830000171
As can be seen from table 1, when the preset planning model provided in the embodiment of the present application is not used for performing the calculation, resource scheduling may be performed on 4 physical servers to create a virtual machine required by a user. In this resource scheduling mode: the memory resources of the server #1 and the server #2 are exhausted, but more surplus exists in the CPU resources and the hard disk resources; the CPU resources of server #3 and server #4 are exhausted, but there is still more surplus in memory resources and hard disk resources. That is, on the premise of meeting the user demand, the physical servers need to be used in full 4, and the final efficiency of the actually used physical servers is 21000/(7720 × 4) =68%.
When the preset planning model provided in the embodiment of the present application is used for calculation, a scheduling manner for scheduling resources with an optimal solution is shown in table 2 (the result is provided by cplex).
TABLE 2
Figure BDA0003074325830000172
As can be seen from table 2, when the preset model provided in the embodiment of the present application is used for calculation, the user requirements can be met only by performing resource scheduling on 3 physical servers to create a virtual machine. In this scheduling mode: 2 slave A and 2 slave B are deployed on 3 physical servers. That is, the user requirements can be satisfied by using all 3 physical servers, and for the physical servers actually used, the final efficiency is as follows: 21000/(7720 × 3) =90.7%. The efficiency is greatly improved compared with 68% efficiency using 4 physical servers. In other words, to meet the same user requirements, resource planning using the preset model provided in the embodiment of the present application can directly save resources of one physical server, and greatly improve the utilization efficiency of the physical server, thereby improving the resource utilization rate of the server cluster.
To sum up, the resource scheduling method provided in the embodiment of the present application may be a dynamic resource scheduling policy based on OpenStack, and aims to improve the utilization rate of hardware resources, and essentially achieve the purpose of reducing cost. Specifically, the embodiments of the present application aim to: the resource utilization rate is improved, namely, under the condition of providing the same number of virtual machines of the same type, physical server fragments are compressed through reasonable scheduling, and the total hardware cost is reduced; the calculation accuracy of the hardware-virtual machine conversion ratio is improved, namely the capacity of the virtual machine which can be provided can be calculated quite accurately according to the current residual hardware quantity, and with the calculation result, whether the request of the user can be met can be judged in advance, and whether the server needs to be purchased in advance is determined.
That is to say, for the current unbalanced resource usage and the inability to accurately calculate the capacity of a virtual machine that can be provided by existing resources, the embodiment of the present application can improve the resource utilization rate of OpenStack. In short, the core of the method for improving the resource utilization rate in the embodiment of the present application is: on one hand, a preset planning model (a core scheduling algorithm) is constructed, and through the preset planning model, all resources of each physical server in the resource pool can be reasonably utilized, so that the value waste caused by fragments is greatly reduced. As a popular example, sesame, apples and watermelons are respectively placed in a plurality of baskets, and if the watermelons, the apples and the sesame are placed in a doped mode, each basket can be filled as far as possible; if a basket is filled with sesame apples, it is difficult for the watermelon to completely fill the remaining basket. On the other hand, according to the virtual machine dynamic scheduling strategy, the most appropriate physical server in the resource pool is selected to create the virtual machine according to the preset planning model, and the utilization rate of resources is improved. In addition, the system can also alarm to inform the planning personnel that the resources cannot be utilized to the maximum extent because the hardware is not matched with the navigator.
Compared with the related art, the resource scheduling method provided by the embodiment of the application has at least the following advantages: (1) The resource utilization rate of the physical server is effectively improved and can even reach more than 90% in a large-scale cloud environment. An increase in resource usage (usage when a single physical server has reached the barrel effect) means saving money, and if usage is increased from 50% to 90%, the cloud facilitator can save as much as half of the overhead. (2) Based on the current resource pool, the type and number of virtual machines that can be supported are predicted. Based on the resource scheduling of the algorithm, the cloud service provider can accurately calculate the types and the number of the virtual machines which can be currently supported, instead of requiring to classify a batch of equipment every time a batch of virtual machine requests are received, and cannot determine whether the equipment can sufficiently meet the requirements. (3) The method has no requirements on the cloud environment, has extremely wide applicability, does not depend on hardware and does not limit the type of the virtual machine.
The embodiment of the application provides a resource scheduling method, and the specific implementation of the embodiment is elaborated through the embodiment, so that the method can be seen that through constructing a preset planning model and then planning the server resources in a resource pool according to the preset planning model, the most appropriate physical server in the resource pool can be selected to create a virtual machine, and the resource utilization rate is improved; based on the preset planning model, the types and the number of the virtual machines which can be supported by the server can be accurately predicted; in addition, when the resources cannot be utilized to the maximum extent, the warning can be given to the planning staff, and the current hardware is not matched with the navigator, so that the planning staff can timely make reasonable measures.
In yet another embodiment of the present application, referring to fig. 6, a schematic structural diagram of a resource scheduling apparatus 60 provided in the embodiment of the present application is shown. As shown in fig. 6, the resource scheduling apparatus 60 may include an obtaining unit 601, a determining unit 602, and a scheduling unit 603, wherein,
the obtaining unit 601 is configured to obtain a virtual machine creation request;
the determining unit 602 is configured to perform resource planning on a server cluster by using a preset planning model according to the virtual machine creation request, and determine a planning strategy when a resource utilization rate of the server cluster reaches a target value;
the scheduling unit 603 is configured to perform virtual machine resource scheduling in the server cluster according to the planning policy.
In some embodiments, the determining unit 602 is further configured to determine a target server selected from the server cluster and virtual machine information deployed by the target server when the resource utilization of the server cluster reaches a target value; and determining the target server and the virtual machine information deployed by the target server as the planning strategy.
In some embodiments, the determining unit 602 is further configured to determine whether a count value is smaller than a preset threshold value if it is determined that there is no planning policy when the resource utilization rate of the server cluster reaches the target value; and when the count value is smaller than or equal to a preset threshold value, performing resource migration processing on the created virtual machines in the server cluster, executing an adding operation on the count value, and returning to execute the step of performing resource planning on the server cluster by using a preset planning model according to the virtual machine creation request.
In some embodiments, as shown in fig. 6, the resource scheduling apparatus 60 further includes an alarm unit 604, which generates alarm information when the count value is greater than a preset threshold; the alarm information is used for indicating that the hardware information of the server cluster is not matched with the virtual machine resources, so that the resource utilization rate of the server cluster cannot reach a target value.
In some embodiments, the determining unit 602 is further configured to set an initial value of the count value to zero.
In some embodiments, the determining unit 602 is further configured to start a timer and count the time; when the timing of the timer reaches a preset duration, the established virtual machines in the server cluster are subjected to resource planning again by using the preset planning model, and a planning strategy when the resource utilization rate of the server cluster reaches a target value is determined; and scheduling the resources of the virtual machine in the server cluster according to a planning strategy.
In some embodiments, the obtaining unit 601 is further configured to obtain server definition information and virtual machine definition information;
the determining unit 602 is further configured to determine a constraint condition according to the server definition information and the virtual machine definition information; and under the constraint condition, constructing the preset planning model; the server definition information at least comprises the number of servers in the server cluster, a performance parameter value set of each server and a price parameter set of each server, and the virtual machine definition information at least comprises the number of virtual machine types, the performance parameter value set of each virtual machine type and the price parameter set of each virtual machine type.
In some embodiments, the set of performance parameters includes: the number of Central Processing Units (CPU), the memory capacity and the hard disk capacity; the set of price parameters includes: unit CPU price, unit memory price and unit hard disk price.
It is understood that in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may also be a module, or may also be non-modular. Moreover, each component in the embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a hardware mode, and can also be realized in a software functional module mode.
Based on the understanding that the technical solution of the present embodiment essentially or partly contributes to the prior art, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the method of the present embodiment. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Accordingly, the present embodiment provides a computer storage medium storing a computer program which, when executed by at least one processor, performs the steps of the method of any of the preceding embodiments.
Based on the above-mentioned composition of a resource scheduling apparatus 60 and computer storage medium, refer to fig. 7, which shows a specific hardware structure diagram of an electronic device 70 provided in an embodiment of the present application. As shown in fig. 7, electronic device 70 may include a communication interface 701, a memory 702, and a processor 703; the various components are coupled together by a bus system 704. It is understood that the bus system 704 is used to enable connected communication between these components. The bus system 704 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled in fig. 7 as the bus system 704. Wherein the content of the first and second substances,
a communication interface 701, configured to receive and transmit signals during information transmission and reception with other external network elements;
a memory 702 for storing a computer program capable of running on the processor 703;
a processor 703 for executing, when running the computer program, the following:
acquiring a virtual machine creation request;
according to the virtual machine establishing request, utilizing a preset planning model to plan resources of a server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and scheduling the resources of the virtual machine in the server cluster according to the planning strategy.
It will be appreciated that the memory 702 in the subject embodiment can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), enhanced Synchronous SDRAM (ESDRAM), synchronous Link Dynamic Random Access Memory (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 702 of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
The processor 703 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the method may be implemented by hardware integrated logic circuits in the processor 703 or by instructions in the form of software. The Processor 703 may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 702, and the processor 703 reads the information in the memory 702 and performs the steps of the above method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
Optionally, as another embodiment, the processor 703 is further configured to, when running the computer program, perform the steps of the method of any of the preceding embodiments.
Here, for the electronic device 70, when the virtual machine is created, the resource planning is performed on the server cluster according to the preset planning model, so as to determine a planning strategy that can maximize the utilization rate of the server resource, and then perform virtual machine resource scheduling according to the planning strategy. Therefore, the types and the number of the virtual machines which can be provided by the server cluster can be accurately calculated, and the calculation accuracy is improved; and by carrying out resource migration on the created virtual machines in the server cluster, reasonable scheduling of resources can be realized, physical server fragments are compressed, resource utilization is maximized, and the total hardware cost is reduced.
The above description is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application.
It should be noted that, in the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
The features disclosed in the several product embodiments presented in this application can be combined arbitrarily, without conflict, to arrive at new product embodiments.
The features disclosed in the several method or apparatus embodiments provided herein may be combined in any combination to arrive at a new method or apparatus embodiment without conflict.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for scheduling resources, the method comprising:
acquiring a virtual machine creation request;
according to the virtual machine establishing request, utilizing a preset planning model to plan resources of a server cluster, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and scheduling the resources of the virtual machine in the server cluster according to the planning strategy.
2. The method of claim 1, wherein determining the planning strategy when the resource utilization of the server cluster reaches the target value comprises:
when the resource utilization rate of the server cluster reaches a target value, determining a target server selected from the server cluster and virtual machine information deployed by the target server;
and determining the target server and the information of the virtual machine deployed by the target server as the planning strategy.
3. The method according to claim 1, wherein after the resource planning of the server cluster according to the virtual machine creation request by using a preset planning model, the method further comprises:
if the planning strategy that the resource utilization rate of the server cluster reaches the target value does not exist, judging whether the count value is smaller than or equal to a preset threshold value;
and when the count value is smaller than or equal to a preset threshold value, performing resource migration processing on the created virtual machines in the server cluster, executing an adding operation on the count value, returning to execute the step of performing resource planning on the server cluster by using a preset planning model according to the virtual machine creation request.
4. The method of claim 3, wherein after determining whether the count value is less than or equal to a preset threshold, the method further comprises:
when the count value is larger than a preset threshold value, generating alarm information; the alarm information is used for indicating that the hardware information of the server cluster is not matched with the virtual machine resources, so that the resource utilization rate of the server cluster cannot reach a target value.
5. The method of claim 1, further comprising:
starting a timer and timing;
when the timing of the timer reaches a preset duration, re-performing resource planning on the created virtual machines in the server cluster by using the preset planning model, and determining a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and scheduling the resources of the virtual machine in the server cluster according to the planning strategy.
6. The method of claim 1, further comprising:
acquiring server definition information and virtual machine definition information;
determining constraint conditions according to the server definition information and the virtual machine definition information;
under the constraint condition, constructing the preset planning model;
the server definition information at least comprises the number of servers in the server cluster, a performance parameter set of each server and a price parameter set of each server, and the virtual machine definition information at least comprises the number of types of virtual machines, a performance parameter set of each type of virtual machines and a price parameter set of each type of virtual machines.
7. The method of claim 6,
the set of performance parameters includes: the number of Central Processing Units (CPU), the memory capacity and the hard disk capacity;
the set of price parameters includes: unit CPU price, unit memory price and unit hard disk price.
8. A resource scheduling apparatus comprising an obtaining unit, a determining unit, and a scheduling unit, wherein,
the acquisition unit is configured to acquire a virtual machine creation request;
the determining unit is configured to perform resource planning on the server cluster by using a preset planning model according to the virtual machine creating request, and determine a planning strategy when the resource utilization rate of the server cluster reaches a target value;
and the scheduling unit is configured to perform virtual machine resource scheduling in the server cluster according to the planning strategy.
9. An electronic device, comprising a memory and a processor, wherein,
the memory for storing a computer program operable on the processor;
the processor, configured to execute the resource scheduling method according to any one of claims 1 to 7 when running the computer program.
10. A computer storage medium, characterized in that the computer storage medium stores a computer program which, when executed by at least one processor, implements the resource scheduling method of any one of claims 1 to 7.
CN202110547949.3A 2021-05-19 2021-05-19 Resource scheduling method, device, equipment and computer storage medium Pending CN115373828A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110547949.3A CN115373828A (en) 2021-05-19 2021-05-19 Resource scheduling method, device, equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110547949.3A CN115373828A (en) 2021-05-19 2021-05-19 Resource scheduling method, device, equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN115373828A true CN115373828A (en) 2022-11-22

Family

ID=84059776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110547949.3A Pending CN115373828A (en) 2021-05-19 2021-05-19 Resource scheduling method, device, equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN115373828A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115840649A (en) * 2023-02-16 2023-03-24 浙江云针信息科技有限公司 Method and device for allocating partitioned capacity block type virtual resources, storage medium and terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115840649A (en) * 2023-02-16 2023-03-24 浙江云针信息科技有限公司 Method and device for allocating partitioned capacity block type virtual resources, storage medium and terminal
CN115840649B (en) * 2023-02-16 2023-05-23 浙江云针信息科技有限公司 Method and device for partitioning capacity block type virtual resource allocation, storage medium and terminal

Similar Documents

Publication Publication Date Title
CN114257599A (en) Adaptive finite duration edge resource management
CN109684074A (en) Physical machine resource allocation methods and terminal device
US20100281478A1 (en) Multiphase virtual machine host capacity planning
EP2261845A1 (en) Data center batch job quality of service control
Wang et al. Dynamically hierarchical resource-allocation algorithm in cloud computing environment
WO2020082611A1 (en) Method for carrying out deep learning on basis of blockchain platform and electronic device
CN107209685B (en) Virtual machine arrangement
CN103946802A (en) Method, computer program, and device for allocating computer resources of a cluster for carrying out a job controlled by said cluster
CN105117285B (en) A kind of nonvolatile memory method for optimizing scheduling based on mobile virtual system
US20220121467A1 (en) A method and a system for managing the computing resources of a cloud computing platform
CN104407925A (en) Dynamic resource distribution method
CN104407912A (en) Virtual machine configuration method and device
CN110333945A (en) A kind of dynamic load balancing method, system and terminal
CN103440182A (en) Adaptive allocation method and device and adaptive replica consistency method
WO2014209565A1 (en) Date adjusted power budgeting for an information handling system
CN108874502A (en) Method for managing resource, device and the equipment of cloud computing cluster
CN103713852A (en) Method for processing information, service platform and electronic devices
CN115373828A (en) Resource scheduling method, device, equipment and computer storage medium
CN107203256B (en) Energy-saving distribution method and device under network function virtualization scene
US10732589B2 (en) Method of controlling energy storage and apparatuses performing the same
CN107621980A (en) A kind of virtual machine migration method, cluster control system and control device
US11017417B1 (en) Using incentives to manage computing resources
CN114884900A (en) Resource allocation method, device, equipment and storage medium
CN109324886A (en) cluster resource scheduling method and device
CN110557339A (en) flow planning method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination