Technology / Networking

What Does a Load Balancer Do?

What Does a Load Balancer Do? picture: A
Follow us
Updated on November 11, 2022

The internet is a magical thing. Most of the time, it simply works.  But how do large websites like Google or Amazon handle all the web traffic that comes to them each day?

When you go to a webpage like CBT Nuggets, your computer makes a connection to another computer. Both your computer and that computer talk to each other. The other computer, a web server, sends information, like the CBT Nuggets website, back to your computer.  

This is a fast process. That communication between your computer and the web server takes four different trips back and forth communicating with each other on top of the website information you requested being sent from the web server to your computer. This communication process only takes a second or two.  

Web servers can only talk to so many computers at one time despite how fast they are, though. Imagine if you were trying to hold a conversation with 20 or more people at one time. There is a very good chance you would get overloaded and shut down and stop responding to people. That is too many people to have a conversation with at once.  

Web servers are not any different.  They can only hold so many conversations with other computers before they get too confused and stop responding. There are two different ways that IT professionals can handle this.

Learn How to Leverage Load Balancing Technologies

If you are unfamiliar with load balancing, get up to speed with CBT Nuggets training! Keith Barker covers load balancing in this video that discusses high availability. If you have experience with configuring load balancing and want to hone your skills further, you might find the following training helpful.

An Overview of Load Balancing

In this video, CBT Nuggets trainer Bart Castle covers how load balancers work as a part of a series on cloud networking concepts.

Once you’re confident in the underlying connections that keep your network running, you might want to turn next to speed and reliability. Load balancers are key to supporting the quality of the connection: load balancing can provide failover and distribution.

How to Keep a Website From Overloading

First, IT admins can make web servers more powerful. By adding more system resources like memory or faster processors to a computer, a web server can talk to more computers at once. Using more powerful web servers can only accomplish so much, though. Web server applications are good about using the resources available to them on a computer, but they are still limited because of how computers work and handle processing threads. Making matters worse, some applications, like NodeJS, may not actually see large performance gains by simply using a more powerful computer.  

So, another option IT administrators have is simply adding more computers. This is typically the best option. Imagine if you could clone yourself. It becomes a lot easier to hold a conversation with 20 different people if you can copy yourself 20 different times. That way, each person having a conversation with you gets their very own copy of you to speak with.  

The internet doesn't work that way, though. When you type in a website address, DNS gives you a single address for one computer or device. It doesn't give you a bunch of different addresses for you to try. So, how is your computer supposed to know if there are multiple copies of a web server to connect to, and even if it did, how would it know which one to connect to?

This is when you would use a load balancer.  Instead of connecting to a single computer (Eg. A web server), you would connect to a load balancer instead.  That load balancer will handle passing communication back and forth from your computer to a chunk of different web servers. This way a chunk of web servers can handle website traffic instead of depending on a single computer.

Why You Should Use a Load Balancer  

Instead of connecting to a single web server, your computer connects to a load balancer. That load balancer keeps a log of which web servers are available and which are being heavily used. With that information, the load balancer can send the request from your computer to the appropriate web server to give you the information you asked for.  

By using a load balancer, web admins can deploy as many web servers as they feel are necessary to handle the number of people that want to visit a single website. That might be two web servers or 100 web servers. The load balancer does the difficult task of keeping track of which web servers are busy and pointing new, incoming website traffic to the web servers that aren't busy at that moment.

What Happens if a Load Balancer Gets Overwhelmed?

Load balancers can manage other load balancers as well. By using multiple load balancers, websites can spread out the amount of traffic a bit more. Each load balancer would have its own chunk of web servers to manage. Those load balancers wouldn't have any idea of what's going on with other chunks of web servers or the load balancers managing those chunks, though.

Instead, there would be one big load balancer that manages all the smaller load balancers. That one big load balancer would keep track of how busy the smaller load balancers are and direct new internet traffic to web servers appropriately.  

By using a load balancer, computational tasks can be spread between multiple computers on demand. This way a single computer does not become overwhelmed and shut down.  

How Does a Web Server Decide Which Web Server to Send Traffic to?

Load balancers generally distribute internet traffic in one of three ways. First, there is a round-robin approach. Using the round-robin method, load balancers simply distribute internet traffic to web servers in sequential order. Otherwise, web servers stand in line and wait for their turn to do something. When it's that web server's turn in line, they take another task to handle from the load balancer despite whether they are done with the tasks it received prior.  

Another approach is sending data to a web server with the least number of connections. By managing internet traffic this way, in theory, the web server with the least number of connections is performing the least amount of work. That means it should be able to handle more work given to it by the load balancer.  

Finally, load balancers can simply send specific traffic to specific web servers. For instance, if any web traffic comes from your specific IP address, that traffic might be routed to web server 1. Any traffic that I request might be routed to web server 2, though.  

Those are just the three basic methods that load balancers use. Depending on who makes the load balancer, there might be other options. Some vendors that make load balancers have their own proprietary algorithms for managing networks and directing network load.

Software vs. Hardware Load Balancers

Load balancers come in all shapes and sizes. For instance, there are software load balancers. Software-based load balancers act as server applications and manage network traffic at an application level. They can be run within virtual machines, in a traditional computer, or as a service for another device.

There are also hardware-based load balancers. These are physical devices much like your home network router. They can be much faster than software-based load balancers but offer far fewer features and can't be updated as easily.  

You can also have cloud-based load balancers. These can be software or hardware-based load balancers, but they aren't located within your network. This is common for websites. Up until now, we have been using web servers as examples of what a load balancer is used for, though load balancers are not only for websites.

Load balancers can be used for anything that handles network traffic. Load balancers in the cloud are commonly used for IT resources, like a website though, where the resources don't need to be on the same network.  

For instance, you could create a website where one server is hosted on AWS in a Virginia data center, and another web server is hosted on AWS in a data center in Oregon (these would not be in the same network according to how Amazon creates its AWS resources), and a third web server might be located in the UK on Microsoft's Azure platform. A load balancer can still distribute traffic evenly between all three web servers even though they are in different parts of the world and are on different networks.  

What Else Can a Load Balancer Do?

Depending on who makes your load balancer, it might come with extra features. For instance, a software-based load balancer might also include a reverse proxy. A reverse proxy is used to redirect a network request from one computer and port to another on the network. This is common with web services. Reverse proxies can be used for all sorts of things.  

It's important to note that just because other features like a reverse proxy might be included with a load balancer does not mean that those features are performing load balancing. It would make sense to include a feature like a reverse proxy with a load balancer, but you need to understand the fundamental differences so you can both purchase and use the proper tools for what you need as well as communicate with the rest of your IT team properly.  

Should You Use a Load Balancer?

If you are creating a website or any other network resource that has even the slimmest possibility of getting a lot of traffic later, it would be a good idea to use a load balancer. Load balancers can be configured to only pass traffic to a single web server.

It's far easier to expand network resources if a load balancer is already being used as opposed to installing one from scratch during periods of heavy traffic, though.  


By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Don't miss out!Get great content
delivered to your inbox.

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Recommended Articles

Get CBT Nuggets IT training news and resources

I have read and understood the privacy policy and am able to consent to it.

© 2024 CBT Nuggets. All rights reserved.Terms | Privacy Policy | Accessibility | Sitemap | 2850 Crescent Avenue, Eugene, OR 97408 | 541-284-5522