Load Balancing 101: Directing Traffic Like A Pro
Have you ever wondered how when you go to the Emergency Room things seem to run like a well orchestrated machine? From the minute you check in, to seeing a triage nurse, to them knowing which doctor to route you to based on your signs and symptoms, there's a process or reason for who you're seeing or where you're going. Load balancers work a lot like triage in the Emergency Room, sitting as the first line of support in front of your application and directing traffic appropriately, based on the predefined rule set you give. Depending on those rule sets, load balancers can inspect and hand off traffic to the appropriate resource.
Below we explore common uses for load balancers and how they can all be orchestrated together for optimal efficiency.
Traffic and Transmission Control
Load balancers are most commonly associated with handling and offloading web based traffic, but can also be used to route Transmission Control Protocol (TCP) traffic as well. A user will visit your website and the load balancer can send the request to one of a number of back end web servers, either based on a round robin algorithm or based on the web server with the least amount of connections.
Load balancers can also check to ensure a back end server is alive before even passing the traffic to it. After identifying the underlying host and passing off the traffic, the load balancer can also be configured to send a small file back to the client and remind the client in the future to always use the same back end node, regardless of the algorithm it is configured for. This is referred to as sticky sessions.
Similar to the first person you talk to, the load balancer can be configured to do a little or a lot. Your configuration can be as simple as when traffic comes in, route it to the application based on an algorithm or it can be complex and include things like inspecting packets, redirecting traffic, and even including secondary information (referred to as proxy protocol). A load balancer can also allow the removal of a specific server in order to test an operating system upgrade or patch to a back end server prior to a system-wide roll out.
If you use the load balancer to handle and redirect web based traffic, similar to the triage nurse, you can have the load balancer also check for other critical factors such as HTTPS certificate validity and port. Configuring the load balancer to handle the certificate check as well as handle port forwarding, you're again offloading the tasks that the end server will need to handle. Traffic can be withheld or stopped based on key critical factors before it even gets to the end node similar to the nurse doing tasks to help offload some of the work from the doctor.
Securing the Experience
As discussed above, one of the things you can have a load balancer do is offload the HTTPS traffic you're sending to the end server(s). As users want a more secure experience each day, they're constantly looking for the green checkmark or lock in the upper corner of the URL bar. Good news for you is that back in 2012 Let's Encrypt was born and it gave administrators a free way to secure their websites and other devices that serve traffic on the internet. Vultr takes security seriously and as such, we've got documentation on providing that safe experience using Let's Encrypt. We've even created a Vultr Doc, outlining step-by-step instructions on how to install and configure a Let's Encrypt certificate on a load balancer.
One other main thing a load balancer can provide is a secondary firewall to your application. When a user makes a request to your website or wants to use your application, the load balancer will first inspect the traffic to ensure it meets the acceptance rules and if any of the traffic does not match the allow rule set, the load balancer will drop it, before the application or back end servers even have to see the traffic.
RELATED: Read Vultr's Announcement of new Load Balancer Security Features.
The Final Balance
Just like being triaged when visiting an emergency room, a load balancer can help direct and route traffic, ensuring that it gets to the right place and handled by the correct back end node. They can also be used to remove nodes to help further adhere to best practices when doing upgrades and patching. Using a load balancer just might be what your application or web server needs in order to make it more performant.
Get started with Vultr Load Balancer.