CN113377496A - Virtual machine load balancing method - Google Patents

Virtual machine load balancing method Download PDF

Info

Publication number
CN113377496A
CN113377496A CN202110539740.2A CN202110539740A CN113377496A CN 113377496 A CN113377496 A CN 113377496A CN 202110539740 A CN202110539740 A CN 202110539740A CN 113377496 A CN113377496 A CN 113377496A
Authority
CN
China
Prior art keywords
host
load
physical host
physical
cluster
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
CN202110539740.2A
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.)
Kirin Software Co Ltd
Original Assignee
Kirin Software 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 Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202110539740.2A priority Critical patent/CN113377496A/en
Publication of CN113377496A publication Critical patent/CN113377496A/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/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
    • 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/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a virtual machine load balancing method, which comprises the following steps: a. determining the load of each physical host in the cluster: the load determination process of each physical host is as follows: the host load = CPU usage rate CPU weight + memory usage rate memory weight + disk usage rate disk weight, where the host load is the load of the physical host; b. sorting the physical hosts in the cluster according to the values of the host loads determined in step a; c. determining an average load of the cluster; d. virtual machine migration: migrating the virtual machine of the source physical host with high load to the target physical host with low load, so that the host loads of the source physical host and the target physical host both tend to the average load of the cluster. The invention solves the problem of unbalanced host load in the initial distribution and later use processes of the virtual machines, effectively and uniformly distributes the virtual machines in the physical hosts of the cluster, and realizes the effective utilization of cluster resources.

Description

Virtual machine load balancing method
Technical Field
The invention relates to a load balancing method in the technical field of cloud, in particular to a virtual machine load balancing method.
Background
In a cloud scenario, a cluster includes a plurality of physical hosts, and a scenario of resource heterogeneity may exist between the physical hosts. The CPU, the memory, and the hard disk resources of the server are not consistent, which causes the virtual machines to be unevenly distributed on the physical host, and may cause the situation that the resource utilization rate on a certain physical host is very high, and the resource utilization rates of other physical hosts are very low. In a common virtual machine load balancing scheduling method, resource utilization such as a CPU or a memory is considered from a single dimension, and is not considered from multiple dimensions uniformly, and when a virtual machine is migrated, migration of a virtual machine on a physical host with a high load to a physical host with a low load is simply considered, so that after migration, a phenomenon of load imbalance may occur again.
Disclosure of Invention
In order to solve the above problems, an object of the present invention is to provide a method for load balancing of a virtual machine, so as to solve the problem that load imbalance is likely to occur again after a virtual machine is migrated in the existing method for load balancing of a virtual machine.
In order to achieve the purpose, the technical means adopted by the invention is as follows:
the invention discloses a virtual machine load balancing method, which comprises the following steps:
a. determining the load of each physical host in the cluster: the load determination process of each physical host is as follows: the host load = CPU usage rate CPU weight + memory usage rate memory weight + disk usage rate disk weight, where the host load is the load of the physical host;
b. sorting the physical hosts in the cluster according to the values of the host loads determined in step a;
c. determining the average load of the cluster: average load = sum of host loads of physical hosts in the cluster/number of physical hosts in the cluster;
d. virtual machine migration: the physical host with the host load higher than the average load of the cluster is a source physical host, the physical host with the host load lower than the average load of the cluster is a target physical host, and the virtual machine of the source physical host is migrated to the target physical host, so that the host loads of the source physical host and the target physical host tend to the average load of the cluster.
The specific process of the step d is as follows:
d11, selecting the source physical host with the highest host load in the step b, and determining the virtual machine load of all the virtual machines running in the source physical host;
d12, sequentially migrating the virtual machines of the source physical host with the highest host load to the target physical host with the lowest host load according to the sequence of the virtual machine load from low to high;
d13, after each virtual machine is migrated, determining the host loads of the source physical host and the target physical host;
d14, judging the host load of the source physical host: when the host load of the source physical host with high load tends to average load, jumping to step d11, and starting to execute the virtual machine emigration operation downwards from the source physical host with second highest host load; otherwise, continuing to carry out the migration operation of the virtual machine on the source physical host;
d15, judging the host load of the target physical host: if the host load of the target physical host tends to average load, migrating the virtual machine of the source physical host to the target physical host with the next lower host load;
d16, repeating the steps d 11-d 15, traversing the rest of the source physical host and the target physical host, and migrating the virtual machine of the source physical host to the target physical host to enable the host loads of the source physical host and the target physical host to tend to average load so as to carry out load balancing adjustment.
The standard that the host loads of the source physical host and the target physical host both tend to the average load of the cluster is as follows:
presetting an offset value i, wherein the average load-i < = the host load of a source physical host < = the average load + i, and the average load-i < = the host load of a target host < = the average load + i.
In step a, the CPU weight + memory weight + disk weight = 1.
In step c, when a physical host which can not migrate the virtual machine exists in the cluster, the physical host which can not migrate the virtual machine is an unscheduled physical host,
average load = (sum of host loads of physical hosts in cluster-host load of non-scheduled physical hosts)/(number of physical hosts in cluster-number of non-scheduled physical hosts).
The invention has the beneficial effects that:
the invention performs balancing based on three dimensions of the CPU, the memory and the disk, and avoids the phenomenon of resource surplus of a certain dimension of a physical host in a cluster. In addition, the virtual machine of the source physical host is migrated to the target physical host, so that the host loads of the source physical host and the target physical host tend to the average load of the cluster, the overall host load condition in the cluster is fully considered, and the condition that the host load is unbalanced after being adjusted is avoided.
The invention solves the problem of unbalanced host load in the initial distribution and later use processes of the virtual machines, effectively and uniformly distributes the virtual machines in the physical hosts of the cluster, and realizes the effective utilization of cluster resources.
Drawings
FIG. 1 is a flowchart of a method for load balancing virtual machines according to the present invention;
fig. 2 is a specific process diagram of the load balancing method for virtual machines according to the present invention.
Detailed Description
The present invention obtains the average load by determining the sum of the host loads of the physical hosts in the cluster. From the average load, the difference between each physical host and the average load can be obtained. Therefore, the virtual machines on the physical host machines with the load higher than the average load can be migrated to the physical host machine with the load lower than the average load, and the aim of making the whole body tend to be average is fulfilled.
The embodiments of the present invention will be described in detail with reference to the accompanying drawings and examples, so that how to implement the technical means for solving the technical problems and achieving the technical effects of the present invention can be fully understood and implemented.
As shown in fig. 1 and fig. 2, the method for load balancing of virtual machines of the present invention includes the following steps:
step a, determining the load of each physical host in the cluster: the load determination process of each physical host is as follows: the host load = CPU usage rate + memory usage rate + disk usage rate, where the host load is a load of the physical host. In this step, the monitor program on each physical host reports the host load information at regular time. The host load is determined and obtained according to three dimensions of the CPU utilization rate, the memory utilization rate and the disk utilization rate of the current physical host. Each dimension is represented by a weight to indicate the percentage of that dimension occupied in terms of host load for the cluster. The larger the weight, the deeper the influence of the dimension on the host load of the cluster. The sum of the weights of the three dimensions is 1, namely: CPU weight + memory weight + disk weight = 1. If the preset weight of a certain dimension is 1, the other two items are 0, which indicates that the load balance of the host of the cluster only considers the single dimension. Host load = CPU usage + memory usage + disk weight.
b. And b, sorting the physical hosts in the cluster according to the numerical value of the host load determined in the step a, wherein in the embodiment, the physical hosts in the cluster are sorted according to the sequence of the host load from high to low, so that the subsequent operation can be conveniently and quickly searched.
c. Determining the average load of the cluster: average load = sum of host loads of physical hosts in the cluster/number of physical hosts in the cluster. The average load of the system is obtained by calculating the arithmetic mean of the loads of the hosts. I.e., average load = (host load of a physical host + host load of B physical host + host load of C physical host. + host load of N physical host)/N, i.e., average load = sum of host loads of physical hosts in cluster/number of physical hosts in cluster. When there are physical hosts in the cluster that cannot migrate the virtual machine, the physical hosts that cannot migrate the virtual machine are non-scheduled physical hosts, and the average load = (sum of host loads of physical hosts in the cluster-host load of non-scheduled physical hosts)/(number of physical hosts in the cluster-number of non-scheduled physical hosts). In this embodiment, the average load of the system is obtained by first calculating the host load of a single physical host according to the weighted average of the CPU, the memory, and the three dimensions of the disk usage of the single physical host, and then adding the host loads and dividing the sum by the number of physical hosts participating in scheduling to obtain the average load of the system. Because three dimensions are considered when the host load of a single physical host is calculated, the situation that only one single dimension possibly exists, namely the situation that the CPU occupancy rate of one host is very high but the disk occupancy rate is very low is avoided. Meanwhile, the method is different from other scheduling algorithms, and the average load of the system is introduced to determine a reference water level for system scheduling, so that all the loads of the host computer approach to the reference water level, and the purposes that the high water level approaches to the low water level and the overall approach to the average water level are achieved. Thereby achieving the purpose that the host load of all physical hosts in the system is even.
d. Virtual machine migration: the physical host with the host load higher than the average load of the cluster is a source physical host, the physical host with the host load lower than the average load of the cluster is a target physical host, and the virtual machine of the source physical host is migrated to the target physical host, so that the host loads of the source physical host and the target physical host tend to the average load of the cluster. The average load determined in step c may be regarded as an average level of the overall load. All host loads above the mean water level need to flow to hosts below the mean water level. I.e., virtual machines on a source physical host that are above average load need to be migrated to run on a target physical host that is below average load. Thus, the overall load of the cluster tends to be close to the average load level, and the host load of each physical host in the cluster is close to the average load. In this step, the criterion that the host loads of the source physical host and the target physical host both tend to the average load of the cluster is as follows: presetting an offset value i, wherein the average load-i < = the host load of a source physical host < = the average load + i, and the average load-i < = the host load of a target host < = the average load + i. The average load-i and the average load + i are threshold ranges, wherein a deviation value i is user-defined, the deviation value i is introduced because the overall load of the system is changed in real time, and the addition of the deviation value i can ensure that the average load obtained according to calculation can be kept within a fluctuation range within a certain time, so that frequent virtual machine migration triggered by the change of the load of the host due to jitter is avoided.
The specific process of the step d is as follows:
d11, selecting the source physical host with the highest host load at the head of the queue in the step b, and determining the load of all the virtual machines running on the source physical host with the highest host load. The virtual machine load determination method is the same as the host load determination method described in step a, that is, in each virtual machine, the virtual machine load = CPU usage rate + CPU weight + memory usage rate + disk weight, where the CPU usage rate, the memory usage rate, and the disk usage rate are all indexes of the virtual machine.
d12, sequentially migrating the virtual machines of the source physical host with the highest host load to the target physical host with the lowest host load according to the sequence of the virtual machine load from low to high. The method is different from a method of directly migrating a virtual machine with the highest load generally adopted, and the virtual machine with the lowest load of the virtual machine is selected for migration because the virtual machine with the highest load generally has a service in a hot-live state when the service is executed, and service interruption can be caused if the migration operation is carried out at the moment, so that the use is influenced. Secondly, the scheduling method adopts a global optimal mode rather than the local optimal mode in the prior art, namely in the process that the virtual machine migrates from the host with the highest load to the host with the lowest load, if the load of the host with the lowest load reaches the global average load, the virtual machine does not migrate to the host but selects the host with the next lowest load to migrate until the loads of all the hosts in the cluster tend to the average load, so that the phenomenon that the load of the target physical host is higher than the average water level (average load) and unbalance occurs again after the virtual machine with the highest load of the virtual machine is migrated to the target physical host is avoided.
d13, obtaining the host loads of the source physical host and the target physical host once after migrating the virtual machine according to the step d12, namely after migrating one virtual machine. The method aims to judge whether the host load of the source physical host is reduced to be close to the average load or not and whether the host load of the target physical host is increased to be close to the average load or not after the virtual machine is migrated.
d14, judging the host load of the source physical host. If the host load of the source physical host tends to average load, the source physical host does not need to perform the operation of migrating the virtual machine. Thus, jumping to step d11, the virtual machine migration operation is performed downward starting from the source physical host with the second highest host load, i.e., the load balancing operation is performed starting from the source physical host with the second highest host load arranged before. Otherwise, the migration operation of the virtual machine is continued on the source physical host with the highest host load, namely, the subsequent steps are continued.
d15, judging the host load of the target physical host: if the host load of the target physical host tends to the average load, it indicates that the target physical host with low load does not need to perform the operation of migrating the virtual machine, so the process jumps to step d12, and the virtual machine is migrated from the source physical host of d12 to the target physical host with the second lowest host load; otherwise, the process also jumps to step d12, and the virtual machine is migrated from the source physical host of d12 to the target physical host with the lowest load of the current host.
d16, repeating the steps d 11-d 15, traversing the rest of the source physical hosts and the target physical hosts, namely completing the load balancing operation of the whole cluster, migrating the virtual machines of the source physical hosts to the target physical hosts, and enabling the host loads of the source physical hosts and the target physical hosts to tend to average loads so as to perform load balancing adjustment. Through one-time load balancing operation of the whole cluster, the distribution condition of the virtual machines in the cluster is adjusted, and the virtual machines on the high-load source physical host are migrated to the low-load target physical host to run. The emigration and immigration operation is to perform one-time integral adjustment on all physical hosts in the cluster, so that the loads of the hosts can be well averaged to each host, the condition that the loads of the target hosts are too high after one-time adjustment is avoided, and integral balance is achieved. In this embodiment, the triggering of the load balancing operation is timed, a user may define the triggering time, when the triggering interval time is 0, the triggering is equivalent to triggering the load balancing operation in real time, and when the load balancing operation is triggered, the host loads of the physical hosts are sequenced, and the virtual machines are migrated from the high-load hosts to the low-load hosts.
The above description is only a preferred embodiment of the present invention, and is only used to help understanding the method and the core idea of the present invention, and the protection scope of the present invention is not limited to the above embodiments, and all technical solutions belonging to the idea of the present invention belong to the protection scope of the present invention. It should be noted that modifications and embellishments within the scope of the invention may occur to those skilled in the art without departing from the principle of the invention, and are considered to be within the scope of the invention.

Claims (5)

1. A virtual machine load balancing method is characterized by comprising the following steps:
a. determining the load of each physical host in the cluster: the load determination process of each physical host is as follows: the host load = CPU usage rate CPU weight + memory usage rate memory weight + disk usage rate disk weight, where the host load is the load of the physical host;
b. sorting the physical hosts in the cluster according to the values of the host loads determined in step a;
c. determining the average load of the cluster: average load = sum of host loads of physical hosts in the cluster/number of physical hosts in the cluster;
d. virtual machine migration: the physical host with the host load higher than the average load of the cluster is a source physical host, the physical host with the host load lower than the average load of the cluster is a target physical host, and the virtual machine of the source physical host is migrated to the target physical host, so that the host loads of the source physical host and the target physical host tend to the average load of the cluster.
2. The method for load balancing of virtual machines according to claim 1, wherein the specific process of step d is as follows:
d11, selecting the source physical host with the highest host load in the step b, and determining the virtual machine load of all the virtual machines running in the source physical host;
d12, sequentially migrating the virtual machines of the source physical host with the highest host load to the target physical host with the lowest host load according to the sequence of the virtual machine load from low to high;
d13, after each virtual machine is migrated, determining the host loads of the source physical host and the target physical host;
d14, judging the host load of the source physical host: when the host load of the source physical host with high load tends to average load, jumping to step d11, and starting to execute the virtual machine emigration operation downwards from the source physical host with second highest host load; otherwise, continuing to carry out the migration operation of the virtual machine on the source physical host;
d15, judging the host load of the target physical host: if the host load of the target physical host tends to average load, migrating the virtual machine of the source physical host to the target physical host with the next lower host load;
d16, repeating the steps d 11-d 15, traversing the rest of the source physical host and the target physical host, and migrating the virtual machine of the source physical host to the target physical host to enable the host loads of the source physical host and the target physical host to tend to average load so as to carry out load balancing adjustment.
3. The method for load balancing of virtual machines according to claim 1, wherein the criteria that the host loads of the source physical host and the target physical host both tend to the average load of the cluster are:
presetting an offset value i, wherein the average load-i < = the host load of a source physical host < = the average load + i, and the average load-i < = the host load of a target host < = the average load + i.
4. The method for load balancing of virtual machines according to claim 1, wherein in step a, the CPU weight + memory weight + disk weight = 1.
5. The method for load balancing of virtual machines according to claim 1, wherein in step c, when there is a physical host that can not migrate the virtual machine in the cluster, the physical host that can not migrate the virtual machine is an unscheduled physical host,
average load = (sum of host loads of physical hosts in cluster-host load of non-scheduled physical hosts)/(number of physical hosts in cluster-number of non-scheduled physical hosts).
CN202110539740.2A 2021-05-18 2021-05-18 Virtual machine load balancing method Pending CN113377496A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110539740.2A CN113377496A (en) 2021-05-18 2021-05-18 Virtual machine load balancing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110539740.2A CN113377496A (en) 2021-05-18 2021-05-18 Virtual machine load balancing method

