CLOUD CONCEPT

Checkpointing

Checkpointing is the practice of durably saving processing progress and any required execution state so work can resume from a known recovery point.

Cloud Concepts Hub →

What is Checkpointing

A checkpoint records enough information to recover a task without restarting all of its work, such as source positions, intermediate calculations, or an agent's workflow state. It reduces recovery time and repeated computation, but reliable recovery also depends on retained inputs, compatible state, and safe handling of repeated side effects.

Checkpointing creates a recoverable boundary in a running process. Depending on the workload, a checkpoint can contain an input offset, completed-file metadata, aggregation state, pending work, or a structured representation of an agent's execution. Recovery loads the latest valid checkpoint and continues from that point rather than beginning again. The checkpoint must survive the failure it is intended to address; a file stored only on a disposable worker is insufficient protection against losing that worker.

In ingestion pipelines, checkpointing commonly tracks which source records or objects have been processed successfully. For example, a stream consumer can save a sequence number for each partition after processing its records. After a failure, it resumes from those positions, potentially processing some records again. Partitioned sources generally require progress tracking per partition rather than one global offset.

Checkpointing supports replayability but does not create it by itself. A source must retain the records needed for recovery, or the pipeline must preserve an independent copy, such as raw events in object storage. If a checkpoint refers to records that have expired from a stream, recovery from that position is no longer possible using that stream alone. Replaying an older interval may require selecting an earlier source position or resetting progress metadata and directing output to an isolated destination.

The relationship between output writes and checkpoint advancement is critical. If a consumer writes output and fails before recording progress, recovery can write that output again. If it records progress before output is durable, a failure can cause missing output. Checkpoints alone therefore do not guarantee end-to-end exactly-once processing. Use transactional coordination where supported, or make output operations idempotent through stable event identifiers, deduplication, or upserts. Stateful processing also requires a consistent relationship between source positions and saved operator state.

Cloud frameworks implement different forms of this idea. AWS Glue job bookmarks track supported source-processing progress, whereas AWS Glue streaming jobs use checkpoints for streaming recovery. A bookmark is not a complete snapshot of arbitrary application memory. On Amazon EMR, Spark Structured Streaming can persist query progress and state to a durable checkpoint location. Ordinary Spark caching is different: cached data improves performance but does not, by itself, provide durable execution recovery.

When troubleshooting a pipeline, inspect the last successful checkpoint, checkpoint errors, source retention, storage permissions, and compatibility between saved state and the deployed job. A processing backlog can grow because checkpoint writes are slow or failing. Removing a checkpoint directory can force reprocessing or prevent restoration of stateful computations; it is not a routine repair step. Preserve evidence and establish a controlled replay plan before resetting progress.

For an AI agent, a checkpoint can store conversation state, the current workflow node, completed tool actions, pending approvals, and references to external artifacts. Save it under a stable execution or conversation identifier so another worker can resume the same workflow. Persisting a transcript alone may not capture control flow or outstanding actions. If an agent submits a payment and fails before saving its next checkpoint, recovery must reconcile the action or reuse an idempotency key rather than blindly submit it again.

Checkpoint frequency balances overhead against recovery effort. Frequent checkpoints reduce repeated work but consume storage, network bandwidth, and processing time. Large state may require incremental snapshots or asynchronous persistence, depending on the framework. Protect checkpoint data with access controls and encryption, isolate independent jobs or agent sessions, manage retention, and test restoration after application changes. A checkpoint is an operational recovery mechanism, not a substitute for backups, source retention, or disaster-recovery planning.

Key aspects of Checkpointing

Effective checkpointing combines durable state, consistent progress tracking, replayable inputs, safe side effects, and tested recovery procedures.

Durable recovery boundary

Save progress and necessary state in storage that survives the relevant worker or process failure. Recovery should use a complete, valid checkpoint rather than partially written state.

Progress and state consistency

Keep source positions aligned with the processing state they describe. Restoring newer offsets with older aggregation state can silently produce incorrect results.

Replay prerequisites

Retain source records long enough to cover expected outages and recovery delays. A saved offset cannot recover data that the source has already deleted.

Safe output and side effects

Expect work after the last successful checkpoint to run again unless stronger coordination prevents it. Use transactional writes, idempotency keys, or deduplication to avoid duplicate output and repeated agent actions.

Checkpoint interval trade-offs

Choose checkpoint frequency according to acceptable reprocessing time and persistence overhead. Monitor checkpoint duration, failures, age, and state size rather than assuming a configured interval guarantees a fresh recovery point.

State lifecycle and compatibility

Version persisted state and validate whether a changed job or agent can restore it. Separate checkpoint locations by workload, protect sensitive contents, and test recovery before deleting or migrating state.

Cloud services for Checkpointing

Kinesis Data Streams can supply retained events while Glue, Spark on EMR, or Managed Service for Apache Flink processes them and maintains framework-specific recovery state. S3 can hold supported checkpoint files and longer-lived raw input archives, allowing recovery beyond a stream's retention window. DynamoDB can hold Kinesis Client Library checkpoints or application-defined agent state with conditional concurrency control. These components do not automatically form one atomic transaction: engineers must coordinate progress with durable output, configure retention, and make repeated writes or tool actions safe.

AWS Glue image AWS Glue

AWS Glue job bookmarks track processing progress for supported sources and can be reset or rewound for controlled reprocessing. Glue streaming jobs use checkpoints instead of job bookmarks; resetting progress does not remove previously written target data.

Open AWS Glue →
Amazon EMR image Amazon EMR

Spark Structured Streaming running on Amazon EMR can use durable checkpoint storage to recover query progress and state. Recovery depends on compatible query changes, available input data, and the selected sink's delivery guarantees.

Open Amazon EMR →
Amazon Managed Service for Apache Flink image Amazon Managed Service for Apache Flink

The service supports Flink checkpointing for recovery of stateful stream processing and application snapshots for supported operational workflows. End-to-end exactly-once behavior also depends on the source and sink connectors and their configuration.

Open Amazon Managed Service for Apache Flink →
Amazon Kinesis Data Streams image Amazon Kinesis Data Streams

Applications using the Kinesis Client Library checkpoint processed sequence numbers, with coordination and checkpoint metadata stored in DynamoDB. Records remain replayable only while they are within the stream's configured retention period.

Open Amazon Kinesis Data Streams →
Amazon DynamoDB image Amazon DynamoDB

DynamoDB can store application-managed checkpoints and structured agent workflow state using stable execution identifiers. Conditional writes or transactions can coordinate concurrent updates, but applications must still handle external tool actions idempotently.

Open Amazon DynamoDB →
Amazon Simple Storage Service image Amazon S3

Amazon S3 provides durable storage for checkpoint files where supported by the processing framework and for raw input archives used during replay. Keep checkpoint paths separate from input and output data, and ensure lifecycle rules do not prematurely delete active recovery state.

Open Amazon S3 →