Senior Track Roadmap

System Design: load balancing layer 7

This course covers layer 7 load balancing, using a Rails application that runs kamal-proxy behind Cloudflare. It compares layer 4 and layer 7 balancers. It explains how a balancer picks a backend with round robin, least connections, hashing and weights. It covers how deep a health check should go and why a check on a shared database can remove every backend. It also shows how X-Forwarded-For and trusted proxies affect client addresses and rate limiting. It ends with path routing, the preconditions for fuller features and a least-connections exercise.

What you'll learn

  • ✓The difference between layer 4 packet forwarding and layer 7 request parsing
  • ✓Round robin, least connections, hashing and weighted backend selection
  • ✓Choosing a health check depth that distinguishes one backend from the others
  • ✓Reading client addresses safely with X-Forwarded-For and trusted proxies
  • ✓When path routing fits and when the code has no real deployment boundary
  • ✓Implementing least-connections selection with health filtering and stable ties
Free preview · Lesson 1 3 min read

The two layers

A load balancer either understands your traffic or it doesn't, and that one distinction produces two families of product with almost nothing in common except the name.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...