A consistency model states what concurrent readers and writers are guaranteed to observe. It becomes visible when two people claim the last slot or two browser tabs update the same record: the promise determines which races are safe and which bugs remain possible. section 9.5
Useful guarantees form a spectrum:
- Linearizable reads see the latest write system-wide. section 9.5
- Serializable execution preserves one operation order, while read-your-writes ensures users see their own updates. section 9.5
- Eventual consistency permits temporary disagreement while replicas converge. section 9.5
Preventing a double booking
Cal.com keeps Postgres as the source of truth and treats Redis as disposable cache. For bookings, a Prisma extension derives a shared idempotency key from the slot and host; the database UNIQUE constraint makes concurrent inserts collide. The preceding availability read alone cannot protect against a race. section 9.5
Table 9.5 What each consistency model promises when two writers race
|
Model
|
What it
promises
|
Examples
|
What it
buys
|
What it
costs
|
|
Linearizable
|
Every read
sees the most recent write, system-wide
|
Single-primary
Postgres/MySQL writes, etcd, Spanner
|
One global
order; the easiest model to reason about
|
Coordination
on every write; the slowest and least available under partition
|
|
Sequential/serializable
|
All clients
see operations in the same order, not necessarily real-time
|
SERIALIZABLE isolation,
FoundationDB
|
Safe
concurrent transactions without manual locking
|
Aborts and
retries under contention
|
|
Read-your-writes
|
You always
see your own writes; others may lag
|
Sticky
sessions to primary, "read from primary after write"
|
A user
never loses their own edit
|
Doesn't
help two different users racing
|
|
Bounded
staleness
|
Reads lag
the truth by at most X seconds
|
DynamoDB
strong-vs-eventual toggle, Cosmos DB tunable
|
Tunable
freshness-vs-cost dial per query
|
You must
pick the bound, and pick wrong somewhere
|
|
Eventual
|
All
replicas converge given no new writes
|
DynamoDB
default reads, Cassandra ONE,
DNS
|
Highest
availability and throughput
|
Stale
reads, lost-update and conflict-resolution headaches
|
Compare consistency models by promise, examples, operational benefit, and coordination cost. section 9.5






