Flink StateBackend - Overview
How to build a State Backend in Flink from scratch.
Translated from Chinese with AI · Read the original
This article explains how to build a State Backend in Flink from scratch.
The StateBackend Interface
public interface StateBackend extends java.io.Serializable {
CompletedCheckpointStorageLocation resolveCheckpoint(String externalPointer) throws IOException;
CheckpointStorage createCheckpointStorage(JobID jobId) throws IOException;
<K> AbstractKeyedStateBackend<K> createKeyedStateBackend(...);
OperatorStateBackend createOperatorStateBackend(...);}Besides resolveCheckpoint (which resolves the Checkpoint location from externalPointer), a StateBackend needs the following capabilities:
- Initialize the CheckpointStorage associated with the State
- Create a Keyed StateBackend and an Operator StateBackend
Implementation Overview
Flink currently provides 4 StateBackend implementations:
- DefaultOperatorStateBackend (Operator StateBackend)
- MemoryStateBackend (Keyed StateBackend)
- FsStateBackend (Keyed StateBackend)
- RocksDBStateBackend (Keyed StateBackend)
Currently under development: