All Questions
Caching hard

A user writes to the DB Primary. 10ms later, they read from a DB Replica (which has 100ms lag), get stale data, and write it to the cache with a 1-hour TTL. What is the severity of this issue?

  1. A The issue is negligible because the database's inherent eventual consistency model will naturally resolve the discrepancy within 100 milliseconds.
  2. B The replication lag is 'pinned' in the cache; every subsequent read will serve stale data for the full 1-hour TTL duration of the cache entry.
  3. C This is a minor performance concern as the cache will eventually refresh its state as soon as the replica catches up to the primary node's log.
  4. D There is no functional risk because modern Redis clusters automatically detect and compensate for database replication lag during read operations.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions