Do you get too many visitors on the website, getting maximum hits on your site may crash your site, your site may get stuck or it may go through a downtime? How to avoid such instances?
Configuring a load balancer to your website can sort your problem. This load balancer device will help in distributing networks across numbers of servers. These devices are used to maximize the reliability and capacity of the network. The overall performance of the network is increased as this load balancer decreases the load on the servers associated with the network.
Load Balancing Algorithms.
There are types of load balancing algorithms which provide different benefits.
• Round robin: It refers to continue rotating the list of server that is attached to it. When a request is received by the virtual server, it assigns the connection sequentially.
• Least connections: In this method, the virtual server is configured to use the lowest connections
• Custom load: In this method, the load balancer chooses the server with the lowest load before distributing the network the load balancer checks where are the lowest transactions going on.
• The least Bandwidth: Load balancer device select the server which currently has lest amount of traffic measured in MBPS.
• Weighted round robin: It is a simple round robin load balancing method where each server there are given a static numerical weighting. The request is sent to those servers which have high ratings.
• Source IP hash: A unique hash key is generated by combining client and server’s IP address. A particular server is allocated using this hash key. As the key can be regenerated if the session is broken this method of load balancing can ensure that the client request is directed to the same server that it was using previously. This is useful if it’s important that a client should connect to a session that is still active after a disconnection. For example, to retain items in a shopping cart between sessions.
Load balancer configuration requirement:
1. Windows or Linux servers.
2. Virtual NIC adapter
3.Hardware or Software load balancer.
Configuration of Virtual NIC on windows server:
- Disable or allow rules the Windows firewall. (To Enable traffic to the loopback adapter)
- Install the loopback adapter.
- Configure the loopback adapter. In particular, stop the loopback adapter from responding to ARP requests.
- Loopback adapter has the same IP address as the VIP address.
- Make the Windows networking stack use the weak host model.
- If you are using IIS, add the loopback adapter to your site bindings.
1. Disable the Windows firewall.
For Microsoft Windows Server 2008 and Windows Server 2012, you need to disable the built-in firewall or manually change the rules to enable traffic to and from the loopback adapter. By default, the Windows firewall blocks all connections to the loopback adapter.
2. Install the loopback adapter.
For Windows Server 2008/2012 or Windows Server 2008/2012 R2, follow these instructions to install a loopback adapter on the server:
1. Open Device Manager. On the Start menu, click Run… and type devmgmt.msc at the prompt.
2. Right-click on the server name and click Add legacy hardware.
3. When prompted by the wizard, choose to install the hardware that I manually select from a list (Advanced).
4. Find Network Adapter in the list and click next.
5. From the listed manufacturers select Microsoft and then Microsoft Loopback Adapter.
6. This will add a new network interface to your server.
3. Configure the loopback adapter.
After the loopback adapter is installed, follow these steps to configure it:
1. In Control Panel, double-click Network and Dial-up Connections.
2. Right-click the newly installed loopback adapter and click Properties.
3. Click to clear the Client for Microsoft Networks check box.
4. Click to clear the File and Printer Sharing for Microsoft Networks check box.
5. Click TCP/IP properties.
6. Enter the VIP address and the subnet mask.
7. Click Advanced.
8. Change the Interface Metric to 254. This stops the adapter from responding to ARP requests.
9. Click OK.
4. Make the Windows networking stack use the weak host model.
For Windows Server 2008/2012 or Windows Server 2008/2012 R2, this step tells you how to make the Windows networking stack use the weak host model
Now, to determine the interface ID for both the loopback adapter and the main NIC on the server
1. Open a command prompt and type.
2. netsh interface ipv4 show interface
Note the IDX for both the main network interface and the loopback adapter you created.
If you have not changed the interface names for this server then usually the main NIC will display as Local Area Connection and the loopback adapter will be named Local Area Connection 2.
An entry will be displayed that includes the IDX numbers for both your loopback adapter and your Internet-facing NIC. For each of these adapters enter these three commands:
1. netsh interface ipv4 set interface <IDX number for Server NIC> weakhostreceive=enabled
2. netsh interface ipv4 set interface <IDX number for loopback> weakhostreceive=enabled
3. netsh interface ipv4 set interface <IDX number for loopback> weakhostsend=enabled.
Configuration of virtual NIC on Linux servers.
To configure virtual IP on linux server we have to run below-mentioned command.
Where XX.XX.XX.XX is the virtual IP and XXX.XXX.XXX.XXX is the subnet mask.
ifconfig lo:0 XX.XX.XX.XX netmask XXX.XXX.XXX.XXX up
In order to add virtual IP permanently follow the steps mentioned below.
Create /etc/sysconfig/network-scripts/ifcfg-lo: 10
Add Below mentioned parameters.
Restart network service.
Hardware Load balancer and software load balancer
Hardware load balancer :
A hardware load balancer is a device that directs computers to individual servers in a network on the basis of server performance, server processor utilization, number of connections to the servers. Hardware load balancer device can decrease the chances of submerging a particular server and optimize the bandwidth of each computer or terminal. It also decreases the network downtime, optimizes traffic prioritization, can provide with an end to end application monitoring and user authentication. There are several load balancers devices available in the market like foundry, F5, Cisco, Citrix.
Software load balancer:
Software load balancers are categorized into two parts that are installable load balancers and Load balancer as a service (LBaaS). This types of load balancer must be installed, configured and well managed. Some example of load balancer software is Varnish, HAproxy, Nginx. When it is about installation there is HA proxy. It is a TCP and HTTP based load balancer which can be suitable for high traffic. Software-defined load balancers not easy to provision but there are scalable, programmable and reliable.
Web Werks delivers best load balancing solutions mainly website who deals with High traffic. Majority of high traffic website rely on Web Werks to deliver content reliably securely and fast.
A software-based load balancer is costs less as compared to hardware-based load balancer with similar abilities. Choosing Web Werks for load balancer service it increases performance, reliability, and efficiency of your website and expands both customer’s satisfaction and returns on IT investment.