What is a load balancer?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
A load balancer distributes incoming network traffic across multiple servers to ensure no single server becomes overwhelmed, improving availability and scalability. Types: Layer 4 (Transport) load balancers make decisions based on IP and TCP/UDP ports without inspecting content — fast but limited visibility. Layer 7 (Application) load balancers inspect HTTP headers, URLs, and cookies to make more intelligent routing decisions (e.g., route /api to API servers, /static to CDN). Load balancing algorithms: Round-Robin (distribute equally in rotation), Least Connections (send to server with fewest active connections), IP Hash (consistent routing based on client IP — session persistence), Weighted (servers get traffic proportional to weight). Health checks detect and route around failed servers. Examples: AWS ELB/ALB/NLB, Nginx, HAProxy, F5 BIG-IP. Load balancers are essential for high-availability web applications.
Common Mistake
Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your Networking experience.