Scrivio Interview library
DebuggingAdvanced6 min read · updated 13 November 2026

An autocomplete service handles 60,000 requests per second, 85 percent answered by an edge cache. After a release that changed how prefixes are normalised, the edge hit ratio fell to 30 percent, origin p99 rose from 15 ms to 220 ms, and suggestions arrived after people had finished typing.

Explain how a normalisation change could cause this, how you recover during the incident, and how such changes should be released next time.

The edge cache key is built from the prefix, so if the client and server now normalise differently, or the URL gained a parameter, equal prefixes stop sharing entries and the cache acts as if cold. The origin was sized for about 15 percent of traffic; at 70 percent misses it saturates and queueing pushes p99 far past the useful 100 ms window. We recover by rolling back or restoring the old key, adding origin replicas from the latest snapshot and dropping requests older than a deadline; next time we canary with hit ratio and origin load as gates, pre-warm the new key, version keys on purpose, and rely on clients to debounce, cancel and reuse.

Why this question is asked

This incident is a reminder that a cache is part of capacity, not a bonus. When 85 percent of traffic is absorbed by the edge, the origin is built for the remaining 15 percent, and a change that seems purely cosmetic, how a prefix is normalised, can multiply the origin's load. Interviewers ask it to see whether we can connect a cache key to a latency graph. In this answer, we will see how the edge cache key works, how the normalisation change broke it, why latency exploded rather than degrading gently, how to recover during the incident, and how to release such changes safely.

1How the Edge Cache Was Working

The CDN edge caches suggestion responses under a cache key, normally the request URL: the path and query string. Two requests for /suggest?q=new%20y&locale=en-US share one entry. Because short and popular prefixes repeat endlessly, 85 percent of the 60,000 requests per second were answered at the edge, and only about 9,000 per second reached the origin. The origin fleet was sized for that, with some headroom, perhaps 12,000 per second at most.

2How a Normalisation Change Breaks the Key

Suppose the release changed the client to send the raw prefix, 'New Y', while the server now normalises it to 'new y' itself, or added a parameter such as norm=2 to every URL. In the first case, requests that used to arrive identical now differ in case, spacing and accents, so 'New Y', 'new y' and 'new y' are three cache entries instead of one. In the second, every old entry is under a key that no longer matches, so the cache starts empty. Either way, equal prefixes stop sharing entries, and the number of distinct keys grows several times, which spreads the same traffic thinly over many entries that each get few hits.

Same prefix, different cache keys
Before the releaseAfter the release
/suggest?q=new%20y&locale=en-US/suggest?q=New%20Y&locale=en-US
(same key for every user)/suggest?q=new%20%20y&locale=en-US
(old entries stay unused)/suggest?q=new%20y&locale=en-US&norm=2
One cache entry became many, so each gets a fraction of the hits.

3Why Latency Exploded Instead of Degrading

With the hit ratio down from 85 to 30 percent, the origin receives 70 percent of 60,000, about 42,000 requests per second, nearly five times its normal load and well over its capacity. A server running near or above capacity does not just get a little slower: requests start waiting in queues, and queue length grows rapidly as utilisation approaches 100 percent. That is why p99 went from 15 ms to 220 ms rather than to 30 ms.

For autocomplete, 220 ms is effectively a failure. The suggestion for 'new y' arrives after the person has typed 'new york ti', so it is thrown away, while the server spent its capacity computing it. Worse, clients that see slow responses may fire more requests as people keep typing, adding load exactly when there is none to spare.

4Recovering During the Incident

The fastest fix is to remove the cause: roll back the release, or, if the client part cannot be rolled back quickly, restore the old cache key at the edge by normalising the prefix there, lowercasing and collapsing spaces in edge logic, and stripping the new parameter from the key. Hit ratio recovers within minutes as the edge refills.

