Scrivio Interview library
DebuggingIntermediate6 min read · updated 13 November 2026

A thumbnail service writes 9,000 objects per second at peak into one bucket under keys such as thumbs/2026-11-13/<id>.jpg. Since a marketing campaign started, about 4 percent of PUTs fail with HTTP 503 Slow Down, and the error rate does not fall when more workers are added.

Explain the cause and how you would fix both the immediate errors and the key design.

S3 scales request rates per partitioned key prefix, starting at about 3,500 writes and 5,500 reads per second per prefix, and keys that start with today's date send all 9,000 PUTs a second to a single prefix. S3 splits hot prefixes over time, but a sudden jump outruns the split, so adding workers only adds rejected requests. The immediate fix is retries with exponential backoff and jitter plus a concurrency limit; the real fix is to put a high-cardinality hash early in the key, and serve reads through a CDN.

Why this question is asked

HTTP 503 Slow Down is S3 telling a client that it is sending more requests to one part of the key space than that part can serve right now. It shows up in exactly the situation in the overview: a busy workload, a key naming scheme that seemed sensible, and a sudden traffic jump. Interviewers ask it because the natural reaction, adding workers, makes it worse, and because the fix is a key design principle that applies to many partitioned systems. In this answer, we will recap how S3 partitions request capacity, explain why the date-prefixed keys hit the limit, apply the immediate fix, redesign the keys, and look at reads and monitoring.

1A Quick Recap of How S3 Scales Requests

S3 does not give a bucket one fixed request budget. Internally it spreads the key space over partitions by key prefix, the leading characters of the key, and each partitioned prefix can serve at least 3,500 PUT, COPY, POST or DELETE requests and 5,500 GET or HEAD requests per second. A bucket with many busy prefixes can therefore serve far more in total.

When one prefix stays hot, S3 notices and splits it into more partitions, which raises capacity. That split is automatic but not instant; it reacts to sustained load over minutes rather than to a jump in a few seconds. While the load exceeds what the current partitions can take, S3 rejects the excess with 503 Slow Down.

2Why These Keys Hit the Limit

Our keys look like thumbs/2026-11-13/<id>.jpg. Every thumbnail written today starts with the same characters, thumbs/2026-11-13/, so all 9,000 writes per second land on the key range of one day. That is more than twice the starting capacity of one partitioned prefix. Yesterday's prefix, which S3 had perhaps split after weeks of steady traffic, is idle, and at midnight the load moves to a fresh prefix that has never been split. The campaign raised traffic suddenly, so the splits could not keep up, and about 4 percent of PUTs were rejected.

Now we see why more workers did not help. The limit is per prefix, not per client. More workers send more requests to the same hot prefix, so more of them are rejected, and if those workers retry immediately, they add even more load. The error rate stays flat or rises.

