Distributed cache: many nodes serving same data. Which node's answer is correct when values differ? Consistency models decide.

Strong consistencysync writesEventualasync replicationRead-your-writessession-scopeEvery read freshFast, occasionally staleYou see your writesLatency + coordinationConfusing to usersSticky session hard
Distributed cache consistency models with tradeoffs
Advertisement

Strong consistency

Writes propagate to all replicas before returning. Every read sees latest. Redis Cluster with WAIT command.

Strong consistency

Writes propagate to all replicas before returning. Every read sees latest. Redis Cluster with WAIT command.

Advertisement

Eventual consistency

Writes return immediately. Async propagation to other nodes. Fast. Occasional stale reads.

Read-your-writes

User sees their own writes immediately, even if others don't. Route reads to same replica as writes for that session.

Monotonic reads

Once you read version X, never see older X. Prevents time-travel confusion in UI.

Consistent prefix

You see writes in the order they happened, even if delayed. Never see 'reply' before original message.

Pick model by what users notice. Strong for money, eventual for likes, read-your-writes for user's own actions.