WO2018014566A1 - 一种负载均衡的方法、装置、计算机可读存储介质及系统 - Google Patents

一种负载均衡的方法、装置、计算机可读存储介质及系统 Download PDF

Info

Publication number
WO2018014566A1
WO2018014566A1 PCT/CN2017/076514 CN2017076514W WO2018014566A1 WO 2018014566 A1 WO2018014566 A1 WO 2018014566A1 CN 2017076514 W CN2017076514 W CN 2017076514W WO 2018014566 A1 WO2018014566 A1 WO 2018014566A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
cpu
physical machine
consumption type
usage rate
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.)
Ceased
Application number
PCT/CN2017/076514
Other languages
English (en)
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2018014566A1 publication Critical patent/WO2018014566A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/503Resource availability

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a load balancing method, apparatus, and computer readable storage medium and system.
  • the virtual machine allocation algorithm adopted by the existing cloud computing platform is a random algorithm, which easily leads to a large difference in the load of each physical machine. Some physical machines are at risk of downtime due to excessive load, or some physical machines are subject to some kind of physical machine. The load is too small and wastes resources.
  • Embodiments of the present invention provide a method and device for load balancing, which can implement load balancing of each physical machine.
  • an embodiment of the present invention provides a method for load balancing, which includes: if receiving a request of a virtual machine, acquiring a CPU core number and a memory size of the virtual machine; and according to the obtained CPU core number of the virtual machine
  • the memory size identifies the consumption type of the virtual machine; obtains the current CPU usage and memory usage of each physical machine; according to the consumption type of the virtual machine and the CPU usage and memory usage of each physical machine obtained, according to the preset
  • a rule calculates the equalization parameters of each physical machine; assigns the virtual machine to the physical machine with the largest equalization parameter.
  • an embodiment of the present invention provides a load balancing apparatus, where the apparatus includes an obtaining module, an identifying module, a first calculating module, and an allocating module, wherein the obtaining module is configured to acquire a virtual machine if receiving a request of the virtual machine.
  • the CPU core and the memory size are also used to obtain the current CPU usage and memory usage of each physical machine;
  • the identification module is configured to identify the consumption type of the virtual machine according to the obtained CPU core number and memory size of the virtual machine;
  • the calculation module is configured to calculate an equalization parameter of each physical machine according to a preset first rule according to a consumption type of the virtual machine and a CPU usage and a memory usage rate of each physical machine acquired;
  • the allocation module is configured to allocate the virtual machine Give the physical machine with the largest balance parameter.
  • an embodiment of the present invention provides a computer readable storage medium storing one or more programs, one or more programs executable by one or more processors to perform the following Operation:
  • the CPU core and the memory size of the virtual machine are obtained; the consumption type of the virtual machine is identified according to the CPU core number and the memory size of the obtained virtual machine; and the current CPU usage and memory of each physical machine are obtained.
  • the usage rate is calculated according to the consumption type of the virtual machine and the CPU usage and memory usage of each physical machine obtained, and the equalization parameter of each physical machine is calculated according to the preset first rule; the virtual machine is allocated to the maximum equalization parameter. Physical machine.
  • embodiments of the present invention provide a load balancing system including one or more processors and one or more memories coupled to one or more processors,
  • a memory for storing one or more programs for implementing load balancing; a processor for executing a program stored in the memory to perform the following operations:
  • the CPU core and the memory size of the virtual machine are obtained; the consumption type of the virtual machine is identified according to the CPU core number and the memory size of the obtained virtual machine; and the current CPU usage and memory of each physical machine are obtained.
  • the usage rate is calculated according to the consumption type of the virtual machine and the CPU usage and memory usage of each physical machine obtained, and the equalization parameter of each physical machine is calculated according to the preset first rule; the virtual machine is allocated to the maximum equalization parameter. Physical machine.
  • the equalization parameter of each physical machine is calculated, and then the physical machine that places the virtual machine is determined according to the equalization parameter, and the equalization parameter is related to the CPU usage of the physical machine, the memory usage rate, and the consumption type of the virtual machine, wherein
  • the CPU usage and memory usage of each physical machine are related to the balance of the physical machine cluster, and the consumption type of the virtual machine is related to the internal CPU and memory balance of each physical machine. Therefore, the method considers the overall balance of the physical machine cluster. Considering the load balancing of the internal resources of a single physical machine, the load balancing of the physical machine cluster is more effectively realized.
  • FIG. 1 is a schematic flowchart of a method for load balancing according to an embodiment of the present invention
  • FIG. 2 is a line diagram showing a load imbalance of a physical machine cluster
  • Figure 3 is a schematic diagram of the sub-flow of Figure 1;
  • Figure 4 is a schematic diagram of the sub-flow of Figure 1;
  • Figure 5 is a schematic diagram of the sub-flow of Figure 4.
  • FIG. 6 is a line diagram of load balancing of a physical machine cluster according to an embodiment of the present invention.
  • FIG. 7 is a scatter diagram of load balancing of a physical machine cluster according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a composition of a load balancing apparatus according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram showing the composition of a first computing unit according to an embodiment of the present invention.
  • FIG. 10 is a hardware structural diagram of a load balancing system according to an embodiment of the present invention.
  • a cluster composed of multiple hosts.
  • One cluster includes several physical machines, and the physical machine is a host for running virtual machines. Because the request from the virtual machine is continuously received, the physical machine needs to be allocated to place the virtual machine. Therefore, it is necessary to select a physical machine with a relatively small load from the physical machine cluster to run the virtual machine according to the load of the physical machine, thereby implementing load balancing of the physical machine cluster.
  • FIG. 1 a load balancing method according to an embodiment of the present invention is shown. As shown in the figure, a method for load balancing includes S100 to S106.
  • CPU central processing unit
  • CPU central processing unit
  • the number of CPU cores is used to indicate the number of CPU cores.
  • the consumption type of the virtual machine includes a regular type, a CPU consumption type, and a memory consumption type.
  • the virtual machines of different consumption types occupy different resources, and the CPU resources occupied by the CPU consumption type are occupied by the memory consumption type and the regular type.
  • the CPU resources are large; the memory resources occupied by the memory consumption type have more memory resources than the CPU consumption type and the regular type.
  • the internal CPU and memory resources of some physical machines are not balanced. Therefore, it is necessary to consider the balance of internal resources of the physical machine and the consumption type of the virtual machine, and place the virtual machine on a better physical machine to achieve resource balance within the physical machine.
  • the specific implementation process is to determine the consumption type of the virtual machine according to the ratio of the acquired CPU core number and the memory size.
  • S104 Calculate an equalization parameter of each physical machine according to a preset first rule according to the consumption type of the virtual machine and the acquired CPU usage rate and memory usage rate of each physical machine.
  • the equalization parameter is represented by S2.
  • the equalization parameter S2 is used to indicate the selectivity of the physical machine when considering load balancing of the entire physical machine cluster and load balancing of the internal CPU and memory resources of the physical machine.
  • the preset first rule is used to indicate the consumption type of the virtual machine, the obtained CPU usage of each physical machine, and the relationship between the memory usage rate and the equalization parameter, and the equalization parameters and physical machines of the physical machine for different consumption types of virtual machines.
  • the relationship between CPU usage and memory usage is different. Specifically, if the consumption type of the virtual machine is CPU consumption or memory consumption, the equalization parameter of the physical machine is also related to the ratio of the CPU usage and the memory usage of the physical machine. If the consumption type of the virtual machine is a regular type, the physical type The equalization parameters of the machine are independent of the ratio of CPU usage and memory usage of the physical machine.
  • the virtual machine Assign the virtual machine to the physical machine with the largest equalization parameter. Since the equalization parameter S2 is used to indicate the load balance of the physical machine cluster as a whole and the load balancing of the internal CPU and memory resources of the physical machine, the selectivity of the physical machine. The larger the physical machine equalization parameter S2, the better it is to consider the physical machine to place the virtual machine. Therefore, the virtual machine is allocated to the physical machine with the largest balance parameter S2, so as to implement load balancing of the physical machine cluster. It should be understood that the load balancing of the physical machine cluster includes load balancing between physical machines and internal resources of a single physical machine. balanced.
  • L1 is the CPU usage rate
  • L2 is the memory usage rate.
  • the CPU usage is high and the memory usage is low. Larger, it will lead to the resource utilization of these physical machines is not high, at full load, it is easy to cause a large waste of CPU or memory, and easily lead to the balance of CPU and memory in the physical machine. Therefore, it is necessary to consider the load balancing of memory and CPU resources inside a single physical machine.
  • FIG. 3 a schematic diagram of the sub-flow of FIG. 1 is provided in the embodiment of the present invention.
  • S102 identifies the consumption type of the virtual machine according to the obtained CPU core number and memory size, including:
  • S302. Determine whether the ratio is in a preset first range or a preset second range or a preset third range.
  • the preset second range is greater than the preset first range and the preset third range, and the preset first range is greater than the preset third range.
  • the preset first range is preferably greater than 0.25 and less than 1, and the preset second range is greater than or equal to 1, and the preset third range is less than or equal to 0.25.
  • the consumption type of the identified virtual machine is a regular type.
  • the consumption type of the recognition virtual machine is a CPU consumption type.
  • the consumption type of the recognition virtual machine is a memory consumption type.
  • the consumption type is identified according to the CPU core number of the virtual machine and the memory size, and the identified consumption type is used to select the physical machine when considering the balance of the internal resources of the physical machine.
  • the equalization parameter S2 calculated in S104 is used to indicate the selectivity of the physical machine when considering load balancing of the entire physical machine cluster and load balancing of the internal CPU and memory resources of the physical machine.
  • the first equalization degree S1 is used to indicate the selectivity of the physical machine when considering the load balancing of the physical machine cluster as a whole; and the second equalization degree t is used to represent the load balancing of the internal CPU and memory resources of the physical machine, and the physical machine is used. The selectivity.
  • S104 calculates each physical machine according to a preset first rule according to the consumption type of the virtual machine and the acquired CPU usage rate and memory usage rate of each physical machine.
  • Equilibrium parameters including S401 ⁇ S405:
  • the first equalization degree S1 is used to indicate the selectivity of the physical machine when considering load balancing of the entire physical machine cluster. It should be understood that if only the load balancing of the entire cluster is considered, and the internal resource balancing of each physical machine is not considered, the physical machine with the largest first equalization S1 will be selected to place the virtual machine.
  • the virtual machine should be allocated to the physical machine with the lowest memory usage. Similarly, only the CPU is considered, and the memory is not considered. When the impact, the virtual machine should be requested to the physical machine with the lowest CPU usage. In this embodiment, the CPU and memory are considered at the same time. Therefore, the first equalization S1 is related to the CPU usage Ui and the memory usage rate Mi. A balance S1 is a function of CPU usage and memory usage.
  • the preset second rule is used to indicate the relationship between the CPU usage and the memory usage of each physical machine and the first equalization degree.
  • the preset second rule is specifically: if the CPU and the memory are paired with the first equalization degree.
  • the degree of influence is the same or the degree of influence between the two is negligible, the CPU usage and memory usage of one physical machine are greater than the CPU usage and memory usage of another physical machine, respectively, then the first physical machine
  • the equalization degree S1 is smaller than the first equalization degree S1 of the other physical machine; if the difference between the influence of the CPU and the memory on the first equalization degree is not negligible, the first equalization degree and the CPU usage rate, the memory usage rate, and the selection weight of the CPU relative memory
  • the selection weight W1 is used to indicate the difference in the degree of influence of the CPU and memory on the first balance.
  • S401 calculates the first equalization degree of each physical machine according to the preset second rule according to the CPU usage rate and the memory usage rate of each physical machine, including S501 to S504:
  • S501 Calculate a reciprocal of the current CPU usage of each physical machine and a reciprocal of the memory usage rate.
  • S502 sum the reciprocal of the CPU usage of all the physical machines to obtain the total weight of the CPU, and sum the reciprocal of the memory usage of all the physical machines to obtain the total memory weight.
  • the preset CPU relative memory selection weight w1 indicates that the CPU influence factor or the memory influence factor is prioritized.
  • w1 is equal to 0.5
  • the second rule is that the CPU usage and the memory usage rate of one physical machine are respectively greater than the CPU usage and the memory usage rate of another physical machine, and the first physical machine One equalization S1 is smaller than the first equalization S1 of the other physical machine.
  • the equalization parameter assigned to each physical machine is the first equalization degree of the corresponding physical machine.
  • the consumption type of the virtual machine is a regular type
  • the consumption type of the virtual machine is a regular type
  • the virtual machine is allocated to the physical machine, no additional imbalance is caused to the internal resources of the physical machine.
  • the consumption type of the virtual machine is CPU consumption type or memory consumption type
  • Uavg is used to indicate the average CPU usage of the physical machine cluster
  • Mavg is the average memory usage of the physical machine cluster. It should be noted that if the consumption type of the virtual machine is a CPU consumption type or a memory consumption type, the equalization parameter of the computing physical machine further includes S404 and S405.
  • the second equalization degree t represents the selectivity of the physical machine when considering load balancing of the internal CPU and memory resources of the physical machine.
  • the second equalization t is equal to the difference between the ratio of the CPU usage Ui of the physical machine and the memory usage rate Mi to the ratio of the average CPU usage Uavg and the average memory usage ratio Mavg, as shown below:
  • t>0 it means that the CPU usage of the physical machine is relatively higher than the memory usage, that is, the CPU consumption is relatively more memory consumption.
  • the larger t is, the more unbalanced the CPU and memory resources in the physical machine are; when t ⁇ 0 , indicating that the memory usage of the physical machine is relatively high compared to the CPU usage, that is, the memory consumption is relatively large compared to the CPU consumption, and the larger the absolute value of t, the more unbalanced the CPU and memory resources in the physical machine.
  • the first equalization S1 is used to indicate the selectivity of the physical machine when considering the load balancing of the physical machine cluster as a whole; and the second equalization t represents the selectivity of the physical machine when considering the load balancing of the internal CPU and memory resources of the physical machine.
  • the equalization parameter is related to the consumption type of the virtual machine, the first equalization degree, and the second equalization degree.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to equalize the overall balance of the physical machine cluster and the internal resource balance of the physical machine, even if the values of S1 and k ⁇ t n are of the same order of magnitude.
  • the consumption type of the virtual machine is CPU consumption type
  • the physical machine with high memory and high CPU consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equalization degree of the selected physical machine. The value is less than zero.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if the values of S1 and k ⁇ t n are of the same order of magnitude. It should be understood that if the consumption type of the virtual machine is memory consumption type, the physical machine with high CPU memory consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equilibrium degree t value of the selected physical machine. Greater than zero.
  • the calculation is performed by allocating 8C/8G and 4C/32G of the physical machine, and the range of Ui/Mi is (0.32, 2.56), so the range of the second equalization t is (-2.24, 2.24).
  • the equalization parameter S2 If the consumption type of the virtual machine is CPU consumption type, the equalization parameter S2:
  • the equalization parameter S2 has:
  • the second equalization degree t is processed such that the range of t/3 is (-1, 1), and after the third power, the influence of the CPU and the memory resources in the physical machine is unbalanced, and the influence on the equalization parameter S2 is performed.
  • the consumption type of the virtual machine is CPU consumption type
  • the first equalization degree of one physical machine is greater than the first equalization degree of another physical machine
  • the second equalization degree of the one physical machine is smaller than another physical medium.
  • the second equalization degree of the machine, the equalization parameter of the one physical machine is greater than the equalization parameter of the other physical machine; if the consumption type of the virtual machine is the memory consumption type, the first equalization degree and the second equalization degree of one physical machine are respectively greater than another
  • the first equalization degree and the second equalization degree of the physical machine, the equalization parameter of the one physical machine is greater than the equalization parameter of the other physical machine.
  • the above load balancing method is adopted, that is, the load balancing of the physical machine cluster as a whole is considered, and the load balancing of the CPU and memory resources of a single physical machine is considered, so that the CPU usage and memory of different physical machines are made by this method.
  • the usage rate is close, and the CPU usage and memory usage of a single physical machine are also close, which ensures the load balancing between the physical machines and the internal resources of a single physical machine, and also improves the resources in each physical machine. Utilization, when the physical machine is fully loaded, the number of virtual machines running increases. Referring to FIG. 6 and FIG. 7, the figure shows a line graph and a scatter plot of the CPU usage and memory usage of the physical machine after using the above load balancing method.
  • L1 is the CPU usage rate
  • L2 is Memory usage.
  • the load balancing method also includes:
  • the average CPU usage and average memory usage are calculated.
  • the integrated equalization Q is obtained according to the degree of dispersion of the CPU usage of each physical machine and the average usage of the CPU, and the degree of dispersion of the memory usage of each physical machine and the average memory usage.
  • the integrated equalization Q is used to represent the physical machine cluster. Load balancing. Specifically, the weighted calculation is performed by calculating the mean square error of the CPU usage rate and the memory usage rate of all the physical machines.
  • the CPU equalization Q1 of the physical machine cluster is a mean square error calculation for the CPU usage of all physical machines.
  • Mi represents the memory usage of the i-th physical machine
  • Mavg represents the average memory usage of the physical machine cluster.
  • the memory balance Q2 of the physical machine cluster is the mean square error calculation for the memory usage of all physical machines:
  • W2 represents the equalization weight of the CPU relative to the memory when considering the integrated equalization degree. If W2 is larger, it means that the influence of the CPU on the integrated equalization is preferably considered. This is because the impact of CPU and memory on the overall balance may be different. In this embodiment, the CPU and the memory are temporarily set to have similar effects on the integrated equalization, and the difference between them is ignored, and W2 is taken as 0.5.
  • the load balancing situation of the physical machine cluster can be known according to the comprehensive equalization degree Q. If the integrated equalization degree is smaller, the representation is more balanced, so that the degree of load balancing of the physical machine cluster can be monitored in real time according to the integrated equalization degree Q, so as to be timely. Adjust the load balancing of the physical machine cluster or use the integrated equalization Q to monitor whether an abnormal virtual machine is allocated.
  • the first equalization degree and the second equalization degree calculation manner may be adjusted according to the integrated equalization degree Q or the relationship between the first equalization degree, the second equalization degree, and the equalization parameter may be adjusted according to the integrated equalization degree Q, so as to be physical.
  • the load of the cluster is more balanced.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
  • the invention also provides a computer readable storage medium having stored one or more programs, one or more programs executable by one or more processors to perform the operations:
  • the following operations are specifically performed:
  • the judgment ratio is whether the preset first range or the preset second range or the preset third range.
  • the preset second range is greater than the preset first range and the preset third range, and the preset first range is greater than the preset third range;
  • the consumption type of the identified virtual machine is a regular type
  • the consumption type of the recognition virtual machine is CPU consumption type
  • the consumption type of the recognition virtual machine is a memory consumption type, wherein the preset second range is greater than the preset first range and the preset third range, the preset A range is greater than the preset third range.
  • the preset first range is: greater than 0.25 and less than 1
  • preset second The range is: greater than or equal to 1
  • the preset third range is less than or equal to 0.25.
  • the one or more programs are executed by one or more processors, according to a consumption type of the virtual machine and a CPU usage and a memory usage rate of each physical machine acquired, according to a preset
  • the first rule calculates the equalization parameter of each physical machine, the following operations are specifically performed:
  • the equalization parameter assigned to each physical machine is the first equalization degree of the corresponding physical machine
  • the average CPU usage rate and the average memory usage rate are calculated according to the obtained CPU usage rate and memory usage rate of each physical machine;
  • the equalization parameters of each physical machine are calculated according to the consumption type of the virtual machine, the first equalization degree of each physical machine, and the second equalization degree.
  • the second equalization is equal to the difference between the ratio of the CPU usage and the memory usage of the physical machine to the ratio of the average CPU usage to the average memory usage.
  • the relationship is as follows:
  • t>0 it means that the CPU usage of the physical machine is relatively higher than the memory usage, that is, the CPU consumption is relatively more memory consumption.
  • the larger t is, the more unbalanced the CPU and memory resources in the physical machine are; when t ⁇ 0 , indicating that the memory usage of the physical machine is relatively high compared to the CPU usage, that is, the memory consumption is relatively large compared to the CPU consumption, and the larger the absolute value of t, the more unbalanced the CPU and memory resources in the physical machine.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to equalize the overall balance of the physical machine cluster and the internal resource balance of the physical machine, even if the values of S1 and k ⁇ t n are of the same order of magnitude.
  • the consumption type of the virtual machine is CPU consumption type
  • the physical machine with high memory and high CPU consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equalization degree of the selected physical machine. The value is less than zero.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if the values of S1 and k ⁇ t n are of the same order of magnitude. It should be understood that if the consumption type of the virtual machine is memory consumption type, the physical machine with high CPU memory consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equilibrium degree t value of the selected physical machine. Greater than zero.
  • the calculation is performed by allocating 8C/8G and 4C/32G of the physical machine, and the range of Ui/Mi is (0.32, 2.56), so the range of the second equalization t is (-2.24, 2.24).
  • the equalization parameter S2 If the consumption type of the virtual machine is CPU consumption type, the equalization parameter S2:
  • the equalization parameter S2 has:
  • the second equalization degree t is processed such that the range of t/3 is (-1, 1), and after the third power, the influence of the CPU and the memory resources in the physical machine is unbalanced, and the influence on the equalization parameter S2 is performed.
  • the consumption type of the virtual machine is a CPU consumption type
  • a first equalization degree of one physical machine is greater than a first equalization degree of another physical machine
  • a second equalization degree of the one physical machine is smaller than the other a second equalization degree of the physical machine
  • the equalization parameter of the one physical machine is greater than the equalization parameter of the another physical machine
  • the consumption type of the virtual machine is a memory consumption type
  • the first equalization degree of a physical machine The second equalization degree is respectively greater than the first equalization degree and the second equalization degree of the other physical machine, and the equalization parameter of the one physical machine is greater than the equalization parameter of the another physical machine.
  • the CPU usage and the memory usage rate of each physical machine to be acquired are calculated according to a preset second rule.
  • the following operations are performed:
  • the sum of the CPU usage of all physical machines is summed to obtain the total weight of the CPU, and the reciprocal of the memory usage of all physical machines is summed to obtain the total memory weight;
  • the first equalization degree S1 is calculated according to the calculated CPU ratio c of each physical machine and the memory ratio m and the selection weight w1 of the preset CPU relative memory.
  • the relationship between the first equalization degree S1 and the CPU ratio c, the memory ratio m, and the CPU relative memory selection weight w1 is as follows:
  • the preset CPU relative memory selection weight w1 indicates that the CPU influence factor or the memory influence factor is prioritized. The larger the w1 is, the more priority is given to the influence of the CPU factor on the overall load balancing of the physical machine cluster, and the smaller the w1 is, the memory factor is given priority. Impact on overall load balancing of physical machine clusters.
  • the one or more programs are also executable by one or more processors to perform the following operations:
  • the integrated equalization Q is obtained according to the degree of dispersion of the CPU usage of each physical machine and the average usage of the CPU, and the degree of dispersion of the memory usage of each physical machine and the average memory usage.
  • the integrated equalization Q is used to represent the physical machine cluster. Load balancing. Specifically, the weighted calculation is performed by calculating the mean square error of the CPU usage rate and the memory usage rate of all the physical machines.
  • a load balancing device is provided in an embodiment of the present invention.
  • the device 100 is configured to allocate a physical machine to place and operate a virtual machine.
  • the device 100 communicates with a physical machine and a virtual machine respectively, as shown in the figure.
  • the device includes a receiving module 81, an obtaining module 82, an identifying module 83, a first calculating module 84, and an assigning module 85.
  • the receiving module 81 is configured to receive a request of the virtual machine.
  • the obtaining module 82 is configured to acquire the CPU core number and the memory size of the virtual machine and also obtain the current CPU usage and memory usage rate of each physical machine.
  • the CPU central processing unit
  • the CPU central processing unit
  • the number of CPU cores is used to indicate the number of CPU cores.
  • the identification module 83 is configured to identify the consumption type of the virtual machine according to the acquired CPU core number and memory size of the virtual machine.
  • the first calculating module 84 calculates the equalization parameter of each physical machine according to the preset first rule according to the consumption type of the virtual machine and the acquired CPU usage rate and memory usage rate of each physical machine.
  • the allocation module 85 is configured to allocate the virtual machine to the physical machine with the largest equalization parameter.
  • the identification module 83 identifies the consumption type of the virtual machine
  • the consumption type of the virtual machine includes a regular type, a CPU consumption type, and a memory consumption type, and different virtual types of virtual machines occupy different resources, and the CPU
  • the CPU resources occupied by the consumption type are more CPU resources than the memory consumption type and the conventional type; the memory resources occupied by the memory consumption type have more memory resources than the CPU consumption type and the regular type.
  • the identification module 83 further includes a first operation unit 831, a determination unit 832, and a processing unit 833.
  • the first operation unit 831 is configured to calculate a ratio of the obtained CPU core number to the memory size.
  • the determining unit 832 is configured to determine whether the ratio is in the preset first range or the preset second range or the preset third range.
  • the preset second range is greater than the preset first range and the preset third range, and the preset first range is greater than the preset third range.
  • the preset first range is preferably greater than 0.25 and less than 1, and the preset second range is greater than or equal to 1, and the preset third range is less than or equal to 0.25.
  • the processing unit 833 is configured to: if the determining unit 832 determines that the ratio is in the preset first range, identify that the consumption type of the virtual machine is a regular type; determine that the ratio is in the preset second range, and identify that the consumption type of the virtual machine is a CPU consumption type and It is determined that the ratio ratio is in the preset third range, and the consumption type of the recognition virtual machine is a memory consumption type.
  • the first calculation module 84 calculates the equalization parameter of each physical machine, which is the selectivity of the physical machine when comprehensively considering the load balancing of the physical machine cluster as a whole and the load balancing of the internal CPU and memory resources of the physical machine.
  • the first equalization degree S1 is used to indicate the selectivity of the physical machine when considering the load balancing of the physical machine cluster as a whole; and the second equalization degree t is used to represent the load balancing of the internal CPU and memory resources of the physical machine, and the physical machine is used.
  • the first calculation module 84 includes a first calculation unit 841, a setting unit 842, a second calculation unit 843, and a third calculation unit 844 and a fourth calculation unit 845.
  • the first calculating unit 841 is configured to calculate the first equalization degree of each physical machine according to a preset second rule by using the obtained CPU usage and memory usage of each physical machine.
  • the first equalization degree S1 is used to indicate the selectivity of the physical machine when considering load balancing of the entire physical machine cluster. It should be understood that if only the load balancing of the entire cluster is considered, regardless of the individual The internal resources of the machine are balanced, and the virtual machine with the largest current balance S1 is selected to place the virtual machine. It should be understood that if only memory is considered, regardless of the influence factor of the CPU, in order to load balance the physical machine cluster, the virtual machine should be allocated to the physical machine with the lowest memory usage. Similarly, only the CPU is considered, and the memory is not considered. When the impact, the virtual machine should be requested to the physical machine with the lowest CPU usage. In this embodiment, the CPU and memory are considered at the same time. Therefore, the first equalization S1 is related to the CPU usage Ui and the memory usage rate Mi. A balance S1 is a function of CPU usage and memory usage.
  • the first calculation unit 841 includes a second operation unit 8411, a summation unit 8412, a third operation unit 8413, and a fourth operation unit 8414.
  • the second operation unit 8411 is configured to calculate a reciprocal of the current CPU usage of each physical machine and a reciprocal of the memory usage rate.
  • the summation unit 8412 is configured to sum the reciprocal of the CPU usage of all the physical machines to obtain the total CPU weight, and sum the reciprocal of the memory usage of all the physical machines to obtain the total memory weight.
  • the third operation unit 8413 is configured to calculate a ratio of the reciprocal of the CPU usage of each physical machine to the total weight of the CPU, and obtain a ratio of the CPU ratio c and a reciprocal of the memory usage of each physical machine to the total memory weight to obtain a memory ratio. m.
  • the fourth operation unit 8414 is configured to calculate the first equalization degree S1 according to the calculated CPU ratio c of each physical machine and the memory ratio m and the selection weight w1 of the preset CPU relative memory.
  • the relationship between the first equalization degree S1 and the CPU ratio c, the memory ratio m, and the CPU relative memory selection weight w1 is as follows:
  • the preset CPU relative memory selection weight w1 indicates that the CPU influence factor or the memory influence factor is prioritized.
  • the difference between the CPU factor and the memory factor is temporarily ignored, and w1 is set to 0.5.
  • w1 can be set to other values according to the influence degree of the CPU factor or the memory factor.
  • the setting unit 842 is configured to: if the consumption type of the virtual machine is a regular type, give each physical machine The balance parameter is the first equalization of the corresponding physical machine.
  • the second calculating unit 843 is configured to calculate the average CPU usage rate and the average memory usage rate according to the acquired CPU usage rate and memory usage rate of each physical machine if the consumption type of the virtual machine is a CPU consumption type or a memory consumption type.
  • Uavg is used to indicate the average CPU usage of the physical machine cluster
  • Mavg is the average memory usage of the physical machine cluster.
  • the third calculating unit 844 is configured to calculate a second equalization degree of each physical machine according to the acquired CPU usage rate and memory usage rate of each physical machine and the average CPU usage rate and the average memory usage rate.
  • the second equalization degree t represents the selectivity of the physical machine when considering load balancing of the internal CPU and memory resources of the physical machine.
  • the second equalization t is equal to the difference between the ratio of the CPU usage Ui of the physical machine and the memory usage rate Mi to the ratio of the average CPU usage Uavg and the average memory usage ratio Mavg, as shown below:
  • t>0 it means that the CPU usage of the physical machine is relatively higher than the memory usage, that is, the CPU consumption is relatively more memory consumption.
  • the larger t is, the more unbalanced the CPU and memory resources in the physical machine are; when t ⁇ 0 , indicating that the memory usage of the physical machine is relatively high compared to the CPU usage, that is, the memory consumption is relatively large compared to the CPU consumption, and the larger the absolute value of t, the more unbalanced the CPU and memory resources in the physical machine.
  • the fourth calculating unit 845 is configured to calculate an equalization parameter of each physical machine according to the consumption type of the virtual machine, the first equalization degree of each physical machine, and the second equalization degree.
  • the first equalization S1 is used to indicate the selectivity of the physical machine when considering the load balancing of the physical machine cluster as a whole; and the second equalization t represents the selectivity of the physical machine when considering the load balancing of the internal CPU and memory resources of the physical machine.
  • the equalization parameter is related to the consumption type of the virtual machine, the first equalization degree, and the second equalization degree.
  • the equalization parameter S2 has:
  • S2 S1-k ⁇ t n where n is an odd number and k is a positive number.
  • the setting of k and n is to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if S1 and k ⁇ t n
  • the values are on the same order of magnitude. It should be understood that if the consumption type of the virtual machine is CPU consumption type, the physical machine with high memory and high CPU consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equalization degree of the selected physical machine. The value is less than zero.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if S1 and k ⁇ t
  • the values of n are on the same order of magnitude. It should be understood that if the consumption type of the virtual machine is memory consumption type, the physical machine with high CPU memory consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equilibrium degree t value of the selected physical machine. Greater than zero.
  • the physical machine is all allocated 8C/8G and 4C/32G for calculation.
  • the range of Ui/Mi is (0.32, 2.56), so the range of t is (-2.24, 2.24).
  • the equalization parameter S2 If the consumption type of the virtual machine is CPU consumption type, the equalization parameter S2:
  • the equalization parameter S2 has:
  • the second equalization degree t is processed such that the range of t/3 is (-1, 1), and after the third power, the influence of the CPU and the memory resources in the physical machine is unbalanced, and the influence on the equalization parameter S2 is performed.
  • the consumption type of the virtual machine is CPU consumption type
  • the first equalization degree of one physical machine is greater than the first equalization degree of another physical machine
  • the second equalization degree of the one physical machine is smaller than another physical medium.
  • the second equalization degree of the machine, the equalization parameter of the one physical machine is greater than the equalization parameter of the other physical machine; if the consumption type of the virtual machine is the memory consumption type, the first equalization degree and the second equalization degree of one physical machine are respectively greater than another
  • the first equalization degree and the second equalization degree of the physical machine, the equalization parameter of the one physical machine is greater than the equalization parameter of the other physical machine.
  • the load balancing device 100 further includes a second computing module 86 and a third computing module 87.
  • the second calculating module 86 is configured to calculate the average CPU usage and the average memory usage rate according to the current CPU usage and memory usage of each physical machine.
  • the third calculating module 87 is configured to obtain the comprehensive equalization degree Q according to the degree of dispersion of the CPU usage rate of each physical machine and the average usage rate of the CPU, and the degree of dispersion of the memory usage rate of each physical machine and the average memory usage rate.
  • Q is used to represent load balancing of physical machine clusters. Specifically, the weighted calculation is performed by calculating the mean square error of the CPU usage rate and the memory usage rate of all the physical machines.
  • the CPU equalization Q1 of the physical machine cluster is a mean square error calculation for the CPU usage of all physical machines.
  • Mi represents the memory usage of the i-th physical machine
  • Mavg represents the average memory usage of the physical machine cluster.
  • the memory balance Q2 of the physical machine cluster is the mean square error calculation for the memory usage of all physical machines:
  • W2 represents the equalization weight of the CPU relative to the memory when considering the integrated equalization degree. If W2 is larger, it means that the influence of the CPU on the integrated equalization is preferably considered. This is because the impact of CPU and memory on the overall balance may be different. It should be understood that the load balancing situation of the physical machine cluster can be known according to the integrated equalization degree Q. If the integrated equalization degree is smaller, the representation is more balanced.
  • the above load balancing method and device consider the load balancing of the physical machine cluster as a whole, and consider the load balancing of the internal CPU and memory resources of a single physical machine. Therefore, the CPU usage and memory usage of different physical machines are determined by the method. Close, while the CPU usage and memory usage of a single physical machine are also close, which ensures load balancing, and also improves the utilization of resources in each physical machine, so that when the physical machine is fully loaded, the number of running virtual machines increases. If the physical machine is increased in size, the load balancing method can quickly integrate the newly added physical machine into the physical machine cluster, so that the CPU usage and memory usage are close to the average value, so that the physical machine cluster is restored. To equilibrium.
  • the units in the apparatus of the embodiment of the present invention may be combined, divided, and deleted according to actual needs.
  • the above receiving module 81, the obtaining module 82, the identifying module 83, and the like may be embedded in or independent of a load balancing system in hardware, or may be stored in a load balancing manner in software.
  • the processor performs the operations corresponding to the above units.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • FIG. 10 is a hardware structural diagram of a load balancing system according to an embodiment of the present invention.
  • the load balancing system includes one or more processors 1001 and a memory 1002.
  • the processor 1001 and the memory 1002 described above are connected by a bus.
  • the memory 1002 is configured to store one or more programs for implementing load balancing.
  • the memory 1002 of the embodiment of the present invention may be a system memory such as volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.), or a combination of the two.
  • the memory 1002 of the embodiment of the present invention may also be an external memory outside the system, such as a magnetic disk, an optical disk, a magnetic tape, or the like.
  • the processor 1001 is configured to execute a program stored in the memory 1002 to perform the following operations:
  • the processor 1001 executes the program stored in the memory 1002 to perform the process of identifying the consumption type of the virtual machine according to the acquired CPU core number and the memory size, the following operations are specifically performed:
  • the judgment ratio is whether the preset first range or the preset second range or the preset third range.
  • the preset second range is greater than the preset first range and the preset third range, and the preset first range is greater than the preset third range;
  • the consumption type of the identified virtual machine is a regular type
  • the consumption type of the recognition virtual machine is CPU consumption type
  • the consumption type of the recognition virtual machine is a memory consumption type
  • the preset second range is greater than the preset first range and the preset third range
  • the preset A range is greater than the preset third range.
  • the preset first range is: greater than 0.25 and less than 1
  • the preset second range is: greater than or equal to 1
  • the preset third range is less than or equal to 0.25.
  • the processor 1001 executes the program stored in the memory 1002, the processor calculates the location according to the preset first rule according to the consumption type of the virtual machine and the acquired CPU usage rate and memory usage rate of each physical machine.
  • the processor calculates the location according to the preset first rule according to the consumption type of the virtual machine and the acquired CPU usage rate and memory usage rate of each physical machine.
  • the equalization parameter assigned to each physical machine is the first equalization degree of the corresponding physical machine
  • the average CPU usage rate and the average memory usage rate are calculated according to the obtained CPU usage rate and memory usage rate of each physical machine;
  • the equalization parameters of each physical machine are calculated according to the consumption type of the virtual machine, the first equalization degree of each physical machine, and the second equalization degree.
  • the second equalization is equal to the difference between the ratio of the CPU usage and the memory usage of the physical machine to the ratio of the average CPU usage to the average memory usage.
  • the relationship is as follows:
  • t>0 it means that the CPU usage of the physical machine is relatively higher than the memory usage, that is, the CPU consumption is relatively more memory consumption.
  • the larger t is, the more unbalanced the CPU and memory resources in the physical machine are; when t ⁇ 0 , indicating that the memory usage of the physical machine is relatively high compared to the CPU usage, that is, the memory consumption is relatively large compared to the CPU consumption, and the larger the absolute value of t, the more unbalanced the CPU and memory resources in the physical machine.
  • the equalization parameter S2 has:
  • S2 S1-k ⁇ t n where n is an odd number and k is a positive number.
  • the setting of k and n is to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if S1 and k ⁇ t n
  • the values are on the same order of magnitude. It should be understood that if the consumption type of the virtual machine is CPU consumption type, the physical machine with high memory and high CPU consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equalization degree of the selected physical machine. The value is less than zero.
  • the equalization parameter S2 has:
  • n is an odd number
  • k is a positive number
  • k and n are set to make the overall balance of the physical machine cluster and the internal resource balance of the physical machine equivalent, even if S1 and k ⁇ t
  • the values of n are on the same order of magnitude. It should be understood that if the consumption type of the virtual machine is memory consumption type, the physical machine with high CPU memory consumption should be selected to run the virtual machine, thereby balancing the internal resources of the physical machine, and the second equilibrium degree t value of the selected physical machine. Greater than zero.
  • the calculation is performed by allocating 8C/8G and 4C/32G of the physical machine, and the range of Ui/Mi is (0.32, 2.56), so the range of the second equalization t is (-2.24, 2.24).
  • the equalization parameter S2 If the consumption type of the virtual machine is CPU consumption type, the equalization parameter S2:
  • the equalization parameter S2 has:
  • the second equalization degree t is processed such that the range of t/3 is (-1, 1), and after the third power, the influence of the CPU and the memory resources in the physical machine is unbalanced, and the influence on the equalization parameter S2 is performed.
  • the consumption type of the virtual machine is a CPU consumption type
  • a first equalization degree of one physical machine is greater than a first equalization degree of another physical machine
  • a second equalization degree of the one physical machine is smaller than the other a second equalization degree of the physical machine
  • the equalization parameter of the one physical machine is greater than the equalization parameter of the another physical machine
  • the consumption type of the virtual machine is a memory consumption type
  • the first equalization degree of a physical machine The second equalization degree is respectively greater than the first equalization degree and the second equalization degree of the other physical machine, and the equalization parameter of the one physical machine is greater than the equalization parameter of the another physical machine.
  • the processor 1001 executes the program stored in the memory 1002, when the CPU usage rate and the memory usage rate of each physical machine to be acquired are calculated according to a preset second rule, the first equalization degree of each physical machine is calculated. To do the following:
  • the sum of the CPU usage of all physical machines is summed to obtain the total weight of the CPU, and the reciprocal of the memory usage of all physical machines is summed to obtain the total memory weight;
  • the first equalization degree S1 is calculated according to the calculated CPU ratio c of each physical machine and the memory ratio m and the selection weight w1 of the preset CPU relative memory.
  • the relationship between the first equalization degree S1 and the CPU ratio c, the memory ratio m, and the CPU relative memory selection weight w1 is as follows:
  • the preset CPU relative memory selection weight w1 indicates that the CPU influence factor or the memory influence factor is prioritized. The larger the w1 is, the more priority is given to the influence of the CPU factor on the overall load balancing of the physical machine cluster, and the smaller the w1 is, the memory factor is given priority. Impact on overall load balancing of physical machine clusters.
  • processor 1001 executes the program stored in the memory 1002, the following operations are also performed:
  • the integrated equalization Q is obtained according to the degree of dispersion of the CPU usage of each physical machine and the average usage of the CPU, and the degree of dispersion of the memory usage of each physical machine and the average memory usage.
  • the integrated equalization Q is used to represent the physical machine cluster. Load balancing. Specifically, the weighted calculation is performed by calculating the mean square error of the CPU usage rate and the memory usage rate of all the physical machines.
  • the processor in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be another general-purpose processor, a digital signal processor (DSP), and an application specific integrated circuit (Application). Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the disclosed apparatus and method can be In other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

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)
  • Multi Processors (AREA)

