Why Discord Keeps Rewriting Its Stack

Published: (May 4, 2026 at 11:30 PM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Why Discord Keeps Rewriting Its Stack

Discord rewrote their stack multiple times—not because they got it wrong, but because they outgrew what they had built.

2013 — The starting stack

  • Elixir for real‑time messaging
  • Python for APIs
  • Go for microservices
  • MongoDB for storage
  • Electron for desktop

Standard startup choices. Ship fast, figure out the rest later.

2017 — MongoDB had to go

  • 5 million users; MongoDB couldn’t keep up.
  • Switched to Cassandra (12 nodes) – worked fine.
  • By 2022 the cluster grew to 177 nodes; maintenance became painful and costs climbed.
  • Moved to ScyllaDB.

One problem. Nine years. Three databases.

2019 — Elixir wasn’t fast enough for everything

Sorting large data sets in Elixir took 170 ms per operation.
At Discord’s scale that was unacceptable.

  • Rewrote the component in Rust.
  • Latency dropped to 1 ms.

That’s the whole reason for the change.

2020 — Go’s garbage collector became the enemy

Discord’s Read States service tracks every message you’ve read and is hit on every app interaction.

  • Go’s garbage collector runs every 2 minutes, scanning all memory.
  • With millions of users cached, the scan caused latency spikes.

Attempts to tune and upgrade Go failed.

  • Rewrote the service in Rust (no GC, immediate memory release).
  • Latency went from milliseconds to microseconds.

The pandemic pushed monthly active users to 100 million, making the Rust rewrite a necessity, not luck.

What they never changed

  • Elixir still handles real‑time messaging; the BEAM VM excels at millions of concurrent processes and instant restarts.
  • Python still powers the APIs.
  • Electron still runs the desktop client.
  • React Native eventually unified iOS and Android after years of separate codebases.

Not everything needs to change.

The pattern behind all of it

Every switch had a specific trigger—a metric that crossed a threshold and couldn’t be fixed by tuning.

  • No switch was made for hype. No switch was made early.

The lesson isn’t about which language or database is best. It’s to use what works, switch when the numbers demand it, and understand why you’re switching.

Discord didn’t build for 500 million users on day one. They built for today and fixed for tomorrow.

Also published on Medium.

0 views
Back to Blog

Related posts

Read more »

Python Selenium Architecture

High Level Selenium Architecture Selenium is a tool to automate web‑based and mobile‑based applications. For web‑based applications Selenium includes built‑in...

What are distributed systems?

Introduction “Distributed systems” is a commonly used concept today. The first time you encounter it, it may sound daunting, but the core idea is simple and ca...