Patent ID: 8826292

Claim:
A method, comprising: detecting, by a processing device, a condition triggering a load balancing operation; identifying, by the processing device, a plurality of candidate target host machines to receive virtual machines (VMs) migrating from a plurality of source host machines, the VMs operating on the source host machines; determining, by the processing device, an expected load per resource on each of the plurality of candidate target host machines by calculating how many VMs with high level of resource sharing are expected to be loaded on a candidate target host machine before a resource threshold of the candidate target host machine is reached; selecting, by the processing device, a target host machine among the plurality of candidate target host machines; scheduling, by the processing device, the VMs on the selected target host machine in a descending order of level of resource sharing with other VMs already scheduled on the selected target host machine until the resource threshold of the selected target host machine is reached, wherein the level of resource sharing is in terms of at least one of shared memory, shared templates, or shared network; selecting, by the processing device, another target host machine among the plurality of candidate target host machines when the expected load per resource on the selected target host machine is surpassed; and scheduling, by the processing device, remaining VMs on the selected another target host machine.