Scrivio Interview library
ConceptFoundations6 min read · updated 13 November 2026

Traffic spikes are sudden rises in load well above the normal peak. Some are planned, such as a sale or a product launch; others are not, such as a viral post, a news event, a bot attack, or clients retrying after an outage.

Which techniques help a web system absorb a spike, and which of them still work when an unplanned spike arrives within seconds?

For planned spikes we forecast and pre-scale everything ahead of time, load test at the expected peak plus a margin and freeze risky changes. For unplanned spikes that arrive within seconds, autoscaling is too slow, so what helps is headroom already running, caching at the CDN and in services, admission control that sheds or queues the excess, filtering bad traffic at the edge, turning synchronous work into queued work, and degrading gracefully, including a waiting room for flows like purchases.

Why this question is asked

Every public system eventually meets a traffic spike: a sale, a launch, a viral post, a bot, or thousands of clients retrying after an outage. Systems that handle normal peaks well often collapse under a spike because their defences need minutes while the spike takes seconds. Interviewers ask this question to see whether we can tell which techniques work in which time frame. In this answer, we will recap how spikes differ, cover planned spikes, then go through the defences that work within seconds, from the edge inward, and finish with graceful degradation.

1A Quick Recap: Planned and Unplanned Spikes

A spike is a sudden rise in load well above the normal peak, for example from 3,000 to 30,000 requests per second. A planned spike, such as a sale at 10:00, gives us time to prepare. An unplanned one gives us seconds.

The key fact is timing. Autoscaling usually needs minutes: it waits for a metric to rise over a window, then starts instances, which pull images, start the JVM and warm up. A spike that arrives in 20 seconds has done its damage long before new capacity is ready. So for unplanned spikes, what matters is what is already in place.

Techniques and how fast they help
TechniquePlanned spikeUnplanned, within seconds
Pre-scaling and load testingYes, the main toolNo, needs warning
AutoscalingHelps if started earlyToo slow: minutes
Headroom already runningYesYes
CDN and service cachingYesYes
Admission control and sheddingYesYes
Edge bot filtering and rate limitsYesYes
Queues and graceful degradationYesYes, if prepared in advance

2Preparing for a Planned Spike

For a planned spike we forecast the peak from past events and the expected audience, then pre-scale everything along the path: application instances, database capacity and connection limits, cache clusters, and cloud quotas, which often cap how many instances we may start. We warm caches before the event so the first users do not all miss.

Then we load test the main user journeys at the expected peak plus a margin, perhaps 1.5 times, to find the first bottleneck before customers do. And we freeze risky changes for a few days before the event, so we do not combine a spike with a fresh bug.

3Defences That Work Within Seconds

Headroom is capacity that is already running. If we normally run at 40 percent of capacity at peak, a doubling of traffic is absorbed without any scaling. Headroom costs money, so we choose it based on how sudden our spikes tend to be.

Caching is the most effective defence for reads. A CDN, a network of edge servers close to users, can serve cached pages and API responses without touching our servers. If a product page is cached for 30 seconds at the edge, a million visitors to that page cause one request per edge location every 30 seconds to our origin. Inside the services, caches such as Redis or in-process caches protect the database the same way.

Admission control decides how much work enters the system. A rate limiter or a concurrency limit at the gateway admits only what the backend can serve, and rejects or queues the rest quickly with a 429 or 503 and a Retry-After. This feels harsh, but serving 80 percent of users well is better than serving 100 percent so slowly that everyone times out.

Step throughSpike defences from the edge inward
  1. Edge bot filtering and rate limitsabusive traffic never arrives
  2. CDN cachemost reads served without the origin
  3. Waiting roompurchases admitted at a fixed rate
  4. Gateway admission controlexcess rejected fast with 429 or 503
  5. Services with headroom and cachesdegrade expensive features first
  6. Queues and the databasework processed at a sustainable rate

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

4Filtering Bad Traffic at the Edge

Some spikes are not customers at all: scrapers, credential-stuffing bots or a denial of service attack. These should be stopped at the edge, before they reach our services, with bot detection, web application firewall rules and rate limits per client. Every request filtered at the edge is a request our services and database never have to handle.

5Turning Synchronous Work Into Queued Work

Some work does not need to finish while the user waits. Uploading a video, placing an order that is confirmed by email, or generating a report can be accepted immediately, put on a queue such as Kafka or SQS, and processed at the rate the backend sustains. The user sees that the request is in progress. During a spike the queue grows, but nothing collapses, and the backlog is cleared once the spike passes.

6Degrading Gracefully

When load still exceeds capacity, we reduce the work per request. Operational flags switch off expensive features such as recommendations, personalised content or live counters. Pages can be served as cached or static versions. The goal is to keep the core of the product working while the extras wait.

Some flows cannot be degraded, such as a purchase. For those, a waiting room holds users in a queue at the edge and admits them at the rate checkout can handle, which is both fairer and safer than letting everyone hit checkout at once.

7Follow-up questions

Why is a CDN cache so effective against flash crowds on read-heavy pages?

Because a flash crowd is many people reading the same few pages. The CDN serves those pages from edge locations close to users, so the number of requests reaching our origin depends on the number of edge locations and the cache time, not on the number of users. With request collapsing, an edge location that misses sends one request to the origin and makes the others wait for it. A million users on one page can mean only a few hundred origin requests per minute.

Why not simply rely on autoscaling with a lower threshold?

A lower threshold starts scaling a little sooner, but the instances still take minutes to start and warm up, and the scaling metric must first rise. It helps with gradual growth, but not with a spike that arrives in seconds. It also cannot scale the database, which is often the first thing to fail.

What should a client do when it receives a 429 or 503?

Back off and retry later, honouring the Retry-After header if present, with exponential backoff and random jitter. Retrying immediately turns a spike into a larger one, which is why well-behaved clients matter as much as server-side defences.

8Conclusion

In this answer, we saw that planned spikes are handled by forecasting, pre-scaling, load testing and change freezes, while unplanned spikes arrive faster than autoscaling can react. What works within seconds is headroom already running, caching at the CDN and in services, admission control that sheds or queues excess, edge filtering of bots, queued processing of work that does not need an immediate answer, and graceful degradation, with a waiting room for flows like purchases.

What to say in the interviewAbout 80 seconds aloud

Open with

I would split it by whether we see the spike coming. For a planned spike, like a sale, we forecast the peak, pre-scale everything on the path including the database, caches and cloud quotas, warm caches, load test at the expected peak plus a margin and freeze risky changes.

Then, if they want more

For an unplanned spike, the important point is that autoscaling needs minutes and the spike takes seconds, so only things already in place help.

Those are headroom we already run, caching at the CDN and in the services so most reads never reach the origin, and admission control at the gateway that admits what the backend can serve and rejects or queues the rest fast with a 429 and Retry-After.

Bad traffic, like bots and scrapers, should be filtered at the edge with bot detection and rate limits. Work that does not need an immediate answer should be accepted and queued, then processed at a sustainable rate.

And we degrade gracefully: flags to switch off expensive features, cached or static pages, and a waiting room for flows like purchases that cannot be degraded. All of that has to be built before the spike, which is really the lesson.

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 "Which techniques help a web system absorb a spike, and which of them still work when an...": https://scrivio-interview-library.netlify.app/architecture/high-availability/1a3eb09ea6/