状态与容错

    For example:

    • When an application searches for certain event patterns, the state will store the sequence of events encountered so far.
    • When aggregating events per minute/hour/day, the state holds the pending aggregates.
    • When historic data needs to be managed, the state allows efficient access to events that occurred in the past.

    Knowledge about the state also allows for rescaling Flink applications, meaning that Flink takes care of redistributing state across parallel instances.

    When working with state, it might also be useful to read about Flink’s state backends. Flink provides different state backends that specify how and where state is stored. State can be located on Java’s heap or off-heap. Depending on your state backend, Flink can also manage the state for the application, meaning Flink deals with the memory management (possibly spilling to disk if necessary) to allow applications to hold very large state. State backends can be configured without changing your application logic.

    • : Shows how to use state in a Flink application and explains the different kinds of state.
    • The Broadcast State Pattern: Explains how to connect a broadcast stream with a non-broadcast stream and use state to exchange information between them.
    • : Explains how to access state from outside of Flink during runtime.
    • State Schema Evolution: Shows how schema of state types can be evolved.
    • : Discusses how to implement custom serializers, especially for schema evolution.