Scrivio Interview library
ScenarioAdvanced6 min read · updated 13 November 2026

An edge proxy fleet holding 300,000 mobile client connections was restarted for an urgent patch. All clients reconnected within seconds, proxy CPU reached 100 percent on TLS handshakes, and the login service behind it was overwhelmed for 15 minutes.

Why was reconnection so costly, and what would you change in the proxies, the certificates and the clients?

Every reconnect needed a TLS handshake with an expensive server-side signature, and because session resumption did not work across proxy nodes, all 300,000 were full handshakes, which saturated the proxies' CPU; then every client logged in again at once. The fixes are fleet-wide session ticket keys, rotated and kept secret, so returning clients resume cheaply on any node, ECDSA P-256 certificates whose signatures cost far less than RSA 2048, gradual restarts that move connections in waves, and clients that reconnect with exponential backoff and jitter and reuse their login session instead of logging in again.

Why this question is asked

A routine patch should not cause a 15-minute outage, but restarting a fleet that holds hundreds of thousands of persistent connections is not routine: every one of those connections comes back at once, and everything the connection setup touches is hit at the same moment. Interviewers ask this to see whether we understand the cost of a TLS handshake and how to design proxies, certificates and clients for mass reconnection. In this answer, we will see why the reconnect was expensive, then fix resumption, certificates, the restart process and the clients.

1Why 300,000 Reconnects Were So Expensive

A full TLS handshake costs the server one private key operation, a signature with the certificate's key, plus a key exchange. With an RSA 2048 key, the signature dominates: a single CPU core can do on the order of one or two thousand RSA 2048 signatures per second, depending on hardware. If the fleet has, say, 6 proxies with 8 cores each, that is 48 cores, or at most about 50,000 to 100,000 full handshakes per second with nothing else running. Three hundred thousand clients reconnecting within one or two seconds already exceed that, the proxies still have to move traffic for clients that did connect, and a handshake that times out under CPU pressure is retried as another full handshake. The CPU sits at 100 percent and handshakes complete slowly, which causes more timeouts and more retries.

Behind the proxies, every reconnected client then logged in again. Three hundred thousand logins within a minute is far more than a login service sized for normal traffic can handle, so it was overwhelmed too, and failed logins triggered yet more retries.

2Fix 1: Make Session Resumption Work Across the Fleet

Session resumption lets a returning client skip the expensive part. On the first connection, the server gives the client a session ticket, an encrypted blob containing the session's secrets, encrypted with a ticket key known only to the server. On a reconnect, the client presents the ticket; the server decrypts it and resumes without a certificate signature. That is much cheaper in CPU.

The problem in a fleet is that each proxy process generates its own random ticket key at startup by default. A client whose ticket was issued by proxy 3 and who reconnects to proxy 7 presents a ticket proxy 7 cannot decrypt, so it falls back to a full handshake. After a restart, every proxy has a new key, so no ticket works at all. The fix is to distribute the same ticket keys to the whole fleet, from a secret store, and rotate them on a schedule, keeping the previous key for decryption during the overlap.

Java
# NGINX: shared ticket keys, distributed to every proxy from a secret store
ssl_session_tickets on;
ssl_session_ticket_key /etc/tls/tickets/current.key; # first key encrypts new tickets
ssl_session_ticket_key /etc/tls/tickets/previous.key; # older keys still decrypt
ssl_session_timeout 12h;
# rotate: every few hours, previous <- current, current <- new random 80-byte key

With shared keys that survive the restart, most of the 300,000 clients resume on whichever proxy they reach, and the CPU cost of the storm drops sharply.

3Fix 2: Use ECDSA Certificates

The second lever is the certificate type. A server signature with an ECDSA P-256 key costs much less CPU than one with an RSA 2048 key, several times less on typical servers, while giving equal or better security. Modern clients, including every current mobile platform, support ECDSA. Proxies such as NGINX and Envoy can hold both an ECDSA and an RSA certificate for the same name and choose per client, serving RSA only to old clients that do not offer ECDSA.

