Skip to content
Calcrivo

Task Execution Time Calculator

Estimate total Ansible run time from task count, average task duration and per-host SSH connection setup overhead.

Inputs

tasks

Total tasks in the playbook (including role tasks).

seconds

Average time for one task to run on one host.

seconds

SSH handshake and auth time incurred once per host per play (less with connection multiplexing/pipelining).

hosts

Number of target hosts. Connection setup is paid once per host (not per task) when pipelining is enabled.

Total Estimated Run Time

1.67min

Connection Overhead Share

40.0%

Task Execution Time

60.0seconds

Connection Setup Time

40.0seconds

Step by step

  1. Task work: tasks × avg duration

    40 × 1.5s

    = 60.0s

  2. Connection overhead: setup × hosts

    0.8s × 50

    = 40.0s

  3. Total time: task work + connection overhead

    60.0 + 40.0

    = 100.0s (1.67 min)

How it works

Total playbook time has two components: the actual task work (tasks × average duration) and one-time-per-host connection setup (SSH handshake, becoming root, Python interpreter discovery). This model assumes pipelining/ControlPersist is enabled so connection setup is paid once per host per run rather than once per task per host — without those optimizations, connection overhead can dominate total run time.

Formula

total_sec = tasks × avg_duration_sec + connection_setup_sec × hosts

tasks
Number of tasks in the playbook
avg_duration_sec
Average duration per task per host (seconds)
connection_setup_sec
SSH handshake/auth time per host
hosts
Number of target hosts

Frequently Asked Questions

Why is connection overhead per host, not per task?

With SSH ControlPersist and pipelining enabled (recommended), Ansible reuses one SSH connection for the whole play against a host, so the connection cost is amortized across all tasks rather than repeated for every task.

What if pipelining is disabled?

Without pipelining, Ansible copies a module file to the remote host and executes it in a separate step for every task, which can multiply connection-related overhead — model this by using a higher 'connection setup time' input to approximate the extra round trips.

How can I reduce task work time?

Batch related operations into fewer, coarser tasks (e.g. one `package` call with a list instead of one task per package), use `async`/`poll` for long-running tasks, and avoid `command`/`shell` when a native module with less overhead exists.

Does this account for parallelism across hosts?

No — this estimates work per host. Combine with the Host Parallelism Calculator to see how forks reduce the wall-clock time of running this workload across your full host count.

You might also need