We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Database Types Storage
Free preview: the first 2 parts of this 8-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 Types Storage
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
Your database runs in us-east-1 (Virginia). A user in Tokyo makes a request. The request travels from Tokyo to Virginia (about 150ms one way), the database processes it (5ms), and the response travels back (another 150ms). Total: 305ms just for the network round trip.
For a read-heavy application, a product catalog, a configuration service, a content platform, this is unacceptable. Users in Asia, Europe, and South America all experience sluggish performance because every read crosses the ocean.
Read replicas in each region help, but they introduce lag. A user in Tokyo writes a review, then immediately refreshes the page, and the review isn't there because the Tokyo replica hasn't received the write from Virginia yet.
Global tables take a different approach. Instead of one primary and multiple read replicas, every region has a full, writable copy of the table. Writes in any region are automatically propagated to all other regions. The table is truly global, not a primary with followers, but a multi-master setup where every region is equal.
DynamoDB Global Tables, Azure Cosmos DB, Google Spanner, and CockroachDB all support this pattern. The mechanics and trade-offs differ, but the goal is the same: low-latency reads and writes for users worldwide.
The fundamental idea: replicate the entire table to multiple regions, and accept writes in any region.
DynamoDB Global Tables:
Cosmos DB with Multi-Region Writes:
Spanner:
The key architectural question: how are write conflicts handled?
When a user in Tokyo and a user in London update the same record at the same millisecond, what happens? The answer depends on the system:
| System | Conflict Resolution | Consistency |
|---|---|---|
| DynamoDB Global Tables | Last-writer-wins (timestamp) | Eventual |
| Cosmos DB | Configurable (LWW, custom merge, custom SP) | Configurable |
| Spanner | Serializable transactions (locks) | Strong |
| CockroachDB | Serializable transactions () | Strong |
It is easy and good
“It is really nice and good Please join the course”