Skip to content
Tech Interview Prep
Technical interview guide

Load Balancing

Distributing traffic across multiple backend instances: algorithms, health checks, and layer 4 vs layer 7 balancing.

Read
45 min
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed
Relevant for
Network Engineer

Scope: Current HTTP/1.1, HTTP/2, QUIC, TLS 1.3, Forwarded, HAProxy 3.2, NGINX, Envoy, Kubernetes, AWS ELB, and Google Cloud Load Balancing references reviewed 2026-09-04.

Curated: · Written: · Reviewed:

25 questions

MCQ-23A team needs TLS to stay end-to-end from client to backend, so the load balancer in front only forwards TCP segments and never terminates TLS. They now want per-request routing and session affinity. Which statement describes what this balancer can and cannot do?
MCQ-1A team replaces the TCP load balancer in front of 12 API pods with an L7 proxy that terminates TLS. They need requests for /v2/checkout to reach a canary pool and each client pinned to one pod by cookie. What does the new setup give them?
MCQ-2A service runs four identical backends behind an L4 (TCP) balancer using round robin, which assigns each new connection to the next backend in turn. Over one 60-second window, a batch job opens a single connection and sends 10,000 requests that each consume 20 ms of backend CPU, while interactive clients open many short connections and send 40,000 requests that each consume 2 ms. No backend fails and no connection is closed early. What does backend CPU time look like across the four?
MCQ-24An HTTP service runs on six backends behind an L7 load balancer using round-robin per request, serving 12,000 rps. Per-backend request counts are 1,995–2,005 rps, but backend 4 shows 3.1 GB/s egress, 100% CPU and p99 340 ms, while the other five sit near 0.5 GB/s, 35% CPU and p99 55 ms. What does this pattern indicate, and what should the team check first?
MCQ-17An nginx upstream block uses least_conn with five healthy backends that run the same service at the same per-request cost, and no max_conns, slow_start or backup directives are configured: | backend | weight | active connections | | --- | --- | --- | | A | 1 | 5 | | B | 2 | 13 | | C | 4 | 12 | | D | 8 | 40 | | E | 16 | 56 | One new request arrives. Which backend receives it?
MCQ-3An L7 balancer spreads gRPC traffic across 8 backends using least-connections. It parses HTTP/2 frames and updates connection counts on every open and close. Clients are configured to open one HTTP/2 connection per backend and multiplex all RPCs over it. Health checks use a separate port and are excluded. One backend reports 12 connections at 90% CPU and p99 4x the others; another reports 40 connections at 20% CPU. The balancer keeps sending new RPCs to the 12-connection backend. Why?
MCQ-4A cache tier assigns keys with `node = hash(key) % 12` across 12 Redis nodes. The team adds a 13th node and is weighing a switch to consistent hashing with virtual nodes. Which pair of churn figures should they expect?
MCQ-13An application runs behind an Application Load Balancer (ALB) that terminates TLS. The backend targets speak HTTP on port 8080. Before the migration, the app terminated TLS itself, logged the client certificate CN for mTLS, and rate-limited by client IP. After the migration, every backend log line shows peer address 10.0.2.14 (the ALB node), the client certificate CN is empty, the app's mTLS check rejects all requests, and the rate limiter's single bucket is saturated at 1,000 req/s. The team wants to keep TLS termination on the ALB. What should they do?
MCQ-14A service you operate sits behind three proxies you control (a CDN edge, then an ALB, then nginx) and each appends the TCP peer address to X-Forwarded-For. A request from a client at 203.0.113.9 arrives carrying `X-Forwarded-For: 192.0.2.99`; the CDN appends 203.0.113.9, the ALB appends 198.51.100.4, and nginx appends 10.0.2.7, so the app receives `192.0.2.99, 203.0.113.9, 198.51.100.4, 10.0.2.7`. The app's TCP peer is nginx at 10.0.3.5. Which value should the app record as the client IP?
MCQ-5A load balancer's only health check is a bare TCP connect to port 8080, run every 5 seconds; there is no HTTP probe. During an incident a backend's worker threads are all blocked on a lock, so it never reads from accepted sockets, yet the check keeps passing and the backend stays in rotation. What does a passing check establish about that backend?
MCQ-8A 12-replica service runs behind an ingress that routes only to ready pods. On each rolling deploy, a pod receives SIGTERM and its handler closes the listener within 100 ms. Endpoint removal takes about 2 s to reach the ingress dataplane, so the ingress keeps opening new connections to that pod for the rest of the window and users see connection-refused errors. Which change removes the errors?
MCQ-6A Kubernetes Deployment runs 12 pods behind a Service. Each pod's /healthz handler checks the database and cache. Both the liveness and readiness probes call /healthz with periodSeconds=5, timeoutSeconds=1, and failureThreshold=3. During a 90 s database failover, /healthz returns HTTP 500 after 2-3 s on every pod, while the process and HTTP listener stay healthy. Kubernetes restarts every pod every 15 s, and the restarts cut capacity. Which manifest change best stops the restart loop while still removing pods that cannot serve database-backed requests?
MCQ-21A payments API runs 24 replicas behind a load balancer. Each replica's readiness probe does a GET against the same shared Redis cluster, with a 1-second timeout, a 5-second period and failureThreshold 3. The load balancer removes an endpoint after three consecutive failed probes and returns it only after two consecutive successes. Redis hits a hot key and answers nothing for 12 seconds; 90 percent of the API's reads could be served from a 60-second local cache. What happens during the stall?
MCQ-16An HTTP API runs on 8 identical backends behind an L7 load balancer with cookie-based session affinity: the balancer sets a cookie naming one backend on a client's first request and keeps sending that client there until the cookie expires 24 hours later, and each backend keeps session state in local memory. Requests are spread evenly across the 8 backends, each serving about 12.5% of traffic. At 14:00 the team drains one backend for a kernel upgrade and terminates it. Which error pattern should the team expect over the next 24 hours?
MCQ-7A gateway proxies to an internal upstream over TLS. Clients set a 2 s end-to-end deadline. Under load, p99 upstream latency is 3.5 s: clients abort at 2 s while the gateway keeps the upstream connection open, and a single hung connect can consume the entire window. Which timeout organization should the team adopt?
MCQ-9An order service POSTs /v1/charges with the order id in the body. The HTTP client sets a 2 s deadline and, on a deadline or a connection reset, resends the byte-identical request once. The payments API commits the charge row and then writes the 200; under the team's load its p99 is 3.5 s, 1.2% of calls hit the client deadline, and 0.3% reset. The API dedupes on an Idempotency-Key header for 24 h, but the order service sends no such header. A 4,000-order run leaves 24 orders (0.6%) holding two charge rows, and the team must stop that without dropping a retry: a dropped call is a lost sale. Which change does that?
MCQ-10A checkout path retries at three layers: the mobile client, the edge proxy, and the orders service. Each layer makes up to 3 attempts before giving up, and the orders service's attempts are calls to the payments provider. Payments normally serves 200 req/s at 120 ms. During an incident its p99 climbs to 3 s, past every layer's 1 s timeout, and it starts returning 503. Which change actually bounds what the provider sees?
MCQ-22A service runs 8 backends, each admitting at most 100 concurrent requests with a 20 ms mean service time, so the pool's capacity is about 40,000 rps. The load balancer retries any request that exceeds its 1 s timeout, up to 2 extra attempts. During a spike the pool receives 30,000 rps of new requests, and 40% of them time out and are retried. How many request attempts per second must the pool absorb?
MCQ-12A load balancer fronts a pool of 20 workers. Each worker handles one request at a time and takes 20 ms, so the pool serves 1,000 req/s. The balancer holds requests in an unbounded FIFO queue. During a spike, arrivals hold at 1,400 req/s for 10 s, and every client abandons its request at 1 s. What happens during the spike?
MCQ-11An Envoy sidecar load-balances across 4 healthy upstream hosts. Per-host circuit-breaker limits are max_connections = 50 and max_pending_requests = 10, and the upstreams speak HTTP/1.1 (one request per connection). A client opens 300 concurrent requests. What does the client observe?
MCQ-15A service runs 30 pods, each with a database connection pool capped at 20 connections, against a PostgreSQL instance with max_connections = 500. During a traffic spike every pod fills its pool. What happens?
MCQ-18A service runs 10 instances behind a load balancer. Each instance handles 100 req/s at 60% CPU. The autoscaler checks average CPU every 15 seconds and adds instances when it exceeds 70%; a new instance takes 45 seconds from launch to pass readiness. At 12:00:00 traffic jumps from 800 req/s to 2,400 req/s and stays there. The service has no admission control or reserved capacity. What happens next?
MCQ-19A two-region service runs in us-east and eu-west behind a DNS record with a 30-second TTL. Health checks run every 10 seconds and drop a failed region from the record within one interval. Clients hold HTTP/2 connections with a 15-minute idle timeout. At 09:00:00 eu-west fails and the record is updated by 09:00:10. Monitoring shows about a third of requests still hitting eu-west until 09:15:00, then none. What explains the 15-minute tail?
MCQ-20A payments API is anycast-advertised from three PoPs: Ashburn, Dublin and Singapore, all announcing the same /24 over BGP with equal AS-path length. A client in Frankfurt opens a TCP connection to the service VIP; its SYN is routed to Dublin, and the connection is established. Mid-request, the Dublin PoP's BGP session to its upstream drops and the /24 is withdrawn there. The client's next packet in the same TCP connection is now routed to Ashburn. What does the client observe?
MCQ-25A team runs two HAProxy instances as an active-passive pair behind a keepalived virtual IP, using the stock configuration. The standby takes over the VIP about two seconds after the active instance dies, and the backends stay healthy throughout. What happens to client state at takeover?