Chapter 14: Data and failure

The last group of failures comes from having more than one copy of anything.

Replication

Also called Read replica, Replica lag

Keeping copies of a database on other machines. One copy, the leader, takes the writes and sends them to the followers, which can serve reads. Usually it sends them after telling the client yes, so a follower is a little behind. That gap is called replica lag.

An agent asked to scale reads will send them to a replica, and it works in every test, where there's no lag. In production someone saves their profile, the page reloads from a replica, and the old value comes back. And if the leader dies, writes that had been confirmed but not yet copied are gone.

Say it to your agent

“Send reports to the read replica, and keep anything a user just changed on the primary. After a write, read that user's data from the primary for 5 seconds. Add a metric and an alert on replica lag, and show me what happens to the page if lag reaches 30 seconds.”

The workshop

Name a word, or describe what you mean in everyday language.