How a write becomes durable
How Nova stores an appended batch in object storage and decides when to acknowledge it.
When Nova acknowledges an append, the records are stored in object storage. They stay readable from any node, even if the node that took them stops a moment later. The acknowledgement waits for object storage only. The metadata store learns where the records are afterwards, in the background.
The parts
| Part | What it does |
|---|---|
| Leader | The node that currently serves a stream's writes. It numbers each batch. |
| Pool | A node's buffer of accepted batches, one per class, shared by every stream the node leads |
| Flight | The batches the node writes to object storage together, as one object in each bucket |
| WAL | The node's write-ahead log in object storage, one per class. Each flight takes the next numbered position in it, a slot. |
| Ledger | A run of consecutive slots written by one writer. A WAL is a sequence of ledgers, each with its own number, the epoch. |
| Bucket set and copy quorum | The K buckets each slot is written to, and the W of them that must confirm |
| Indexer | Runs on the leader after the acknowledgement and records in the metadata store where each stream's records are |
From append to acknowledgement
- A producer sends a batch to the stream's leader. A batch holds at most 1,000 records and 1 MiB, and Nova stores all of it or none of it. The leader gives each record the next sequence number. If the batch carries a match sequence number that is not the next one, the leader refuses that batch at once and reports the tail.
- The batch joins the node's pool for its class. The pool holds at most 256 MiB by default. When it is full, producers wait.
- One loop, the flusher, turns the pool into a flight once 8 MiB has gathered, or once the oldest byte has waited 200 ms on Standard or 25 ms on Express. The same loop gives the flight the next slot, so slot order is the order in which batches arrived.
- The node writes the flight to its slot in every bucket of the class's bucket set. Each write succeeds only if no object exists at that key yet. The slot is committed when W buckets confirm.
- The node acknowledges in slot order. A flight's batches are acknowledged once its slot is committed and every earlier slot has been acknowledged. Each acknowledgement gives the batch's sequence numbers, and it is never taken back.
- The indexer then writes each stream's share of the flight to the metadata store and moves the ledger's checkpoint past it. This step is called absorb. Until it finishes, only the leader knows where those records are. It serves them from memory or from the slot.
The metadata store stays off the acknowledgement
The write to the slot is the commit. An append touches the metadata store only when a node takes the lead of a stream or starts a new ledger, never once per batch.
A simpler design writes a metadata row for each batch before acknowledging it. That costs several metadata operations for every MiB, each copied three times inside the metadata store, and puts a metadata commit inside every acknowledgement. Deriving the rows afterwards, from a log that is already in order, takes that commit out of the latency and cuts the metadata work by about two hundred times. Absorb writes one row per stream for each group of flights, however many bytes they hold. Every acknowledged record can also be found again from object storage alone.
What an acknowledgement waits for
Once a stream has a leader, an acknowledgement waits for object storage and nothing else. The metadata store catches up in the background, and its work depends on how many streams are active, whatever the volume of bytes.
The cost is a short window in which only the leader knows where the newest records are. After a failure, the next leader rebuilds that from the WAL, as described below.
One log per node, shared by every stream
A node writes the streams it leads into one WAL per class, so a flight mixes records from many streams. Object storage charges per request and adds a fixed delay to each one. Sharing flights keeps the number of requests per second flat however many streams a node leads, and keeps each object large.
Standard storage limits the request rate under one key prefix until it splits a busy one, so each new Standard ledger starts at a hashed place in the key space.
In exchange, a stream's recent records are spread over shared objects, called transit bundles, and are read by byte range. Later, the auditor (Nova's background process) runs a job called denorm. It copies each stream's records into stream objects of their own, which suit long reads and retention. Both classes keep stream objects in the standard bucket, and Express records leave transit sooner because express storage costs more. See the transit window.
Acknowledgements follow slot order
Up to 128 slots per class upload at once by default. This hides the latency of each storage write. Acknowledgements are still released in slot order, so every stream sees its batches acknowledged in the order it sent them. A ledger's committed slots also have no gaps, which gives recovery a simple rule: every slot before the first one that cannot commit is committed.
The cost is head-of-line blocking. A slow write delays the acknowledgement of every later slot in that WAL, for every stream on the node, even when the later uploads have finished. When all 128 slots are waiting, the flusher waits, then the pool fills, then producers wait.
Two classes, one protocol
Standard and Express use the same slots and the same ordering. They differ in the bucket set and how long a flight waits.
| Standard | Express | |
|---|---|---|
| Flight cut | 8 MiB, or the oldest byte at 200 ms | 8 MiB, or the oldest byte at 25 ms |
| Buckets per slot (K) | 1 standard bucket | 1 express bucket per availability zone, at least 2 |
| Copies to acknowledge (W) | 1 | 2 by default, never fewer |
| Durable at acknowledgement | In the region's standard storage | In two availability zones |
With three zones, Express acknowledges after the second-fastest copy, so one slow or unavailable zone does not delay it. The quorum stays at two even when a zone is down. Each flight costs K writes to express storage. See Storage classes inside for the costs.
What waits when storage slows
Every step has a limit, and at each limit the step before it waits.
| Limit | Default | What waits |
|---|---|---|
| A producer session's unacknowledged batches | 48 MiB Standard, 8 MiB Express, and 1,024 batches | The client stops sending |
| The pool | 256 MiB per class | New batches |
| Slots uploading at once | 128 per class | The flusher |
| The backlog: flights acknowledged but not yet absorbed | 1,024 flights and 4 GiB | New slots |
The backlog limit bounds the leader's memory, the window in which only the leader can read the newest records, and the work a successor must redo after a failure. Nova records each stall with its cause, such as absorb falling behind or a slow metadata store, and logs any wait longer than 5 seconds. See Backpressure.
When a node fails mid-write
A storage write fails
When a slot cannot reach its quorum, because too many buckets refuse it or its writes keep failing for 30 seconds, the node stops that ledger. It fences the ledger, starts a new one with the next epoch, acknowledges the flights committed before the stop, and writes the rest again into the new ledger. Producers see a delay. A call fails only if its own deadline passes first, and then nothing was appended.
The leader stops
Its lease ends when its metadata store session expires, after 10 seconds with an external metadata store or 15 seconds with the built-in one. The next leader runs ledger recovery before it serves:
- It fences the old ledger. It copies any partly written slot to enough buckets, then writes a marker into the first empty slot, so nothing at or after that slot can ever be acknowledged. That slot is the ledger's cut.
- It records in the metadata store where the records in every slot below the cut are. This moves no record data.
- It deletes slots above the cut that were written but never acknowledged.
A slot that was committed before the crash is kept, even if its acknowledgement never reached the client. A node that only seemed dead, because it paused or lost its network, finds the marker on its next write and stops.
What the client sees
The SDK finds the new leader and resends unacknowledged batches, within a 30-second retry budget. A batch that was already stored is appended twice. With a match sequence number, the resend is refused instead, and the client learns that an earlier attempt may have been stored. A one-shot append reports an uncertain outcome instead of retrying. Sequence numbers never have gaps. See Writer coordination for how to append exactly once.
Go deeper
WAL, slots and ledgers
The slot states, the slot envelope, and what halts a ledger
Epochs and fencing
How a ledger is fenced, and why the cut is the same for every fencer
Ledger recovery
How a successor indexes a stopped ledger before it serves
Storage layout
The object keys of WAL slots, with and without the hash
Back to the concept: Appends.