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.
See it run
Look inside each form, fail one, grow one, and change its rules safely.
Operations
Inside an appliance
A packet through a hardware load balancer, and what its special parts do.
Step 1 of 4
The parts
inside
ASIC or FPGA · crypto · CPU · ports
Packet chips, a crypto processor, main processor and fast ports in one box. A second box waits.
Step 1: The parts
def appliance(packet): if chip.knows(packet.flow): return chip.forward(packet) # fast path flow = cpu.decide(packet) # rules, new flows chip.learn(flow) return cpu.forward(packet)- Grows by
- Bigger unit, new pair
- Looked after by
- You and the vendor
Chips help with the work they were made for. Anything else uses the main processor.
In the real world
The same hardware and software load balancers doing real jobs. Pick one and step through it.
A company moves from an appliance to a software tier, in shares.
Step 1 of 4
Write the rules down
Rebuild every rule as text, and replay traffic to compare.
Step 1: Write the rules down
Common mistakes
The bugs interviewers watch for, with the fix beside each.
Buying one unit
criticalOne large box is a single point of failure, however reliable its parts.
Wrongbalancers = [big_box]Rightbalancers = [box_a, box_b] # and test failoverComparing different speeds
majorRequests on open connections and new TLS connections cannot be compared.
Wrongchoose(max(a.rps, b.cps))Rightchoose(test(a, our_traffic), test(b, our_traffic))Reloading an unchecked file
criticalA typing mistake on every instance at once stops the site.
Wrongfor b in balancers: write(b, new); restart(b)Rightif syntax_ok(new): reload_in_steps(balancers, new)Planning for 100% use
majorWhen one instance fails, the rest are overloaded and fail too.
Wrongceil(peak / each)Rightceil(peak / (each * 0.6)) + 1
Interview tips
How to explain it
- Built-in oven, or camping stoves.
- Buy a box, run a program, or rent the result.
Choose hardware when
- Own data centre, steady and very high traffic.
- A measured need or a certified device.
Choose software when
- Cloud, containers, changing traffic.
- Custom rules and reviewed changes.
Always
- Two or more.
- Test with your traffic.
- Count people and years.