Meanwhile we add origin capacity. Because the suggest servers load an immutable snapshot, new replicas can start from the latest snapshot in object storage and join the pool within minutes. And we shed useless work: each request carries the time it was sent, and the server drops any request older than a deadline, for example 80 ms, because a late suggestion is worthless. Dropping late requests frees capacity for fresh ones, so the system recovers instead of spiralling.

Step throughIncident recovery
  1. Roll back or restore the old cache keynormalise and strip the parameter at the edge
  2. Scale origin replicas from the latest snapshotminutes, not hours
  3. Drop requests older than a deadlinefor example 80 ms; late answers are useless
  4. Edge hit ratio back above 80 percent?
    YesRemove extra replicas graduallyNoKeep shedding and scaling

4 steps in order. Play them, or step through them one at a time.

5Releasing Such Changes Next Time

The deeper lesson is that the cache key is an interface. A change to normalisation or URL format must be released like a capacity change. We canary it to a small share of traffic with two release gates, edge hit ratio and origin load, and halt automatically if the hit ratio for the canary drops more than a few points.

We also pre-warm the cache for the top prefixes under the new key before shifting traffic, by requesting the few hundred thousand most common prefixes through the edge, so the switch does not start cold. And we version cache keys deliberately: if a change must alter the key, we include an explicit version and move traffic gradually from the old version to the new, rather than discovering the change through a graph.

6How Clients Help

Clients are the other half of the system. Debouncing by 100 to 150 ms removes requests for letters the person typed in quick succession. Cancelling the in-flight request on each new keystroke means the server's work for an outdated prefix is abandoned when possible. And reusing results for prefixes already seen, on backspace or when retyping, removes requests entirely. Done well, these cut origin load by half during normal times and much more during a slowdown, since people type ahead faster than the server answers.

7Follow-up questions

Should normalisation happen on the client or the server?

Both must agree, and the cache key must be built from the normalised form. A common approach is that the client normalises, the edge normalises again for safety before building the key, and the server normalises once more, all using the same shared rules and tests.

Why not cache longer prefixes at the edge as well?

We can, but they are more varied, so their hit ratio is lower and the cache churns. Caching everything is fine as long as the origin is sized for realistic miss rates, not the best case.

What alert would have caught this in minutes?

An alert on edge hit ratio and origin request rate, compared with the same time last week, would have fired almost immediately after the release, well before the p99 alarm.

8Conclusion

In this answer, we traced a latency incident to the cache key. A normalisation change made equal prefixes produce different keys, so the edge hit ratio fell from 85 to 30 percent and the origin, sized for about 15 percent of traffic, received nearly five times its load, where queueing pushed p99 past the useful window. We recovered by rolling back or restoring the old key, scaling replicas from the latest snapshot and dropping requests older than a deadline. For the future, we canary such changes with hit ratio and origin load as gates, pre-warm the new key, version keys deliberately, and rely on clients to debounce, cancel and reuse.

What to say in the interviewAbout 80 seconds aloud

Open with

The edge cache key is built from the prefix in the URL. If the release made the client and server normalise differently, say the client now sends raw case and spacing, or the URL gained a parameter, then equal prefixes no longer share entries and the cache behaves as if cold, with many more distinct keys.

Then, if they want more

The origin was sized for about 15 percent of traffic. At 30 percent hit ratio it gets 70 percent, roughly 42,000 requests per second instead of 9,000, so the servers saturate and queuing pushes tail latency from 15 to over 200 ms, far beyond the useful 100 ms window.

To recover I would roll back, or restore the old key at the edge by normalising and stripping the new parameter there, add origin replicas from the latest snapshot, and drop requests older than a deadline because a late suggestion is worthless and only wastes capacity.

Next time I would canary the change with edge hit ratio and origin load as release gates, pre-warm the cache for top prefixes under the new key, and version cache keys deliberately so a key change is a planned migration.

Clients help too: debouncing, cancelling in-flight requests on each keystroke and reusing results for prefixes already seen all cut origin load.

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 "Explain how a normalisation change could cause this, how you recover during the...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/988bfafa8d/