Publications (1)

Publication Number Publication Date
CN113377496A true CN113377496A (en) 2021-09-10

Family

ID=77571148

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110539740.2A Pending CN113377496A (en) 2021-05-18 2021-05-18 Virtual machine load balancing method

Country Status (1)

Country Link
CN (1) CN113377496A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110131570A1 (en) * 2009-11-30 2011-06-02 Itamar Heim Mechanism for Target Host Optimization in a Load Balancing Host and Virtual Machine (VM) Selection Algorithm
CN104270416A (en) * 2014-09-12 2015-01-07 杭州华为数字技术有限公司 Load balancing control method and management node
CN106897116A (en) * 2017-02-27 2017-06-27 郑州云海信息技术有限公司 A kind of virtual machine migration method and device
CN110389838A (en) * 2019-07-24 2019-10-29 北京邮电大学 A kind of Real-Time Scheduling suitable for virtual resource and online migration management-control method
CN111061561A (en) * 2019-11-27 2020-04-24 扆亮海 Full-stage load sharing comprehensive optimization method of cloud computing management platform

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110131570A1 (en) * 2009-11-30 2011-06-02 Itamar Heim Mechanism for Target Host Optimization in a Load Balancing Host and Virtual Machine (VM) Selection Algorithm
CN104270416A (en) * 2014-09-12 2015-01-07 杭州华为数字技术有限公司 Load balancing control method and management node
CN106897116A (en) * 2017-02-27 2017-06-27 郑州云海信息技术有限公司 A kind of virtual machine migration method and device
CN110389838A (en) * 2019-07-24 2019-10-29 北京邮电大学 A kind of Real-Time Scheduling suitable for virtual resource and online migration management-control method
CN111061561A (en) * 2019-11-27 2020-04-24 扆亮海 Full-stage load sharing comprehensive optimization method of cloud computing management platform

