Calendar Saturday, April 20, 2024
Text Size
   

gary

 

When I heard that oxygen and magnesium hooked up I was like OMg.
A Simple Server Cluster Design - Part 3 PDF Print E-mail
Written by Administrator   

This series is intended to provide documentation of a simple server cluster based on two physical servers and four virtual servers per machine, and configured to host an instance of the Moodle Learning Management System.

Topics


 

 

Load Balancing and Failover

Load BalancingWhat is Load Balancing?

Wikipedia defines this as: 

... a computer networking method to distribute workload across multiple computers or a computer cluster, network links, central processing units, disk drives, or other resources, to achieve optimal resource utilization, maximize throughput, minimize response time, and avoid overload. Using multiple components with load balancing, instead of a single component, may increase reliability through redundancy. The load balancing service is usually provided by dedicated software or hardware, such as a multilayer switch or a Domain Name System server.

There are two methods I will discusss in this article.The first method uses DNS, the second dedicated hardware. For a more in-depth discussion on the topic read this article.

Load balancing using DNS

The Domain Name System, or DNS as we more commonly refer to it, allows for multiple IP numbers to be assigned to a domain or sub-domain. When a DNS server is served with a request for DNS resolution, it will then deliver a result that sequences through the assigned numbers. We call this Round Robin DNS after the childrens game.

This method provdes a very easy, but basic method of load balancing - or rather load distribution as the balancing part is not very evident. There are downsides to this method, due to the various methods of caching inherent in the DNS System itself. The balancing component is very broad, and does not take into account any points of failure. This means that a faulty element in the system will continue to be served requests.

 

Load balancing using Dedicated Dardware

There are proprietary solutions which perform this role. Please refer to the manufacturers documentation for more information in this regard. As a starter try these sites:

5-Load-Balancers-You-Need-to-Know.htm

best-load-balancing-hardware.html

 

If you want to build your own, then read on. We will be implementing IPVSADM with help from the Linux Virtual Server Project. The elements we will be using are Pacemaker (which includes Heartbeat)  and ldirectord. The latter is used in Github for load balancing.

Lets look at a picture of the system we will be implementing:

 

Moodle Cluster

 

At the top level we have the Load Balancers. These run in a parallel mode, but only one is active at the time. The other monitors the active unit, and if it detects a potential failure situation, it implements  a STONITH procedure - ie Shoot The Other Node In The Head - ie to make sure that it is indeed dead, then takes over the same network configuration as the first. The Load Balancer operating manages it own process of Round Robin, but under a set of parameters that allows it to work co-operatively with the applications running on the Web Servers. This is due to the session handling that is fundamental in asynchronous systems such as Moodle.

The Load Balancers provide a means to balance the load to the various web servers, which can generate their output from a combination of static resources ( images, files etc ) located locally ( faster but requires more management of updates) or remotel from the File Server / NAS ( requires more network traffic).

NOTE: I have purposefully not shown the network connections as this may vary considerably, and is a topic in itself for reliability / redundancy.

The Web Servers then access resources from the Database Server(s), which will perform the required queries on the database. This requires the most resources of CPU, RAM and HDD.

There are other servers that may be required to share the load, such as redundant LDAP servers for authentication, and a Mail Server to manage the delivery of email. When placed on the local network the Mail Server will speed up the delivery process for the web servers.

 

Pacemaker & Heartbeat

Pacemaker (including Heartbeat) is the process that will provide the high availability of the Load Balancers themselves, so that if one fails, the other will take over almost immediately. As the documentation for installation and configuration changes from time to time I will not repeat/copy it here, but instead refer you to the source documentation. However, for installation check out the install link below.

 

LdirectorD

LdirectorD is the process that manages the actual balancing of the load between the Webservers. here is an excellent article for installing both Pacemaker/Heartbeat and LdirectorD.

Create High-Available Loadbalancer with Pacemaker

 

With these systems in place you now have Load Balancing and Failover capability for both the Load Balancers themselves, and the Web Servers.

 

Some other notes

With LdirectorD, you can configure a default message should all the Web Servers become unavailable.

 

Next

In the next article we will look at the setup for the webservers, handling sessions, and the update management of the Moodle application code.