Abstract

一种负载均衡方法、装置、计算机可读存储介质及系统,方法包括:若接收虚拟机的请求,获取虚拟机的CPU核数和内存大小(S101);根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型(S102);获取每个物理机当前的CPU使用率和内存使用率(S103);根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数(S104);将虚拟机分配给均衡参数最大的物理机(S105)。上述方法通过计算出均衡参数来分配物理机以供虚拟机运行,实现物理机的负载均衡

Description

一种负载均衡的方法、装置、计算机可读存储介质及系统 技术领域
本发明涉及计算机技术领域,尤其涉及一种负载均衡的方法、装置、计算机可读存储介质及系统。
背景技术
现有云计算平台上默认采用的虚拟机分配算法是随即算法,容易导致各个物理机的负载差异很大,部分物理机因为负载过大而带来宕机的风险,或者部分物理机因某种负载过小而带来资源的浪费。
发明内容
本发明实施例提供一种负载均衡的方法及其装置,可以实现各个物理机的负载均衡。
第一方面,本发明实施例提供了一种负载均衡的方法,该方法包括:若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小;根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;获取每个物理机当前的CPU使用率和内存使用率;根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;将虚拟机分配给均衡参数最大的物理机。
另一方面,本发明实施例提供了一种负载均衡装置,该装置包括获取模块、识别模块、第一计算模块和分配模块,其中,获取模块用于若接收虚拟机的请求,获取虚拟机的CPU核数和内存大小以及还用于获取每个物理机当前的CPU使用率和内存使用率;识别模块用于根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;第一计算模块用于根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;分配模块用于将虚拟机分配给均衡参数最大的物理机。
另一方面,本发明实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有一个或者一个以上程序,一个或者一个以上程序可被一个或者一个以上的处理器执行,以执行以下操作:
若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小;根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;获取每个物理机当前的CPU使用率和内存使用率;根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;将虚拟机分配给均衡参数最大的物理机。
另一方面,本发明实施例提供了一种负载均衡系统,系统包括一个或者一个以上的处理器,以及与一个或者一个以上处理器连接的一个或者一个以上存储器,
存储器,用于存储用于实现负载均衡的一个或者一个以上程序;处理器,用于执行存储器中存储的程序,以执行以下操作:
若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小;根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;获取每个物理机当前的CPU使用率和内存使用率;根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;将虚拟机分配给均衡参数最大的物理机。
本发明实施例通过计算出每个物理机的均衡参数,再根据均衡参数确定放置虚拟机的物理机,由于均衡参数与物理机的CPU使用率、内存使用率和虚拟机的消耗类型相关,其中每个物理机的CPU使用率以及内存使用率与物理机集群的均衡相关、虚拟机的消耗类型又与每个物理机内部CPU和内存均衡相关,因此该方法即考虑了物理机集群整体的均衡又考虑了单个物理机内部资源的负载均衡,因此更有效的实现了物理机集群的负载均衡。
附图说明
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供一种负载均衡的方法的示意流程图;
图2是提供的一种物理机集群负载不均衡的折线图;
图3是图1的子流程示意图;
图4是图1的子流程示意图;
图5是图4的子流程示意图;
图6是本发明实施例提供一种物理机集群负载均衡的折线图;
图7是本发明实施例提供一种物理机集群负载均衡的散点图;
图8是本发明实施例提供一种负载均衡装置的组成示意图。
图9是本发明实施例提供第一计算单元的组成示意图。
图10是本发明实施例提供的一种负载均衡系统的硬件结构图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组建的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组建和/或其集合的存在或添加。还应当理解,在此本发明说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本发明。如在本发明说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。还应当进一步理解,在本发明说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
在云计算平台的数据中心有多主机组成的集群,一个集群中包括若干个物理机,物理机是用于运行虚拟机的主机。由于不断接收来自虚拟机的请求,需要分配物理机来放置虚拟机,因此需要根据物理机的负载从物理机集群中选择负载相对小的物理机来运行虚拟机,进而实现物理机集群的负载均衡。请参看图1,本发明实施例提供的一种负载均衡的方法,如图所示,负载均衡的方法包括S100~S106。
S100,开始。
S101,若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小。CPU (central processing unit)是中央处理器的缩写,CPU核数用于表示CPU核心的数量。
S102,根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型。具体的,虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,不同消耗类型的虚拟机的对资源的占用不同,CPU消耗型所占用的CPU资源相比内存消耗型和常规类型占用的CPU资源多;内存消耗型所占用的内存资源相比CPU消耗型和常规类型占用的内存资源多。而部分物理机内部CPU和内存的资源存在不均衡,因此需要考虑物理机内部资源的均衡以及虚拟机的消耗类型,将虚拟机放置于较佳的物理机上来实现物理机内部的资源均衡。具体实现过程为根据获取的CPU核数和内存大小的比值来判断虚拟机的消耗类型。
S103,获取每个物理机当前的CPU使用率和内存使用率。本实施例中,用Ui表示第i个物理机的CPU使用率,Mi表示第i个物理机的内存使用率。
S104,根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数。本实施例中,用S2表示均衡参数。
均衡参数S2用于表示综合考虑物理机集群整体的负载均衡以及物理机内部CPU和内存资源的负载均衡时,物理机的选择性。物理机的均衡参数S2越大,则优选考虑该物理机来放置虚拟机。
预设第一规则用于表示虚拟机的消耗类型、获取的每个物理机的CPU使用率和内存使用率与均衡参数的关系,针对不同消耗类型的虚拟机,物理机的均衡参数与物理机的CPU使用率和内存使用率的关系式不同。具体的,若虚拟机的消耗类型为CPU消耗型或者内存消耗型,物理机的均衡参数还与物理机的CPU使用率以及内存使用率的比值相关,若虚拟机的消耗类型为常规类型,物理机的均衡参数与物理机的CPU使用率以及内存使用率的比值无关。
S105,将虚拟机分配给均衡参数最大的物理机。由于均衡参数S2用于表示综合考虑物理机集群整体的负载均衡以及物理机内部CPU和内存资源的负载均衡时,物理机的选择性。物理机均衡参数S2越大,则优选考虑该物理机来放置虚拟机。因此将虚拟机分配给均衡参数S2最大的物理机,以此来实现物理机集群的负载均衡,应当理解,物理机集群的负载均衡包括物理机彼此之间的负载均衡以及单个物理机内部资源的均衡。
S106,结束。
需要说明的是,基于物理机内部存在CPU和内存资源的不均衡以及不同消耗类型的虚拟机消耗CPU或者内存的不同,S102中识别虚拟机的消耗类型是有必要的。请参看图2,如图2所示图中所示L1为CPU使用率,L2为内存使用率,其中16~20这几个物理机出现了CPU使用率高而内存使用率低的情况,相差较大,会导致这几个物理机的资源利用率不高,在满负荷时,容易造成CPU或内存较大的浪费,且容易导致物理机内CPU和内存的均衡问题。因此需要考虑单个物理机内部的内存和CPU资源的负载均衡。首先需要识别虚拟机的类型,进而根据虚拟机的消耗类型和各个物理机内部资源的情况分配适宜的物理机,例如虚拟机为CPU消耗型时,应该选择内存相对CPU消耗高的物理机来放置虚拟机;虚拟机为内存消耗型时,应该选择CPU相对内存消耗高的物理机来放置虚拟机。请参看图3,本发明实施例提供的图1的子流程示意图,如图所示,S102根据获取的CPU核数和内存大小识别虚拟机的消耗类型,包括:
S301,计算获取的虚拟机的CPU核数与内存大小的比值。
S302,判断比值是在预设第一范围还是预设第二范围或是预设第三范围。其中预设第二范围大于预设第一范围和预设第三范围,预设第一范围大于预设第三范围。本实施例中优选预设第一范围为:大于0.25且小于1,预设第二范围为:大于或等于1,预设第三范围为小于或等于0.25。
S303,若比值在预设第一范围,识别虚拟机的消耗类型为常规类型。
S304,若比值在预设第二范围,识别虚拟机的消耗类型为CPU消耗型。
S305,若比值在预设第三范围,识别虚拟机的消耗类型为内存消耗型。
上述方法,根据虚拟机的CPU核数以及内存大小识别消耗类型,所识别的消耗类型用于考虑物理机内部资源的均衡时选择物理机。
还需要说明的是,S104中计算的均衡参数S2用于表示综合考虑物理机集群整体的负载均衡以及物理机内部CPU和内存资源的负载均衡时,物理机的选择性。本实施例中,用第一均衡度S1表示考虑物理机集群整体的负载均衡时,物理机的选择性;用第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。
请参看图4,如图所示,S104根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机 的均衡参数,包括S401~S405:
S401,将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度。
具体的,第一均衡度S1用于表示考虑物理机集群整体的负载均衡时,物理机的选择性。应当理解,若只考虑整个集群整体的负载均衡,而不考虑各个物理机内部资源均衡,将选择当前第一均衡度S1最大的物理机来放置虚拟机。
应当理解若只考虑内存,而不考虑CPU的影响因素时,为了物理机集群的负载均衡,应当将虚拟机分配给当前内存使用率最低的物理机,同理,只考虑CPU,不考虑内存的影响时,应当将虚拟机的请求给当前CPU使用率最低的物理机,本实施例同时考虑CPU以及内存的影响,因此第一均衡度S1与CPU使用率Ui和内存使用率Mi均相关,第一均衡度S1与CPU使用率以及内存使用率成函数关系。
预设第二规则用于表示每个物理机的CPU使用率和内存使用率与第一均衡度的关系,本实施例中,预设第二规则具体为:若CPU和内存对第一均衡度的影响程度相同时或者两者之间的影响程度差可以忽略,一个物理机的CPU使用率和内存使用率分别大于另一物理机的CPU使用率和内存使用率,则该一个物理机的第一均衡度S1小于另一物理机的第一均衡度S1;若CPU和内存对第一均衡度的影响差异不可忽略,第一均衡度与CPU使用率、内存使用率以及CPU相对内存的选择权重w1有关,选择权重W1用于表示CPU和内存对第一均衡度的影响程度差异。
请参照图5,如图所示,S401将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度,包括S501~S504:
S501,计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数。
S502,对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重。
S503,计算每个物理机的CPU使用率的倒数与CPU总权重的比值得到CPU占比c以及每个物理机的内存使用率的倒数与内存总权重的比值得到内存占比m。例如三个物理机的CPU使用率为1/3/、1/3、以及1/4,则此三个物理机的CPU使用率的倒数为3、3、4,CPU总权重为3+3+4=10,三个物理机的CPU占比c分别为3/10、3/10以及4/10,或者三个物理机的内存使用率为1/3/、1/3、 以及1/4,则此三个物理机的内存使用率的倒数为3、3、4,内存总权重为3+3+4=10,三个物理机的内存占比m分别为3/10、3/10以及4/10。
S504,根据所计算出的每个物理机的CPU占比c以及内存占比m和预设的CPU相对内存的选择权重w1计算出第一均衡度S1。第一均衡度S1与CPU占比c、内存占比m、CPU相对内存的选择权重w1的关系如下:
S1=c×w1+m×(1-w1)
其中预设的CPU相对内存的选择权重w1表示优先考虑CPU影响因素或者内存影响因素,w1越大表示更优先考虑CPU因素对物理机集群整体负载均衡的影响,w1越小表示更优先考虑内存因素对物理机集群整体负载均衡的影响。本实施例优选忽略CPU因素或内存因素的影响区别,将w1设置为0.5,其它可行的实施例中,w1可以根据CPU因素或者内存因素的影响程度设置为其他数值。
由于本实施例中优选w1等于0.5,此时预设第二规则为一个物理机的CPU使用率和内存使用率分别大于另一物理机的CPU使用率和内存使用率,该一个物理机的第一均衡度S1小于另一物理机的第一均衡度S1。
S402,若虚拟机的消耗类型是常规类型,赋予每个物理机的均衡参数为对应物理机的第一均衡度。
具体的,若虚拟机的消耗类型为常规类型,因为虚拟机的消耗类型为常规类型时,分配该虚拟机给物理机后,不会对物理机内部资源造成额外的不均衡。
S403,若虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率。
具体的,本实施例中用Uavg表示物理机集群的CPU平均使用率,Mavg表示物理机集群的内存平均使用率。需要说明的是,若虚拟机的消耗类型是CPU消耗型或内存消耗型,计算物理机的均衡参数还包括S404和S405。
S404,根据获取的每个物理机的CPU使用率和内存使用率以及CPU平均使用率和内存平均使用率计算出每个物理机的第二均衡度。
用第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。第二均衡度t等于物理机的CPU使用率Ui和内存使用率Mi的比值与CPU平均使用率Uavg和内存平均使用率Mavg比值的差,关系如下所示:
Figure PCTCN2017076514-appb-000001
当t﹥0是,表示此物理机的CPU使用率相对内存使用率较多即CPU消耗相对内存消耗较多,t越大表示该物理机内CPU和内存资源越不均衡;当t﹤0时,表示此物理机的内存使用率相对CPU使用率较多,即内存消耗相对CPU消耗较多,t的绝对值越大,表示该物理机内CPU和内存资源越不均衡。
S405,根据虚拟机的消耗类型、每个物理机的第一均衡度以及第二均衡度计算出每个物理机的均衡参数。
由于第一均衡度S1用于表示考虑物理机集群整体的负载均衡时,物理机的选择性;而第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。而虚拟机的消耗类型为CPU消耗型或者内存消耗型时,虚拟机放置在物理机上后均会对物理机内部资源的均衡造成影响。因此均衡参数与虚拟机的消耗类型、第一均衡度以及第二均衡度相关。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2有:
S2=S1-k×tn
其中,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为CPU消耗型,应该选择内存相对CPU消耗高的物理机来运行虚拟机,以此来均衡物理机的内部资源,所选择的物理机的第二均衡度t值小于零。
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
S2=S1+k×tn
同理,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为内存消耗型,应该选择CPU相对内存消耗高的物理机来运行虚拟机,以此来均衡物理机内部资源,所选择的物理机的第二均衡度t值大于零。
本实施例中,将物理机全部分配8C/8G和4C/32G情况进行计算获知,Ui/Mi的范围为(0.32,2.56),因此第二均衡度t的范围为(-2.24,2.24)。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2:
Figure PCTCN2017076514-appb-000002
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
Figure PCTCN2017076514-appb-000003
其中,对第二均衡度t进行处理,使t/3的范围为(-1,1),再3次方后,使物理机内CPU和内存资源越不均衡时,对均衡参数S2的影响越大,再除以1000,使物理机内部资源的均衡对均衡参数S2的影响程度与物理机集群整体均衡的影响程度在同一等级。
从上述关系式可知,若虚拟机的消耗类型是CPU消耗型,一个物理机的第一均衡度大于另一物理机的第一均衡度,且该一个物理机的第二均衡度小于另一物理机的第二均衡度,该一个物理机的均衡参数大于另一物理机的均衡参数;若虚拟机的消耗类型是内存消耗型,一个物理机的第一均衡度和第二均衡度分别大于另一物理机的第一均衡度和第二均衡度,该一个物理机的均衡参数大于另一物理机的均衡参数。
应当理解,利用上述负载均衡的方法,即考虑了物理机集群整体的负载均衡,又考虑了单个物理机内部CPU和内存资源的负载均衡,因此通过该方法使不同物理机的CPU使用率和内存使用率接近,同时单个物理机内部的CPU使用率和内存使用率也接近,进而即保证了物理机彼此之间的负载均衡以及单个物理机内部资源的均衡,同时还提高了各个物理机内资源的利用率,使物理机满载时,运行的虚拟机数量增加了。请参看图6和图7,图中所示为使用上述负载均衡方法后,物理机的CPU使用率和内存使用率的折线图和散点图,图中所示L1为CPU使用率,L2为内存使用率。
相较于上述方法,进一步地,为了衡量物理机集群的均衡情况,采用综合均衡度以及接收的虚拟机的数量作为衡量标准,综合均衡度越低,表示物理机集群的负载越加均衡;处理的虚拟机越多,表示物理机内资源利用率越高。负载均衡方法还包括:
根据每个物理机当前的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率。
根据每个物理机的CPU使用率与CPU平均使用率的离散程度以及每个物理机的内存使用率与内存平均使用率的离散程度获取综合均衡度Q,综合均衡度Q用于表示物理机集群的负载均衡度。具体的,通过对所有物理机的CPU使用率以及内存使用率分别进行均方误差计算后进行加权计算。
具体的,若Ui表示第i个物理机的CPU使用率,Uavg表示物理机集群的CPU平均使用率,则物理机集群的CPU均衡度Q1为对所有物理机的CPU使用率进行均方误差计算:
Figure PCTCN2017076514-appb-000004
若Mi表示第i个物理机的内存使用率,Mavg表示物理机集群的内存平均使用率。物理机集群的内存均衡度Q2为对所有物理机的内存使用率进行均方误差计算:
Figure PCTCN2017076514-appb-000005
则对所计算出来的CPU均衡度以及内存均衡度进行加权计算,综合均衡度Q有:
Q=Q1×W2+Q2×(1-W2)
其中,W2表示考虑综合均衡度时,CPU相对内存的均衡权重,若W2越大,表示优选考虑CPU对综合均衡度的影响。这是因为CPU和内存对综合均衡度的影响可能是不同的。本实施例中,暂时设定CPU和内存对综合均衡度的影响相近,忽略之间的差异,取W2为0.5。
应当理解,根据综合均衡度Q可获知该物理机集群的负载均衡情况,若综合均衡度越小,表示越均衡,因此可以实时根据综合均衡度Q监控物理机集群的负载均衡的程度,以便及时调节物理机集群的负载均衡或者利用综合均衡度Q来监控是否出现了异常的分配虚拟机的情况。另一方面,还可以根据综合均衡度Q调整第一均衡度、第二均衡度的计算方式或者根据综合均衡度Q调整第一均衡度、第二均衡度与均衡参数之间的关系,以便物理机集群的负载更加均衡。
还应当理解,若在实际情况中,为了扩大规模,需要增加物理机,使用该 负载均衡的方法后,增加物理机后,刚增加的物理机的CPU使用率和内存使用率为零,远远偏离各自均值,物理机集群的当前的综合均衡度Q将会上升,系统相对不均衡,但是根据负载均衡方法,将会优先分配虚拟机给新增的物理机,因此,物理机集群的综合均衡度Q将会下降直至平稳,因此新增的物理机可以快速的融入物理机集群中,且物理机集群相对快速的恢复至均衡状态。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器、磁盘或光盘等。
本发明还提供了一种计算机可读存储介质,计算机可读存储介质存储有一个或者一个以上程序,一个或者一个以上程序可被一个或者一个以上的处理器执行,以执行以下操作:
若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小;
根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;
获取每个物理机当前的CPU使用率和内存使用率;
根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;
将虚拟机分配给均衡参数最大的物理机。
优选地,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型时,具体执行以下操作:
计算获取的虚拟机的CPU核数与内存大小的比值;
判断比值是在预设第一范围还是预设第二范围或是预设第三范围。其中预设第二范围大于预设第一范围和预设第三范围,预设第一范围大于预设第三范围;
若比值在预设第一范围,识别虚拟机的消耗类型为常规类型;
若比值在预设第二范围,识别虚拟机的消耗类型为CPU消耗型;
若比值在预设第三范围,识别虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。优选预设第一范围为:大于0.25且小于1,预设第二 范围为:大于或等于1,预设第三范围为小于或等于0.25。
优选地,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数时,具体执行以下操作:
将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
若虚拟机的消耗类型是常规类型,赋予每个物理机的均衡参数为对应物理机的第一均衡度;
若虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
根据获取的每个物理机的CPU使用率和内存使用率以及CPU平均使用率和内存平均使用率计算出每个物理机的第二均衡度;
根据虚拟机的消耗类型、每个物理机的第一均衡度以及第二均衡度计算出每个物理机的均衡参数。
优选地,第二均衡度等于物理机的CPU使用率和内存使用率的比值与CPU平均使用率和内存平均使用率比值的差。关系如下所示:
Figure PCTCN2017076514-appb-000006
当t﹥0是,表示此物理机的CPU使用率相对内存使用率较多即CPU消耗相对内存消耗较多,t越大表示该物理机内CPU和内存资源越不均衡;当t﹤0时,表示此物理机的内存使用率相对CPU使用率较多,即内存消耗相对CPU消耗较多,t的绝对值越大,表示该物理机内CPU和内存资源越不均衡。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2有:
S2=S1-k×tn
其中,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为CPU消耗型,应该选择内存相对CPU消耗高的物理机来运行虚拟机,以此来均衡物理机的内部资源,所选择的物理机的第二均衡度t值小于零。
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
S2=S1+k×tn
同理,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为内存消耗型,应该选择CPU相对内存消耗高的物理机来运行虚拟机,以此来均衡物理机内部资源,所选择的物理机的第二均衡度t值大于零。
本实施例中,将物理机全部分配8C/8G和4C/32G情况进行计算获知,Ui/Mi的范围为(0.32,2.56),因此第二均衡度t的范围为(-2.24,2.24)。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2:
Figure PCTCN2017076514-appb-000007
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
Figure PCTCN2017076514-appb-000008
其中,对第二均衡度t进行处理,使t/3的范围为(-1,1),再3次方后,使物理机内CPU和内存资源越不均衡时,对均衡参数S2的影响越大,再除以1000,使物理机内部资源的均衡对均衡参数S2的影响程度与物理机集群整体均衡的影响程度在同一等级。
优选地,若所述虚拟机的消耗类型是CPU消耗型,一个物理机的第一均衡度大于另一物理机的第一均衡度,且所述一个物理机的第二均衡度小于所述另一物理机的第二均衡度,所述一个物理机的均衡参数大于所述另一物理机的均衡参数;若所述虚拟机的消耗类型是内存消耗型,一个物理机的第一均衡度和第二均衡度分别大于另一物理机的第一均衡度和第二均衡度,所述一个物理机的均衡参数大于所述另一物理机的均衡参数。
优选地,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算 出每个物理机的第一均衡度时,具体执行以下操作:
计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
计算每个物理机的CPU使用率的倒数与CPU总权重的比值得到CPU占比c以及每个物理机的内存使用率的倒数与内存总权重的比值得到内存占比m;
根据所计算出的每个物理机的CPU占比c以及内存占比m和预设的CPU相对内存的选择权重w1计算出第一均衡度S1。
第一均衡度S1与CPU占比c、内存占比m、CPU相对内存的选择权重w1的关系如下:
S1=c×w1+m×(1-w1)
其中预设的CPU相对内存的选择权重w1表示优先考虑CPU影响因素或者内存影响因素,w1越大表示更优先考虑CPU因素对物理机集群整体负载均衡的影响,w1越小表示更优先考虑内存因素对物理机集群整体负载均衡的影响。
优选地,所述一个或者一个以上程序还可被一个或者一个以上的处理器执行,以执行以下操作:
根据每个物理机当前的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
根据每个物理机的CPU使用率与CPU平均使用率的离散程度以及每个物理机的内存使用率与内存平均使用率的离散程度获取综合均衡度Q,综合均衡度Q用于表示物理机集群的负载均衡。具体的,通过对所有物理机的CPU使用率以及内存使用率分别进行均方误差计算后进行加权计算。
请参看图8,本发明实施例提供的一种负载均衡装置,该装置100用于分配物理机给虚拟机放置运行,该装置100分别与物理机以及虚拟机通讯,如图所示,负载均衡装置包括接收模块81、获取模块82、识别模块83、第一计算模块84和分配模块85。
其中接收模块81用于接收虚拟机的请求。
获取模块82用于获取虚拟机的CPU核数和内存大小以及还用于获取每个物理机当前的CPU使用率和内存使用率。CPU(central processing unit)是中央处理器的缩写,CPU核数用于表示CPU核心的数量。
识别模块83用于根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型。
第一计算模块84根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数。
分配模块85用于将虚拟机分配给均衡参数最大的物理机。
具体的,识别模块83识别虚拟机的消耗类型时,本实施例中,虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,不同消耗类型的虚拟机的对资源的占用不同,CPU消耗型所占用的CPU资源相比内存消耗型和常规类型占用的CPU资源多;内存消耗型所占用的内存资源相比CPU消耗型和常规类型占用的内存资源多。识别模块83还包括第一运算单元831、判断单元832以及处理单元833。
其中第一运算单元831用于计算获取的CPU核数与内存大小的比值。
判断单元832用于判断比值是在预设第一范围还是预设第二范围或是预设第三范围。其中预设第二范围大于预设第一范围和预设第三范围,预设第一范围大于预设第三范围。本实施例中优选预设第一范围为:大于0.25且小于1,预设第二范围为:大于或等于1,预设第三范围为小于或等于0.25。
处理单元833用于如判断单元832判断出比值在预设第一范围,识别虚拟机的消耗类型为常规类型;判断出比值在预设第二范围,识别虚拟机的消耗类型为CPU消耗型以及判断出比值比值在预设第三范围,识别虚拟机的消耗类型为内存消耗型。
需要说明的是,第一计算模块84计算出每个物理机的均衡参数,是综合考虑物理机集群整体的负载均衡以及物理机内部CPU和内存资源的负载均衡时,物理机的选择性。本实施例中,用第一均衡度S1表示考虑物理机集群整体的负载均衡时,物理机的选择性;用第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。第一计算模块84包括第一计算单元841、设置单元842、第二计算单元843以及第三计算单元844和第四计算单元845。
第一计算单元841用于将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度。
具体的,第一均衡度S1用于表示考虑物理机集群整体的负载均衡时,物理机的选择性。应当理解,若只考虑整个集群整体的负载均衡,而不考虑各个物 理机内部资源均衡,将选择当前第一均衡度S1最大的物理机来放置虚拟机。应当理解若只考虑内存,而不考虑CPU的影响因素时,为了物理机集群的负载均衡,应当将虚拟机分配给当前内存使用率最低的物理机,同理,只考虑CPU,不考虑内存的影响时,应当将虚拟机的请求给当前CPU使用率最低的物理机,本实施例同时考虑CPU以及内存的影响,因此第一均衡度S1与CPU使用率Ui和内存使用率Mi均相关,第一均衡度S1与CPU使用率以及内存使用率成函数关系。
请参看图9,第一计算单元841包括第二运算单元8411、求和单元8412、第三运算单元8413以及第四运算单元8414。
其中,第二运算单元8411用于计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数。
求和单元8412用于对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重。
第三运算单元8413用于计算每个物理机的CPU使用率的倒数与CPU总权重的比值得到CPU占比c以及每个物理机的内存使用率的倒数与内存总权重的比值得到内存占比m。
第四运算单元8414用于根据所计算出的每个物理机的CPU占比c以及内存占比m和预设的CPU相对内存的选择权重w1计算出第一均衡度S1。
第一均衡度S1与CPU占比c、内存占比m、CPU相对内存的选择权重w1的关系如下:
S1=c×w1+m×(1-w1)
其中预设的CPU相对内存的选择权重w1表示优先考虑CPU影响因素或者内存影响因素,w1越大表示更优先考虑CPU因素对物理机集群整体负载均衡的影响,w1越小表示更优先考虑内存因素对物理机集群整体负载均衡的影响。本实施例暂时忽略CPU因素或内存因素的影响区别,将w1设置为0.5,其它可行的实施例中,w1可以根据CPU因素或者内存因素的影响程度设置为其他数值。
应当理解,由于本实施例中w1等于0.5,因此若一个物理机的CPU使用率和内存使用率分别大于另一物理机的CPU使用率和内存使用率,该一个物理机的第一均衡度S1小于另一物理机的第一均衡度S1。
设置单元842用于若虚拟机的消耗类型是常规类型,赋予每个物理机的均 衡参数为对应物理机的第一均衡度。
第二计算单元843用于若虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率。
具体的,本实施例中用Uavg表示物理机集群的CPU平均使用率,Mavg表示物理机集群的内存平均使用率。
第三计算单元844用于根据获取的每个物理机的CPU使用率和内存使用率以及CPU平均使用率和内存平均使用率计算出每个物理机的第二均衡度。
用第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。第二均衡度t等于物理机的CPU使用率Ui和内存使用率Mi的比值与CPU平均使用率Uavg和内存平均使用率Mavg比值的差,关系如下所示:
Figure PCTCN2017076514-appb-000009
当t﹥0是,表示此物理机的CPU使用率相对内存使用率较多即CPU消耗相对内存消耗较多,t越大表示该物理机内CPU和内存资源越不均衡;当t﹤0时,表示此物理机的内存使用率相对CPU使用率较多,即内存消耗相对CPU消耗较多,t的绝对值越大,表示该物理机内CPU和内存资源越不均衡。
第四计算单元845用于根据虚拟机的消耗类型、每个物理机的第一均衡度以及第二均衡度计算出每个物理机的均衡参数。
由于第一均衡度S1用于表示考虑物理机集群整体的负载均衡时,物理机的选择性;而第二均衡度t表示考虑物理机内部CPU和内存资源的负载均衡时,物理机的选择性。而虚拟机的消耗类型为CPU消耗型或者内存消耗型时,虚拟机放置在物理机上后均会对物理机内部资源的均衡造成影响。因此均衡参数与虚拟机的消耗类型、第一均衡度以及第二均衡度相关。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2有:
S2=S1-k×tn其中,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为CPU消耗型,应该选择内存相对CPU消耗高的物理机来运行虚拟机,以此来均衡物理机的内部资源,所选择的物理机的第二均衡度t值小于零。
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
S2=S1+k×tn,同理,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为内存消耗型,应该选择CPU相对内存消耗高的物理机来运行虚拟机,以此来均衡物理机内部资源,所选择的物理机的第二均衡度t值大于零。
本实施例中,将物理机全部分配8C/8G和4C/32G情况进行计算获知,Ui/Mi的范围为(0.32,2.56),因此t的范围为(-2.24,2.24)。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2:
Figure PCTCN2017076514-appb-000010
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
Figure PCTCN2017076514-appb-000011
其中,对第二均衡度t进行处理,使t/3的范围为(-1,1),再3次方后,使物理机内CPU和内存资源越不均衡时,对均衡参数S2的影响越大,再除以1000,使物理机内部资源的均衡对均衡参数S2的影响程度与物理机集群整体均衡的影响程度在同一等级。
从上述关系式可知,若虚拟机的消耗类型是CPU消耗型,一个物理机的第一均衡度大于另一物理机的第一均衡度,且该一个物理机的第二均衡度小于另一物理机的第二均衡度,该一个物理机的均衡参数大于另一物理机的均衡参数;若虚拟机的消耗类型是内存消耗型,一个物理机的第一均衡度和第二均衡度分别大于另一物理机的第一均衡度和第二均衡度,该一个物理机的均衡参数大于另一物理机的均衡参数。
还需要说明的是,为了衡量物理机集群的均衡情况,采用综合均衡度以及接收的虚拟机的数量作为衡量标准,综合均衡度越低,表示物理机集群的负载越加均衡;处理的虚拟机越多,表示物理机内资源利用率越高。该负载均衡装置100还包括第二计算模块86以及第三计算模块87。
其中第二计算模块86用于根据每个物理机当前的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率。
第三计算模块87用于根据每个物理机的CPU使用率与CPU平均使用率的离散程度以及每个物理机的内存使用率与内存平均使用率的离散程度获取综合均衡度Q,综合均衡度Q用于表示物理机集群的负载均衡。具体的,通过对所有物理机的CPU使用率以及内存使用率分别进行均方误差计算后进行加权计算。
具体的,若Ui表示第i个物理机的CPU使用率,Uavg表示物理机集群的CPU平均使用率,则物理机集群的CPU均衡度Q1为对所有物理机的CPU使用率进行均方误差计算:
Figure PCTCN2017076514-appb-000012
若Mi表示第i个物理机的内存使用率,Mavg表示物理机集群的内存平均使用率。物理机集群的内存均衡度Q2为对所有物理机的内存使用率进行均方误差计算:
Figure PCTCN2017076514-appb-000013
则对所计算出来的CPU均衡度以及内存均衡度进行加权计算,综合均衡度Q有:
Q=Q1×W2+Q2×(1-W2)
其中,W2表示考虑综合均衡度时,CPU相对内存的均衡权重,若W2越大,表示优选考虑CPU对综合均衡度的影响。这是因为CPU和内存对综合均衡度的影响可能是不同的。应当理解,根据综合均衡度Q可获知该物理机集群的负载均衡情况,若综合均衡度越小,表示越均衡。
上述负载均衡的方法和装置,即考虑了物理机集群整体的负载均衡,又考虑了单个物理机内部CPU和内存资源的负载均衡,因此通过该方法使不同物理机的CPU使用率和内存使用率接近,同时单个物理机内部的CPU使用率和内存使用率也接近,进而即保证了负载均衡,同时还提高了各个物理机内资源的利用率,使物理机满载时,运行的虚拟机数量增加了,且若扩大规模增加物理机时,通过该负载均衡的方法可以使新增的物理机快速融入物理机集群中,使其CPU使用率和内存使用率与均值快速接近,使物理机集群恢复至均衡状态。
需要说明的是,本发明实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本发明实施例装置中的单元可以根据实际需要进行合并、划分和删减。
另一方面,在硬件实现上,以上接收模块81、获取模块82以及识别模块83等可以以硬件形式内嵌于或独立于一种负载均衡系统中,也可以以软件形式存储于一种负载均衡系统的存储器中,以便于处理器执行以上各个单元对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
如图10所示,图10是本发明实施例提供的一种负载均衡系统的硬件结构图,在本实施例中,该一种负载均衡系统包括一个或者一个以上处理器1001、以及存储器1002。上述处理器1001以及存储器1002通过总线连接。
存储器1002,用于存储用于实现负载均衡的一个或者一个以上程序。具体实现中,本发明实施例的存储器1002可以是系统存储器,比如,挥发性的(诸如RAM),非易失性的(诸如ROM,闪存等),或者两者的结合。具体实现中,本发明实施例的存储器1002还可以是系统之外的外部存储器,比如,磁盘、光盘、磁带等。
处理器1001,用于执行存储器1002中存储的程序,以执行以下操作:
若接收虚拟机的请求,则获取虚拟机的CPU核数和内存大小;
根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型;
获取每个物理机当前的CPU使用率和内存使用率;
根据虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出每个物理机的均衡参数;
将虚拟机分配给均衡参数最大的物理机。
优选地,处理器1001执行存储器1002中存储的程序时,以执行根据获取的虚拟机的CPU核数和内存大小识别虚拟机的消耗类型时,具体执行以下操作:
计算获取的虚拟机的CPU核数与内存大小的比值;
判断比值是在预设第一范围还是预设第二范围或是预设第三范围。其中预设第二范围大于预设第一范围和预设第三范围,预设第一范围大于预设第三范围;
若比值在预设第一范围,识别虚拟机的消耗类型为常规类型;
若比值在预设第二范围,识别虚拟机的消耗类型为CPU消耗型;
若比值在预设第三范围,识别虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。优选预设第一范围为:大于0.25且小于1,预设第二范围为:大于或等于1,预设第三范围为小于或等于0.25。
优选地,处理器1001执行存储器1002中存储的程序时,以执行根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数时,具体执行以下操作:
将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
若虚拟机的消耗类型是常规类型,赋予每个物理机的均衡参数为对应物理机的第一均衡度;
若虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
根据获取的每个物理机的CPU使用率和内存使用率以及CPU平均使用率和内存平均使用率计算出每个物理机的第二均衡度;
根据虚拟机的消耗类型、每个物理机的第一均衡度以及第二均衡度计算出每个物理机的均衡参数。
优选地,第二均衡度等于物理机的CPU使用率和内存使用率的比值与CPU平均使用率和内存平均使用率比值的差。关系如下所示:
Figure PCTCN2017076514-appb-000014
当t﹥0是,表示此物理机的CPU使用率相对内存使用率较多即CPU消耗相对内存消耗较多,t越大表示该物理机内CPU和内存资源越不均衡;当t﹤0时,表示此物理机的内存使用率相对CPU使用率较多,即内存消耗相对CPU消耗较多,t的绝对值越大,表示该物理机内CPU和内存资源越不均衡。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2有:
S2=S1-k×tn其中,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为CPU消耗型,应该选择内存相对CPU消耗高的物理机来运行虚拟机,以此来均衡物理机的内部资源,所选 择的物理机的第二均衡度t值小于零。
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
S2=S1+k×tn,同理,n为奇数,k为正数,k以及n的设置是为了使物理机集群整体均衡以及物理机内部资源均衡的影响相当,即使S1与k×tn的数值在同一数量级。应当理解,若虚拟机的消耗类型为内存消耗型,应该选择CPU相对内存消耗高的物理机来运行虚拟机,以此来均衡物理机内部资源,所选择的物理机的第二均衡度t值大于零。
本实施例中,将物理机全部分配8C/8G和4C/32G情况进行计算获知,Ui/Mi的范围为(0.32,2.56),因此第二均衡度t的范围为(-2.24,2.24)。
若虚拟机的消耗类型为CPU消耗型,均衡参数S2:
Figure PCTCN2017076514-appb-000015
若虚拟机的消耗类型为内存消耗型,均衡参数S2有:
Figure PCTCN2017076514-appb-000016
其中,对第二均衡度t进行处理,使t/3的范围为(-1,1),再3次方后,使物理机内CPU和内存资源越不均衡时,对均衡参数S2的影响越大,再除以1000,使物理机内部资源的均衡对均衡参数S2的影响程度与物理机集群整体均衡的影响程度在同一等级。
优选地,若所述虚拟机的消耗类型是CPU消耗型,一个物理机的第一均衡度大于另一物理机的第一均衡度,且所述一个物理机的第二均衡度小于所述另一物理机的第二均衡度,所述一个物理机的均衡参数大于所述另一物理机的均衡参数;若所述虚拟机的消耗类型是内存消耗型,一个物理机的第一均衡度和第二均衡度分别大于另一物理机的第一均衡度和第二均衡度,所述一个物理机的均衡参数大于所述另一物理机的均衡参数。
优选地,处理器1001执行存储器1002中存储的程序时,以执行将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度时,具体执行以下操作:
计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
计算每个物理机的CPU使用率的倒数与CPU总权重的比值得到CPU占比c以及每个物理机的内存使用率的倒数与内存总权重的比值得到内存占比m;
根据所计算出的每个物理机的CPU占比c以及内存占比m和预设的CPU相对内存的选择权重w1计算出第一均衡度S1。
第一均衡度S1与CPU占比c、内存占比m、CPU相对内存的选择权重w1的关系如下:
S1=c×w1+m×(1-w1)
其中预设的CPU相对内存的选择权重w1表示优先考虑CPU影响因素或者内存影响因素,w1越大表示更优先考虑CPU因素对物理机集群整体负载均衡的影响,w1越小表示更优先考虑内存因素对物理机集群整体负载均衡的影响。
优选地,处理器1001执行存储器1002中存储的程序时还执行以下操作:
根据每个物理机当前的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
根据每个物理机的CPU使用率与CPU平均使用率的离散程度以及每个物理机的内存使用率与内存平均使用率的离散程度获取综合均衡度Q,综合均衡度Q用于表示物理机集群的负载均衡。具体的,通过对所有物理机的CPU使用率以及内存使用率分别进行均方误差计算后进行加权计算。
本发明实施例中所述处理器可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的工具和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可 以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组建可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本发明实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种负载均衡的方法,其特征在于,包括:
    若接收虚拟机的请求,则获取所述虚拟机的CPU核数和内存大小;
    根据获取的虚拟机的CPU核数和内存大小识别所述虚拟机的消耗类型;
    获取每个物理机当前的CPU使用率和内存使用率;
    根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数;
    将所述虚拟机分配给所述均衡参数最大的物理机。
  2. 根据权利要求1所述的方法,其特征在于,所述根据获取的CPU核数和内存大小识别所述虚拟机的消耗类型,包括:
    计算获取的所述CPU核数与所述内存大小的比值;
    若所述比值在预设第一范围,识别所述虚拟机的消耗类型为常规类型;
    若所述比值在预设第二范围,识别所述虚拟机的消耗类型为CPU消耗型;
    若所述比值在预设第三范围,识别所述虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。
  3. 根据权利要求1所述的方法,其特征在于,所述虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,所述根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数,包括:
    将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
    若所述虚拟机的消耗类型是常规类型,赋予所述每个物理机的均衡参数为对应物理机的第一均衡度;
    若所述虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据获取的每个物理机的CPU使用率和内存使用率以及所述CPU平均使用率和所述内存平均使用率计算出每个物理机的第二均衡度;
    根据所述虚拟机的消耗类型、所述每个物理机的第一均衡度以及第二均衡度计算出所述每个物理机的均衡参数。
  4. 根据权利要求3所述的方法,其特征在于,所述将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度,包括:
    计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
    对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
    计算每个物理机的所述CPU使用率的倒数与所述CPU总权重的比值得到CPU占比以及每个物理机的所述内存使用率的倒数与所述内存总权重的比值得到内存占比;
    根据所计算出的每个物理机的所述CPU占比以及所述内存占比和预设的CPU相对内存的选择权重计算出第一均衡度。
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    根据每个物理机当前的所述CPU使用率和所述内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据每个物理机的所述CPU使用率与所述CPU平均使用率的离散程度以及每个物理机的所述内存使用率与所述内存平均使用率的离散程度获取综合均衡度,所述综合均衡度用于表示物理机集群的负载均衡度,以便根据综合均衡度来监控物理机集群的负载均衡的情况。
  6. 一种负载均衡装置,其特征在于,包括:
    获取模块,用于若接收虚拟机的请求,获取所述虚拟机的CPU核数和内存大小以及还用于获取每个物理机当前的CPU使用率和内存使用率;
    识别模块,用于根据获取的虚拟机的CPU核数和内存大小识别所述虚拟机的消耗类型;
    第一计算模块,用于根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数;
    分配模块,用于将所述虚拟机分配给所述均衡参数最大的物理机。
  7. 根据权利要求6所述的装置,其特征在于,所述识别模块包括:
    第一运算单元,用于计算获取的所述CPU核数与所述内存大小的比值;
    处理单元,用于若所述比值在预设第一范围,识别所述虚拟机的消耗类型为常规类型;以及还用于若所述比值在预设第二范围,识别所述虚拟机的消耗 类型为CPU消耗型;以及还用于若所述比值在预设第三范围,识别所述虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。
  8. 根据权利要求6所述的装置,其特征在于,所述虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,所述第一计算模块包括:
    第一计算单元,用于将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
    设置单元,用于若所述虚拟机的消耗类型是常规类型,赋予所述每个物理机的均衡参数为对应物理机的第一均衡度;
    第二计算单元,用于若所述虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
    第三计算单元,用于根据获取的每个物理机的CPU使用率和内存使用率以及所述CPU平均使用率和所述内存平均使用率计算出每个物理机的第二均衡度;
    第四计算单元,用于根据所述虚拟机的消耗类型、所述每个物理机的第一均衡度以及第二均衡度计算出所述每个物理机的均衡参数。
  9. 根据权利要求8所述的装置,其特征在于,所述第一计算单元包括:
    第二运算单元,用于计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
    求和单元,用于对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
    第三运算单元,用于计算每个物理机的所述CPU使用率的倒数与所述CPU总权重的比值得到CPU占比以及每个物理机的所述内存使用率的倒数与所述内存总权重的比值得到内存占比;
    第四运算单元,用于根据所计算出的每个物理机的CPU占比以及内存占比和预设的CPU相对内存的选择权重计算出第一均衡度。
  10. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    第二计算模块,用于根据每个物理机当前的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
    第三计算模块,用于根据每个物理机的CPU使用率与CPU平均使用率的离 散程度以及每个物理机的内存使用率与内存平均使用率的离散程度获取综合均衡度,所述综合均衡度用于表示物理机集群的负载均衡度,以便根据综合均衡度来监控物理机集群的负载均衡的情况。
  11. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序可被一个或者一个以上的处理器执行,以执行以下操作:
    若接收虚拟机的请求,则获取所述虚拟机的CPU核数和内存大小;
    根据获取的虚拟机的CPU核数和内存大小识别所述虚拟机的消耗类型;
    获取每个物理机当前的CPU使用率和内存使用率;
    根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数;
    将所述虚拟机分配给所述均衡参数最大的物理机。
  12. 根据权利要求11所述的计算机可读存储介质,其特征在于,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行所述根据获取的CPU核数和内存大小识别所述虚拟机的消耗类型时,具体执行以下操作:
    计算获取的所述CPU核数与所述内存大小的比值;
    若所述比值在预设第一范围,识别所述虚拟机的消耗类型为常规类型;
    若所述比值在预设第二范围,识别所述虚拟机的消耗类型为CPU消耗型;
    若所述比值在预设第三范围,识别所述虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。
  13. 根据权利要求11所述的计算机可读存储介质,其特征在于,所述虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行所述根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数时,具体执行以下操作:
    将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
    若所述虚拟机的消耗类型是常规类型,赋予所述每个物理机的均衡参数为对应物理机的第一均衡度;
    若所述虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据获取的每个物理机的CPU使用率和内存使用率以及所述CPU平均使用率和所述内存平均使用率计算出每个物理机的第二均衡度;
    根据所述虚拟机的消耗类型、所述每个物理机的第一均衡度以及第二均衡度计算出所述每个物理机的均衡参数。
  14. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述一个或者一个以上程序被一个或者一个以上的处理器执行时,在执行将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度时,具体执行以下操作:
    计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
    对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
    计算每个物理机的所述CPU使用率的倒数与所述CPU总权重的比值得到CPU占比以及每个物理机的所述内存使用率的倒数与所述内存总权重的比值得到内存占比;
    根据所计算出的每个物理机的所述CPU占比以及所述内存占比和预设的CPU相对内存的选择权重计算出第一均衡度。
  15. 根据权利要求11所述的计算机可读存储介质,其特征在于,所述一个或者一个以上程序还可被一个或者一个以上的处理器执行,以执行以下操作:
    根据每个物理机当前的所述CPU使用率和所述内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据每个物理机的所述CPU使用率与所述CPU平均使用率的离散程度以及每个物理机的所述内存使用率与所述内存平均使用率的离散程度获取综合均衡度,所述综合均衡度用于表示物理机集群的负载均衡度,以便根据综合均衡度来监控物理机集群的负载均衡的情况。
  16. 一种负载均衡系统,其特征在于,包括:所述系统包括一个或者一个以上的处理器,以及与所述一个或者一个以上处理器连接的一个或者一个以上存储器,所述存储器,用于存储用于实现负载均衡的一个或者一个以上程序;
    所述处理器,用于执行所述存储器中存储的程序,以执行以下操作:
    若接收虚拟机的请求,则获取所述虚拟机的CPU核数和内存大小;
    根据获取的虚拟机的CPU核数和内存大小识别所述虚拟机的消耗类型;
    获取每个物理机当前的CPU使用率和内存使用率;
    根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数;
    将所述虚拟机分配给所述均衡参数最大的物理机。
  17. 根据权利要求16所述的系统,其特征在于,所述处理器执行所述存储器中存储的程序时,在执行所述根据获取的CPU核数和内存大小识别所述虚拟机的消耗类型时,具体执行以下操作:
    计算获取的所述CPU核数与所述内存大小的比值;
    若所述比值在预设第一范围,识别所述虚拟机的消耗类型为常规类型;
    若所述比值在预设第二范围,识别所述虚拟机的消耗类型为CPU消耗型;
    若所述比值在预设第三范围,识别所述虚拟机的消耗类型为内存消耗型,其中所述预设第二范围大于所述预设第一范围和所述预设第三范围,所述预设第一范围大于所述预设第三范围。
  18. 根据权利要求16所述的系统,其特征在于,所述虚拟机的消耗类型包括常规类型、CPU消耗型以及内存消耗型,所述处理器执行所述存储器中存储的程序时,在执行所述根据所述虚拟机的消耗类型以及获取的每个物理机的CPU使用率和内存使用率,按照预设第一规则计算出所述每个物理机的均衡参数时,具体执行以下操作:
    将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度;
    若所述虚拟机的消耗类型是常规类型,赋予所述每个物理机的均衡参数为对应物理机的第一均衡度;
    若所述虚拟机的消耗类型是CPU消耗型或内存消耗型,根据获取的每个物理机的CPU使用率和内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据获取的每个物理机的CPU使用率和内存使用率以及所述CPU平均使用率和所述内存平均使用率计算出每个物理机的第二均衡度;
    根据所述虚拟机的消耗类型、所述每个物理机的第一均衡度以及第二均衡度计算出所述每个物理机的均衡参数。
  19. 根据权利要求18所述的系统,其特征在于,所述处理器执行所述存储器中存储的程序时,在执行所述将获取的每个物理机的CPU使用率和内存使用率按照预设第二规则计算出每个物理机的第一均衡度时,具体执行以下操作:
    计算每个物理机当前的CPU使用率的倒数和内存使用率的倒数;
    对所有物理机的CPU使用率的倒数进行求和得到CPU总权重,对所有物理机的内存使用率的倒数进行求和得到内存总权重;
    计算每个物理机的所述CPU使用率的倒数与所述CPU总权重的比值得到CPU占比以及每个物理机的所述内存使用率的倒数与所述内存总权重的比值得到内存占比;
    根据所计算出的每个物理机的所述CPU占比以及所述内存占比和预设的CPU相对内存的选择权重计算出第一均衡度。
  20. 根据权利要求16所述的系统,其特征在于,所述处理器执行所述存储器中存储的程序时,还执行以下操作:
    根据每个物理机当前的所述CPU使用率和所述内存使用率,计算出CPU平均使用率和内存平均使用率;
    根据每个物理机的所述CPU使用率与所述CPU平均使用率的离散程度以及每个物理机的所述内存使用率与所述内存平均使用率的离散程度获取综合均衡度,所述综合均衡度用于表示物理机集群的负载均衡度,以便根据综合均衡度来监控物理机集群的负载均衡的情况。
