We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

CookbooksBatch Processing

Batch Processing

Batch processing involves running the same operation across a large set of items like images, documents, records, or API calls. We’ll structure batch workloads in Hatchet with fan-out, retry, and concurrency control.

At its core, batch processing is Fanout applied at scale. If your batch also has fixed stages (e.g., validate → transform → load), you can combine it with Pre-Determined Pipelines.

Step-by-step walkthrough

You’ll build a parent workflow that fans out to one child task per item and aggregates results.

Define the parent workflow

Create a parent workflow that receives a batch of item IDs and spawns one child per item.

Process each item

Each child task processes a single item independently. Failed items are retried according to your retry policy.

Run the worker

Register and start the worker with both parent and child workflows. For large batches, use durable workflows so the parent does not hold a slot while waiting.

⚠️

For batches with thousands of items, use durable workflows so the parent task doesn’t hold a worker slot while waiting for all children to complete. See Durable Workflows for details.

Common Patterns

PatternDescription
Image processingResize, transcode, or analyze images in parallel across workers
Data enrichmentEnrich records by calling external APIs (geocoding, company info, email validation)
Report generationGenerate per-customer reports in parallel, then aggregate into a summary
Database migrationsProcess and migrate records in batches with retry and progress tracking
Notification deliverySend emails, SMS, or push notifications to a user list with rate limiting

Next Steps