Maximizing virtual machine resources through load balancing methods

Started by Kralj187, Sep 29, 2022, 09:14 AM

Previous topic - Next topic

Kralj187Topic starter

Efficient utilization of virtual machine resources can be achieved through load balancing in an IaaS provider's cloud. There are several methods of load balancing available, but this material will focus on some of the most popular static methods: round-robin, CMA and threshold algorithm. In this article, we will discuss how they work, their unique features and where they can be utilized.

Static load balancing methods do not take into account the state of individual nodes when distributing traffic and instead rely on pre-defined parameters. This means that there is a binding to a specific server.

One way to select a web server is by the geographical location of the client or randomly. However, the round-robin method distributes the load evenly between all nodes without prioritizing tasks. The first node is selected randomly, and the rest are subsequently ordered. When the number of servers ends, the queue goes back to the first one.

Round-robin DNS is one implementation of this algorithm, where DNS responds to requests not with a single IP address, but with a list of several addresses. Haproxy, apache and nginx typically employ this method to allocate resources both within the data center and between individual data centers.

However, this approach has disadvantages as DNS does not check servers for errors and does not exclude disabled VMs from the list of IP addresses. Additionally, the cache lifetime of the address table should be adjusted to prevent delays in processing requests or an increased load on the DNS server.

On the other hand, the central manager algorithm (CMA) selects the least loaded server based on information sent to it by web servers. IBM utilizes a similar approach in their Guardium solution, where data flows are managed using a load map created from constantly updated information about all managed modules.

The Central Manager Algorithm assigns processes to web servers when they are created, allowing for more even distribution of the load. However, it has a significant drawback due to the large number of interprocess interactions, resulting in a bottleneck. Also, the central processor is susceptible to failure since it's a single point of failure.

A different approach is the Threshold Algorithm, which assigns processes to hosts immediately when they are created. The web server can be in one of three states determined by two threshold values: t_upper and t_under. If the system is balanced, then no additional actions are taken. If there is an imbalance, the system takes up one of two actions: requests to increase or decrease the load.

In the first case, the central web server evaluates which tasks that have not yet been performed by any other hosts can be delegated to the node. In the second case, the central server can take away from the node those tasks that it has not yet started to execute and, if possible, transfer them to another web server. Such messages are rarely exchanged since, with sufficient server resources, a new process starts at home, which increases performance.

Indian scientists from Guru Gobind Singh Indraprasta University evaluated the effectiveness of the threshold algorithm in heterogeneous systems and provided examples of functions that nodes can use to send a request to increase/decrease the load. The load balancer is called to balance the load in both cases.


One source of magic constants in code examples involves comparisons with 0 or 1 to evaluate function values within if statements. This approach assumes that the function value returned does not rely on standard true/false conversion. As a result, without knowledge of the function, it is unclear what occurs in principle when comparing with 0 or 1.

It is important to avoid the use of magic constants in coding to ensure readability and maintainability. Instead, constants should be assigned meaningful names and used in variables to make code more understandable and flexible. By removing ambiguity and increasing clarity, writing clean code makes it easier for others to understand and modify.


The typical hosting of virtual servers is not truly a cloud, despite being labeled as such. A standard virtual server based on Windows 2008 R2 can be easily hosted by any provider, with similar limitations and capabilities. What sets a cloud apart is the ability to access resources from multiple servers without limits, and the capacity to dynamically change server parameters in real-time.

While many hosting services claim to be clouds, only true cloud providers offer flexible resource usage without preset thresholds. Amazon's "Reserved Instances" service is an example of a full-fledged cloud, where subscribers pay for both resources used and emergency capacity redundancy. True clouds allow for a more cost-effective and scalable solution to hosting needs than traditional virtual web hosting.


Load balancing is an essential technique for maximizing virtual machine (VM) resources in a virtualized environment. It involves the efficient distribution of workloads across VMs to enhance performance, optimize resource utilization, and ensure high availability.

There are several load balancing methods that can be used to achieve these goals:

1. Round Robin: In this method, incoming requests are distributed evenly across available VMs in a cyclical manner. Each request is assigned to the next available VM in a predefined order. While simple, this method may not consider the current load or capacity of each VM, leading to potentially inefficient resource allocation.

2. Weighted Round Robin: This method extends the basic Round Robin approach by assigning weights to different VMs based on their capacities or capabilities. VMs with higher capacities are allocated more requests compared to those with lower capacities, ensuring a better load distribution.

3. Least Connection: This method distributes incoming requests to the VM with the fewest active connections at the time. By directing new requests to VMs with lower existing workloads, this method helps avoid overloading any single VM.

4. Source IP Hashing: In this method, the source IP address of an incoming request is used to determine which VM should handle it. This ensures that requests from the same source are always routed to the same VM, enabling session persistence and avoiding any issues related to stateful connections.

5. Dynamic Load Balancing: This method utilizes real-time monitoring and analysis of VM and network conditions to dynamically adjust the workload distribution. It takes into account factors like CPU utilization, memory usage, network traffic, and response times to make intelligent decisions on load balancing. This approach ensures optimal resource utilization and adaptability to changing workload patterns.

Additionally, many load balancing techniques can be combined or customized to suit specific requirements and environments. Load balancers, such as software-based solutions or dedicated hardware appliances, are commonly employed to implement these load balancing methods effectively.

Overall, the key aim of load balancing in a virtualized environment is to maximize VM resources by ensuring efficient workload distribution, preventing performance bottlenecks, and providing high availability.