# Stanislav Vishnevskiy - How Discord Stores Billions of Messages (Highlights)

## Metadata
**Review**:: [readwise.io](https://readwise.io/bookreview/61966147)
**Source**:: #from/readwise #from/reader
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Stanislav Vishnevskiy]]
**Full Title**:: How Discord Stores Billions of Messages
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**Document Tags**:: #work
**URL**:: [discord.com](https://discord.com/blog/how-discord-stores-billions-of-messages)
**Host**:: [[discord.com]]
**Highlighted**:: [[2026-07-10]]
**Created**:: [[2026-07-11]]
## Highlights
- This is actually part of our company culture: build quickly to prove out a product feature, but always with a path to a more robust solution. ([View Highlight](https://read.readwise.io/read/01kx60vf8a2197trh5dfy105q5)) ^1033166569
- Cassandra was the only database that fulfilled all of our requirements. We can just add nodes to scale it and it can tolerate a loss of nodes without any impact on the application. Large companies such as Netflix and Apple have thousands of Cassandra nodes. Related data is stored contiguously on disk providing minimum seeks and easy distribution around the cluster. It’s backed by DataStax, but still open source and community driven. ([View Highlight](https://read.readwise.io/read/01kx610vhce2yvs8cxhh76xm51)) ^1033166769
- Having made the choice, we needed to prove that it would actually work. ([View Highlight](https://read.readwise.io/read/01kx618jz75tsce3s2ahp7fj77)) ^1033167042
#work
- The best way to describe Cassandra to a newcomer is that it is a KKV store. The two Ks comprise the primary key. The first K is the partition key and is used to determine which node the data lives on and where it is found on disk. The partition contains multiple rows within it and a row within a partition is identified by the second K, which is the clustering key. The clustering key acts as both a primary key within the partition and how the rows are sorted. You can think of a partition as an ordered dictionary. These properties combined allow for very powerful data modeling. ([View Highlight](https://read.readwise.io/read/01kx6126cnn675jndc8m6aejfg)) ^1033166803
- Deleting a column and writing null to a column are the exact same thing. They both generate a tombstone. Since all writes in Cassandra are upserts, that means you are generating a tombstone even when writing null for the first time. In practice, our entire message schema contains 16 columns, but the average message only has 4 values set. We were writing 12 tombstones into Cassandra most of the time for no reason. The solution to this was simple: only write non-null values to Cassandra. ([View Highlight](https://read.readwise.io/read/01kx61k6njp5y3gpqzg0ydvyfe)) ^1033167576
- We changed our query code to track empty buckets and avoid them in the future for a channel. This meant that if a user caused this query again then at worst Cassandra would be scanning only in the most recent bucket. ([View Highlight](https://read.readwise.io/read/01kx61ppswee5pkmda8gv0bbqc)) ^1033167960