InterviewStack.io LogoInterviewStack.io

Load Balancing and Horizontal Scaling Questions

Covers principles and mechanisms for distributing traffic and scaling services horizontally. Includes load balancing algorithms such as round robin, least connections, and consistent hashing; health checks, connection draining, and sticky sessions; and session management strategies for stateless and stateful services. Explains when to scale horizontally versus vertically, capacity planning, and trade offs of each approach. Also includes infrastructure level autoscaling concepts such as auto scaling groups, launch templates, target tracking and step scaling policies, and how load balancers and autoscaling interact to absorb traffic spikes. Reviews different load balancer types and selection criteria, integration with service discovery, and operational concerns for maintaining availability and performance at scale.

MediumSystem Design
58 practiced
Design a session management solution for a shopping-cart web app that needs strong session affinity for cart updates while supporting horizontal autoscaling and high availability. Compare strategies: LB sticky sessions, client-side signed tokens, centralized session store (Redis with replication), and event-sourced cart service. Discuss trade-offs for consistency, latency, failover, operational complexity, and cost.
HardTechnical
55 practiced
Explain how to implement session affinity (sticky sessions) in Kubernetes when using multiple Ingress controllers and Horizontal Pod Autoscaler (HPA). Include specific Service.spec.sessionAffinity settings, common Ingress annotations for nginx/traefik to enable cookie affinity, and pitfalls such as pod rescheduling, multi-LB layers, and affinity persistence across autoscaling events.
MediumTechnical
59 practiced
Explain how service discovery integrates with load balancers in microservices architectures. Compare DNS-based discovery, client-side discovery with registries (Consul/Eureka), and server-side discovery with gateways or service meshes. For each pattern describe how instances register/deregister, how the LB learns about backends, and how to handle TTLs and stale entries.
HardTechnical
70 practiced
You operate a service that handles millions of short-lived TCP connections and observe high TIME_WAIT counts and ephemeral port exhaustion on load-balancer nodes. Propose a comprehensive mitigation plan across OS tuning (e.g., TIME_WAIT reuse, socket options), load balancer configuration (connection pooling, proxying), and application-level changes (keep-alive, batching, multiplexing). Discuss trade-offs and risks of each approach.
MediumTechnical
67 practiced
Estimate the number of server instances and load balancer capacity needed for a streaming ingestion API that accepts 1,000 concurrent TCP connections, each sending 5KB/sec on average. Show calculations for aggregate bandwidth, headroom for spikes, per-connection CPU/memory assumptions (e.g., 0.5 KB/s -> 1% CPU), and how you would size LB and network capacity. State your assumptions explicitly.

Unlock Full Question Bank

Get access to hundreds of Load Balancing and Horizontal Scaling interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.