CN109840135A - A kind of load-balancing method, device and electronic equipment - Google Patents

A kind of load-balancing method, device and electronic equipment Download PDF

Info

Publication number
CN109840135A
CN109840135A CN201910094168.6A CN201910094168A CN109840135A CN 109840135 A CN109840135 A CN 109840135A CN 201910094168 A CN201910094168 A CN 201910094168A CN 109840135 A CN109840135 A CN 109840135A
Authority
CN
China
Prior art keywords
processor
load
group
virtual machine
processors
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.)
Granted
Application number
CN201910094168.6A
Other languages
Chinese (zh)
Other versions
CN109840135B (en
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201910094168.6A priority Critical patent/CN109840135B/en
Publication of CN109840135A publication Critical patent/CN109840135A/en
Application granted granted Critical
Publication of CN109840135B publication Critical patent/CN109840135B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Multi Processors (AREA)

Abstract

本发明实施例提供一种负载均衡方法、装置及电子设备,当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;当存在与第一处理器相同物理内核的、空闲,或者与第一处理器相同主机的、空闲的第二处理器时,将第二处理器移动到第一处理器组;当不存在与第一处理器相同物理内核的、与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。本发明将处理器组进行了分组管理,并借助分组的动态调整有效提高了负载均衡的灵活性,实现负载均衡的良好效果。

Embodiments of the present invention provide a load balancing method, device, and electronic device. When the load of a first processor belonging to a first processor group is higher than a threshold, traverse all second processors in the second processor group; When there is an idle second processor of the same physical core as the first processor, or an idle second processor of the same host as the first processor, move the second processor to the first processor group; When there is an idle second processor with the same physical core as the first processor and the same host as the first processor, a third processor with a different host from the first processor is selected from the first processor group, and is configured in the first processor group. The target virtual machine on the server is migrated to the third processor. The invention manages the processor groups in groups, and effectively improves the flexibility of load balancing by means of dynamic adjustment of the groups, and realizes the good effect of load balancing.

Description

一种负载均衡方法、装置及电子设备A load balancing method, device and electronic device

技术领域technical field

本发明涉及计算机技术领域,特别是涉及一种负载均衡方法、装置及电子设备。The present invention relates to the field of computer technology, and in particular, to a load balancing method, device and electronic device.

背景技术Background technique

虚拟化是一种资源管理技术,广泛应用于数据中心,将计算、网络、存储等资源抽象转化,打破不同计算实体之间的障碍,使用户更合理、充分的利用这些资源。I/O虚拟化是虚拟化技术的一个核心部分,该技术使得虚拟机可以共享数据中心中的I/O资源。Virtualization is a resource management technology that is widely used in data centers. It abstracts and transforms computing, network, storage and other resources, breaks down barriers between different computing entities, and enables users to utilize these resources more rationally and fully. I/O virtualization is a core part of virtualization technology, which enables virtual machines to share I/O resources in a data center.

然而,发明人通过研究发现,针对I/O虚拟化性能优化的方法仍存在一些问题,在一示例中,虚拟机在竞争CPU资源时,通常是用虚拟机迁移的方式进行负载均衡,但是频繁的虚拟CPU迁移所引入的缓存污染、上下文切换等额外开销会在很大程度上抵消负载均衡所带来的好处,这样由于负载均衡配置的单一性导致达不到负载均衡应有的效果。However, the inventor found through research that there are still some problems with the method for I/O virtualization performance optimization. In an example, when virtual machines compete for CPU resources, load balancing is usually performed by means of virtual machine migration, but frequently The additional overheads such as cache pollution and context switching introduced by virtual CPU migration will largely offset the benefits brought by load balancing, so that due to the singularity of load balancing configuration, the expected effect of load balancing cannot be achieved.

因此,如何能够提高负载均衡的灵活性,进而提高负载均衡效果是本领域技术人员亟需解决的技术问题。Therefore, how to improve the flexibility of load balancing and further improve the effect of load balancing is a technical problem that needs to be solved urgently by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

鉴于以上所述现有技术的缺点,本发明的目的在于提供一种负载均衡方法、装置及电子设备,用于解决现有技术中负载均衡灵活性差、效果差的问题。In view of the above-mentioned shortcomings of the prior art, the purpose of the present invention is to provide a load balancing method, device and electronic device for solving the problems of poor flexibility and poor effect of load balancing in the prior art.

为实现上述目的及其他相关目的,根据本发明的第一方面,本发明实施例提供一种负载均衡方法,该方法包括以下步骤:In order to achieve the above purpose and other related purposes, according to the first aspect of the present invention, an embodiment of the present invention provides a load balancing method, which includes the following steps:

当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;When the load of the first processor belonging to the first processor group is higher than the threshold, traverse all the second processors of the second processor group;

当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;When there is an idle second processor of the same physical core as the first processor, or an idle second processor of the same host as the first processor, move the second processor to the first processor a processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group;

当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, select the first processor group from the first processor group. A third processor of a host with a different processor, migrates the target virtual machine configured on the first processor to the third processor.

可选地,所述第一处理器组的所有处理器被配置为第一时间片,所述第二处理器组的所有处理器被配置为第二时间片,且所述第一时间片与所述第二时间片不同;Optionally, all processors in the first processor group are configured as a first time slice, all processors in the second processor group are configured as a second time slice, and the first time slice and the second time slices are different;

所述第一处理器组的所有处理器上配置有第一类型虚拟机,所述第二处理器组的所有处理器上配置有第二类型虚拟机,所述第一类型虚拟机和所述第二类型虚拟机具有不同的业务类型。All processors of the first processor group are configured with a first type of virtual machine, all processors of the second processor group are configured with a second type of virtual machine, the first type of virtual machine and the The second type of virtual machine has a different service type.

可选地,从第一处理器组中选择与第一处理器不同主机的第三处理器,包括:Optionally, selecting a third processor of a different host from the first processor from the first processor group, including:

按照负载从小到大的顺序排列第三处理器;Arrange the third processors in ascending order of load;

依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载;Calculate the sum of the load of the target virtual machine and the load of the third processor in turn, as a reference load;

当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。When the reference load is lower than the highest load of the third processor, the third processor corresponding to the reference load is selected.

可选地,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器之前,还包括:Optionally, selecting a third processor of a host different from the first processor from the first processor group, and before migrating the target virtual machine configured on the first processor to the third processor, further comprising:

从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机。From the virtual machines configured on the first processor, the virtual machine with the largest load is selected as the target virtual machine.

根据本发明的第二方面,本发明实施例还提供一种负载均衡装置,包括:According to a second aspect of the present invention, an embodiment of the present invention further provides a load balancing device, including:

遍历模块,用于当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;a traversal module, configured to traverse all the second processors of the second processor group when the load of the first processors belonging to the first processor group is higher than the threshold;

分组模块,用于当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;a grouping module, configured to process the second processor when there is an idle second processor with the same physical core as the first processor, or when there is an idle second processor with the same host as the first processor moving the processor to the first processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group;

迁移模块,用于当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。The migration module is configured to, when there is no idle second processor with the same physical core as the first processor, and no idle second processor with the same host as the first processor, migrate from the first processor A third processor of a host different from the first processor is selected in the group, and the target virtual machine configured on the first processor is migrated to the third processor.

可选地,还包括配置模块,用于将所述第一处理器组的所有处理器配置为第一时间片,将所述第二处理器组的所有处理器配置为第二时间片,且所述第一时间片与所述第二时间片不同;在所述第一处理器组的所有处理器上配置第一类型虚拟机,在所述第二处理器组的所有处理器上配置第二类型虚拟机,所述第一类型虚拟机和所述第二类型虚拟机具有不同的业务类型。Optionally, it also includes a configuration module configured to configure all processors of the first processor group as a first time slice, and configure all processors of the second processor group as a second time slice, and The first time slice is different from the second time slice; the first type of virtual machine is configured on all processors of the first processor group, and the first type of virtual machine is configured on all processors of the second processor group. Two types of virtual machines, the first type of virtual machines and the second type of virtual machines have different service types.

可选地,所述迁移模块还用于,按照负载从小到大的顺序排列第三处理器;Optionally, the migration module is further configured to arrange the third processors in order of load from small to large;

依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载;Calculate the sum of the load of the target virtual machine and the load of the third processor in turn, as a reference load;

当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。When the reference load is lower than the highest load of the third processor, the third processor corresponding to the reference load is selected.

可选地,所述迁移模块还用于,从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机。Optionally, the migration module is further configured to, from the virtual machines configured on the first processor, select the virtual machine with the largest load as the target virtual machine.

根据本发明的第三方面,本发明实施例还提供一种电子设备,所述电子设备包括处理器;以及,According to a third aspect of the present invention, an embodiment of the present invention further provides an electronic device, the electronic device includes a processor; and,

与所述处理器通信连接的存储器;其中,a memory communicatively coupled to the processor; wherein,

所述存储器存储有可被所述处理器执行的指令,所述指令被所述处理器执行,以使所述处理器能够:The memory stores instructions executable by the processor, the instructions being executed by the processor to enable the processor to:

当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;When the load of the first processor belonging to the first processor group is higher than the threshold, traverse all the second processors of the second processor group;

当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;When there is an idle second processor of the same physical core as the first processor, or an idle second processor of the same host as the first processor, move the second processor to the first processor a processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group;

当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, select the first processor group from the first processor group. A third processor of a host with a different processor, migrates the target virtual machine configured on the first processor to the third processor.

如上所述,本发明实施例提供的一种负载均衡方法、装置及电子设备,具有以下有益效果:当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。本发明将处理器组进行了分组管理,并借助分组的动态调整有效提高了负载均衡的灵活性,实现负载均衡的良好效果。As described above, the load balancing method, device, and electronic device provided by the embodiments of the present invention have the following beneficial effects: when the load of the first processor belonging to the first processor group is higher than a threshold, traverse the second processor All second processors of the group; when there is an idle second processor of the same physical core as the first processor, or there is an idle second processor of the same host as the first processor, the The second processor is moved to the first processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group; when there is no processor with the same physical core as the first processor , an idle second processor, and there is no idle second processor of the same host as the first processor, select a third processor of a different host from the first processor group from the first processor group, The target virtual machine configured on the first processor is migrated to the third processor. The invention manages the processor groups in groups, and effectively improves the flexibility of load balancing by means of dynamic adjustment of the groups, and realizes the good effect of load balancing.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. In other words, on the premise of no creative labor, other drawings can also be obtained from these drawings.

图1是本发明实施例提供的一种负载均衡方法的流程示意图;FIG. 1 is a schematic flowchart of a load balancing method provided by an embodiment of the present invention;

图2是本发明实施例提供的一种物理处理器选择方法的流程示意图;2 is a schematic flowchart of a method for selecting a physical processor according to an embodiment of the present invention;

图3是本发明实施例提供的一种负载均衡装置的结构示意图;FIG. 3 is a schematic structural diagram of a load balancing apparatus provided by an embodiment of the present invention;

图4是本发明实施例提供的执行负载均衡方法的电子设备的硬件结构示意图。FIG. 4 is a schematic diagram of a hardware structure of an electronic device for executing a load balancing method provided by an embodiment of the present invention.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本发明中的技术方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only some of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

请参阅图1至图4。需要说明的是,本实施例中所提供的图示仅以示意方式说明本发明的基本构想,遂图示中仅显示与本发明中有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。See Figures 1 through 4. It should be noted that the diagrams provided in this embodiment are only to illustrate the basic concept of the present invention in a schematic way, so the diagrams only show the components related to the present invention rather than the number, shape and the number of components in the actual implementation. For dimension drawing, the type, quantity and proportion of each component can be changed at will in actual implementation, and the component layout may also be more complicated.

参见图1,是本发明实施例提供的一种负载均衡方法的流程示意图,如图1所示,本发明实施例示出了执行负载均衡的过程:Referring to FIG. 1, it is a schematic flowchart of a load balancing method provided by an embodiment of the present invention. As shown in FIG. 1, an embodiment of the present invention shows a process of performing load balancing:

步骤S101:当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器。Step S101: When the load of the first processors belonging to the first processor group is higher than a threshold, traverse all the second processors of the second processor group.

在发明实施中,对虚拟机进行分类,并对物理处理器进行分组处理,从而提高负载均衡的灵活性和效果。In the implementation of the invention, the virtual machines are classified and the physical processors are grouped, thereby improving the flexibility and effect of load balancing.

在一示例性实施例中,虚拟机分类,在虚拟机创建时判断虚拟机类型,该虚拟机类型可以根据虚拟机上运行业务的不同进行分类,具体地,可以将虚拟机分为I/O负载和计算负载两种类型。其中,I/O负载类型对物理处理器具有较短时延和较高调度频率的需求,需要保证物理处理器能够满足该类型虚拟机的要求;计算负载类型能够具有较高的处理时长,从而满足长时间计算的需求,这样也同样保证物理处理器能够满足该类型虚拟机的要求。In an exemplary embodiment, the virtual machine is classified, and the virtual machine type is determined when the virtual machine is created. The virtual machine type can be classified according to different services running on the virtual machine. Specifically, the virtual machine can be divided into I/O There are two types of load and computational load. Among them, the I/O load type has the requirements of short delay and high scheduling frequency on the physical processor, and it is necessary to ensure that the physical processor can meet the requirements of this type of virtual machine; the computing load type can have a high processing time, so To meet the needs of long-term computing, it also ensures that the physical processor can meet the requirements of this type of virtual machine.

而且,在具体实施时,当不能确定虚拟机类型时,还可以将该虚拟机暂时标记为未分类类型,通过监测虚拟机CPU一段时间的运行情况包括采集对处理器的调用时延和调用频率等参数,当参数满足相应的数值范围时,确定该虚拟类型,具体实施过程在本发明实施例中不再赘述。Moreover, in the specific implementation, when the type of the virtual machine cannot be determined, the virtual machine can also be temporarily marked as an unclassified type, and by monitoring the running status of the virtual machine CPU for a period of time, including collecting the calling delay and calling frequency of the processor and other parameters, when the parameter satisfies the corresponding numerical range, the virtual type is determined, and the specific implementation process is not repeated in this embodiment of the present invention.

进一步,针对物理CPU分组,将数据中心或者服务器集群中的多个物理处理器分为多组,每个处理器组可以包括任意多个物理处理器。在一示例性实施例中,根据虚拟机类型,可以配置相应的物理处理器分组,可以配置第一处理器组和第二处理器组,第一处理器组的所有物理处理器可以具有短时间片,目的是降低I/O的调度时延,提升调度的频率,从而满足I/O负载类型虚拟机的处理需求,第二处理器组的所有物理处理器可以设置长时间片,保证较高的处理时长。Further, for physical CPU grouping, multiple physical processors in a data center or server cluster are divided into multiple groups, and each processor group may include any number of physical processors. In an exemplary embodiment, according to the virtual machine type, a corresponding physical processor group may be configured, a first processor group and a second processor group may be configured, and all physical processors of the first processor group may have a short time The purpose is to reduce the I/O scheduling delay and increase the frequency of scheduling, so as to meet the processing requirements of I/O load type virtual machines. All physical processors in the second processor group can be set to long time slices to ensure higher processing time.

这样,I/O负载类型的虚拟机可以配置在第一处理器组的物理处理器上,计算负载类型的虚拟机可以配置在第二处理器组上,实现不同物理处理器组对不同类型虚拟机的匹配配置。In this way, virtual machines of the I/O load type can be configured on the physical processors of the first processor group, and virtual machines of the computing load type can be configured on the second processor group. matching configuration of the machine.

基于上述描述,本发明实施例以第一处理器组中的第一处理器具有较高负载,需要执行负载均衡为例进行详细描述,其中第一处理器组可以具有多个第一处理器,第二处理器组可以具有多个第二处理器。当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器。Based on the above description, the embodiment of the present invention takes the first processor in the first processor group has a relatively high load and needs to perform load balancing as an example for detailed description, wherein the first processor group may have multiple first processors, The second processor group may have a plurality of second processors. When the load of the first processor belonging to the first processor group is higher than the threshold, all the second processors of the second processor group are traversed.

步骤S102:当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源。Step S102: When there is an idle second processor with the same physical core as the first processor, or when there is an idle second processor with the same host as the first processor, move the second processor to the first processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group.

遍历第二处理器组中的所有第二处理器,可以先判断是否存在与第一处理器相同物理内核、或者与该第一处理器配置在同一主机的第二处理器,且该第二处理器的负载低于一阈值,处于空闲状态,则对第二处理器组进行调整,实现重新分组。具体地,将符合上述条件的第二处理器从第二处理器组中删除,并添加到第一处理器组中,从而使得第一处理器上的虚拟机能够使用新的第一处理器组的物理处理器资源。By traversing all the second processors in the second processor group, you can first determine whether there is a second processor with the same physical core as the first processor, or a second processor configured on the same host as the first processor, and the second processor If the load of the processor is lower than a threshold value and is in an idle state, the second processor group is adjusted to realize regrouping. Specifically, the second processor that meets the above conditions is deleted from the second processor group and added to the first processor group, so that the virtual machine on the first processor can use the new first processor group physical processor resources.

步骤S103:当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。Step S103: When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, remove the processor from the first processor group A third processor of a host different from the first processor is selected, and the target virtual machine configured on the first processor is migrated to the third processor.

当不存在与第一处理器相同物理内核、空闲的第二处理器,且不存在与第一处理器相同的主机的、空闲的第二处理器时,表征当前主机处理器资源不能满足虚拟机需求,则需要进行虚拟机迁移。When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor of the same host as the first processor, it indicates that the current host processor resources cannot satisfy the virtual machine requirements, virtual machine migration is required.

当需要进行虚拟机迁移时,参见图2是本发明实施例提供的一种物理处理器选择方法的流程示意图,如图2所示,该方法包括:When virtual machine migration needs to be performed, referring to FIG. 2 is a schematic flowchart of a method for selecting a physical processor provided by an embodiment of the present invention. As shown in FIG. 2 , the method includes:

步骤S1031:按照负载从小到大的顺序排列第三处理器。Step S1031: Arrange the third processors in order of load from small to large.

可以对不同于第一处理器所在主机的其他主机的物理处理器,按照当前负载从小到大的顺序进行排序。在一示例性实施例中,可以通过统计物理处理器的固定时间的平均线程描述负载,可以确定第三处理器A的当前负载为1.2,第三处理器B的当前负载为2.5,第三处理器C的当前负载为4.1。The physical processors of other hosts different from the host where the first processor is located may be sorted in descending order of current load. In an exemplary embodiment, the load can be described by counting the average threads of the physical processors at a fixed time, and it can be determined that the current load of the third processor A is 1.2, the current load of the third processor B is 2.5, and the third processing The current load of device C is 4.1.

步骤S1032:依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载。Step S1032: Calculate the sum of the load of the target virtual machine and the load of the third processor in sequence as a reference load.

待迁移的虚拟机作为目标虚拟机,该目标虚拟机的负载目前为6,则依次计算得到各个参考负载。目标虚拟机与第三处理器A的参考负载为7.2,目标虚拟机与第三处理器B的参考负载为8.5,目标虚拟机与第三处理器C的参考负载为10.1。The virtual machine to be migrated is used as the target virtual machine, and the load of the target virtual machine is currently 6, so each reference load is calculated in turn. The reference load between the target virtual machine and the third processor A is 7.2, the reference load between the target virtual machine and the third processor B is 8.5, and the reference load between the target virtual machine and the third processor C is 10.1.

步骤S1033:当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。Step S1033: When the reference load is lower than the highest load of the third processor, select the third processor corresponding to the reference load.

当第三处理器的最高负载为10时,即第三处理器最高支持在固定时间内10个线程,则通过参考负载判断当虚拟机转移到该第三处理器时是否到达处理器性能极限。基于上述实施例,可以看到目标虚拟机与第三处理器A的参考负载为7.2,目标虚拟机与第三处理器B的参考负载为8.5均低于最高负载,则可以选择第三处理器A和第三处理器B中的任意一个,优先地,可以选择参考负载与最高负载差值最大的第三处理器,即第三处理器A。When the maximum load of the third processor is 10, that is, the third processor supports up to 10 threads in a fixed time, it is judged by referring to the load whether the virtual machine reaches the processor performance limit when the virtual machine is transferred to the third processor. Based on the above embodiment, it can be seen that the reference load of the target virtual machine and the third processor A is 7.2, and the reference load of the target virtual machine and the third processor B is 8.5, both lower than the maximum load, so the third processor can be selected Any one of A and the third processor B, preferentially, can select the third processor with the largest difference between the reference load and the highest load, that is, the third processor A.

而且,在进行虚拟机迁移时,本发明实施例还进一步优化了虚拟机选择方式。由于第一处理器上可能同时配置多个虚拟机,可以从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机,以将该目标虚拟机迁移到其他主机的物理处理器。Moreover, when performing virtual machine migration, the embodiment of the present invention further optimizes the virtual machine selection manner. Since multiple virtual machines may be configured on the first processor at the same time, from the virtual machines configured on the first processor, the virtual machine with the largest load can be selected as the target virtual machine, so as to migrate the target virtual machine to other hosts. physical processor.

通过上述方式,可以进一步将目标虚拟机迁移到选择出来的第三处理器上,从而实现负载均衡。In the above manner, the target virtual machine can be further migrated to the selected third processor, so as to achieve load balancing.

由上述实施例的描述可见,本发明实施例提供的一种负载均衡方法,当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。本发明将处理器组进行了分组管理,并借助分组的动态调整有效提高了负载均衡的灵活性,实现负载均衡的良好效果。It can be seen from the description of the foregoing embodiments that, in a load balancing method provided by the embodiments of the present invention, when the load of the first processor belonging to the first processor group is higher than a threshold, it traverses all the second processes of the second processor group. When there is an idle second processor with the same physical core as the first processor, or when there is an idle second processor with the same host as the first processor, move the second processor to The first processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group; when there is no idle second processing with the same physical core as the first processor When there is no idle second processor of the same host as the first processor, select a third processor of a different host from the first processor from the first processor group, and configure it on the first processor The target virtual machine on is migrated to the third processor. The invention manages the processor groups in groups, and effectively improves the flexibility of load balancing by means of dynamic adjustment of the groups, and realizes the good effect of load balancing.

通过以上的方法实施例的描述,所属领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:只读存储器(ROM)、随机存取存储器(RAM)、磁碟或者光盘等各种可以存储程序代码的介质。From the description of the above method embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on such understanding, the technical solutions of the present invention essentially or the parts that contribute to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium and includes several instructions for making a A computer device (which may be a personal computer, a server, or a network device, etc.) executes all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: read only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.

与本发明提供的负载均衡方法实施例相对应,本发明还提供了一种负载均衡装置。Corresponding to the embodiments of the load balancing method provided by the present invention, the present invention further provides a load balancing device.

参见图3,是本发明实施例提供的一种负载均衡装置的结构示意图,如图3所示,该负载均衡装置包括:Referring to FIG. 3, it is a schematic structural diagram of a load balancing apparatus provided by an embodiment of the present invention. As shown in FIG. 3, the load balancing apparatus includes:

遍历模块11,用于当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;Traversing module 11, configured to traverse all second processors of the second processor group when the load of the first processors belonging to the first processor group is higher than the threshold;

分组模块12,用于当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;The grouping module 12 is configured to, when there is an idle second processor with the same physical core as the first processor, or an idle second processor with the same host as the first processor, group the second processor moving the processor to the first processor group so that a virtual machine configured on the first processor can use processor resources of the new first processor group;

迁移模块13,用于当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。The migration module 13 is configured to, when there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, from the first processor In the processor group, a third processor of a host different from the first processor is selected, and the target virtual machine configured on the first processor is migrated to the third processor.

在一示例性实施例中,该负载均衡装置还可以进一步包括配置模块,该配置模块用于所述第一处理器组的所有处理器配置为第一时间片,将所述第二处理器组的所有处理器配置为第二时间片,且所述第一时间片与所述第二时间片不同;在所述第一处理器组的所有处理器上配置第一类型虚拟机,在所述第二处理器组的所有处理器上配置第二类型虚拟机,所述第一类型虚拟机和所述第二类型虚拟机具有不同的业务类型。In an exemplary embodiment, the load balancing apparatus may further include a configuration module, the configuration module is configured to configure all processors of the first processor group as a first time slice, and configure the second processor group to be a first time slice. All processors in the first processor group are configured as the second time slice, and the first time slice is different from the second time slice; the first type virtual machine is configured on all processors of the first processor group, and the first time slice is A second type of virtual machine is configured on all processors of the second processor group, and the first type of virtual machine and the second type of virtual machine have different service types.

为了实现虚拟机迁移的有效进行,该迁移模块13,还可以用于按照负载从小到大的顺序排列第三处理器;In order to implement the virtual machine migration effectively, the migration module 13 can also be used to arrange the third processors in the order of load from small to large;

依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载;Calculate the sum of the load of the target virtual machine and the load of the third processor in turn, as a reference load;

当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。When the reference load is lower than the highest load of the third processor, the third processor corresponding to the reference load is selected.

为了确定目标虚拟机,从而提高虚拟机迁移效率,在本发明实施例中,该迁移模块13还可以用于,从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机。In order to determine the target virtual machine and improve the virtual machine migration efficiency, in this embodiment of the present invention, the migration module 13 may also be used to select the virtual machine with the largest load as the target from the virtual machines configured on the first processor virtual machine.

本发明实施例提供了一种非易失性计算机存储介质,所述计算机存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述任意方法实施例中的负载均衡方法。An embodiment of the present invention provides a non-volatile computer storage medium, where the computer storage medium stores computer-executable instructions, where the computer-executable instructions can execute the load balancing method in any of the foregoing method embodiments.

图4是本发明实施例提供的执行负载均衡方法的电子设备的硬件结构示意图,如图4所示,该设备包括:FIG. 4 is a schematic diagram of a hardware structure of an electronic device for executing a load balancing method provided by an embodiment of the present invention. As shown in FIG. 4 , the device includes:

一个或多个处理器410以及存储器420,图4中以一个处理器410为例。One or more processors 410 and a memory 420, one processor 410 is taken as an example in FIG. 4 .

执行负载均衡方法的设备还可以包括:输入装置430和输出装置440。The apparatus for performing the load balancing method may further include: an input device 430 and an output device 440 .

处理器410、存储器420、输入装置430和输出装置440可以通过总线或者其他方式连接,图4中以通过总线连接为例。The processor 410, the memory 420, the input device 430, and the output device 440 may be connected through a bus or in other ways, and the connection through a bus is taken as an example in FIG. 4 .

存储器420作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本发明实施例中的负载均衡方法对应的程序指令/模块(例如,附图3所示的遍历模块11、分组模块12和迁移模块13)。处理器410通过运行存储在存储器420中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例负载均衡方法。As a non-volatile computer-readable storage medium, the memory 420 can be used to store non-volatile software programs, non-volatile computer-executable programs and modules, such as program instructions corresponding to the load balancing method in the embodiment of the present invention /modules (eg, the traversal module 11, the grouping module 12, and the migration module 13 shown in FIG. 3). The processor 410 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 420, that is, to implement the load balancing method of the above method embodiment.

存储器420可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据负载均衡装置的使用所创建的数据等。此外,存储器420可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器420可选包括相对于处理器410远程设置的存储器,这些远程存储器可以通过网络连接至负载均衡装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 420 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the load balancing device, and the like. Additionally, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 420 may optionally include memory located remotely from processor 410, which may be connected to the load balancing device via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

输入装置430可接收输入的数字或字符信息,以及产生与负载均衡装置的用户设置以及功能控制有关的键信号输入。输出装置440可包括显示屏等显示设备。The input device 430 may receive inputted numerical or character information, and generate key signal input related to user setting and function control of the load balancing device. The output device 440 may include a display device such as a display screen.

所述一个或者多个模块存储在所述存储器420中,当被所述一个或者多个处理器410执行时,执行上述任意方法实施例中的负载均衡方法。The one or more modules are stored in the memory 420, and when executed by the one or more processors 410, perform the load balancing method in any of the above method embodiments.

上述产品可执行本发明实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本发明实施例所提供的方法。The above product can execute the method provided by the embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.

本发明实施例的电子设备以多种形式存在,包括但不限于:The electronic devices of the embodiments of the present invention exist in various forms, including but not limited to:

(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。(1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions, and its main goal is to provide voice and data communication. Such terminals include: smart phones (eg iPhone), multimedia phones, functional phones, and low-end phones.

(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, such as iPads.

(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment equipment: This type of equipment can display and play multimedia content. Such devices include: audio and video players (eg iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.

(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。(4) Server: A device that provides computing services. The composition of the server includes a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but due to the need to provide highly reliable services, the processing capacity, stability , reliability, security, scalability, manageability and other aspects of high requirements.

(5)其他具有数据交互功能的电子装置。(5) Other electronic devices with data interaction function.

以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this embodiment

本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置或系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置及系统实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the apparatus or system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for related parts. The apparatus and system embodiments described above are only illustrative, wherein 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, It can be located in one place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.

需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as "first" and "second" etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these There is no such actual relationship or sequence between entities or operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

以上所述仅是本发明的具体实施方式,使本领域技术人员能够理解或实现本发明。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above descriptions are only specific embodiments of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to 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 (10)

1.一种负载均衡方法,其特征在于,包括以下步骤:1. A load balancing method, comprising the following steps: 当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;When the load of the first processor belonging to the first processor group is higher than the threshold, traverse all the second processors of the second processor group; 当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;When there is an idle second processor of the same physical core as the first processor, or an idle second processor of the same host as the first processor, move the second processor to the first processor a processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group; 当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, select the first processor group from the first processor group. A third processor of a host with a different processor, migrates the target virtual machine configured on the first processor to the third processor. 2.根据权利要求1所述的负载均衡方法,其特征在于,所述第一处理器组的所有处理器被配置为第一时间片,所述第二处理器组的所有处理器被配置为第二时间片,且所述第一时间片与所述第二时间片不同;2 . The load balancing method according to claim 1 , wherein all processors of the first processor group are configured as a first time slice, and all processors of the second processor group are configured as a first time slice. 3 . a second time slice, and the first time slice is different from the second time slice; 所述第一处理器组的所有处理器上配置有第一类型虚拟机,所述第二处理器组的所有处理器上配置有第二类型虚拟机,所述第一类型虚拟机和所述第二类型虚拟机具有不同的业务类型。All processors of the first processor group are configured with a first type of virtual machine, all processors of the second processor group are configured with a second type of virtual machine, the first type of virtual machine and the The second type of virtual machine has a different service type. 3.根据权利要求1所述的负载均衡方法,其特征在于,从第一处理器组中选择与第一处理器不同主机的第三处理器,包括:3. The load balancing method according to claim 1, wherein selecting a third processor of a host different from the first processor from the first processor group comprises: 按照负载从小到大的顺序排列第三处理器;Arrange the third processors in ascending order of load; 依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载;Calculate the sum of the load of the target virtual machine and the load of the third processor in turn, as a reference load; 当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。When the reference load is lower than the highest load of the third processor, the third processor corresponding to the reference load is selected. 4.根据权利要求1所述的负载均衡方法,其特征在于,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器之前,还包括:4 . The load balancing method according to claim 1 , wherein a third processor of a host different from the first processor is selected from the first processor group, and a target virtual machine configured on the first processor is selected. 5 . Before migrating to the third processor, it also includes: 从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机。From the virtual machines configured on the first processor, the virtual machine with the largest load is selected as the target virtual machine. 5.一种负载均衡装置,其特征在于,包括:5. A load balancing device, comprising: 遍历模块,用于当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;a traversal module, configured to traverse all the second processors of the second processor group when the load of the first processors belonging to the first processor group is higher than the threshold; 分组模块,用于当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;a grouping module, configured to process the second processor when there is an idle second processor with the same physical core as the first processor, or when there is an idle second processor with the same host as the first processor moving the processor to the first processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group; 迁移模块,用于当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。The migration module is configured to, when there is no idle second processor with the same physical core as the first processor, and no idle second processor with the same host as the first processor, migrate from the first processor A third processor of a host different from the first processor is selected in the group, and the target virtual machine configured on the first processor is migrated to the third processor. 6.根据权利要求5所述的负载均衡装置,其特征在于,还包括配置模块,用于将所述第一处理器组的所有处理器配置为第一时间片,将所述第二处理器组的所有处理器配置为第二时间片,且所述第一时间片与所述第二时间片不同;在所述第一处理器组的所有处理器上配置第一类型虚拟机,在所述第二处理器组的所有处理器上配置第二类型虚拟机,所述第一类型虚拟机和所述第二类型虚拟机具有不同的业务类型。6 . The load balancing apparatus according to claim 5 , further comprising a configuration module, configured to configure all processors of the first processor group as a first time slice, and configure the second processor to All processors in the first processor group are configured as the second time slice, and the first time slice is different from the second time slice; the first type virtual machine is configured on all processors in the first processor group, A second type of virtual machine is configured on all processors of the second processor group, and the first type of virtual machine and the second type of virtual machine have different service types. 7.根据权利要求5所述的负载均衡装置,其特征在于,所述迁移模块还用于,按照负载从小到大的顺序排列第三处理器;7 . The load balancing device according to claim 5 , wherein the migration module is further configured to arrange the third processors according to the load from small to large; 7 . 依次计算目标虚拟机的负载与第三处理器的负载的和,作为参考负载;Calculate the sum of the load of the target virtual machine and the load of the third processor in turn, as a reference load; 当参考负载低于第三处理器的最高负载时,选择该参考负载对应的第三处理器。When the reference load is lower than the highest load of the third processor, the third processor corresponding to the reference load is selected. 8.根据权利要求5所述的负载均衡装置,其特征在于,所述迁移模块还用于,从配置在第一处理器上的虚拟机中,选择负载最大的虚拟机作为目标虚拟机。8 . The load balancing apparatus according to claim 5 , wherein the migration module is further configured to, from the virtual machines configured on the first processor, select the virtual machine with the largest load as the target virtual machine. 9 . 9.一种电子设备,其特征在于,所述电子设备包括处理器;以及,9. An electronic device comprising a processor; and, 与所述处理器通信连接的存储器;其中,a memory communicatively coupled to the processor; wherein, 所述存储器存储有可被所述处理器执行的指令,所述指令被所述处理器执行,以使所述处理器能够:The memory stores instructions executable by the processor, the instructions being executed by the processor to enable the processor to: 当属于第一处理器组的第一处理器的负载高于阈值时,遍历第二处理器组的所有第二处理器;When the load of the first processor belonging to the first processor group is higher than the threshold, traverse all the second processors of the second processor group; 当存在与第一处理器相同物理内核的、空闲的第二处理器,或者,存在与第一处理器相同主机的、空闲的第二处理器时,将所述第二处理器移动到第一处理器组,以使配置在第一处理器上的虚拟机能够使用新的第一处理器组的处理器资源;When there is an idle second processor of the same physical core as the first processor, or an idle second processor of the same host as the first processor, move the second processor to the first processor a processor group, so that the virtual machine configured on the first processor can use the processor resources of the new first processor group; 当不存在与第一处理器相同物理内核的、空闲的第二处理器,且不存在与第一处理器相同主机的、空闲的第二处理器时,从第一处理器组中选择与第一处理器不同主机的第三处理器,将配置在第一处理器上的目标虚拟机迁移到所述第三处理器。When there is no idle second processor with the same physical core as the first processor, and there is no idle second processor with the same host as the first processor, select the first processor group from the first processor group. A third processor of a host with a different processor, migrates the target virtual machine configured on the first processor to the third processor. 10.一种电子设备,其特征在于,包括如权利要求5至8任意一项所述的负载均衡装置。10. An electronic device, comprising the load balancing device according to any one of claims 5 to 8.
CN201910094168.6A 2019-01-30 2019-01-30 Load balancing method and device and electronic equipment Active CN109840135B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910094168.6A CN109840135B (en) 2019-01-30 2019-01-30 Load balancing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910094168.6A CN109840135B (en) 2019-01-30 2019-01-30 Load balancing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109840135A true CN109840135A (en) 2019-06-04
CN109840135B CN109840135B (en) 2022-02-18

Family

ID=66884270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910094168.6A Active CN109840135B (en) 2019-01-30 2019-01-30 Load balancing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109840135B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427673A (en) * 2020-03-16 2020-07-17 杭州迪普科技股份有限公司 Load balancing method, device and equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101799772A (en) * 2010-02-26 2010-08-11 上海华为技术有限公司 Kernel dispatching method, kernel backup method and multi-core processor
CN102394903A (en) * 2011-07-14 2012-03-28 上海红神信息技术有限公司 Active reconstruction calculating system constructing system
CN102402462A (en) * 2010-09-30 2012-04-04 微软公司 Techniques for load balancing GPU enabled virtual machines
US20120102189A1 (en) * 2010-10-25 2012-04-26 Stephany Burge Dynamic heterogeneous computer network management tool
CN103377089A (en) * 2012-04-16 2013-10-30 国际商业机器公司 Programmatic load-based management method and system of processor population
CN103778017A (en) * 2012-10-19 2014-05-07 国际商业机器公司 Affinity of virtual processor dispatching
US20140173623A1 (en) * 2012-12-17 2014-06-19 Mediatek Inc. Method for controlling task migration of task in heterogeneous multi-core system based on dynamic migration threshold and related computer readable medium
CN104503838A (en) * 2014-11-23 2015-04-08 华中科技大学 Method for scheduling virtual CPU (Central Processing Unit)
CN104850461A (en) * 2015-05-12 2015-08-19 华中科技大学 NUMA-oriented virtual cpu (central processing unit) scheduling and optimizing method
CN107918557A (en) * 2016-10-05 2018-04-17 联发科技股份有限公司 Device and method for operating multi-core system and multi-core system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101799772A (en) * 2010-02-26 2010-08-11 上海华为技术有限公司 Kernel dispatching method, kernel backup method and multi-core processor
CN102402462A (en) * 2010-09-30 2012-04-04 微软公司 Techniques for load balancing GPU enabled virtual machines
US20120102189A1 (en) * 2010-10-25 2012-04-26 Stephany Burge Dynamic heterogeneous computer network management tool
CN102394903A (en) * 2011-07-14 2012-03-28 上海红神信息技术有限公司 Active reconstruction calculating system constructing system
CN103377089A (en) * 2012-04-16 2013-10-30 国际商业机器公司 Programmatic load-based management method and system of processor population
CN103778017A (en) * 2012-10-19 2014-05-07 国际商业机器公司 Affinity of virtual processor dispatching
US20140173623A1 (en) * 2012-12-17 2014-06-19 Mediatek Inc. Method for controlling task migration of task in heterogeneous multi-core system based on dynamic migration threshold and related computer readable medium
CN104503838A (en) * 2014-11-23 2015-04-08 华中科技大学 Method for scheduling virtual CPU (Central Processing Unit)
CN104850461A (en) * 2015-05-12 2015-08-19 华中科技大学 NUMA-oriented virtual cpu (central processing unit) scheduling and optimizing method
CN107918557A (en) * 2016-10-05 2018-04-17 联发科技股份有限公司 Device and method for operating multi-core system and multi-core system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TOQEER ALI SYED,SHAHRULNIZA MUSA,ABDUR RAHMAN,SALMAN JAN: "Towards Secure Instance Migration in the Cloud", 《IEEE》 *
马汝辉: "基于多核的虚拟化技术研究", 《万方》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427673A (en) * 2020-03-16 2020-07-17 杭州迪普科技股份有限公司 Load balancing method, device and equipment
CN111427673B (en) * 2020-03-16 2023-04-07 杭州迪普科技股份有限公司 Load balancing method, device and equipment

Also Published As

Publication number Publication date
CN109840135B (en) 2022-02-18

Similar Documents

Publication Publication Date Title
WO2017185616A1 (en) File storage method and electronic equipment
CN109933420A (en) Node task scheduling method, electronic device and system
CN104348881B (en) User resources division methods and device in cloud management platform
CN109558444B (en) Data retrieval method and device
WO2021068205A1 (en) Access control method and apparatus, and server and computer-readable medium
CN104063501B (en) copy balance method based on HDFS
CN113392863A (en) Method and device for acquiring machine learning training data set and terminal
WO2023196042A1 (en) Data flow control in distributed computing systems
CN110489224A (en) A kind of method and apparatus of task schedule
CN109840135B (en) Load balancing method and device and electronic equipment
CN109840182A (en) A kind of resource monitoring method, device and electronic equipment
CN104572687B (en) The key user's recognition methods and device that microblogging is propagated
CN115270941A (en) Method, device and equipment for training data classification model and storage medium
CN114840565A (en) Sampling query method, device, electronic device and computer-readable storage medium
TWI866729B (en) Geometric stream data processing method, computing device and computer readable storage medium
CN118502956A (en) Resource scheduling method, device, electronic device, storage medium and program product based on cloud storage system
CN112015718A (en) HBase cluster balancing method and device, electronic equipment and storage medium
CN112912849B (en) A method, system, computer-readable medium and device for scheduling computing operations based on graph data
CN119225898A (en) Capacity elastic expansion method and related device
CN109981726A (en) A kind of distribution method of memory node, server and system
CN104793985B (en) A kind of dispatching method of virtual machine and management equipment
CN103902686B (en) A kind of data duplicate removal method and device
CN105208084B (en) Method and device for determining resources to be deployed
CN114637790A (en) List data query method and device, electronic equipment and storage medium
CN103793386B (en) The method and system of data processing

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