Why it matters
State is what enables complex event processing. Understanding state APIs unlocks Flink's real power.
Advertisement
The architecture
Keyed state: partitioned by record key. Each key has its own state. Types: ValueState, ListState, MapState, ReducingState, AggregatingState.
Operator state: per-operator instance state. Broadcasted to all downstream.
Advertisement
How it works end to end
State access: within KeyedProcessFunction or window function. State auto-scoped to current key.
State TTL: configure state expiration. Prevents unbounded growth.
Snapshots: checkpoints serialize state. Recovery restores state.
Rescaling: operator parallelism changes require state redistribution.