Reference · Cheat sheet
Lesson 0008 distilled — w and j are orthogonal; together they set your durability/latency position. Built to print.
j — single-node durability: did this node's journal flush to disk? About surviving a process crash.
w — replication acknowledgment: how many nodes confirmed? About surviving a node failure.
Setting one says nothing about the other. Choose both deliberately.
w valuesw: 0 — fire and forget.
w: 1 (default) — primary acked. Rollback risk if primary crashes before replication.
w: "majority" — majority of voting members acked. Any elected primary already has the write. No rollback.
jj: false (default) — ack without journal flush. Write is in memory. Lost if process crashes before next journal write (~100 ms).
j: true — wait for WAL flush before ack. Survives process crash. Small latency cost (sub-ms on SSD).
| w + j | Survives | Use for |
|---|---|---|
| w:1, j:false | Network errors | Bulk loads, metrics |
| w:1, j:true | Process crash on primary | Middle ground |
| w:majority, j:false | Node failure | Perf-sensitive, replicated |
| w:majority, j:true | Crash + node failure | Financial, orders, critical |
local (default) — most recent on the node; may include data that could roll back.
majority — only data acknowledged by a majority; cannot be rolled back. Pair with w: "majority".
linearizable — strongest: reflects all majority-acked writes before the read; primary-only, highest latency.
| MongoDB | Postgres |
|---|---|
| w:1, j:false | synchronous_commit = off |
| w:1, j:true | synchronous_commit = local |
| w:majority, j:true | synchronous_commit = on |
| readConcern: majority | read from primary + sync_commit on |