.NET Architecture & System Design Interview Question #55

What is replication lag?

Database Scaling, Partitioning, NoSQL & Data Consistency Mid-Level Intermediate

Quick Interview Answer

Replication lag is the delay between a change being committed on the source database and becoming visible on a replica.

Detailed Explanation

Replication lag is the delay between a change being committed on the source database and becoming visible on a replica.

Lag matters when an application writes data and immediately reads from a replica, because the new value may not yet be present. Designs can route consistency-sensitive reads to the primary, tolerate bounded staleness, or use technology-specific synchronization mechanisms.

Code Example

T0: Primary commits Order 123
T1: Client reads Replica
    -> Order 123 not visible yet
T2: Replica catches up