Load Balancing - What, Why and How
The WHAT - Load Balancing in simple terms
As displayed in this example image below, Load Balancing in its simplest form means having a device (load balancer) setting in front of two or more Web or Application Servers. The Load Balancer will monitor the Servers and split the load between the Servers based on your preferences.
This also means that if one of the servers is down for any reason, like rebooting for Security Patches, the Load Balancer would send the traffic to the Server that is still available, insuring your site or application continues to load.
The WHY - Why use a Load Balancer
- Handle larger number of visitors or requests during "peak" traffic times
- Insure uptime for mission critical sites or applications
Regardless of how much Ram or CPU you throw at a server, there is a physical limitation to the amount of requests it can handle. By utilizing a Load Balancer, you can spread the load amongst multiple (generally 2 servers will handle most scenarios).
With a Load Balancer, it can be set to balance the load in "Round Robin" style meaning each Server takes turns getting the request. Another option is to have the Servers load balanced based on load.
The HOW - How to get started with a Load Balanced solution
Let's look at two scenarios first.
Tim (1st scenario), a photographer, has a mostly hobby site where he displays his awesome photos.
John (2nd scenario), an IT director, has a busy Application Server that handles his company's busy site or API traffic.
Tim doesn't really need a Load Balanced solution. John on the other hand definitely should have a Load Balancer setup.
So how would John get started? First we would recommend John schedule a conversation with one of our Server Specialists to make sure the correct solution is implemented. There are many things to consider when implementing a Load Balanced solution. We have helped many customers sucessfully launch the perfect solution.
Real Life Solution - Large City Government Planning for 7,000 visitors per MINUTE
To serve 7,000 people per minute for a large City Government, load balancing their web-servers was a perfect fit. Months before the launch of their new application they developed a simple list of requirements for the best user experience.
Their main objectives were:
- < 4 second load time (Actual Result: < 1 second load time)
- 7,000 visitors per minute (Actual Result: 6,000 visitors per minute)
Knowing their objectives, this gave us a great opportunity to plan the next steps. We needed to test their application and find the thresholds. For the tests we chose two servers; one for web and one for SQL databases. The application achieved ≈700 visitors per minute. We noted additional changes for their application to improve performance even further.
Once we had the updated version of their application from the development team, we ran new tests successfully. The final testing of the fully deployed solution was the remaining step before their official launch. The specs for the solution that would meet their performance objectives (<4 second load time, 7,000 visitors) included:
- 1 x Load Balancer & Virtual LAN
- 7 x Windows VPS
- 2 x Database VPS
This solution worked perfectly. Not only were we able to help them achieve their goals; we went a few steps further. Their database server was prepared for disaster, by log shipping to their secondary database server. Additionally, we helped them implement CloudFlare for CDN & Caching to turbo charge the load time.
You can read more about this particular soluton on our blog: How to Cost Effectively Support 150,000+ Visitors A Day.