Same load, two key designs
Key designPrefixes in usePUTs per prefix per second
thumbs/2026-11-13/<id>.jpg1 (today's date)9,000, over the 3,500 start
thumbs/<2 hex of hash>/<id>.jpg256about 35
thumbs/<4 hex of hash>/<id>.jpg65,536well under 1

3The Immediate Fix: Backoff, Jitter and a Concurrency Limit

Today, while keys still use dates, we must stop making things worse. Every 503 should be retried with exponential backoff, waiting longer after each failure, with jitter, a random part of the wait, so thousands of workers do not retry in lock-step. The AWS SDKs do this in their standard retry mode, and the adaptive mode also slows the client down when it sees throttling. We also cap the concurrency of the uploader, for example with a semaphore or a bounded executor, so the total request rate stays near what S3 accepts rather than far above it. With rates held steady, S3 has time to split the prefix, and the error rate falls.

Java
S3Client s3 = S3Client.builder()
.overrideConfiguration(c -> c.retryStrategy(
AwsRetryStrategy.adaptiveRetryStrategy() // backoff with jitter, plus client-side rate limiting
.toBuilder().maxAttempts(6).build()))
.build();
Semaphore inFlight = new Semaphore(400); // cap concurrent PUTs per service instance
inFlight.acquire();
try { s3.putObject(req, body); } finally { inFlight.release(); }

The exact builder names differ slightly between SDK versions, so check the version in use. What matters is the behaviour: backoff, jitter and a bounded number of requests in flight.

4The Real Fix: Spread Writes Over Many Prefixes

The lasting fix is a key design where the leading characters vary from the first request. We take a few hex characters of a hash of the id and put them right after the fixed part: thumbs/a7/<id>.jpg. Two hex characters give 256 prefixes, so 9,000 writes per second become about 35 per prefix, far below the per-prefix limit, and capacity is spread from the start instead of waiting for splits. If the id itself is random, such as a UUID, its first characters already serve the purpose.

Java
String id = UUID.randomUUID().toString();
String shard = sha256Hex(id).substring(0, 2); // "a7": 256 possible values
String key = "thumbs/" + shard + "/" + id + ".jpg"; // thumbs/a7/3f9c...jpg
// the date lives in the database row (created_at), not in the key

The date does not disappear. It moves into the database row for each thumbnail, or into object metadata or tags, where queries such as all thumbnails from yesterday can use an index. Notice also that the service must be able to rebuild the key from the id alone, which the hash makes possible.

5Reads Through a CDN, and Watching 503s

GET requests count against the same prefixes as PUTs, so popular thumbnails being fetched straight from S3 compete with new uploads. Serving reads through a CDN means most requests are answered from edge caches, and S3 sees only cache misses. Thumbnails are immutable under their key, so they can be cached for a year.

Finally, we monitor 503 rates. S3 request metrics, which can be enabled per bucket or per prefix filter, and server access logs show 503 counts and where they occur. An alert on a rising 503 rate catches the next hot prefix before users notice.

6Follow-up questions

Why do tools that list objects by date get harder after this change, and how do you compensate?

Listing is by prefix, so with dates in the key a cleanup tool could list thumbs/2026-11-13/ and get one day. With hash prefixes, a day's objects are scattered over 256 prefixes mixed with every other day. We compensate by keeping the date in the database and querying there, by using S3 Inventory reports, which list every object with its creation time daily, or by placing a coarse date after the hash, such as thumbs/a7/2026-11-13/<id>.jpg, so a tool can list 256 date prefixes. Lifecycle rules can also expire by object age or by tag, which needs no listing.

Is the 3,500 per second limit a hard number?

It is the documented starting point per partitioned prefix, not a cap for the bucket. S3 can split further and go much higher, but only after sustained load, so designs should not rely on splits arriving in time for a sudden spike.

Would random prefixes hurt read performance?

No. S3 GET latency does not depend on key locality the way a B-tree index does; spreading keys only spreads load. The cost is in tooling that relied on listing by human-readable prefixes.

7Conclusion

In this answer, we saw that S3 scales request capacity per partitioned prefix, starting around 3,500 writes and 5,500 reads per second each, and that date-first keys funnel all of a day's 9,000 writes per second into one prefix that cannot split fast enough during a sudden jump. More workers only add rejected requests. We fixed the immediate errors with backoff, jitter and a concurrency cap, redesigned keys with a hash prefix so writes spread over 256 prefixes, moved dates into the database, served reads through a CDN, and monitored 503 rates.

What to say in the interviewAbout 80 seconds aloud

Open with

S3 scales by key prefix: each partitioned prefix starts with at least 3,500 writes and 5,500 reads a second, and S3 splits busy prefixes automatically, but only after sustained load.

Then, if they want more

Our keys start with thumbs/ followed by today's date, so all 9,000 writes a second hit one prefix, more than twice its starting capacity. At midnight the load also jumps to a brand new prefix, and the campaign spike came faster than S3 could split it, so about four percent of PUTs got 503 Slow Down.

Adding workers just sends more requests to the same hot prefix, so more get rejected. For today, I would make sure we retry 503s with exponential backoff and jitter, the SDK's standard or adaptive retry mode, and put a concurrency limit on the uploaders so we stop overloading the prefix and give S3 time to split.

The real fix is the key design: put a high-cardinality part first, like two hex characters of a hash of the id, so writes spread over 256 prefixes, about 35 a second each. The date goes into the database or object metadata instead.

I would also serve thumbnails through a CDN so reads do not compete with writes, and alert on the 503 rate per prefix.

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 the cause and how you would fix both the immediate errors and the key design.": https://scrivio-interview-library.netlify.app/architecture/storage-and-pipelines/199cd6d513/