Host Parallelism Calculator
Calculate how many hosts Ansible will manage in parallel given fork settings.
About Host Parallelism Calculator
Ansible processes hosts in batches of size `forks`, running each batch's tasks to completion before moving to the next batch (unless using free strategy). Total run time is therefore the number of batches — ceil(hosts / forks) — multiplied by how long one batch takes to clear all tasks. Raising forks reduces batch count and total time, up to the point where the control node's CPU, memory or network saturates.
Formula
total_time_sec = ceil(hosts / forks) × time_per_batch
- hosts
- Total target hosts
- forks
- Ansible parallelism (--forks)
- time_per_batch
- Seconds for one batch to complete all tasks
Worked example
With the default values below, Host Parallelism Calculator returns Total Run Time of 1.33. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Total Hostsaccepts 1–100,000 hosts
- 200 hosts
- Forksaccepts 1–1,000 forks
- 20 forks
- Time per Batchaccepts 0.1–3,600 seconds
- 8 seconds
Results
- Total Run Time
- 1.33 min
- Number of Batches
- 10 batches
- Hosts in Final Batch
- 20 hosts
- Fork Utilization
- 100.0%
Step by step
- 1Batches: ceil(hosts / forks)= 10 batches
- 2Total run time: batches × time per batch= 80.0s (1.33 min)
- 3Hosts in final (partial) batch= 20 hosts
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why does the last batch matter?
If hosts doesn't divide evenly by forks, the final batch runs with fewer hosts than your fork limit, meaning you're not using full parallelism for that batch — but it still takes roughly the same wall-clock time as a full batch since batch time is dominated by the slowest host.
Does raising forks always reduce total time?
Only up to the point where the control node runs out of CPU, memory, or available SSH connections. Beyond that ceiling, contention increases per-batch time enough to offset the reduction in batch count.
What's the difference between forks and the linear strategy's batching?
With the default 'linear' strategy, Ansible waits for every host in a batch to finish a task before starting the next task, batching by forks. The 'free' strategy lets each host run ahead independently, which this batch model doesn't capture.
How do I measure real task time per batch?
Run with `-vvv` or the profile_tasks callback plugin to get per-task timing, then use the slowest host's cumulative task time as your 'time per batch' input.
