Home/Labs/Consistency Model Lab
All 280 Labs
INTERACTIVE LAB🎚️

Consistency Models Anomaly Lab (Interactive)

Run scripted read probes against five models and watch anomalies appear and disappear. Strong, sequential, causal, read-your-writes, and eventual consistency probed with post-then-reply scenarios that expose exactly which guarantee each model drops.

Consistency Spectrum Anomaly Probe

A post and its reply race down two replication paths. Replay three observer reads at t=60/80/120ms under each model and count the anomalies.

Base replication lag150 ms
Reply path replicates at 0.6x lag; replica B reads at 1.4x lag — independent channels reorder updates.
Anomalies
1
Read latency
2ms
Partition behavior
AP: serves
Read probes at t=60/80/120ms (writes: post@0ms, reply@40ms)
t=60ms Alice (author) — re-reads her own postANOMALY
sees post: no · sees reply: no
✗ read-your-writes violated (Alice cannot see her own post)
t=80ms Charlie — reads replica Aconsistent
sees post: no · sees reply: no
t=120ms Charlie — re-reads replica B (slower path, 1.4x lag)consistent
sees post: no · sees reply: no

Eventual: Zero coordination; anomalies until background sync. Push the lag slider to 0 to watch every model momentarily agree — consistency strength is about what happens when they do not.

How It Works Under the Hood

Consistency is not binary: it is a spectrum of guarantees each defined by the anomalies it forbids. Strong consistency forbids reading old values at all; sequential keeps every observer seeing one global order; causal preserves dependencies between writes; read-your-writes only promises you never lose sight of your own edits; eventual promises convergence with no window bound. This lab replays a fixed write story — a post, then a reply that cites it — against your chosen replica model, replication lag, and partition state, then reports which guarantees the probe scenario violated.

Core Architectural Principles

  • Deterministic probe scenario tests read-your-writes, monotonic reads, and causal visibility.
  • Replication lag slider decides when each anomaly actually fires under weak models.
  • CP-tier models switch from stale answers to hard errors when the partition toggle is set.
Interview Round Script

Never say “eventually consistent” alone — name the property you need: causal for threads, read-your-writes for user edits, monotonic reads so counters never go backwards. Then give a convergence bound: “staleness bounded by replication lag, p99 under 1 second,” which is the answer reviewers want.

Key Trade-Offs

Each stronger guarantee you add removes a real anomaly but hands back a slice of latency or availability.

Related Curriculum Chapter

Consistency Models: Strong, Eventual, and Causal

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs