The Backend Engineering Show with Hussein Nasser

Why Discord Moved from MongoDB to Apache Cassandra, Let us Discuss

10 snips
Oct 9, 2020
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Index Size Determines DB Performance

  • Discord's MongoDB setup hit unpredictable latency when indexes no longer fit in RAM.
  • When indexes exceed memory, databases shift from CPU-bound to I/O-bound and performance degrades dramatically.
ADVICE

Partition Early To Avoid Memory Thrashing

  • Partition or shard indexes to keep index working sets small and in memory.
  • Avoid single huge indexes; design partitions by access pattern like channel-id to limit memory growth.
INSIGHT

Cassandra's Partitioned Data Model Fits Chat

  • Cassandra offers built-in partitioning and a composite key model (partition, primary, clustering).
  • That model routes queries to the node holding the partition, reducing cross-node scanning for channel queries.
Get the Snipd Podcast app to discover more snips from this episode
Get the app