Skip to main content

Parallel Execution

Replay supports parallel execution at three levels: multi-workflow concurrency, shell command parallelism, and multi-workflow file format. This speeds up test suites and enables efficient use of CI resources.

Multi-Workflow Concurrency

Run multiple workflow files at the same time using --concurrency N:
This starts a worker pool with 4 workers. Each workflow gets its own isolated state bag — no variable leakage between parallel workflows.

How It Works

Replay uses a worker pool pattern:
  1. All workflows are loaded and queued
  2. Up to N workers pull workflows from the queue
  3. Each worker executes one workflow in its own goroutine
  4. Each workflow has an independent state bag
  5. Results are collected and reported per workflow

Safeguards

  • Each workflow has its own isolated state bag — no shared variables
  • Max concurrency is capped to prevent DB/API overload
  • Output stays ordered in the final summary
  • Supports both fail-fast and continue-on-error modes

Example

Fail-Fast

Stop execution on the first failure — saves time in CI:
When --fail-fast is active and any single workflow fails, remaining queued workflows are skipped and Replay exits with code 1.

Multi-Workflow Files

A single YAML file can contain multiple workflows separated by ---:
Run them in parallel:
Total time is ~7s instead of ~12s.

Combining with Glob Patterns

Each workflow in each file is treated as a unit of work for the pool.

Parallel Shell Commands

Within a single shell step, you can run multiple commands concurrently:
All three commands start simultaneously. The step waits for all to finish before proceeding.

Output in Parallel Mode

When parallel: true, per-command outputs are stored with indexed names:
The final stdout variable contains the output of the last command.

Combining All Three Levels

This runs all three workflows concurrently. Within the Cache Tests step, three Redis commands run in parallel.

What’s Next?