What a reconnect costs the proxy
HandshakeServer private key operationRelative CPU cost
Full, RSA 2048RSA signaturehighest
Full, ECDSA P-256ECDSA signatureseveral times lower
Resumed with a valid ticketnonelowest
Resumption removes the signature; ECDSA makes the remaining full handshakes cheaper. Measure on your hardware.

4Fix 3: Restart Gradually

Even with cheap handshakes, restarting the whole fleet at once creates a synchronized wave. An urgent patch still leaves time for a rolling restart: take a few proxies out of the balancer at a time, let them drain by closing idle connections gradually and sending clients a polite close or GOAWAY spread over a minute or two, restart them, and move on. With 6 proxies restarted one at a time, about a sixth of connections move in each wave, and each wave lands on proxies that are warm and have spare CPU.

5Fix 4: Make Clients Reconnect Politely

The clients are the final multiplier. If every app reconnects immediately when its connection drops, and retries immediately on failure, a restart becomes a thundering herd. Clients should reconnect with exponential backoff and random jitter: wait a random time within a growing window, so 300,000 clients spread their reconnects over tens of seconds instead of one.

Java
long backoffMillis(int attempt) {
long cap = 60_000; // never wait more than 60 s
long base = Math.min(cap, 500L << attempt); // 500, 1000, 2000, 4000 ... ms
return ThreadLocalRandom.current().nextLong(base + 1); // full jitter: 0..base
}
// attempt 0 -> 0..500 ms, attempt 3 -> 0..4000 ms, attempt 7 -> 0..60000 ms

Clients should also reuse their login session. A dropped connection does not mean the user's session ended: the app should reconnect presenting its existing access token or refresh token, and only log in again if that is rejected. That turns 300,000 logins into 300,000 cheap token validations, which the login service, or the proxy itself, can handle easily.

6Follow-up questions

What is the security risk of long-lived session ticket keys?

Whoever holds a ticket key can decrypt every ticket encrypted with it, and tickets contain the session secrets. If a key leaks and an attacker has recorded traffic, they may be able to decrypt the resumed sessions protected by that key, which undermines forward secrecy for those sessions. So ticket keys must be kept in a secret store, never on disk longer than needed, and rotated frequently, for example every few hours, with old keys deleted after a short overlap. TLS 1.3 resumption can also mix in a fresh key exchange, which limits the damage, so prefer that mode where supported.

Why not just add more proxies?

More proxies help, but sizing a fleet for a full simultaneous reconnect wastes most of that capacity on every normal day. Resumption, ECDSA, gradual restarts and client jitter reduce the peak itself, which is far cheaper than buying for it.

7Conclusion

In this answer, we saw that 300,000 simultaneous reconnects meant 300,000 full handshakes, each with an expensive signature, because resumption did not work across proxy nodes, and then 300,000 logins. The fixes are shared, rotated session ticket keys so clients resume on any node, ECDSA P-256 certificates that make full handshakes much cheaper than RSA 2048, rolling restarts that move connections in waves, and clients that use exponential backoff with jitter and reuse their sessions instead of logging in again.

What to say in the interviewAbout 80 seconds aloud

Open with

Every reconnect needed a TLS handshake, and the expensive part is the server's private key signature. Session resumption should make returning clients cheap, but each proxy had its own ticket key, generated at startup, so after the restart, or when a client landed on a different node, no ticket could be decrypted and all 300,000 were full handshakes at once.

Then, if they want more

That pinned the CPU, slow handshakes timed out and were retried, and then every client logged in again, which overwhelmed the login service. I would fix it at four levels.

In the proxies, share session ticket keys across the fleet from a secret store, rotate them every few hours with an overlap, so any node can resume any client and restarts do not invalidate tickets.

In the certificates, use ECDSA P-256, whose signatures cost several times less CPU than RSA 2048, and serve RSA only to old clients that need it. In operations, restart proxies a few at a time and drain them gradually, so connections move in waves.

In the clients, reconnect with exponential backoff and full jitter, so reconnects spread over tens of seconds, and reuse the existing token or refresh token rather than logging in again, so the login service only sees cheap token checks.

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 "Why was reconnection so costly, and what would you change in the proxies, the...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/207bd7b305/