Skip to main content

Load balancing (L4 vs L7) and consistent hashing

Contrast L4 vs L7 load balancers and explain why consistent hashing with virtual nodes matters for caches/shards.

Official Reference

Model Answer & Explanation

L4 balances TCP/UDP connections fast without inspecting payloads; L7 terminates TLS and routes by HTTP path, headers, or cookies. Modulo hashing (hash(key) % N) remaps almost all keys when a node joins/leaves; consistent hashing maps nodes and keys onto a ring so adding/removing 1 node moves only ~1/N keys, and virtual nodes prevent uneven hotspots.

Follow-up Interview Question · When does least-connections routing beat round-robin (e.g. mixed fast CRUD + slow LLM endpoints)?

Module Context & References

System Design · Popular interview theory The 20% of distributed systems building blocks behind 80% of architecture rounds
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.