Data LineLesson
Read replicas for a read-heavy app
Copy the database to read-only replicas to spread the reads — every write still goes to the one primary, and a replica can lag behind it.
11 minMediumStation: Read replicasMembers lesson
Membership isn’t open yet. The free lessons are open — 16 of them.
- Users
- Users
- Load balancer
- Web API
- Web API
- Web API
- Database
What you'll be able to do
- 1Predict the load on the primary and on each replica when reads are spread across N replicas.
- 2Explain replication lag and when a read from a replica can return stale data.
- 3Choose which reads may go to a replica and which must go to the primary.
Inside the lesson
- steps
- 8
- questions
- 9
- simulations
- 2
You guess first, then run the system and see if you were right.
Step 1 · The setup
Pixel's feed is now read 360 times a second, while people post only 30 times a second. Every one of those requests goes to the same database.
Watch the database server's CPU bar.
Steps 2–8 are for members