PCT/CN2017/076514 2016-07-22 2017-03-14 一种负载均衡的方法、装置、计算机可读存储介质及系统 Ceased WO2018014566A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610584168.0 2016-07-22
CN201610584168.0A CN106445629B (zh) 2016-07-22 2016-07-22 一种负载均衡的方法及其装置

Publications (1)

Publication Number Publication Date
WO2018014566A1 true WO2018014566A1 (zh) 2018-01-25

Family

ID=58184695

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076514 Ceased WO2018014566A1 (zh) 2016-07-22 2017-03-14 一种负载均衡的方法、装置、计算机可读存储介质及系统

Country Status (2)

Country Link
CN (1) CN106445629B (zh)
WO (1) WO2018014566A1 (zh)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408227A (zh) * 2018-09-19 2019-03-01 平安科技(深圳)有限公司 负载均衡方法、装置及存储介质
CN110287017A (zh) * 2019-07-01 2019-09-27 北京首都在线科技股份有限公司 一种任务调度方法及任务调度装置
CN111240577A (zh) * 2018-11-28 2020-06-05 中国移动通信集团山东有限公司 基于mpp数据库的数据多分片存储方法及装置
CN111367646A (zh) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 容器转移方法及系统
CN113128673A (zh) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 数据处理方法、存储介质、神经网络处理器及电子设备
CN113448716A (zh) * 2020-03-24 2021-09-28 中兴通讯股份有限公司 一种资源调整方法、计算机设备及存储介质
CN115033340A (zh) * 2022-05-16 2022-09-09 天翼云科技有限公司 一种宿主机的选择方法及相关装置
CN115904676A (zh) * 2021-08-12 2023-04-04 中国移动通信集团浙江有限公司 Cpu超分比部署方法、装置、设备及存储介质
CN116232781A (zh) * 2022-12-08 2023-06-06 中国联合网络通信集团有限公司 节能方法、装置及存储介质
CN116800757A (zh) * 2022-03-14 2023-09-22 中国移动通信集团江苏有限公司 Pulsar bundles的负载均衡方法及装置
US12112212B2 (en) 2021-02-26 2024-10-08 Google Llc Controlling system load based on memory bandwidth

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106445629B (zh) * 2016-07-22 2019-05-21 平安科技(深圳)有限公司 一种负载均衡的方法及其装置
CN107800756A (zh) * 2017-03-13 2018-03-13 平安科技(深圳)有限公司 一种负载均衡方法及负载均衡器
CN107203394B (zh) * 2017-04-18 2021-01-01 中国科学院计算技术研究所 一种高安全docker容器批量部署方法及装置
CN107277143A (zh) * 2017-06-21 2017-10-20 郑州云海信息技术有限公司 一种资源匹配管理方法及装置
CN107295090B (zh) * 2017-06-30 2020-01-21 北京奇艺世纪科技有限公司 一种资源调度的方法和装置
CN107707612B (zh) * 2017-08-10 2020-11-13 北京奇艺世纪科技有限公司 一种负载均衡集群的资源利用率的评估方法及装置
CN107526640B (zh) * 2017-08-17 2020-03-27 Oppo广东移动通信有限公司 资源管理方法、装置、移动终端及计算机可读存储介质
CN108170517A (zh) * 2018-01-08 2018-06-15 武汉斗鱼网络科技有限公司 一种容器分配方法、装置、服务器及介质
CN111338745B (zh) * 2019-04-25 2023-09-19 中国移动通信集团湖南有限公司 一种虚拟机的部署方法、装置及智能设备
CN114064191B (zh) * 2020-07-30 2025-03-18 中移(苏州)软件技术有限公司 资源调度方法及装置、设备、存储介质
CN113986454B (zh) * 2021-10-12 2025-04-29 烽火通信科技股份有限公司 一种云平台的虚拟机cpu资源管理系统及方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504620A (zh) * 2009-03-03 2009-08-12 华为技术有限公司 一种虚拟化集群系统负载平衡方法、装置及系统
CN102185779A (zh) * 2011-05-11 2011-09-14 田文洪 与综合配置能力成比例的数据中心资源负载均衡的方法及装置
CN102232282A (zh) * 2010-10-29 2011-11-02 华为技术有限公司 一种实现数据中心资源负载均衡的方法及装置
CN103514046A (zh) * 2013-09-24 2014-01-15 华为技术有限公司 一种虚拟机放置方法及集群管理服务器
CN106445629A (zh) * 2016-07-22 2017-02-22 平安科技(深圳)有限公司 一种负载均衡的方法及其装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8849971B2 (en) * 2008-05-28 2014-09-30 Red Hat, Inc. Load balancing in cloud-based networks
CN103164283B (zh) * 2012-05-10 2018-08-10 上海兆民云计算科技有限公司 一种虚拟桌面系统中虚拟化资源动态调度管理方法及系统
CN102866915B (zh) * 2012-08-21 2015-08-26 华为技术有限公司 虚拟化集群整合方法、装置及虚拟化集群系统
CN104065745A (zh) * 2014-07-07 2014-09-24 电子科技大学 云计算动态资源调度系统和方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504620A (zh) * 2009-03-03 2009-08-12 华为技术有限公司 一种虚拟化集群系统负载平衡方法、装置及系统
CN102232282A (zh) * 2010-10-29 2011-11-02 华为技术有限公司 一种实现数据中心资源负载均衡的方法及装置
CN102185779A (zh) * 2011-05-11 2011-09-14 田文洪 与综合配置能力成比例的数据中心资源负载均衡的方法及装置
CN103514046A (zh) * 2013-09-24 2014-01-15 华为技术有限公司 一种虚拟机放置方法及集群管理服务器
CN106445629A (zh) * 2016-07-22 2017-02-22 平安科技(深圳)有限公司 一种负载均衡的方法及其装置

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408227A (zh) * 2018-09-19 2019-03-01 平安科技(深圳)有限公司 负载均衡方法、装置及存储介质
CN111240577A (zh) * 2018-11-28 2020-06-05 中国移动通信集团山东有限公司 基于mpp数据库的数据多分片存储方法及装置
CN111240577B (zh) * 2018-11-28 2023-08-15 中国移动通信集团山东有限公司 基于mpp数据库的数据多分片存储方法及装置
CN110287017A (zh) * 2019-07-01 2019-09-27 北京首都在线科技股份有限公司 一种任务调度方法及任务调度装置
CN113128673A (zh) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 数据处理方法、存储介质、神经网络处理器及电子设备
CN113128673B (zh) * 2019-12-31 2023-08-11 Oppo广东移动通信有限公司 数据处理方法、存储介质、神经网络处理器及电子设备
CN113448716A (zh) * 2020-03-24 2021-09-28 中兴通讯股份有限公司 一种资源调整方法、计算机设备及存储介质
CN111367646B (zh) * 2020-03-31 2023-08-22 中国工商银行股份有限公司 容器转移方法及系统
CN111367646A (zh) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 容器转移方法及系统
US12112212B2 (en) 2021-02-26 2024-10-08 Google Llc Controlling system load based on memory bandwidth
CN115904676A (zh) * 2021-08-12 2023-04-04 中国移动通信集团浙江有限公司 Cpu超分比部署方法、装置、设备及存储介质
CN116800757A (zh) * 2022-03-14 2023-09-22 中国移动通信集团江苏有限公司 Pulsar bundles的负载均衡方法及装置
CN115033340A (zh) * 2022-05-16 2022-09-09 天翼云科技有限公司 一种宿主机的选择方法及相关装置
CN115033340B (zh) * 2022-05-16 2025-02-11 天翼云科技有限公司 一种宿主机的选择方法及相关装置
CN116232781A (zh) * 2022-12-08 2023-06-06 中国联合网络通信集团有限公司 节能方法、装置及存储介质
CN116232781B (zh) * 2022-12-08 2024-04-16 中国联合网络通信集团有限公司 节能方法、装置及存储介质

