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
Easy SOC 2 compliance + AI-based RFP automation (Sponsored)
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.
How does DNS work?
How Discord Stores Trillions Of Messages
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
Breaking down what's going on with the Silicon Valley Bank (SVB) collapse
What’s new in GPT-4
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.
Join the ByteByteGo Talent Collective
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.
Featured job openings
X1 Card: Software Engineer, Back End (United States)
X1 Card: Head of Infrastructure and Risk (United States)
STOP - DO NOT INVEST IN SUBSTACK'S BROKEN MODEL!!!
Seriously if they are begging for money and VC bailed it means its a broken model. Think about it, how many regular people are paying per writer $5 to $10 per month? Not enough apparently and the next thing they will introduce is advertising which is 1million times worse. This monetization model is for elites, elite writers and elite readers who can afford to pay to "benefit" from their writing. Its not Twitter but its just as elitist as Twitter and will devolve into the same mess and control mechanism.
Go check out web3. Go check out crypto. Go check out the MVP of my solo hobbiest project "dplatform.me" The next platforms will be web3, crypto, micro-transactions, and governed by decentralized autonomous organizations (DAOs) or no one
The future is decentralized!