Live state storage and durable checkpoint storage are different layers
Separate state access from checkpoint persistence, explain incremental file reuse, and estimate upload and recovery costs without equating changed keys with changed storage bytes.
On this page
The question for today
What you’ll understand
- Distinguish a state backend from durable checkpoint storage.
- Explain physical incremental reuse without assuming a changed-key log.
- Calculate upload lower bounds and identify a restore's complete dependency set.
A local key-value store can make live state access efficient without surviving the loss of the worker that owns it. A durable checkpoint can survive that loss while being too slow for every event's state lookup. Stream execution uses these layers for different purposes. Track logical state, local representation, immutable checkpoint artifacts, and metadata references separately before claiming that a small incremental upload means a small or independent recovery image.
The backend serves running operators
A state backend chooses how managed state is represented and accessed during execution. Flink 2.1 documents heap-based and embedded key-value-store choices with different serialization, memory, and I/O tradeoffs, as well as additional backend options with their own restrictions. Checkpoint storage identifies where durable snapshot material and metadata are retained. A local backend directory is not automatically a disaster-resilient checkpoint. Conversely, placing checkpoints in durable object storage does not imply each state read performs an object-store request. Read the selected version's backend and checkpoint configuration as two related decisions.
Measure access patterns: random keyed reads, sequential scans, updates, timers, value sizes, and skew. A backend that holds large state efficiently can still pay CPU costs for serialization, compaction, or cache misses. More memory can change cache behavior while leaving state cardinality unchanged. A heap payload estimate and a serialized file size do not include the same overhead. Choose a backend based on representative processing and recovery measurements, not solely the largest state size it can theoretically hold. Operational limits also include local disk capacity and checkpoint-storage throughput.
Incremental checkpoints reuse artifacts under a complete manifest
For an incremental backend mechanism such as the documented RocksDB checkpoint path, unchanged immutable artifacts can be referenced rather than uploaded again. Newly produced files and metadata are persisted as required. This is a physical-storage mechanism, not necessarily a log containing only the keys the application updated. Compaction can produce new files containing values that were not logically changed, and metadata can reference artifacts shared across checkpoints. A small logical update rate therefore does not guarantee a proportionally small upload, especially while the store reorganizes data.
The latest completed checkpoint describes the artifacts needed for recovery. Shared files must remain available while referenced; cleanup cannot delete them merely because they originated in an older checkpoint. Restoring an incremental checkpoint does not mean starting from its newly uploaded delta alone. Nor should one assume every backend reconstructs state through a universal chronological chain of application-level patches. Use the actual manifest and backend rules. Validate serialization and state-schema compatibility before restoring into changed code; a durable artifact that the new program cannot interpret is not a successful upgrade strategy.
Test recovery as well as steady-state throughput
Track checkpoint duration, new and referenced bytes, failed or expired checkpoints, local compaction, state-access latency, restore download, and catch-up time. An asynchronous checkpoint still consumes CPU, I/O, and network resources while processing continues. Check recovery when local files are unavailable rather than validating only a favorable local-reuse case. Retention and source replay windows must cover the recovery plan. A job that checkpoints quickly but takes too long to restore and catch up can miss the availability objective despite a green checkpoint-success counter.
The cache lab isolates locality, not a real backend. For EACH run Reset, explicitly set BOTH C and s, predict, then Play or Step. At t=0/N=16, (C,s)=(4,2) yields zero hits across eight identities; (8,2) yields eight hits after the first pass. Requests are capped at min(4096,16+floor(2t)); edits retain t and recompute from empty. This fully associative LRU toy has no serialization, disk, compaction, checkpoint manifest, or recovery. Use it to explain why the same logical state-access stream can respond differently to cache capacity, without claiming measured backend speed.
Work it through
A small upload can reference a large restore image
A fictional completed checkpoint references 900 MB of reusable immutable state files and 100 MB of new files, all decimal units. Effective upload throughput for new material is 50 MB/s; ignore metadata and all other overhead.
Only the 100 MB of new material needs uploading in this simplified checkpoint step. Its transfer lower bound is 100/50=2 seconds.
The complete referenced image contains 900+100=1,000 MB. A worker with no reusable local material may need that full set to restore, not just the latest 100 MB.
At an assumed restore bandwidth of 100 MB/s, raw download alone needs at least 1,000/100=10 seconds. Deserialization, local-store work, coordination, and replay catch-up add time beyond that lower bound.
Two seconds of new upload does not imply a two-second restore or a 100-MB complete state image.
The living notebook
Explore the model
Interactive lab · cache
Locality is only one backend cost
For EACH comparison Reset, set BOTH C and s, predict, then Play or Step. At N=16/t=0, (4,2) yields zero hits and (8,2) yields eight. N=min(4096,16+floor(2t)); edits retain t/recompute from empty. This LRU trace does not simulate a Flink backend, compaction, checkpoint files, durable storage, or measured throughput.
- Hits / requests
- 0 / 16
- Hit rate
- 0%
- Address-stream period
- 16 addresses
A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forCache capacity can affect a fixed access pattern, while checkpoint durability and restore dependencies require separate storage evidence.
Pause & reason
Check your understanding
Your turn
Try it yourself
A checkpoint needs 240 MB of new upload at an effective 80 MB/s. Its complete manifest references 1,200 MB. Calculate the upload lower bound and explain whether that bounds restoration time above.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Compute the new transfer time, then distinguish a lower bound on one phase from an upper bound on a different operation.
Compare with the solution
The ideal upload lower bound is 240/80=3 seconds. It is not an upper bound on restore: restoring may require the full 1,200 MB plus metadata handling, backend construction, deserialization, and input replay. Actual upload can also exceed three seconds because of overhead or contention.
Keep the idea
Take it with you
- Live backend representation and durable checkpoint storage serve different paths.
- Incremental reuse concerns physical artifacts and their complete dependency manifest.
- Restore and catch-up measurements belong beside checkpoint-upload metrics.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.