Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

A public platform must handle 2 million HTTPS requests per second at peak with 400,000 concurrent client connections, route by host and path to about 150 services, and survive the loss of a zone or of individual balancer nodes.

Design the load-balancing tiers from the client to the services, and explain why each tier exists.

I would build three tiers. At the edge, DNS and anycast addresses announced from several sites spread clients and absorb attacks. Next, a layer 4 tier using ECMP routing and Maglev-style consistent hashing spreads connections across a large layer 7 proxy fleet while barely disturbing existing connections when nodes change. The layer 7 fleet terminates TLS, routes by host and path to 150 services, enforces limits and auth, and pools backend connections. Every tier is sized to lose a zone, and internal traffic uses internal balancers or client-side balancing.

Why this question is asked

At 2 million requests per second and 400,000 concurrent connections, no single box or product does everything, so the design is about splitting responsibilities into tiers that each scale horizontally and fail independently. Interviewers ask this to see whether we can explain why each tier exists rather than just list components, and whether we size for failure rather than for the average day. In this answer, we will go through the requirements and rough numbers, the high-level design, each tier in turn with the reason it exists, sizing for a zone loss and reconnect storms, and how traffic flows inside the platform.

1Requirements and Rough Numbers

We need 2 million HTTPS requests per second at peak, 400,000 concurrent client connections, routing by host and path to about 150 services, and survival of a zone loss or individual balancer node failures without a visible outage. Implicitly we also need TLS termination with certificates for many hosts, protection against attacks, and per-route visibility.

Some rough numbers guide the sizing. A tuned layer 7 proxy such as Envoy or NGINX on a 16 to 32 core machine might handle on the order of 50,000 to 100,000 HTTPS requests per second, depending on request size and features; at 50,000, we need about 40 proxies for peak before headroom. 400,000 connections spread over 40 proxies is 10,000 each, which is comfortable for memory. New TLS handshakes are the expensive part, which matters in a reconnect storm, so we measure handshakes per second per core rather than assume.

2The High-Level Design

Traffic flows through three load-balancing tiers before reaching services. Each tier solves a different problem: getting clients to a nearby healthy site, spreading connections over many proxies, and understanding requests.

Step throughLoad-balancing tiers from client to service
  1. DNS and anycastclients reach the nearest healthy site, attacks are spread
  2. Layer 4 tierECMP plus Maglev hashing over the proxy fleet
  3. Layer 7 proxy fleetTLS, routing to 150 services, limits, auth, pooling
  4. Service balancinginternal balancers or client-side, per request
  5. Servicesmany pods per service across zones

5 layers, from the top down. Step through them one at a time.

3The Edge: DNS and Anycast

The first tier decides which site a client reaches. With anycast, the same IP address is announced over BGP from several locations, and the internet's routing sends each client to the nearest one. If a site fails, it stops announcing and traffic shifts to the others. GeoDNS achieves similar spreading by returning different addresses per region, with health checks removing failed sites.

This tier exists because no single location can be both close to every client and immune to failure, and because volumetric attacks, floods of traffic that try to saturate links, are absorbed when spread across many sites and scrubbing capacity, often provided by a CDN or DDoS protection service.

4The Layer 4 Tier and Consistent Hashing

Inside a site, routers use equal-cost multipath routing (ECMP) to spread packets for the service address across many layer 4 balancer nodes. Each node then picks a layer 7 proxy for the connection. A node must choose the same proxy for every packet of a connection, even though ECMP may send packets of one connection to different layer 4 nodes after a change. That is why these nodes use consistent hashing on the connection's addresses and ports, with Maglev hashing from Google's design being a common choice: every node computes the same answer independently, and adding or removing a proxy or a balancer node changes the mapping for only a small fraction of connections.

This tier exists so that the layer 7 fleet can scale horizontally behind one set of addresses, and so that losing a balancer or proxy breaks only the connections that were on it. It is cheap per packet, often running in the kernel with XDP or IPVS, or as a managed network load balancer.

Why each tier exists
TierProblem it solvesScales by
DNS and anycastreach a nearby healthy site, absorb floodsmore sites, more announcements
Layer 4 with Maglev hashingspread connections, keep them stablemore L4 nodes behind ECMP
Layer 7 proxy fleetTLS, routing, limits, auth, poolingmore proxies behind L4
Service balancingper-request spread over podsservice discovery, client policy

5The Layer 7 Proxy Fleet

