Storage Engine and Replication
Correcting a Common Assumption
It is extremely common — and was the working assumption in this very study plan before verification — to assume DynamoDB uses an LSM-tree storage engine "like Cassandra," on the theory that both descend from Dynamo and LSM-trees are the default choice for write-optimized distributed stores (Cassandra, HBase, RocksDB, ScyllaDB all use them). This is wrong for DynamoDB specifically. According to the USENIX ATC 2022 paper, each storage replica persists data in a B-tree, alongside a write-ahead log used for replication and crash recovery.
This is worth dwelling on because the reason is a staff-level insight in itself:
| LSM-tree (Cassandra) | B-tree (DynamoDB) | |
|---|---|---|
| Write path | Append to memtable (in-memory), flush to immutable SSTable, compact later | In-place page updates via copy-on-write, logged to WAL first |
| Write cost | Cheap and sequential — great raw write throughput | More expensive per write (page splits, tree rebalancing) but bounded |
| Read path | Must check memtable + potentially many SSTables, filtered by bloom filters, merged | Direct O(log n) descent to the exact page — one lookup path, always |
| Background interference | Compaction — a background process that can consume significant I/O/CPU and, if it falls behind, degrades read latency by forcing reads to check more SSTables | None comparable — no compaction, no merge step, no read amplification that grows with write volume |
| Tail latency behavior | Read latency variance grows under write-heavy or compaction-lagging conditions | Read latency stays flat regardless of write volume, because there's no accumulating layer of unmerged files to search through |
DynamoDB's entire product promise is "single-digit-millisecond latency at any scale, predictably." An LSM-tree's read amplification is a function of how much unmerged write history has accumulated — which is exactly the kind of variable, workload-dependent tail latency that would break that promise under sustained write-heavy load or a compaction backlog. A B-tree's read cost is a near-constant function of tree depth (which grows logarithmically, i.e., barely at all, even at huge scale). DynamoDB paid a write-cost tax (B-tree writes are costlier than LSM appends) to buy a flat, predictable read-latency guarantee — which is precisely the trade a managed, SLA-backed service needs to make, and precisely the trade a self-managed system optimizing for raw write throughput (Cassandra) does not have to make.
Replication: Multi-Paxos, Not Leaderless Quorums
Every partition is served by a replication group — historically three replicas, spread across three Availability Zones for durability against an AZ failure. Unlike Cassandra, where any replica can accept any write, a DynamoDB replication group elects a leader via Multi-Paxos, and all writes for that partition go through the leader.
Client write for partition P
│
▼
Request Router ──► MemDS: "who is the current leader for P?"
│
▼
Leader replica (elected via Multi-Paxos)
│
│ 1. Append to write-ahead log
│ 2. Replicate log entry to followers
│ 3. Wait for acknowledgment from a QUORUM of the group
│ 4. Apply to local B-tree
│ 5. Return success to client
▼
ACK ◄── quorum of replicas have durably logged the write
(not necessarily all — the laggard catches up async)
Walking Through an Availability Zone Failure
The reason for spreading a replication group's three replicas across three AZs, made concrete:
Normal operation, partition P, replication group in us-east-1:
Replica A (AZ 1a) — LEADER
Replica B (AZ 1b) — follower
Replica C (AZ 1c) — follower
AZ 1a experiences a failure (power, network partition, whatever).
Replica A stops responding to Multi-Paxos heartbeats.
Timeline:
t+0ms Replica A becomes unreachable.
t+~few00ms Replicas B and C detect the missing heartbeats, initiate a new
Multi-Paxos leader election between themselves.
t+~sub-second One of B/C (say B) wins election, becomes new leader.
Writes to P are blocked/retried by the client during this window
(Section 2's stated production trap).
t+after B now serves as leader. Writes flow through B, replicate to C
and (once A recovers) back to A, which catches up from its WAL
gap or, if the gap is too large, gets a fresh B-tree copy.
Durability check: any write that had already reached QUORUM (2 of 3) before
A failed is safe — it was acknowledged only after B or C (not just A) had
durably logged it, so the failure of A alone cannot lose it. This is the
concrete meaning of "durable against loss of a minority of replicas."
This is also why a log replica (next) is valuable during exactly this kind of event: if the group additionally has a 4th, lightweight log replica in a different AZ, quorum durability and even a functioning leader election can be maintained with even less dependence on any single full-data replica being healthy.
Log Replicas: A Genuine 2022-Paper Innovation
A standard replica stores both the write-ahead log and the full B-tree (the complete dataset for that partition). The 2022 paper describes an additional, lighter-weight replica type: a log replica, which stores only the recent write-ahead log entries — not the full B-tree.
Why this exists: replacing a failed full replica (or promoting a new one during a leader failover) requires copying the entire B-tree dataset for that partition, which takes time proportional to partition size. A log replica can be added to a group almost instantly (it only needs to catch up on recent log entries, not the whole dataset), giving the group a fast, cheap way to maintain quorum durability (and unblock a leader election) while a full data-carrying replacement replica is being provisioned in the background. This is the same idea as a "witness" node in other consensus systems — a vote-carrying participant that doesn't carry the full state — and it resurfaces in the Global Tables part under Multi-Region Strong Consistency, which uses an explicit witness replica across regions for the same reason.
Item Size and the 400 KB Ceiling
DynamoDB caps every item at 400 KB, including attribute names and values. This is not an arbitrary billing tier — it is a direct consequence of the B-tree storage engine and the leader-based replication path: every write, no matter how small a delta it represents (even a single-attribute increment), replicates the entire item through the write-ahead log and across the quorum, because the WAL records item-level mutations, not byte-level diffs. An unbounded item size would mean an unbounded amount of data crossing the network per write, which directly threatens the same predictable-latency guarantee that motivated the B-tree choice in the first place. The practical consequence: large blobs (images, documents, logs) don't belong in DynamoDB items at all — store them in S3 and keep only a pointer (key, size, content hash) in the item, a pattern sometimes called "claim-check."
The Invariants
- Guaranteed: a write acknowledged to the client has been durably logged by a quorum of the replication group (not all replicas) — durable against the loss of a minority of replicas.
- Guaranteed: exactly one leader per partition at any point in logical time, enforced by Multi-Paxos — no split-brain dual-leader writes within a single-region replication group.
- Not guaranteed by the storage/replication layer alone: which specific replica a read hits — that's a consistency-model choice, covered next.