Discord, the popular chat platform, once faced a bizarre problem: it could serve billions of messages a day, yet opening a single message sometimes took 20 seconds. That performance gap drove a major database migration that reveals the hard trade-offs in scaling real-time systems.
In 2015, Discord started with MongoDB—simple and fast at first, but it broke when the message count hit 100 million. The team then moved to Cassandra, a distributed NoSQL database known for high write throughput. They cleverly designed partition keys and buckets to spread load. For a while, it worked beautifully.
But as Discord grew to trillions of messages, Cassandra's weaknesses emerged. The culprit: tombstones. When a user edits or deletes a message, Cassandra marks the old version with a tombstone rather than immediately removing it. Over time, these tombstones accumulate, slowing reads and causing compaction storms. The system spent more time cleaning up than serving data.
Even with careful tuning, the latency spikes became unacceptable. Discord needed a database that could handle mutable data without the tombstone tax. Their solution? ScyllaDB, a C++ rewrite of Cassandra that eliminates many of these issues, plus customized storage engines. The migration was painful but necessary.
Today, Discord stores trillions of messages with sub-second latency. The story is a cautionary tale: no database is perfect forever. What works at 100 million messages can break at 100 billion. Discord's journey from MongoDB to Cassandra to ScyllaDB shows that scaling means constantly questioning your infrastructure choices.