Batch Processing Patterns
Patterns for processing large volumes of records reliably, at scale, and without overwhelming downstream systems.
Choose based on your throughput requirements, record set size, and whether you need rate limiting or maximum parallelism.
When to use which pattern
| Pattern | Record set size | Parallelism model | Workflow-based rate control |
|---|---|---|---|
| Basic Workflow | Small (up to a few hundred records) | Sequential or parallel activities in one Workflow | No |
| Fan-Out with Child Workflows | Up to ~4M records | Fixed concurrency (one child per chunk) | No |
| Batch Iterator | Unlimited | Limited (activities per page) | Yes — fixed page rate |
| Sliding Window | Unlimited | Bounded window of concurrent children | Yes — configurable window |
| MapReduce Tree | Unlimited | Fully parallel recursive tree | No — maximum speed |
Schedules
Schedules allow Workflows to be executed on a recurring basis — think of them as a more powerful cron.
- Supports
start/pause/stop/update/backfillof scheduled Workflow executions - Configurable Overlap Policies control what happens when the previous run is still running
- Full execution history visibility in the Temporal UI
- Schedules can be created via the UI, CLI, or SDK
temporal schedule create \
--schedule-id 'your-schedule-id' \
--workflow-id 'your-workflow-id' \
--task-queue 'your-task-queue' \
--workflow-type 'YourWorkflowType'References:
Basic Workflow (single-tier fan-out)
The simplest form of batch processing: the Workflow fetches or receives record IDs and executes one Activity per record.
- Activities can be executed sequentially or concurrently (using the SDK's async primitives)
- Limit: 2,000 in-flight Activities per Workflow run (aim for 500)
- If total event count is likely to exceed 2,000 (hard limit: 50,000), use the Batch Iterator instead
Pros: Simple
Cons: Hard cap on concurrent Activities; all-or-nothing failure model; can overwhelm downstream systems
Batch Signalling
The Temporal CLI lets you signal, reset, cancel, or terminate multiple Workflows with a single command using a visibility query.
- 1 running batch job per namespace
- 50 Workflows per second per batch
# Signal all running Workflows of a given type
temporal workflow signal \
--name MySignal \
--input '{"Input": "As-JSON"}' \
--query 'ExecutionStatus = "Running" AND WorkflowType="YourWorkflow"' \
--reason "Testing"
# Terminate all running Workflows of a given type
temporal workflow terminate \
--query 'ExecutionStatus = "Running" AND WorkflowType="SomeWorkflowType"' \
--reason "Terminate Test Workflows"Reference: CLI batch commands
Key Limits
Full reference: Temporal Cloud limits
| Limit | Value |
|---|---|
| Unfinished actions per Workflow | 2,000 max (aim for 500). Includes Activities, Signals, Child Workflows, cancellation requests |
| Events per Workflow history | 50,000 events max (aim for 2,000) or 50 MB total history size |
| Signals per Workflow | 10,000 |
| Updates per Workflow | 10 in-flight, 2,000 total |
| Batch Signalling | 1 batch job per namespace; 50 Workflows/sec per batch |