BeCuriouzLearn something new every day
When a million fans open the same message, Discord runs one query
💡 The hardest scaling problems come from uneven access patterns, not sheer data volume — and sometimes the fix is to simply not do the same work twice.
When Discord's database groaned under trillions of messages, the culprit wasn't total volume — it was hot partitions. In their engineering post How Discord Stores Trillions of Messages, the team explains that a single popular channel (think a huge announcement everyone opens at once) can send thousands of identical read requests slamming the exact same slice of the database in the same instant. That stampede — the classic thundering herd — can overwheln a shard even when the overall system is nowhere near capacity.
Their fix is delightfully simple: request coalescing. Discord put a thin layer of services (written in Rust) between the app and the database. When it sees many requests for the same data arriving together, it fires one query to the database and fans the single result back out to every waiting caller. A thousand identical requests collapse into one round trip.
The deeper lesson is that scaling problems are often about distribution, not size. Discord also migrated from Cassandra to ScyllaDB to tame latency spikes — but coalescing shows that a clever access pattern can neutralize a bottleneck that no amount of raw hardware would fix.