Subscribe free
Alloconomy 21 Nov 2026 3 min read

When one school district becomes half the traffic

A marketplace peaks at 12,000 writes per second.

The interview prompt

A marketplace peaks at 12,000 writes per second. One district generates 50%. Each shard is sized for 1,000 writes per second at the target latency. What happens with district as the shard key, and what will splitting that key cost the reader?

The busiest key bounds the design

The heavy district alone sends 6,000 writes per second to one logical key. More shards can spread the other districts while leaving this one overloaded. Six evenly distributed write buckets would run at the theoretical limit before overhead or headroom. Eight buckets would average 750 writes per second apiece if that district’s work distributes evenly. Check actual skew and the physical placement of those buckets before treating the arithmetic as capacity.

An order-ID partition key can keep updates to an order together without forcing every district order onto one shard. Reading all open orders for that district then requires querying multiple shards, maintaining a secondary index, or building a dedicated district projection. A time bucket helps bound history but can still hotspot the current bucket.

Discuss consistency at the unit of action. A support agent updating one order may require read-your-writes for that order. A district dashboard can perhaps tolerate thirty seconds of lag. If an order itself becomes the hot key, splitting by order ID no longer helps. Examine whether the source is sending redundant updates or whether the workload truly requires serialized changes to the same entity.

The model behind the answer

The marketplace expands to bulk purchasing, and one school district generates half the order writes. Hashing the district ID still sends all of that district’s writes to one shard. A large number of shards cannot help a key that never changes. Monitor the busiest shard and tail latency during a bulk order. An average across the fleet conceals the queue.

Sharding by order ID can distribute the district’s writes while keeping each order’s updates together. The price is a more expensive district-wide lookup. A secondary projection can serve that query if its freshness and rebuild cost are acceptable. Range partitioning can preserve ordered scans, but a growing timestamp range may concentrate the newest writes.

Replication answers another question. A support agent who just updated an order may need to read their write immediately. A lagging replica can briefly show the older state. Pick the read path and consistency guarantee for that action, then price the extra capacity and failure behavior. AWS on partition-key selection

Make the load generator reproduce the hot key

The agent reports that a sharding change passed 12,000 writes per second. Inspect the generated input. Require 6,000 writes per second from the one heavy district, and return the measured load on the busiest physical shard.

Reviewer decision. Eight logical buckets average 750 heavy-district writes each under even distribution. Co-location, collisions or the other districts’ traffic can still breach the 1,000-write target. Keep the old read path during a shadow comparison and measure the district-wide read cost as well as peak write latency.

Further reading. Designing Data-Intensive Applications, 2nd ed., on splitting a hot key and collecting its results across shards.

One more question

Would adding read replicas fix the district’s write hotspot?

Check your reasoning

Read replicas can divert eligible reads. If every write still reaches the same primary shard, the write bottleneck remains. Establish whether observed queueing is read pressure, write pressure, or both before paying for replicas.

Previous · Choose a layout from a real filter · Next · The decimal that changed its meaning · Complete series map