This week’s system design briefer:
How does DNS work?
How Discord Stores Trillions Of Messages
Silicon Valley Bank (SVB) collapse
What’s new in GPT-4
Job openings
With a streamlined workflow and expert guidance, Secureframe automates the entire compliance process, end-to-end.
What makes Secureframe different?
Get audit-ready and achieve compliance in weeks, not months with built-in remediation guidance and 100+ integrations.
Stay compliant with the latest regulations and requirements including ISO 27001, GDPR, HIPAA, PCI, and other standards.
Automate responses to RFPs and security questionnaires with AI.
Trusted by hyper-growth organizations: AngelList, Ramp, Lob, Remote, and thousands of other businesses.
The diagram below shows the evolution of message storage at Discord:
MongoDB ➡️ Cassandra ➡️ ScyllaDB
In 2015, the first version of Discord was built on top of a single MongoDB replica. Around Nov 2015, MongoDB stored 100 million messages and the RAM couldn’t hold the data and index any longer. The latency became unpredictable. Message storage needs to be moved to another database. Cassandra was chosen.
In 2017, Discord had 12 Cassandra nodes and stored billions of messages.
At the beginning of 2022, it had 177 nodes with trillions of messages. At this point, latency was unpredictable, and maintenance operations became too expensive to run.
There are several reasons for the issue:
Cassandra uses the LSM tree for the internal data structure. The reads are more expensive than the writes. There can be many concurrent reads on a server with hundreds of users, resulting in hotspots.
Maintaining clusters, such as compacting SSTables, impacts performance.
Garbage collection pauses would cause significant latency spikes
ScyllaDB is Cassandra compatible database written in C++. Discord redesigned its architecture to have a monolithic API, a data service written in Rust, and ScyllaDB-based storage.
The p99 read latency in ScyllaDB is 15ms compared to 40-125ms in Cassandra. The p99 write latency is 5ms compared to 5-70ms in Cassandra.
Over to you: What kind of NoSQL database have you used? How do you like it?
References:
scylladb.com/product/technology/shard-per-core-architecture/
discord.com/blog/how-discord-stores-trillions-of-messages
AI is evolving at a scary pace. I dove deep into the GPT-4 Technical Report and some videos, and here's what's fresh.
Multimodal: support both image and text
Increased word limit to 25,000
Human-level performance on academic benchmarks
More creative & collaborative
Better safety
Not so open: no further details about the architecture, hardware, training compute, etc.
If you’re looking for a new gig, join the collective for customized job offerings from selected companies. Public or anonymous options are available. Leave anytime.
If you’re hiring, join the ByteByteGo Talent Collective to start getting bi-monthly drops of world-class hand-curated engineers who are open to new opportunities.
X1 Card: Software Engineer, Back End (United States)
X1 Card: Head of Infrastructure and Risk (United States)