Also Published As

Publication number Publication date
CN106445629B (zh) 2019-05-21
CN106445629A (zh) 2017-02-22

Similar Documents

Publication Publication Date Title
WO2018014566A1 (zh) 一种负载均衡的方法、装置、计算机可读存储介质及系统
CN115562843B (zh) 一种容器集群算力调度方法及相关装置
CN111614746B (zh) 云主机集群的负载均衡方法、装置及服务器
US8739167B2 (en) Method and device for balancing load of multiprocessor system by sequencing migration priorities based on memory size and calculated execution time
CN103841196B (zh) 一种基于多线程的文件上传系统及方法
JP5664098B2 (ja) 複合イベント分散装置、複合イベント分散方法および複合イベント分散プログラム
JP6424632B2 (ja) 負荷算出方法、負荷算出プログラム及び負荷算出装置
WO2011110026A1 (zh) 一种实现数据中心资源负载均衡的方法及装置
CN109962969A (zh) 用于云计算存储系统的自适应缓存负载均衡的方法和装置
CN104035823B (zh) 负载均衡方法及装置
CN104239154B (zh) 一种Hadoop集群中的作业调度方法和作业调度器
CN103514046B (zh) 一种虚拟机放置方法及集群管理服务器
US11716384B2 (en) Distributed resource management by improving cluster diversity
CN105760230A (zh) 一种自动调整云主机运行的方法及装置
CN112511649B (zh) 多接入边缘计算方法及设备
CN106874116A (zh) 一种放置新建虚拟机的服务器选择方法及装置
WO2019105379A1 (zh) 资源管理的方法、装置、电子设备及存储介质
CN114153549A (zh) 一种虚拟机创建方法及相关设备
CN114116228A (zh) 一种任务分配方法、装置、设备及存储介质
US12566636B2 (en) Using deployment priorities to implement QoS for service capacity requests in multi-tenant clusters
CN107491352B (zh) 一种资源调度方法及装置
CN105306525A (zh) 一种数据布局的方法、装置和系统
CN105204945B (zh) 一种在大数据背景下的负载平衡装置
CN119668866A (zh) 一种内存分配管理方法、装置和设备
CN115878332B (zh) 深度学习网络中的内存资源分配方法、装置、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17830210

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 21.05.2019)

122 Ep: pct application non-entry in european phase

Ref document number: 17830210

Country of ref document: EP

Kind code of ref document: A1