Codele / System design
Replication
Keep copies of your data on several machines so one breaking loses nothing. But copies take time to catch up. Choose when and where a friend reads, and see if they get the old answer.
- Replication keeps copies of the same data on several machines.
- The leader takes all writes and passes them to the followers. Reads can go to any copy.
- Replication lag is the delay before a follower has the newest data. A read in that gap is stale: old but not broken.
- If the leader fails, a follower that has caught up takes over as the new leader and the data survives.
- For things that must be fresh (like your bank balance) read from the leader.
Loading the playable lesson…