Introducing to Cloud Server

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

Previous topic - Next topic

Kralj187Topic starter

Load balancing in the IaaS provider's cloud helps to efficiently use the resources of virtual machines.
There are many methods of load balancing, but in today's material we will focus in detail on some of the most popular static methods: round-robin, CMA and threshold algorithm. Under the cut, let's talk about how they are arranged, what are their characteristic features and where they are used.



Static load balancing methods imply that the state of individual nodes is not taken into account when distributing traffic. Information about their parameters is "prescribed" in advance. And it turns out that there is a "binding" to a specific server.

Static distribution — binding to a single machine

The choice of web server can be determined by various factors, for example, the geographical location of the client, or it can be selected randomly.

Round-robin

This algorithm distributes the load evenly between all nodes. In that case, the tasks do not have priorities: the first node is selected randomly, and the rest are further in order. When the number of servers ends, the queue goes back to the first one.

One of the implementations of that algorithm is round-robin DNS. In this case, DNS responds to requests not with a single IP address, but with a list of several addresses.
When a user makes a name resolution request for a site, the DNS web  server assigns a new connection to the first server in the list. This constantly redistributes the load on web server group.

Today, that approach is used to allocate resources both within the data center and between individual data centers. Round-robin is usually implemented using reverse proxies, haproxy, apache and nginx. The intermediary application receives all incoming messages from external clients, maintains a list of web  servers and monitors the translation of requests.

Imagine that we have two environments deployed with highly available Tomcat 7 application servers and nginx load balancers. DNS servers "bind" several IP addresses to a domain name by adding external addresses of load balancers to a resource record of type A. Next, the DNS server forwards a list of IP addresses of available web servers, and the client "tries" them in order and establishes a connection with the first responder.

Note that that approach is not without drawbacks. For example, DNS does not check servers for errors and does not exclude IDs of disabled VMs from the list of IP addresses. Therefore, if one of web servers is unavailable, there may be delays in processing requests (about 10-30 seconds).

Another problem is that you need to adjust the cache lifetime of the table with addresses. If the value is too large, clients will not know about changes in web server group, and if it is too small, the load on the DNS server will seriously increase.

Central Manager Algorithm

In that algorithm, the central processor (CM) determines the host for the new process by selecting the least loaded server. The central processor makes a choice based on the information sent to it by web servers each time the number of tasks being processed changes (for example, when creating a child process or terminating it).

A similar approach is used by IBM in the Guardium solution. The application collects and constantly updates information about all managed modules and creates a so-called load map based on it. With its help, data flows are managed. The load balancer accepts HTTPS requests from S-TAP, a traffic monitoring tool, by listening on port 8443 and using Transport Layer Security (TLS).


The Central Manager Algorithm allows you to distribute the load more evenly, since the decision to assign a process to web server is made at the time of its creation.
But, the approach has one serious drawback — it is a large number of interprocess interactions, which leads to the appearance of a "bottleneck". At the same time, the central processor itself is a single point of failure.

Threshold Algorithm

Processes are assigned to hosts immediately when they are created. In that case, web server can be in one of three states defined by two threshold values — t_upper and t_under.

    Not loaded: load < t_under
    Balanced: t_under ≤ load ≤ t_upper
    Overloaded: load > t_upper


If the system is in a balanced state, then no additional actions are taken. If there is an imbalance, then the system takes one of two actions: sends a request to increase the load or, conversely, reduce it.

In the first case, the central web server evaluates which tasks that have not yet started to be performed by other hosts can be delegated to the node.
 Indian scientists from Guru Gobind Singh Indraprasta University in their study, which they devoted to evaluating the effectiveness of the threshold algorithm in heterogeneous systems, give an example of a function that nodes can use to send a request to increase the load:

UnderLoaded()
{
// validating request made by node
int status = Load_Balancing_Request(Ni);
if (status = = 0 )
{
// checking for non executable jobs from load matrix
int job_status = Load_Matrix_Nxj (No);
if (job_status = =1)
{
// checking suitable node from capability matrix
int node_status=Check_CM();
if (node_status = = 1)
{
// calling load balancer for balancing load
Load_Balancer()
}
} } }


In the second case, the central server can take away from the node those tasks that it has not yet started to perform, and, if possible, transfer them to another web server. To start the migration process, scientists used the following function:

OverLoaded()
{
// validating request made by node
int status = Load_Balancing_Request(No);
if (status = = 1)
{
// checking load matrix for non executing jobs
int job_status = Load_Matrix_Nxj (No);
if (job_status = =1)
int node_status=Check_CM();
if (node_status = = 1)
{
// calling load balancer to balance load
Load_Balancer()
}
} } }


When the load is redistributed, web servers send a message about the change in their process counter to other hosts so that they update their system status information.
The advantage of that approach is that such messages are rarely exchanged, since with a sufficient amount of server resources, it simply starts a new process at home — this increases performance.
  •  

nisha03

Code examples are a typical instance against magic constants. a comparison with 0 or 1 of the function value in if assumes that the value returned by the function does not rely on the standard conversion to true/false,
which means that without looking into the function it is unclear what is happening in principle, as a comparison with 0 or 1 indicates.
  •  

amardeep

What's cloudy about it? The usual hosting of virtual servers. Positioning yourself as a cloud is cool, of course, but it's not a cloud at all.
A regular virtual server based on Windows 2008 R2. The usual increase in the Frame, HDD, CPU load on a virtual machine, all the same can be done with any hosting provider on R2.
In my understanding, the cloud is when you do not have limited resources from above — those, you will be able to use the power of more than 1 server at once. And the server parameters should change dynamically, not by hand, and not within 10-15 minutes.
Bottom line: the usual virtual web hosting — which positions itself as a cloud.

amazon has such services, read — they call it "Reserved Instances". You pay not only for the resources used, but also pay for emergency capacity redundancy.
A subscriber of $2800 per year + $0.24 per hour is for High-CPU Reserved Instances.
This is what I call a full-fledged cloud.
Paying only for the resources used without a conditional threshold for voracity is a special case of the cloud.
  •