Member-only story

How Discord Stores Trillions Of Messages

Discord’s journey from MongoDB → Cassandra → ScyllaDB highlights the challenges of scaling a high-volume messaging platform.

1. Initial Stage (2015) — MongoDB

Database Used: MongoDB

Scale: 100 million messages

Challenges:

  • Initially, MongoDB was sufficient for Discord’s message storage.
  • However, as the volume of messages grew, data no longer fit in RAM.
  • Latency became unpredictable, making it unsuitable for a large-scale messaging system.
  • MongoDB wasn’t scalable enough for Discord’s rapid growth.

Decision: Move storage from MongoDB to another database.

Chosen Solution: Apache Cassandra.

2. Scaling to Billions of Messages (2017) — Cassandra

Database Used: Apache Cassandra

Scale: Billions of messages

Challenges:

  • By early 2022, Discord had 177 nodes storing trillions of messages.
  • Latency became unpredictable, and maintenance operations were costly.

Key Issues:

  • Cassandra’s LSM Tree Structure

--

--

Sonika | @Walmart | Frontend Developer | 11 Years
Sonika | @Walmart | Frontend Developer | 11 Years

No responses yet