Skip to content
Minute Campus.

How real companies do itLesson 011 min

How Discord stores trillions of messages

Discord began on MongoDB, then moved to Cassandra as messages reached the billions. By 2022 that was 177 machines, struggling with busy channels slowing a machine and pauses for memory clean-up. The team moved to ScyllaDB, which stores data in the same way but avoids those pauses. After a Rust rewrite of the migration tool, 72 machines and faster reads replaced 177.

Remember

The right database changes as you grow, so no single choice is best.

Transcript

The lesson, word for word.

Read it at your own pace, or search the page for a term.

Discord stores trillions of messages. In twenty twenty-two, it moved every one of them to a new database. Here is why. Discord began on a database called MongoDB. As messages grew into the billions, it moved to Cassandra, a database built to spread data across many machines. By twenty twenty-two that was one hundred and seventy-seven machines, and it was struggling. One very busy channel could slow a whole machine down. And the database kept pausing to clean up its own memory. So the team chose ScyllaDB, which stores data in the same way but is built to avoid those pauses. They rewrote their migration tool in Rust, and the estimate fell from three months to nine days. The result: seventy-two machines instead of one hundred and seventy-seven, and faster reads. The lesson is not that one database is the best. It is that the right choice changes as you grow.

Questions? Comment on the lesson on YouTube

New lessons every day.

Follow Minute Campus where you already scroll.