TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation Β· 5.9K subscribers
Post #1375 375
πŸ—οΈ SYSTEM DESIGN MONDAY #3 - Load Balancing & Horizontal Scaling

One server is now overwhelmed. Two options: make it bigger (vertical scaling) or add more of them (horizontal scaling). Horizontal scaling is what most large systems actually do - there's a ceiling on how big one machine can get, but no real ceiling on how many machines you can add.


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”Œβ”€β”€β”€β”€β”€β–Άβ”‚ Server 1β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
[Client] β†’ [Load Balancer]
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”œβ”€β”€β”€β”€β”€β–Άβ”‚ Server 2β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
└─────▢│ Server 3β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


The load balancer sits in front of your servers and distributes incoming requests, usually via:
πŸ”Ή Round robin - requests go to servers in rotating order
πŸ”Ή Least connections - send to whichever server currently has the fewest active requests
πŸ”Ή IP hash - same client always routed to the same server (useful for session data)

Here's the important follow-up question interviewers ask: "if a user's session data is stored in Server 2's memory, what happens if the load balancer routes their next request to Server 3?"

That's the concept of statelessness - well-designed servers shouldn't hold session data locally at all. Instead, store session state in a shared cache (like Redis) or a database, so ANY server can handle ANY request. This is a foundational principle behind horizontally scalable systems.

Why do you think "statelessness" matters so much in distributed systems? πŸ‘‡
More from @coding_interview_preparation
  1. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  2. Oct 6, 2026document post
  3. Oct 4, 2026πŸ’Ό Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  4. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
  5. Oct 1, 2026Most Asked Topics in AI Engineer Interviews Based on 2026 candidate reports
  6. Sep 30, 2026πŸ’Ό What Companies Actually Look For in a Fresher Think companies only care about your CGPA…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’