The proxies do the expensive and valuable work. They terminate TLS, selecting the certificate by SNI for many hostnames, parse HTTP/1.1, HTTP/2 or HTTP/3, look up routes by host and path to one of 150 services, apply rate limits, authentication and request size limits, and add tracing and forwarded headers. Routes and certificates are pushed from a control plane, for example through Envoy's xDS APIs, so all proxies change consistently without restarts.

Crucially, the proxies keep pooled, long-lived connections to the services. 400,000 client connections do not become 400,000 backend connections; each proxy keeps a modest pool per service and multiplexes requests over it, using HTTP/2 where possible. That protects services from connection storms and from slow clients, since the proxy buffers requests and responses.

6Sizing for a Zone Loss and Reconnect Storms

Every tier is sized for failure, not for the average day. If three zones share the load and one fails, the other two must carry everything, so each zone must be able to take half as much again as its normal share: 50 percent headroom on top of peak. With 40 proxies needed at peak, spread across three zones, we would run about 60.

When a zone or many proxies fail, their clients reconnect elsewhere almost at once, and each reconnect is a full TLS handshake. 130,000 clients reconnecting in a few seconds can overload the surviving proxies' CPU even if steady-state capacity is fine. We size handshake capacity for that, enable TLS session resumption so returning clients do cheaper handshakes, and rely on clients retrying with jitter. Proxies also drain gracefully on deploys, closing connections gradually instead of all at once.

7Inside the Platform and Observability

Behind the edge, services call each other through internal load balancers or client-side balancing, such as a mesh sidecar or gRPC clients with round robin over service discovery, so internal traffic does not pass back through the public edge. Every tier exports metrics: connections and handshakes at layer 4, and per-route request rate, latency percentiles and error rates at layer 7, so when one of 150 services degrades we can see it on its own route rather than in a global average.

8Follow-up questions

Why does the layer 4 tier use consistent hashing instead of round robin?

Because packets of one TCP connection must always reach the same proxy, and the layer 4 nodes do not share state. With consistent hashing on the connection's addresses and ports, any node computes the same proxy for a given connection, so ECMP can send its packets to any node. When a proxy or node is added or removed, only the connections mapped to it move, about 1/N of them, while round robin or a simple modulo hash would remap most connections and break them.

Where would you put a CDN in this design?

In front of the edge for cacheable content and DDoS absorption. The CDN terminates many client connections close to users, serves static and cacheable responses itself, and forwards the rest over a smaller number of long-lived connections to our anycast addresses, which reduces both handshakes and traffic at our tiers.

How do you deploy a new proxy configuration safely across the fleet?

Through the control plane in stages: validate the configuration, push it to a small canary group of proxies, watch per-route errors and latency, then roll out zone by zone. Keep the previous version ready for an instant rollback.

9Conclusion

In this answer, we saw that 2 million requests per second across 150 services needs tiers with distinct jobs: DNS and anycast to reach a nearby healthy site and absorb floods, a layer 4 tier with ECMP and Maglev hashing to spread stable connections over many proxies, and a layer 7 fleet for TLS, routing, limits, auth and pooled backend connections. Each tier is sized for a zone loss and reconnect storms, and internal traffic uses internal or client-side balancing with per-route metrics everywhere.

What to say in the interviewAbout 80 seconds aloud

Open with

I would design three tiers, each with its own job. At the edge, anycast addresses announced from several sites, or GeoDNS with health checks, send clients to a nearby healthy location and spread volumetric attacks across sites and scrubbing capacity.

Then, if they want more

Inside a site, routers use ECMP to spread packets over many layer 4 balancer nodes, which pick a layer 7 proxy per connection using consistent hashing such as Maglev, so every node agrees on the mapping and adding or removing a node only moves a small fraction of connections.

The layer 7 fleet, for example Envoy configured through a control plane, terminates TLS by SNI, routes by host and path to the 150 services, applies rate limits and authentication, and keeps pooled long-lived connections to services, so 400,000 client connections do not become 400,000 backend ones.

For sizing, if a proxy handles around 50,000 requests per second, peak needs about 40, and to survive a zone loss across three zones each must absorb half as much again, so roughly 60, with spare TLS handshake capacity and session resumption for the reconnect storm.

Internally, services use internal balancers or client-side balancing, and every tier exports per-route latency and errors.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Design the load-balancing tiers from the client to the services, and explain why each...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/4fd8db0b7b/