Hardware and software load balancers
easy 24 minA hardware load balancer is an appliance you install, often with chips made for moving packets or encrypting.
Video lesson · Chapter 1 of 5
Trace one flow through the appliance
Built-in oven or camping stove: load balancers in 75 seconds
1:15Reel coming soon
Theory
Read or listen first. About 2 min.
What it is
Every load balancer is a program running on some machine. With a hardware load balancer you buy the two together: an appliance from a vendor, with its own operating system, a support contract and often special chips.
With a software load balancer you bring the machine. NGINX, HAProxy, Envoy and Traefik run on a server, a virtual machine or a container. A cloud load balancer is a third choice: the provider runs it and you only configure it.
Why it exists
Moving packets and doing encryption is heavy, repeated work. Special chips can do a fixed kind of work very fast, so appliances were the normal answer for big sites for many years.
General processors, network cards and operating systems improved, and companies wanted to add capacity by starting another machine. Software balancers grew with that. Today the question is less "which is faster" and more "which fits how we operate".
A short history
February 1996
F5 is founded. Its BIG-IP line becomes one of the best-known families of load balancing appliances.
November 2000
The first lines of HAProxy are written, according to its change log.
October 2004
NGINX 0.1.0, the first public version, is released.
March 2016
Google publishes Maglev, a software network load balancer on ordinary Linux servers. The paper says it had served Google's traffic since 2008.
May 2018
Facebook releases Katran, which balances packets inside the Linux kernel with XDP and eBPF.
Words to know
- Appliance
- A machine sold for one job, with hardware and software from one vendor.
- ADC
- Application delivery controller: an appliance or product that balances, encrypts, caches and protects.
- ASIC
- A chip made for one task. Very fast, and cannot be changed later.
- FPGA
- A chip whose circuits can be configured after it is made.
- CPS
- Connections per second: how many new connections are opened each second.
- Commodity server
- An ordinary machine, not made for one product.
- Active and standby
- One works, the other waits to take over.
- Sidecar
- A small proxy that runs beside each service instance.
How it works
Step through the idea, or press Play.
Measure the need. Connections, requests, bandwidth, TLS and delay
Understand it
Start here
The oven and the stove story
Imagine cooking for guests with a built-in oven or with camping stoves. The oven is strong and fixed to the wall. A stove is small, can stand anywhere, and you can bring another.
Neither is simply better. It depends on the kitchen, the guests and who cooks.
Overview
Three forms of the same job
| Hardware | Software | Cloud service | |
|---|---|---|---|
| What you get | An appliance | A program | An address and settings |
| Runs on | Vendor's machine | Your server, VM or container | Provider's machines |
| Processing | General CPU, often with ASIC or FPGA help | General CPU, network card and kernel features | Hidden from you |
| You look after | Rack, power, firmware, contract | Machines, updates, spare capacity | Settings and limits |
| Examples | F5, A10, NetScaler, Kemp appliances | NGINX, HAProxy, Envoy, Traefik | Load balancers of AWS, Azure, Google Cloud |
All forms can work at layer 4 and layer 7. The form tells you how it is delivered, not what it reads. Load balancing covers the rules that choose a server.
Hardware
Hardware load balancers
A pair of appliances
What is in the box
Packet chips
ASICs or FPGAs move known kinds of packets without the main processor.
Crypto processors
Do part of the TLS work.
Network ports
Many fast ports on one machine.
Spare parts
Two power supplies, parts that can be changed while it runs.
Product families
| Product | Vendor | What it is |
|---|---|---|
| BIG-IP | F5 | Application delivery. Hardware with FPGA help, and virtual editions |
| NetScaler (earlier Citrix ADC) | NetScaler | Application delivery controller |
| Thunder ADC | A10 Networks | Hardware, virtual, cloud, bare metal and container forms |
| LoadMaster | Progress Kemp | Hardware, virtual and cloud load balancers |
Software
Software load balancers
Two balancers as pods
Well-known programs
| Program | Layers | Known for |
|---|---|---|
| NGINX | 4 and 7 | Web server, reverse proxy and balancer |
| HAProxy | 4 and 7 | TCP and HTTP balancing |
| Envoy | 3, 4 and 7 | Edge and service proxy, often a sidecar in a service mesh |
| Traefik | 4 and 7 | Edge router that reads its routes from container platforms |
upstream shop { least_conn; server 10.0.0.1:8080 weight=2; server 10.0.0.2:8080;}server { listen 80; location / { proxy_pass http://shop; proxy_http_version 1.1; proxy_set_header Connection ""; }}Because it is text, it can be reviewed, tested and stored in Git. Check a file with nginx -t, then nginx -s reload: new worker processes start with the new settings, and old ones finish the clients they have.
Speed
What does fast mean?
Four different speeds
| Measure | Question | Mostly limited by |
|---|---|---|
| Connections per second | How many new ones? | TCP and TLS handshakes |
| Requests per second | How many on open connections? | Parsing and copying |
| Bandwidth | How many bits? | Network cards and memory |
| Open connections | How many at once? | Memory |
From new connections to open connections
Old advice says hardware handles millions of connections a second and software only thousands. That is too simple. HAProxy's makers measured more than two million HTTP requests per second on one large Arm server in 2021, on open connections. Google's paper says one Maglev machine can fill a 10 gigabit link with small packets. Your number depends on TLS, message size and machine.
How much does the balancer's delay matter?
Growth
Scaling and spare capacity
Hardware grows
- Change to a bigger model
- Add a licence if the unit allows it
- Buy another pair
- Order early: delivery and rack space take time
Software grows
- Start another instance
- Use more cores
- Scale up and down with traffic
- Needs something to spread traffic over instances
How many software instances?
Who balances the balancers?
Failure
When one fails
Standby takes over
Two boxes do not help if both think they are active. Use a second heartbeat path, and a rule that prevents a split brain. Test a failover on a normal day. Software can use the same pattern, or run many active copies and lose only a share.
Money
Cost over years
| Cost | Hardware | Software | Cloud |
|---|---|---|---|
| Start | High: usually two units | Low | None |
| Licence | Device, features, support | Often free, paid editions exist | Usage |
| Place | Rack, power, cooling | Servers or VMs | Included |
| People | Vendor skills | Linux and automation skills | Cloud skills |
| Growth | In steps | Smooth | Smooth |
| End | Replace after support ends | Upgrade | Provider's schedule |
A break-even sum
Operations
Changes and updates
| Task | Hardware | Software |
|---|---|---|
| Change a rule | Vendor console, API or script | Text file or API, reviewed in Git |
| Update | Firmware, standby first | Rolling, a few instances at a time |
| Extend | Vendor scripting and modules | Modules, scripts, source code |
| Support | Contract with the vendor | Community, or a paid contract |
| Go back | Boot the previous image | Deploy the previous version |
Change a software balancer safely
- 1
Generate
Build the file from reviewed data, and refuse odd names or ports.
- 2
Check
Run the program's own syntax check.
- 3
Try one
Reload one instance and compare errors and delay.
- 4
Continue
Go on in steps. Keep the last good file ready.
Compare
Side by side
| Aspect | Hardware | Software |
|---|---|---|
| Speed | High and predictable for work its chips handle | Depends on machine and setup. Can be very high |
| Added delay | Often below a millisecond | Can also be below a millisecond. More with TLS and rules |
| Start cost | High | Low |
| Scale | Bigger unit or another pair | More instances |
| Deploy | Rack in a data centre | VM, container, cloud |
| Updates | Firmware | Rolling releases |
| Flexibility | What the vendor offers | High |
| Support | One vendor for all | Community or contract |
| Often found | Large own data centres, telecoms, banks | Web applications, microservices, clouds |
Decide
Which one when
Hardware fits
- Own data centre with steady, very high traffic
- Measured need for special chips
- A rule or contract asks for a certified appliance
- One vendor to call, and budget for it
- Staff already know the product
Software fits
- Cloud or containers
- Traffic that rises and falls
- Cost at the start matters
- Custom rules or scripts
- Reviewed, automated changes
- Many services that each need balancing
A short decision
A hybrid
Summary
The whole topic in one minute.
Hardware comes as a finished appliance with support and special chips, and grows by buying a bigger or another unit. Software runs almost anywhere, is configured as text and grows by adding machines. Vendors sell both forms, and clouds offer a managed third.
Decide from measured needs: new connections, requests, bandwidth, encryption and the delay you can accept. Count the spare capacity, the people and the years. Test with your own traffic, and never believe a speed without knowing what was measured.
- Hardware, software and cloud are ways to deliver the same job.
- Ask which speed was measured, and with what traffic.
- Hardware grows in large steps, software in small ones.
- Every form needs a spare and a rehearsed failover.
- Compare cost over years, with people included.