Demo: read replicas and the stale-read bug they introduce
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
reproduce and fix a read-after-write bug.
Draft outline details
Step by step
- Add a replica and route reads to it.
- Place an order, then immediately load "my orders"; the order is missing.
- Planned mistake: blame the cache. Fix: confirm replica lag in metrics; the read went to the replica.
- Implement read-your-writes: route recent writers to the primary or wait for the replica's position.
- Add lag monitoring and a fallback threshold.
- Add a test that fails when the stale read returns.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.