We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Database Fundamentals
Free preview: the first 2 parts of this 9-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Database Fundamentals
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Every time you browse Twitter, watch Netflix, or scroll Instagram, you're reading from a replica. The data you see wasn't fetched from the primary database, it was served by one of dozens (or hundreds) of read replicas sitting behind the primary.
This is master-slave , more commonly called primary-replica replication in modern terminology. One server handles all writes. Multiple servers handle reads. It's the backbone of nearly every web application that outgrows a single database server.
The reason it's so widespread: it matches real-world traffic patterns perfectly. Most applications are 90-99% reads and 1-10% writes. If your primary can handle 5,000 writes per second and you need to serve 100,000 reads per second, you don't need a faster primary, you need 20 read replicas.
This is the first replication topology most engineers encounter, and it's the one you'll use most often in your career. Let's understand it deeply.
The flow is straightforward:
Writes (always go to the primary):
Reads (go to any replica or the primary):
The replication log is the key mechanism. It's an ordered sequence of every change that happened on the primary. Replicas don't need to re-parse or re-execute transactions, they just replay the log entries in order. This is called log-based replication and it's how PostgreSQL, MySQL, MongoDB, and most SQL databases implement it.