Design a Software Load Balancer
Design a regional software load balancer with a chosen L4 or L7 data path, versioned policies, backend health, and graceful draining. Audit round robin for a bounded opaque request profile.
Problem statement
For this exercise, assume service operators configure regional virtual services and clients are routed through a software load-balancer fleet to healthy backends in three availability zones.
Choose either connection-level L4 routing for TCP traffic or request-aware L7 routing for HTTP traffic as your primary design, then explain the important data-path differences for the other mode.
An L4 design may balance connections by weight or affinity; an L7 design may additionally match host, path, or headers and split traffic by weight among backend pools. Operators can register or remove backends, change policies through validated revisions, inspect health, and drain a backend before maintenance.
The data plane must keep serving the last validated revision during a control-plane outage. New configuration should reach healthy instances within thirty seconds. Active and passive health evidence should stop new work from reaching a failed backend within ten seconds while avoiding fleet-wide flapping.
A draining backend receives no new work. For L4, established connections may finish until a bounded deadline and are never silently moved; for L7, retry only requests the policy declares safe and keep retry budgets bounded.
Design the control plane, configuration distribution, your chosen data path, backend discovery and health model, load-balancing policy execution, connection or affinity state, overload behavior, observability, and recovery.
Certificate issuance, global traffic steering, service-mesh sidecars, application authentication, and denial-of-service scrubbing are outside scope.
A separate reported case describes services behind a load balancer that assigns tasks round robin and asks whether this is suitable for a customer disclosure task. The report does not define that task, its duration, state, protocol, affinity, effect semantics or worker capacity.
For this exercise, interpret it only as an opaque, stateless synchronous HTTP request profile for an additional L7 audit: each request and response, including headers and body, is at most 64 KiB; healthy backend processing completes within 200 milliseconds; there is no cross-request affinity, durable task admission or external side effect.
These are authored profile limits, not reported disclosure requirements. Preserve the primary L4/L7 design choices and all existing control, health, drain and retry rules.
Audit equal-weight round robin over a versioned eligible endpoint snapshot with a bounded per-proxy cursor. Explain what it balances when endpoints and work are comparable, and why equal assignment counts do not guarantee equal work, latency or capacity use when service times, endpoint capacity or eligibility differ.
State per-backend concurrency/admission bounds, skip or explicitly reject saturated/ineligible endpoints under the declared policy, and expose no-eligible-backend, overload and uncertain outcomes. Cursors may differ across proxies; no global perfect fairness is promised.
Keep uncertain requests non-retryable by default for this opaque profile, and choose a measured capacity-aware alternative only when justified. Application disclosure business logic, customer identity/authentication, asynchronous work and exactly-once effects remain outside scope.
What to build
- Operators can create and activate validated, versioned listeners in the chosen L4 or L7 mode, with backend pools, applicable routing rules, weights, and affinity policies.
- The data plane routes new connections or requests to eligible healthy backends according to the active policy while preserving required connection and affinity semantics.
- Operators can register, inspect, drain, and remove backends, while active and passive health evidence controls eligibility without disrupting established L4 connections.
- Operators can observe configuration rollout, backend health, routing outcomes, saturation, and failures, and the data plane sheds or rejects overload predictably.
- Audit round-robin endpoint selection for the declared bounded stateless L7 profile, distinguish assignment count from work and capacity, and expose eligibility, saturation and uncertain outcomes without inventing a durable-task or business-effect guarantee.
At scale
- For this exercise, assume one regional virtual service may sustain 250,000 L7 requests per second or 100,000 new L4 connections per second, with up to two million concurrent connections.
- For this exercise, keep added proxy latency below 10 milliseconds at p99 for ordinary L7 requests and below 2 milliseconds at p99 for L4 connection admission when the fleet is healthy.
- For this exercise, target 99.99% regional data-plane availability across three availability zones; a control-plane outage must not interrupt traffic on the last validated configuration.
- For this exercise, propagate validated configuration within 30 seconds and stop assigning new work to a confirmed failed backend within 10 seconds, while preserving bounded drain deadlines and retry budgets.
- Separate source fact: a fleet of services sits behind a round-robin task-assigning load balancer, and the interviewer asks about suitability for an undefined customer disclosure task. For this added audit only, assume stateless synchronous HTTP, at most 64 KiB each request/response including headers/body, healthy backend processing within 200 ms, no affinity/durable task/external effect, and stated concurrency bounds. These limits do not replace the primary L4/L7 throughput and latency targets; work variability/capacity are measured inputs.