CN109491788B - A method and device for implementing load balancing on a virtualization platform - Google Patents
A method and device for implementing load balancing on a virtualization platform Download PDFInfo
- Publication number
- CN109491788B CN109491788B CN201811296874.0A CN201811296874A CN109491788B CN 109491788 B CN109491788 B CN 109491788B CN 201811296874 A CN201811296874 A CN 201811296874A CN 109491788 B CN109491788 B CN 109491788B
- Authority
- CN
- China
- Prior art keywords
- virtualization platform
- virtual machine
- cpu
- adjusted
- utilization 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5077—Logical partitioning of resources; Management or configuration of virtualized resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
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使用率;分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;若是,则确定虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过第一阈值的虚拟机的进程确定为待调整进程;将待调整进程与可用CPU做亲和性绑定,以使可用CPU处理待调整进程,实现虚拟化平台的负载均衡。从而实现了虚拟化平台的负载均衡,提高了当前繁忙虚拟机的性能,可以避免宕机等意外情况的发生。相应地,本发明公开的一种虚拟化平台负载均衡实现装置、设备及可读存储介质,也同样具有上述技术效果。
The invention discloses a method for realizing load balancing of a virtualization platform, which includes: obtaining the CPU usage rate corresponding to each virtual machine in the virtualization platform; respectively judging whether the CPU usage rate corresponding to each virtual machine exceeds A preset first threshold; if so, determine the available CPU whose CPU usage in the virtualization platform is lower than the preset second threshold, and determine the process of the virtual machine exceeding the first threshold as a process to be adjusted; The adjustment process is bound to the available CPU affinity, so that the available CPU can process the process to be adjusted, and realize the load balancing of the virtualization platform. In this way, the load balancing of the virtualization platform is realized, the performance of the currently busy virtual machine is improved, and unexpected situations such as downtime can be avoided. Correspondingly, a virtualization platform load balancing implementation device, device and readable storage medium disclosed in the present invention also have the above-mentioned technical effects.
Description
技术领域technical field
本发明涉及虚拟化技术领域,更具体地说,涉及一种虚拟化平台负载均衡实现方法、装置、设备及可读存储介质。The present invention relates to the technical field of virtualization, and more specifically, to a method, device, device and readable storage medium for realizing load balancing of a virtualization platform.
背景技术Background technique
在虚拟化平台中,每台虚拟机固定绑定一个或多个CPU来处理其中的业务进程,即每个CPU对应一个业务进程,一般为qemu-kvm进程。虚拟机对应几个CPU,就对应几个qemu-kvm进程,这样可以避免进程在不同的cpu上频繁切换造成的性能下降。In a virtualization platform, each virtual machine is fixedly bound to one or more CPUs to process its business processes, that is, each CPU corresponds to a business process, generally a qemu-kvm process. The virtual machine corresponds to several CPUs and corresponds to several qemu-kvm processes, which can avoid performance degradation caused by frequent switching of processes on different CPUs.
但是,当虚拟化平台中的某台虚拟机对应的CPU使用率持续偏高时,表明每个CPU中的qemu-kvm进程比较繁忙,若此种情况持续时间过长,就很可能发生宕机等意外情况。需要说明的是,由于每台虚拟机固定绑定CPU,因此当某台虚拟机对应的CPU使用率持续偏高时,其他虚拟机对应的CPU可能处于空闲状态。可见,在此种情况下虚拟化平台的负载无法保持均衡,若不解决此问题,会造成繁忙虚拟机的性能下降,同时也浪费了虚拟化平台中的CPU资源。However, when the CPU usage of a virtual machine in the virtualization platform continues to be high, it indicates that the qemu-kvm process in each CPU is relatively busy. If this situation lasts for too long, downtime is likely to occur Wait for the unexpected. It should be noted that since each virtual machine is fixedly bound to a CPU, when the CPU usage of a certain virtual machine continues to be high, the CPUs corresponding to other virtual machines may be in an idle state. It can be seen that in this case, the load of the virtualization platform cannot be kept balanced. If this problem is not solved, the performance of the busy virtual machine will be degraded, and CPU resources in the virtualization platform will also be wasted.
因此,如何实现虚拟化平台的负载均衡,提高虚拟机的性能,是本领域技术人员需要解决的问题。Therefore, how to realize the load balancing of the virtualization platform and improve the performance of the virtual machine is a problem to be solved by those skilled in the art.
发明内容Contents of the invention
本发明的目的在于提供一种虚拟化平台负载均衡实现方法、装置、设备及可读存储介质,以实现虚拟化平台的负载均衡,提高虚拟机的性能。The object of the present invention is to provide a method, device, device and readable storage medium for implementing load balancing of a virtualization platform, so as to realize load balancing of a virtualization platform and improve the performance of a virtual machine.
为实现上述目的,本发明实施例提供了如下技术方案:In order to achieve the above object, the embodiment of the present invention provides the following technical solutions:
一种虚拟化平台负载均衡实现方法,包括:A method for implementing load balancing on a virtualization platform, comprising:
获取虚拟化平台中的每台虚拟机对应的CPU使用率;Obtain the CPU usage corresponding to each virtual machine in the virtualization platform;
分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;Determine whether the CPU usage corresponding to each virtual machine exceeds a preset first threshold within a preset time period;
若是,则确定所述虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过所述第一阈值的虚拟机的进程确定为待调整进程;将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。If so, then determine the available CPU whose CPU usage rate in the virtualization platform is lower than the preset second threshold, and determine the process of the virtual machine exceeding the first threshold as the process to be adjusted; Affinity binding is performed between a process and the available CPU, so that the available CPU can process the process to be adjusted, so as to realize load balancing of the virtualization platform.
其中,所述获取虚拟化平台中的每台虚拟机对应的CPU使用率,包括:Wherein, said obtaining the CPU utilization rate corresponding to each virtual machine in the virtualization platform includes:
按照预设的间隔时间获取所述虚拟化平台中的每台虚拟机对应的CPU使用率。The CPU utilization rate corresponding to each virtual machine in the virtualization platform is acquired at a preset interval.
其中,所述可用CPU处理所述待调整进程之后,还包括:Wherein, after the available CPU processes the process to be adjusted, it further includes:
获取处理所述待调整进程的CPU使用率,并判断所述待调整进程的CPU使用率在预设时长内是否超过所述第一阈值;Acquiring the CPU usage of the process to be adjusted, and judging whether the CPU usage of the process to be adjusted exceeds the first threshold within a preset period of time;
若是,则确定所述可用CPU,并将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。If so, then determine the available CPU, and bind the process to be adjusted with the available CPU for affinity binding, so that the available CPU can process the process to be adjusted, and realize the load balancing of the virtualization platform .
其中,还包括:Among them, also include:
当所述待调整进程的CPU使用率低于预设的第三阈值时,将所述待调整进程与所述可用CPU做亲和性解绑。When the CPU usage rate of the process to be adjusted is lower than a preset third threshold, affinity unbinding is performed between the process to be adjusted and the available CPU.
其中,获取虚拟化平台中的每台虚拟机对应的CPU使用率之前,还包括:Wherein, before obtaining the CPU utilization rate corresponding to each virtual machine in the virtualization platform, it also includes:
监测所述虚拟化平台中的每台虚拟机对应的CPU使用率。Monitor the CPU usage corresponding to each virtual machine in the virtualization platform.
一种虚拟化平台负载均衡实现装置,包括:A device for implementing load balancing on a virtualization platform, comprising:
获取模块,用于获取虚拟化平台中的每台虚拟机对应的CPU使用率;An acquisition module, configured to acquire the CPU utilization rate corresponding to each virtual machine in the virtualization platform;
判断模块,用于分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;A judging module, configured to judge whether the CPU usage corresponding to each virtual machine exceeds a preset first threshold within a preset duration;
执行模块,用于当虚拟机对应的CPU使用率在预设时长内超过预设的第一阈值时,确定所述虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过所述第一阈值的虚拟机的进程确定为待调整进程;将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。An execution module, configured to determine an available CPU whose CPU usage in the virtualization platform is lower than a preset second threshold when the CPU usage corresponding to the virtual machine exceeds a preset first threshold within a preset duration, and determining the process of the virtual machine exceeding the first threshold as a process to be adjusted; binding the process to be adjusted with the available CPU for affinity binding, so that the available CPU can process the process to be adjusted, Realize load balancing of the virtualization platform.
其中,所述获取模具体用于:Wherein, described acquisition mold body is used for:
按照预设的间隔时间获取所述虚拟化平台中的每台虚拟机对应的CPU使用率。The CPU utilization rate corresponding to each virtual machine in the virtualization platform is acquired at a preset interval.
一种虚拟化平台负载均衡实现设备,包括:A device for implementing load balancing on a virtualization platform, comprising:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序时实现上述任意一项所述的虚拟化平台负载均衡实现方法的步骤。The processor is configured to implement the steps of any one of the methods for implementing load balancing on a virtualization platform described above when executing the computer program.
一种可读存储介质,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述任意一项所述的虚拟化平台负载均衡实现方法的步骤。A readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the methods for realizing load balancing of a virtualization platform described above are implemented.
通过以上方案可知,本发明实施例提供的一种虚拟化平台负载均衡实现方法,包括:获取虚拟化平台中的每台虚拟机对应的CPU使用率;分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;若是,则确定所述虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过所述第一阈值的虚拟机的进程确定为待调整进程;将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。It can be seen from the above solutions that a method for realizing load balancing of a virtualization platform provided by an embodiment of the present invention includes: obtaining the CPU usage rate corresponding to each virtual machine in the virtualization platform; and separately determining the CPU usage rate corresponding to each virtual machine Whether the preset first threshold value is exceeded within the preset duration; Determine the process of the machine as the process to be adjusted; bind the process to be adjusted with the available CPU for affinity binding, so that the available CPU can process the process to be adjusted, and realize the load balancing of the virtualization platform.
可见,所述方法在虚拟化平台中的虚拟化对应的CPU使用率在预设时长内超过预设的第一阈值时,便将超过第一阈值的虚拟机的进程确定为待调整进程,并将该待调整进程与确定出的可用CPU做亲和性绑定,以使可用CPU处理待调整进程,从而实现了所述虚拟化平台的负载均衡,提高了当前繁忙虚拟机的性能,可以避免宕机等意外情况的发生。It can be seen that, in the method, when the CPU usage corresponding to virtualization in the virtualization platform exceeds the preset first threshold within a preset period of time, the process of the virtual machine exceeding the first threshold is determined as a process to be adjusted, and Binding the process to be adjusted with the determined available CPU for affinity binding, so that the available CPU processes the process to be adjusted, thereby realizing load balancing of the virtualization platform, improving the performance of the currently busy virtual machine, and avoiding The occurrence of unforeseen circumstances such as downtime.
相应地,本发明实施例提供的一种虚拟化平台负载均衡实现装置、设备及可读存储介质,也同样具有上述技术效果。Correspondingly, the virtualization platform load balancing implementation device, device, and readable storage medium provided by the embodiments of the present invention also have the above-mentioned technical effects.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例公开的一种虚拟化平台负载均衡实现方法流程图;FIG. 1 is a flow chart of a method for realizing load balancing of a virtualization platform disclosed by an embodiment of the present invention;
图2为本发明实施例公开的另一种虚拟化平台负载均衡实现方法流程图;FIG. 2 is a flow chart of another method for realizing load balancing of a virtualization platform disclosed by an embodiment of the present invention;
图3为本发明实施例公开的一种虚拟化平台负载均衡实现装置示意图;FIG. 3 is a schematic diagram of a virtualization platform load balancing implementation device disclosed in an embodiment of the present invention;
图4为本发明实施例公开的一种虚拟化平台负载均衡实现设备示意图。FIG. 4 is a schematic diagram of a device for realizing load balancing of a virtualization platform disclosed by an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例公开了一种虚拟化平台负载均衡实现方法、装置、设备及可读存储介质,以实现虚拟化平台的负载均衡,提高虚拟机的性能。The embodiment of the present invention discloses a virtualization platform load balance realization method, device, equipment and readable storage medium, so as to realize the load balance of the virtualization platform and improve the performance of the virtual machine.
参见图1,本发明实施例提供的一种虚拟化平台负载均衡实现方法,包括:Referring to FIG. 1, a method for realizing load balancing of a virtualization platform provided by an embodiment of the present invention includes:
S101、获取虚拟化平台中的每台虚拟机对应的CPU使用率;S101. Obtain the CPU utilization rate corresponding to each virtual machine in the virtualization platform;
具体的,虚拟化平台中有多台虚拟机,每台虚拟化均对应有CPU使用率,因此本实施例中获取到的CPU使用率为多个数据,这些数据与各个虚拟机一一对应。Specifically, there are multiple virtual machines in the virtualization platform, and each virtualization corresponds to a CPU usage rate. Therefore, the CPU usage rate obtained in this embodiment has a plurality of data, and these data are in one-to-one correspondence with each virtual machine.
S102、分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;若是,则执行S103;若否,则执行S101;S102. Determine whether the CPU usage rate corresponding to each virtual machine exceeds a preset first threshold within a preset duration; if yes, execute S103; if not, execute S101;
S103、确定虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过第一阈值的虚拟机的进程确定为待调整进程,并执行S104;S103. Determine the available CPUs in the virtualization platform whose CPU utilization rate is lower than the preset second threshold, and determine the process of the virtual machine exceeding the first threshold as the process to be adjusted, and execute S104;
S104、将待调整进程与可用CPU做亲和性绑定,以使可用CPU处理待调整进程,实现虚拟化平台的负载均衡。S104. Bind the processes to be adjusted with the available CPUs for affinity binding, so that the available CPUs process the processes to be adjusted, and realize load balancing of the virtualization platform.
需要说明的是,由于CPU使用率为多个,因此需要逐一将CPU使用率与预设的第一阈值进行比对,以确定在预设时长内超过预设的第一阈值的CPU使用率对应的虚拟机进程。例如:当虚拟化平台中有5台虚拟机,分别为A、B、C、D、E,获取的到的CPU使用率分别为60%、60%、80%、87%、90%,假设预设的第一阈值为85%,那么超过第一阈值的CPU使用率为87%和90%,对应的虚拟机为D和E,因此D和E即为超过第一阈值的虚拟机,其分别对应的进程即为待调整进程。可见,待调整进程的数量并不固定。It should be noted that since there are multiple CPU usage rates, it is necessary to compare the CPU usage rates with the preset first threshold one by one, so as to determine the corresponding virtual machine process. For example: when there are 5 virtual machines in the virtualization platform, they are A, B, C, D, and E, and the obtained CPU usage rates are 60%, 60%, 80%, 87%, and 90%, assuming The preset first threshold is 85%, then the CPU usage rates exceeding the first threshold are 87% and 90%, and the corresponding virtual machines are D and E, so D and E are the virtual machines exceeding the first threshold. The corresponding processes are the processes to be adjusted. It can be seen that the number of processes to be adjusted is not fixed.
同理,假设预设的第二阈值为70%,那么可用CPU即为虚拟机A和B分别对应的CPU。可见,可用CPU的数量并不固定。在做亲和性绑定时,可以根据实际需求为待调整进程选择合适的可用CPU,故本说明书在此不做具体限定。Similarly, assuming that the preset second threshold is 70%, the available CPUs are the CPUs corresponding to the virtual machines A and B respectively. It can be seen that the number of available CPUs is not fixed. When doing affinity binding, you can select an appropriate available CPU for the process to be adjusted according to actual needs, so this specification does not make specific limitations here.
可见,本实施例提供了一种虚拟化平台负载均衡实现方法,所述方法在虚拟化平台中的虚拟化对应的CPU使用率在预设时长内超过预设的第一阈值时,便将超过第一阈值的虚拟机的进程确定为待调整进程,并将该待调整进程与确定出的可用CPU做亲和性绑定,以使可用CPU处理待调整进程,从而实现了所述虚拟化平台的负载均衡,提高了当前繁忙虚拟机的性能,可以避免宕机等意外情况的发生。It can be seen that this embodiment provides a method for implementing load balancing on a virtualization platform. In the method, when the CPU usage corresponding to virtualization in the virtualization platform exceeds a preset first threshold within a preset period of time, it will exceed The process of the virtual machine with the first threshold is determined as the process to be adjusted, and the affinity binding of the process to be adjusted and the determined available CPU is made, so that the available CPU can process the process to be adjusted, thereby realizing the virtualization platform Load balancing improves the performance of currently busy virtual machines and avoids accidents such as downtime.
本发明实施例公开了另一种虚拟化平台负载均衡实现方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。The embodiment of the present invention discloses another method for realizing load balancing of a virtualization platform. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
参见图2,本发明实施例提供的另一种虚拟化平台负载均衡实现方法,包括:Referring to Fig. 2, another method for realizing load balancing of a virtualization platform provided by an embodiment of the present invention includes:
S201、获取虚拟化平台中的每台虚拟机对应的CPU使用率;S201. Obtain the CPU utilization rate corresponding to each virtual machine in the virtualization platform;
S202、分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;若是,则执行S203;若否,则执行S202;S202. Determine whether the CPU usage rate corresponding to each virtual machine exceeds a preset first threshold within a preset duration; if yes, execute S203; if not, execute S202;
S203、确定虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过第一阈值的虚拟机的进程确定为待调整进程,并执行S204;S203. Determine the available CPUs in the virtualization platform whose CPU utilization rate is lower than the preset second threshold, and determine the process of the virtual machine exceeding the first threshold as the process to be adjusted, and execute S204;
S204、将待调整进程与可用CPU做亲和性绑定,以使可用CPU处理待调整进程;S204. Affinity-binding the process to be adjusted with the available CPU, so that the available CPU processes the process to be adjusted;
S205、获取处理待调整进程的CPU使用率,并判断待调整进程的CPU使用率在预设时长内是否超过第一阈值;若是,则执行S206;若否,则执行S202;S205. Obtain and process the CPU usage rate of the process to be adjusted, and determine whether the CPU usage rate of the process to be adjusted exceeds the first threshold within the preset duration; if yes, execute S206; if not, execute S202;
S206、确定虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将待调整进程与可用CPU做亲和性绑定,以使可用CPU处理待调整进程,实现虚拟化平台的负载均衡。S206. Determine the available CPUs in the virtualization platform whose CPU utilization rate is lower than the preset second threshold, and bind the processes to be adjusted with the available CPUs, so that the available CPUs can process the processes to be adjusted to realize virtualization Platform load balancing.
需要说明的是,在第一次亲和性绑定完成后,可再次检测待调整进程的CPU使用率,若仍然超过第一阈值,可以多次为待调整进程选择合适的可用CPU做亲和性绑定,直至待调整进程的CPU使用率低于预设的第一阈值。It should be noted that after the first affinity binding is completed, the CPU usage of the process to be adjusted can be detected again. If it still exceeds the first threshold, an appropriate available CPU can be selected for affinity for the process to be adjusted multiple times. performance binding until the CPU usage of the process to be adjusted is lower than the preset first threshold.
可见,本实施例提供了另一种虚拟化平台负载均衡实现方法,所述方法在虚拟化平台中的虚拟化对应的CPU使用率在预设时长内超过预设的第一阈值时,便将超过第一阈值的虚拟机的进程确定为待调整进程,并将该待调整进程与确定出的可用CPU做亲和性绑定,当需要时可以多次调整,以使可用CPU处理待调整进程,从而实现了所述虚拟化平台的负载均衡,提高了当前繁忙虚拟机的性能,可以避免宕机等意外情况的发生。It can be seen that this embodiment provides another method for implementing load balancing on a virtualization platform. In the method, when the CPU usage corresponding to virtualization in the virtualization platform exceeds a preset first threshold within a preset period of time, the The process of the virtual machine exceeding the first threshold is determined as the process to be adjusted, and the process to be adjusted is bound to the determined available CPU affinity, and can be adjusted multiple times when necessary, so that the available CPU can process the process to be adjusted , so that the load balancing of the virtualization platform is realized, the performance of the currently busy virtual machine is improved, and unexpected situations such as downtime can be avoided.
基于上述任意实施例,需要说明的是,所述获取虚拟化平台中的每台虚拟机对应的CPU使用率,包括:按照预设的间隔时间获取所述虚拟化平台中的每台虚拟机对应的CPU使用率。Based on any of the above embodiments, it should be noted that the obtaining the CPU usage rate corresponding to each virtual machine in the virtualization platform includes: obtaining the corresponding CPU usage rate of each virtual machine in the virtualization platform at a preset interval. CPU usage.
具体的,为了确定CPU使用率持续偏高的虚拟机,可以按照预设的间隔时间获取CPU使用率;当然还可以实时监测所述虚拟化平台中的每台虚拟机对应的CPU使用率。Specifically, in order to determine the virtual machines whose CPU usage is consistently high, the CPU usage can be obtained at preset intervals; of course, the CPU usage corresponding to each virtual machine in the virtualization platform can also be monitored in real time.
基于上述任意实施例,需要说明的是,还包括:当所述待调整进程的CPU使用率低于预设的第三阈值时,将所述待调整进程与所述可用CPU做亲和性解绑。即:当待调整进程不繁忙时,进行亲和性解绑,以恢复虚拟化平台原来的CPU绑定关系。Based on any of the above embodiments, it should be noted that the method further includes: when the CPU usage of the process to be adjusted is lower than a preset third threshold, performing affinity resolution between the process to be adjusted and the available CPU tie. That is: when the process to be adjusted is not busy, affinity unbinding is performed to restore the original CPU binding relationship of the virtualization platform.
下面介绍依据本发明的核心思想进行具体实施过程,其主要包括:监控调整个线程。监控线程主要监控每台虚拟机对应的CPU使用率情况,定时扫描CPU使用率,并且在使用率达到一定阈值时,向调整线程发送信息,调整线程根据信息调整该进程。The following describes the specific implementation process according to the core idea of the present invention, which mainly includes: monitoring and adjusting each thread. The monitoring thread mainly monitors the CPU usage of each virtual machine, regularly scans the CPU usage, and sends information to the adjustment thread when the usage reaches a certain threshold, and the adjustment thread adjusts the process according to the information.
具体的,通过虚拟机平台管理软件查询每台虚拟机对应的CPU,以及CPU使用率情况,查询每个CPU对应的进程ID并保存。因为CPU使用率的变化频率很高,很可能存在由于虚拟机内部的突发任务导致CPU某个时刻使用率很高,对CPU使用率在短暂时间内过高的处理没有意义,因此当CPU的使用率持续过高时,才进行调整。例如:以每分钟为单位的频率进行CPU使用率的检测,连续两次检测值都超过阈值之后,再进行调整。Specifically, the CPU corresponding to each virtual machine and the usage rate of the CPU are queried through the virtual machine platform management software, and the process ID corresponding to each CPU is queried and saved. Because the CPU usage rate changes very frequently, it is likely that the CPU usage rate is high at a certain moment due to sudden tasks inside the virtual machine. It is meaningless to deal with the CPU usage rate being too high in a short period of time. Only make adjustments when usage is persistently high. For example: the CPU usage rate is detected at a frequency per minute, and adjustments are made after the detected values exceed the threshold for two consecutive times.
当连续两次的检测都显示某个虚拟机的进程CPU使用率超过阈值时,监控线程会向调整线程发送消息。消息内容包含虚拟机的名称,CPU个数、对应的进程ID以及CPU使用率。When two consecutive detections show that the process CPU usage of a certain virtual machine exceeds the threshold, the monitoring thread will send a message to the adjustment thread. The message content includes the name of the virtual machine, the number of CPUs, the corresponding process ID, and the CPU usage.
调整线程收到监控线程的消息之后,查看消息中对应进程的CPU占用率是否仍超过预设的阈值。如果是,查询平台中所有CPU的使用率,选择使用率最低的CPU,与消息中的进程ID做CPU亲和性绑定,使该进程可以运行在使用率最低的CPU上,以提高虚拟机的性能。如果不是,则放弃此次调整。After the adjustment thread receives the message from the monitoring thread, check whether the CPU usage of the corresponding process in the message still exceeds the preset threshold. If so, query the utilization rate of all CPUs in the platform, select the CPU with the lowest utilization rate, and bind the CPU affinity with the process ID in the message, so that the process can run on the CPU with the lowest utilization rate, so as to improve the performance of the virtual machine. performance. If not, the adjustment is discarded.
如果做了调整之后,该虚拟机的所占的CPU使用率仍然很高,调整线程就会进行二次调整,具体为:增加该虚拟机的CPU数量。If after the adjustment is made, the CPU usage rate of the virtual machine is still high, the adjustment thread will perform a second adjustment, specifically: increase the number of CPUs of the virtual machine.
下面对本发明实施例提供的一种虚拟化平台负载均衡实现装置进行介绍,下文描述的一种虚拟化平台负载均衡实现装置与上文描述的一种虚拟化平台负载均衡实现方法可以相互参照。A virtualization platform load balancing realization device provided by an embodiment of the present invention is introduced below. The virtualization platform load balancing realization device described below and the virtualization platform load balancing realization method described above may refer to each other.
参见图3,本发明实施例提供的一种虚拟化平台负载均衡实现装置,包括:Referring to FIG. 3 , a virtualization platform load balancing implementation device provided by an embodiment of the present invention includes:
获取模块301,用于获取虚拟化平台中的每台虚拟机对应的CPU使用率;An
判断模块302,用于分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;A judging
执行模块303,用于当虚拟机对应的CPU使用率在预设时长内超过预设的第一阈值时,确定所述虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过所述第一阈值的虚拟机的进程确定为待调整进程;将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。An
其中,所述获取模具体用于:Wherein, described acquisition mold body is used for:
按照预设的间隔时间获取所述虚拟化平台中的每台虚拟机对应的CPU使用率。The CPU utilization rate corresponding to each virtual machine in the virtualization platform is acquired at a preset interval.
其中,还包括:Among them, also include:
调整模块,用于获取处理所述待调整进程的CPU使用率,并判断所述待调整进程的CPU使用率在预设时长内是否超过所述第一阈值;若是,则确定所述可用CPU,并将所述待调整进程与所述可用CPU做亲和性绑定,以使所述可用CPU处理所述待调整进程,实现所述虚拟化平台的负载均衡。An adjustment module, configured to obtain and process the CPU usage rate of the process to be adjusted, and determine whether the CPU usage rate of the process to be adjusted exceeds the first threshold within a preset duration; if so, determine the available CPU, And binding the process to be adjusted with the available CPU through affinity binding, so that the available CPU can process the process to be adjusted, so as to realize load balancing of the virtualization platform.
其中,还包括:Among them, also include:
解绑模块,用于当所述待调整进程的CPU使用率低于预设的第三阈值时,将所述待调整进程与所述可用CPU做亲和性解绑。An unbinding module, configured to unbind the process to be adjusted and the available CPU with affinity when the CPU usage of the process to be adjusted is lower than a preset third threshold.
其中,还包括:Among them, also include:
监测模块,用于监测所述虚拟化平台中的每台虚拟机对应的CPU使用率。A monitoring module, configured to monitor the CPU usage corresponding to each virtual machine in the virtualization platform.
可见,本实施例提供了一种虚拟化平台负载均衡实现装置,包括:获取模块、判断模块以及执行模块。首先由获取模块获取虚拟化平台中的每台虚拟机对应的CPU使用率;然后判断模块分别判断每台虚拟机对应的CPU使用率在预设时长内是否超过预设的第一阈值;当虚拟机对应的CPU使用率在预设时长内超过预设的第一阈值时,执行模块确定虚拟化平台中的CPU使用率低于预设的第二阈值的可用CPU,并将超过第一阈值的虚拟机的进程确定为待调整进程;将待调整进程与可用CPU做亲和性绑定,以使可用CPU处理待调整进程,实现虚拟化平台的负载均衡。如此各个模块之间分工合作,各司其职,从而实现了虚拟化平台的负载均衡,提高了当前繁忙虚拟机的性能,可以避免宕机等意外情况的发生。It can be seen that this embodiment provides a virtualization platform load balancing implementation device, including: an acquisition module, a judgment module, and an execution module. First, the acquisition module obtains the CPU utilization rate corresponding to each virtual machine in the virtualization platform; then the judging module judges whether the CPU utilization rate corresponding to each virtual machine exceeds a preset first threshold within a preset duration; when the virtual When the CPU utilization rate corresponding to the machine exceeds the preset first threshold within the preset time period, the execution module determines that the CPU usage rate of the virtualization platform is lower than the preset second threshold of the available CPU, and will exceed the first threshold The process of the virtual machine is determined as the process to be adjusted; the process to be adjusted is bound to the available CPU affinity, so that the available CPU can process the process to be adjusted, and the load balancing of the virtualization platform is realized. In this way, the division of labor and cooperation among the various modules, each performing its own duties, thus realizes the load balancing of the virtualization platform, improves the performance of the current busy virtual machine, and can avoid unexpected situations such as downtime.
下面对本发明实施例提供的一种虚拟化平台负载均衡实现设备进行介绍,下文描述的一种虚拟化平台负载均衡实现设备与上文描述的一种虚拟化平台负载均衡实现方法及装置可以相互参照。The following is an introduction to a virtualization platform load balancing implementation device provided by the embodiment of the present invention. The virtualization platform load balancing implementation device described below and the virtualization platform load balancing implementation method and device described above can be cross-referenced. .
参见图4,本发明实施例提供的一种虚拟化平台负载均衡实现设备,包括:Referring to FIG. 4, a virtualization platform load balancing implementation device provided by an embodiment of the present invention includes:
存储器401,用于存储计算机程序;
处理器402,用于执行所述计算机程序时实现上述任意实施例所述的虚拟化平台负载均衡实现方法的步骤。The
下面对本发明实施例提供的一种可读存储介质进行介绍,下文描述的一种可读存储介质与上文描述的一种虚拟化平台负载均衡实现方法、装置及设备可以相互参照。A readable storage medium provided by an embodiment of the present invention is introduced below. The readable storage medium described below and the method, device, and device for implementing load balancing on a virtualization platform described above may be referred to together.
一种可读存储介质,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述任意实施例所述的虚拟化平台负载均衡实现方法的步骤。A readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for realizing load balancing of a virtualization platform as described in any of the above embodiments are implemented.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811296874.0A CN109491788B (en) | 2018-11-01 | 2018-11-01 | A method and device for implementing load balancing on a virtualization platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811296874.0A CN109491788B (en) | 2018-11-01 | 2018-11-01 | A method and device for implementing load balancing on a virtualization platform |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109491788A CN109491788A (en) | 2019-03-19 |
CN109491788B true CN109491788B (en) | 2022-12-09 |
Family
ID=65692124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811296874.0A Active CN109491788B (en) | 2018-11-01 | 2018-11-01 | A method and device for implementing load balancing on a virtualization platform |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109491788B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110362402B (en) * | 2019-06-25 | 2021-08-10 | 苏州浪潮智能科技有限公司 | Load balancing method, device, equipment and readable storage medium |
CN110442423B (en) * | 2019-07-09 | 2022-04-26 | 苏州浪潮智能科技有限公司 | A method and device for realizing virtual machine reservation of CPU by using control group |
CN111488210B (en) * | 2020-04-02 | 2023-04-07 | 腾讯科技(深圳)有限公司 | Task scheduling method and device based on cloud computing and computer equipment |
CN112835720A (en) * | 2021-02-26 | 2021-05-25 | 杭州迪普科技股份有限公司 | ARP aging thread management method and device and electronic equipment |
CN113032098B (en) * | 2021-03-25 | 2024-04-09 | 深信服科技股份有限公司 | Virtual machine scheduling method, device, equipment and readable storage medium |
CN113626196A (en) * | 2021-08-12 | 2021-11-09 | 杭州海康威视数字技术股份有限公司 | Task sending method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101976201A (en) * | 2010-10-22 | 2011-02-16 | 北京航空航天大学 | CPU affinity-based virtual CPU dynamic binding method |
CN106970831A (en) * | 2017-05-15 | 2017-07-21 | 金航数码科技有限责任公司 | The resources of virtual machine dynamic scheduling system and method for a kind of facing cloud platform |
Family Cites Families (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101533362A (en) * | 2009-04-15 | 2009-09-16 | 南京联创科技股份有限公司 | Inter-process CPU resource balance scheduling method |
CN102546920B (en) * | 2011-01-04 | 2013-10-23 | 中国移动通信有限公司 | A method, system and device for running a process |
CN103064733A (en) * | 2011-10-20 | 2013-04-24 | 电子科技大学 | Cloud computing virtual machine live migration technology |
CN102508718B (en) * | 2011-11-22 | 2015-04-15 | 杭州华三通信技术有限公司 | Method and device for balancing load of virtual machine |
CN102681913A (en) * | 2011-12-21 | 2012-09-19 | 中兴通讯股份有限公司 | Method and device for realizing live migration along virtual machines |
WO2013139037A1 (en) * | 2012-03-23 | 2013-09-26 | 华为技术有限公司 | Method and device for scheduling resources |
CN102932418B (en) * | 2012-09-27 | 2015-04-15 | 东软集团股份有限公司 | Cloud application deploying method and device |
CN102937912B (en) * | 2012-11-28 | 2016-06-15 | 华为技术有限公司 | Dispatching method of virtual machine and equipment |
CN103294540B (en) * | 2013-05-17 | 2014-05-14 | 北京航空航天大学 | Method of improving performance of Erlang virtual machines by Xeon Phi coprocessor |
CN104809026B (en) * | 2015-05-14 | 2018-03-30 | 苏州中晟宏芯信息科技有限公司 | A kind of method that CPU computing resources are borrowed using remote node |
CN105740074B (en) * | 2016-01-26 | 2019-04-05 | 中标软件有限公司 | A kind of virtual machine load-balancing method based on cloud computing |
CN106161625A (en) * | 2016-07-11 | 2016-11-23 | 浪潮(北京)电子信息产业有限公司 | A kind of method of the cloud computing resources utilization rate for improving virtual machine |
CN106406977B (en) * | 2016-08-26 | 2019-06-11 | 山东乾云启创信息科技股份有限公司 | A kind of GPU vitualization realization system and method |
CN108241527B (en) * | 2016-12-26 | 2021-10-08 | 成都理想境界科技有限公司 | Task scheduling method and electronic equipment |
CN107231421A (en) * | 2017-05-27 | 2017-10-03 | 北京力尊信通科技股份有限公司 | A kind of virtual machine computing capability dynamic adjusting method, device and system |
CN107197053A (en) * | 2017-07-31 | 2017-09-22 | 郑州云海信息技术有限公司 | A kind of load-balancing method and device |
-
2018
- 2018-11-01 CN CN201811296874.0A patent/CN109491788B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101976201A (en) * | 2010-10-22 | 2011-02-16 | 北京航空航天大学 | CPU affinity-based virtual CPU dynamic binding method |
CN106970831A (en) * | 2017-05-15 | 2017-07-21 | 金航数码科技有限责任公司 | The resources of virtual machine dynamic scheduling system and method for a kind of facing cloud platform |
Also Published As
Publication number | Publication date |
---|---|
CN109491788A (en) | 2019-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109491788B (en) | A method and device for implementing load balancing on a virtualization platform | |
US11240745B2 (en) | Network slice instance processing method and apparatus, and system | |
US20160378570A1 (en) | Techniques for Offloading Computational Tasks between Nodes | |
CN108205541B (en) | Distributed network crawler task scheduling method and device | |
JP2015530676A (en) | Real-time optimization of computing infrastructure in virtual environment | |
CN104954478A (en) | System and method for realizing automatic longitudinal scaling of server in cloud computing platform | |
CN105159775A (en) | Load balancer based management system and management method for cloud computing data center | |
EP3349130B1 (en) | Data compression method and storage system | |
EP3125115A1 (en) | Vm resource scheduling method, apparatus, and system | |
EP3208709B1 (en) | Batch processing method and device for system invocation commands | |
CN103412786A (en) | High performance server architecture system and data processing method thereof | |
CN109412841A (en) | Method of adjustment, device and the cloud platform of resources of virtual machine | |
CN109408399B (en) | A computing power estimation method, device, equipment and storage medium | |
CN107797865A (en) | User task processing method and application server | |
WO2013082742A1 (en) | Resource scheduling method, device and system | |
CN103034475A (en) | Distributed parallel computing method, device and system | |
JP2023092413A (en) | Capacity reduction method and device based on cluster | |
CN114461335A (en) | Method, device and device for elastic scaling of virtual machine and container in cloud computing environment | |
CN105022668B (en) | A job scheduling method and system | |
CN107704310A (en) | A kind of method, apparatus and equipment for realizing container cluster management | |
CN109284192B (en) | Parameter configuration method and electronic equipment | |
CN109144666A (en) | A kind of method for processing resource and system across cloud platform | |
CN116483546B (en) | Distributed training task scheduling method, device, equipment and storage medium | |
CN115617497B (en) | Thread processing method, scheduling component, monitoring component, server and storage medium | |
CN111314401A (en) | Resource allocation method, device, system, terminal and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |