SSH Connection Calculator
Calculate concurrent SSH connection load generated by an Ansible run across hosts.
About SSH Connection Calculator
Peak concurrent SSH load is capped at min(forks, hosts) — Ansible never opens more simultaneous connections than either your fork limit or your host count. Total connections over the whole run, however, depends heavily on whether SSH multiplexing (ControlPersist/ControlMaster) is enabled: without it, a naive per-task connection would need one SSH session per task per host; with it, one persistent connection per host serves every task in the play.
Formulas
With multiplexing
total_connections = hosts (one persistent connection per host)
- hosts
- Number of target hosts
Without multiplexing
total_connections = hosts × tasks_per_play
- hosts
- Number of target hosts
- tasks_per_play
- Tasks executed per host
Worked example
With the default values below, SSH Connection Calculator returns Peak Concurrent SSH Connections of 20. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Total Hostsaccepts 1–100,000 hosts
- 150 hosts
- Forksaccepts 1–1,000 forks
- 20 forks
- Tasks per Playaccepts 1–5,000 tasks
- 30 tasks
- Connection Multiplexing (ControlPersist)
- Yes
Results
- Peak Concurrent SSH Connections
- 20 connections
- Total Connections This Run
- 150 connections
- Multiplexing Savings
- 96.7%
- Connections Saved
- 4,350 connections
Step by step
- 1Concurrent connections: min(forks, hosts)= 20 connections
- 2Total connections without multiplexing= 4500 connections
- 3Total connections with multiplexing= 150 connections
- 4Savings from multiplexing= 96.7% (4350 connections saved)
Assumptions and limits
- The result is derived only from the 4 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 1 decimal place, 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
Is connection multiplexing on by default?
Modern Ansible enables pipelining and SSH ControlPersist-based multiplexing by default via the `ssh` connection plugin, but it can be disabled by configuration — always confirm `ansible.cfg`'s `[ssh_connection]` settings if you see unexpectedly high SSH load.
Why does peak concurrency matter separately from total connections?
Peak concurrency determines instantaneous load on the control node's file descriptors and the network/firewall's simultaneous-connection limits, while total connections over the run affects aggregate SSH daemon load on target hosts and any per-connection rate limiting.
Can too many concurrent SSH connections cause failures?
Yes — target hosts with a low `MaxStartups` or `MaxSessions` in sshd_config can reject connections under high fork counts, and firewalls/security groups with connection-rate limits can throttle or drop them.
How do I verify multiplexing is actually working?
Run with `-vvv` and look for `ControlPath` reuse in the SSH command output, or check `~/.ansible/cp/` for active control sockets during a run.
