Skip to content

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

PatternRecord set sizeParallelism modelWorkflow-based rate control
Basic WorkflowSmall (up to a few hundred records)Sequential or parallel activities in one WorkflowNo
Fan-Out with Child WorkflowsUp to ~4M recordsFixed concurrency (one child per chunk)No
Batch IteratorUnlimitedLimited (activities per page)Yes — fixed page rate
Sliding WindowUnlimitedBounded window of concurrent childrenYes — configurable window
MapReduce TreeUnlimitedFully parallel recursive treeNo — 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 / backfill of 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
bash
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
bash
# 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

LimitValue
Unfinished actions per Workflow2,000 max (aim for 500). Includes Activities, Signals, Child Workflows, cancellation requests
Events per Workflow history50,000 events max (aim for 2,000) or 50 MB total history size
Signals per Workflow10,000
Updates per Workflow10 in-flight, 2,000 total
Batch Signalling1 batch job per namespace; 50 Workflows/sec per batch

Temporal Design Patterns Catalog