Scalability

Subpage of SWE for Pros

Sophisticated software systems under the hood

The Core Idea: The End of “One Size Fits All”

In small projects, you usually have one database (like PostgreSQL or MongoDB) and it does everything. In large-scale systems, data is specialized.

You might use PostgreSQL for your “Source of Truth,” Redis for lightning-fast lookups, and Elasticsearch for searching. The core idea is Mechanical Sympathy: picking the tool that matches the physical way data is stored and accessed.

Real-World Example: Discord

Discord handles billions of messages. They originally used MongoDB, but as they grew, it became too slow. They migrated to ScyllaDB (a high-performance version of Cassandra) because they needed a database that could handle “wide rows” (thousands of messages in a single channel) and “sub-millisecond” latency across a global cluster.


🛠 Platforms & Tools

  • Redis: The world’s fastest data store. It lives entirely in RAM (memory). If you need to know “Is this user online?” in 0.5ms, you use Redis.
  • Apache Kafka: A distributed “stream” of data. It allows you to process millions of events (like clicks or logs) per second without crashing your main database.
  • ScyllaDB / Cassandra: Databases designed to never go down, even if entire data centers fail.

💻 Code to Explore: The “High Performance” King

redis/redis

Don’t just use Redis—read how it’s built. * What to look for: * src/server.c: Look at the event loop. Redis is (mostly) single-threaded. See how it handles thousands of concurrent connections using an “Event-Driven” model. * Data Structure Implementations: Look at how they implement “Sorted Sets” or “Hashes” in C to be incredibly memory-efficient.

twitter/util

Twitter’s shared library for high-concurrency. * What to look for: The Future and Try abstractions. This shows how Twitter handles massive amounts of asynchronous data without getting lost in “Callback Hell.”


📚 Deep Dive Resources

🎥 Watch: “How Discord Stores Billions of Messages”

  • YouTube Link (Search for the Discord engineering talk version)
  • How to use it: Focus on the “Why.” Why did they leave MongoDB? What specific technical limit did they hit? This teaches you how to recognize when a tool is no longer “fit for purpose.”

📝 Read: “The Dynamo Paper” (Amazon)

  • Technical Summary
  • How to use it: This paper started the “NoSQL” revolution. It explains how Amazon keeps its “Shopping Cart” available even if the database is failing. It’s about Availability over Consistency.

📄 Research: “Designing Data-Intensive Applications” (Martin Kleppmann)

  • Book / Blog
  • How to use it: This is the most recommended book for Big Tech engineers. Start with the blog posts on “Logs” and “Batch Processing.” It explains the ideas behind the tools.

💡 The Big Idea to Take Away

Performance isn’t just about “fast code.” It’s about Data Locality and Concurrency. The fastest code in the world won’t save you if your database is on the other side of the planet or if your data is locked by another process.

/ Continue

Follow the technical trail.

Use the dense notes as the source material, then move through the guided route, writing, or project proof when you want a cleaner entry point.