Quick revision
The short answer
Keep 202 Accepted with a status URL, but tell clients when to come back with Retry-After on the 202 and on every in-progress status response, sized to the expected duration and backed by a documented backoff schedule. Make each status check cheap with a cache or small status table and ETag with If-None-Match so an unchanged status returns 304, rate limit the status endpoint per client with 429 and Retry-After for clients that ignore the hints, offer webhooks, long polling or server-sent events for clients that need fast notice, and return a status body with state, progress, timestamps, a result link and a structured error.
What to remember
In this answer, we saw that polling load equals jobs in progress divided by the polling interval, which is how 100-millisecond polling produced 40,000 requests per second. We kept the 202 pattern but added Retry-After sized to the expected duration, made status checks cheap with a small status record, caching and ETag with 304, enforced a per-client rate limit with 429, offered webhooks, long polling and server-sent events for clients that need fast notice, and defined a status body with state, progress, timestamps, a result link and a structured error.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Keep 202 Accepted with a status URL, but tell clients when to come back with Retry-After on the 202 and on every in-progress status response, sized to the expected duration and backed by a documented backoff schedule. Make each status check cheap with a cache or small status table and ETag with If-None-Match so an unchanged status returns 304, rate limit the status endpoint per client with 429 and Retry-After for clients that ignore the hints, offer webhooks, long polling or server-sent events for clients that need fast notice, and return a status body with state, progress, timestamps, a result link and a structured error.
Why this question is asked
The asynchronous request pattern, accept the work with 202 and let the client poll a status URL, is the standard answer to operations that take longer than an HTTP request should. It depends on clients polling at a sensible pace, and when a popular library starts polling every 100 milliseconds, a cheap endpoint turns into the busiest one in the system. Interviewers like this question because the answer combines HTTP semantics, caching and rate limiting with good API documentation. In this answer, we will recap the pattern, work out why the load exploded, and then reduce it in layers: hints in the response, cheap status checks, enforcement, and push alternatives, ending with what a good status response contains.
1A Quick Recap of the 202 Pattern
For an operation like report generation that takes 30 seconds to several minutes, the server does not keep the request open. POST /reports validates the input, creates a job, and returns 202 Accepted with a Location header pointing to a status resource, such as /reports/jobs/r-91. The client then calls GET on that URL until the job finishes, at which point the status contains a link to the result.
The pattern is sound. Its weak point is the word 'until': the API usually never said how often to ask, so each client library picks its own interval.
2Why the Status Endpoint Gets 40,000 Requests per Second
Polling load is easy to estimate: requests per second equal the number of jobs in progress divided by the polling interval. Suppose 4,000 reports are running at a typical moment. If clients poll every 5 seconds, that is 800 status requests per second. The library update changed the interval to 100 milliseconds, so the same 4,000 jobs produce 4,000 / 0.1 = 40,000 requests per second, fifty times more, and almost every one of them returns the same 'still running' answer as the previous one.
Two things follow. The status checks must become much cheaper, and clients must be told, and if necessary made, to poll less often.
| Polling interval | Status requests per second | Answers that changed |
|---|---|---|
| 100 ms (new library) | 40,000 | almost none |
| 1 s | 4,000 | very few |
| 5 s, from Retry-After | 800 | a small share |
| Webhook or SSE on completion | near 0 | every message is news |
3Tell Clients When to Come Back
HTTP already has a header for this. Retry-After on the 202 response and on each in-progress status response tells the client how many seconds to wait before asking again. The value should match the expected duration: if most reports take about 40 seconds, the first Retry-After can be 10, and later ones can grow, for example 10, 15, 30, so clients poll less as jobs run longer. The API documentation should state the schedule, and our own SDKs must follow it, since a well-behaved official library is the fastest way to fix the majority of traffic.
Notice the ETag. Each time the job's status changes, its version increases, and the client sends the last version it saw in If-None-Match. If nothing changed, the server answers 304 Not Modified without a body, which is cheaper to produce and to send.
4Make Each Status Check Cheap, and Enforce the Limits
A status check should never touch the heavy report tables. Workers update a small status record, a row in a job status table or a key in Redis, whenever the state or progress changes, and the status endpoint reads only that. Because the record carries a version, the server can answer 304 by comparing the version alone. A short-lived cache in front, even for one second, absorbs bursts of identical requests.
Hints only work for clients that read them. For clients that ignore Retry-After, we enforce a per-client rate limit on the status endpoint, for example 2 requests per second per job or 50 per second per API key, and return 429 Too Many Requests with Retry-After when they exceed it. That protects the service from the broken library version while its users upgrade, and the 429s show up in their logs as a clear signal to fix their client.
- Client over its status rate limit?YesReturn 429 with Retry-AfterNoContinue
- Read status record from cache or status tablenever the report tables
- If-None-Match equals current version?YesReturn 304 with Retry-AfterNoReturn 200 with body and ETag
- Job still running?YesAdd Retry-After sized to expected durationNoInclude result link or error
4 steps in order. Play them, or step through them one at a time.
5Push Alternatives and a Good Status Body
Some clients poll fast because they genuinely want to know the moment a report is ready. We can give them a better tool. A webhook on completion calls the client's URL when the job finishes. Long polling lets the client send GET /reports/jobs/r-91?wait=30, and the server holds the request until the state changes or 30 seconds pass, so one request replaces hundreds. Server-sent events stream state changes over one open connection, which suits browsers. Each of these delivers the news immediately without repeated questions.
Finally, the status body should answer every question a client might poll for. It includes the state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED), progress as a percentage if we know it, creation and last update times, a link to the result when the job succeeded, and a structured error when it failed, with a code, a human message and whether retrying makes sense. A client that gets all of that has no reason to poll faster than Retry-After.
6Follow-up questions
Should the result link expire?
Usually yes, if it points to a file in object storage through a presigned URL: give it an expiry such as one hour, and let clients get a fresh link from the status resource. The status resource itself should stay available for as long as the result is retained, for example 7 days, and then return 404 or 410.
Why not return 303 See Other when the job is done?
Some APIs do: the status URL redirects to the result once the job succeeds. It is elegant for simple clients, but a 200 status body with a result link carries more information, such as timestamps and size, and works better with clients that do not want to follow redirects automatically.
7Conclusion
In this answer, we saw that polling load equals jobs in progress divided by the polling interval, which is how 100-millisecond polling produced 40,000 requests per second. We kept the 202 pattern but added Retry-After sized to the expected duration, made status checks cheap with a small status record, caching and ETag with 304, enforced a per-client rate limit with 429, offered webhooks, long polling and server-sent events for clients that need fast notice, and defined a status body with state, progress, timestamps, a result link and a structured error.
Open with
Polling load is jobs in progress divided by the polling interval. With a few thousand reports running and clients polling every hundred milliseconds, you get tens of thousands of status requests per second, almost all of them asking a question whose answer has not changed.
Then, if they want more
I would keep the asynchronous pattern and fix it in layers. First, tell clients when to come back: Retry-After on the 202 and on every in-progress status response, sized to the expected duration and growing as the job runs, plus a documented backoff schedule, and make sure our own SDKs follow it. Second, make each check cheap.
The status endpoint reads a small status record in a table or Redis, never the report data, and it supports ETag with If-None-Match, so an unchanged status returns 304 with no body. Third, enforce it: a per-client rate limit on the status endpoint that returns 429 with Retry-After to clients that ignore the hints.
Fourth, give clients that really need fast notice a better tool: a webhook on completion, long polling that holds the request until the state changes, or server-sent events.
And the status body should include the state, progress if we know it, created and updated times, a result link when it is done, and a structured error when it failed, so the client never has a reason to poll faster.
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 "How do you control polling load while keeping the asynchronous pattern, and what should...": https://scrivio-interview-library.netlify.app/architecture/api-design-at-scale/21ad586aba/