Similar Documents

Publication Publication Date Title
CN106790726B (en) Priority queue dynamic feedback load balancing resource scheduling method based on Docker cloud platform
US7610425B2 (en) Approach for managing interrupt load distribution
Yu et al. A load balancing mechanism for multiple SDN controllers based on load informing strategy
US8463971B2 (en) Approach for distributing interrupts from high-interrupt load devices
US7581052B1 (en) Approach for distributing multiple interrupts among multiple processors
CN102185779B (en) Method and device for realizing data center resource load balance in proportion to comprehensive allocation capability
WO2011110026A1 (en) Method and apparatus for realizing load balance of resources in data center
US8572621B2 (en) Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
CN108089918B (en) Graph computation load balancing method for heterogeneous server structure
CN111045808B (en) Distributed network task scheduling method and device
CN114296868B (en) Virtual machine automatic migration decision method based on user experience in multi-cloud environment
CN105516347A (en) Method and device for load balance allocation of streaming media server
CN111131486B (en) Load adjustment method and device of execution node, server and storage medium
CN113810304A (en) Load balancing method, device, equipment and computer storage medium
CN105893155B (en) Virtual machine control method for equalizing load and device
Zhu et al. Improved dynamic load balancing algorithm based on Least-Connection Scheduling
CN111078391A (en) Service request processing method, device and equipment
CN103440158B (en) The hotspot migration method of facing cloud scheduling of resource
Qin et al. Research on nginx dynamic load balancing Algorithm
CN118138590A (en) Data center load balancing method
CN101763032B (en) Method and device of controller for adjusting logical unit number
US20120042322A1 (en) Hybrid Program Balancing
CN113377496A (en) Virtual machine load balancing method
CN104899072B (en) Fine granularity resource scheduling system based on virtual platform and method
Raj et al. Augmenting hierarchical load balancing with intelligence in grid environment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210910