A partitioned database (most NoSQL stores, and sharded SQL) splits a table across many partitions by key. Each partition holds some of the keys and has its own limit on how much traffic it can take. The table's capacity is the sum of all of them, which is why it can look unlimited on paper.
A hot partition is what happens when the traffic is not spread out. If one key gets most of the requests, the partition that holds it hits its limit while the rest sit idle. Requests for that key get throttled, and the table as a whole looks barely busy.
The experiment
A gift shop serves 3,200 requests a second from a partitioned store, through twelve medium app servers that can autoscale to 24. The store bills on demand, and its partition key is poor: a few keys carry a lot of the traffic. Twenty-five seconds in, a celebrity posts a glowing teddy bear. Traffic doubles, and almost all of it wants that one product page.
We ran five versions with the same seed.
| Store | Availability after the post | p95 | Simulated cost / month |
|---|---|---|---|
| Poor key (as shipped) | 44.0% | 5,897 ms | $3,059 |
| Poor key, 20,000 units bought | 44.0% | 5,897 ms | $2,893 |
| Fair key | 99.94% | 56 ms | $3,137 |
| Good key | 99.94% | 51 ms | $3,137 |
| Poor key, cache in front | 99.94% | 48 ms | $2,226 |
InfraSim, Advent of Outages door 23, seed 261223. Measured from 0:35, once traffic had finished doubling.
Buying capacity changed nothing
With the poor key, 56% of requests failed after the post. The obvious fix for a throttling database is more capacity, so we switched the store to 20,000 units of provisioned capacity.
The result was identical to the decimal: 44.0% availability, the same p95. The bill went down slightly, because provisioned capacity is billed differently from on demand, which made it a cheaper way to fail.
The reason is the whole idea of partitioning. Extra capacity is spread across all the partitions, and the bear lives on one of them. That partition's limit did not move. In InfraSim, as in real partitioned stores, a single partition tops out at a fixed rate however much the table buys.
Spreading the key
A better partition key spreads requests across partitions more evenly. Even a fair key took availability to 99.94% and the p95 to 56 ms; a good one to 51 ms. In InfraSim this is one setting. In a real system it is a design decision you make before the data exists, because changing a partition key later usually means moving every row.
For a single item that everyone wants at once, no key design splits one key's reads by itself. The real-world tricks are to keep several copies of the hot item under different keys and read from a random one, or to stop the reads reaching the store at all.
Or stop the reads reaching it
A cache in front of the store, with the poor key left exactly as it was, also held 99.94%, and it was the cheapest working option at $2,226 a month. The hot partition was still just as hot; it simply was not asked very often, because one popular page is the easiest thing in the world to cache. The cache answered it from memory and the store saw a trickle.
A hot key is a single server with extra steps. Caching is how you give a single server fewer things to do.
How to spot one
The signature is throttling while the table's total usage looks moderate. If your store reports per-partition or per-key metrics, look for one partition at its ceiling and the rest near idle. Adding capacity, as above, is the expensive way to confirm it.
About these numbers
They describe InfraSim's simulation, which models traffic as flows per tick and partition skew as a single score, with a fixed seed so each run repeats exactly. Costs are the game's simulated monthly figures, not any provider's prices.
Break it yourself
This is Advent of Outages door 23, "The Only Gift": the same store, the same bear. Free in your browser with no account; the door opens on 23 December and stays open after.
In the InfraSim app, Hot Key (chapter 3, Data Bottlenecks, free) is a front-page post trending on exactly one partition.
New to InfraSim? The first five campaign levels play in your browser right now. No install, no account.