Skip to content
ENExplore Calculators

Fact Gathering Time Calculator

Estimate time spent gathering facts across all hosts at the start of a playbook run.

About Fact Gathering Time Calculator

Every play implicitly runs the `setup` module against each host unless `gather_facts: false` is set, and this cost scales like any other task: ceil(hosts / forks) batches × time per host. Fact caching (backed by redis, jsonfile, or memcached) lets Ansible skip re-gathering for hosts with a valid cache entry within the configured TTL, which this calculator models via a cache hit rate applied before batching.

Formula

total_fact_time_sec = ceil(hosts / forks) × gather_time_per_batch_sec

hosts
Number of target hosts
forks
Ansible parallelism (--forks)
gather_time_per_batch_sec
Time for setup module to complete per batch

Worked example

With the default values below, Fact Gathering Time Calculator returns Total Fact Gathering Time of 12.00. Change any input above and every figure here is recalculated in your browser.

Inputs used

Total Hostsaccepts 1–100,000 hosts
200 hosts
Gather Time per Hostaccepts 0.01–60 seconds
1.2 seconds
Forksaccepts 1–1,000 forks
20 forks
Fact Caching Enabled
No
Cache Hit Rateaccepts 0–100 %
70 %

Results

Total Fact Gathering Time
12.00 seconds
Time Saved by Caching
0.0%
Hosts Requiring Fresh Gather
200 hosts
Gather Batches
10 batches

Step by step

  1. 1Hosts requiring fresh gather= 200 hosts
  2. 2Batches needed= 10 batches
  3. 3Total gather time= 12.00s
  4. 4Time saved vs. no caching= 0.00s (0.0%)

Assumptions and limits

  • The result is derived only from the 5 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

Can I just disable fact gathering entirely?

Yes, with `gather_facts: false`, but only if your playbook doesn't reference any `ansible_*` facts — many roles (package management, service handling) rely on facts like `ansible_os_family`, so disabling it entirely is often impractical.

What's a typical fact cache TTL?

Common values are 1-24 hours (`fact_caching_timeout` in ansible.cfg) — short enough that facts don't go stale after infrastructure changes, long enough to skip re-gathering across frequent, related playbook runs.

Does `gather_subset` help if I can't disable facts entirely?

Yes — `gather_subset: min` or listing specific subsets (e.g. `!hardware`) gathers only the facts you actually need, which can meaningfully reduce per-host gather time versus the full fact set.

Why is my cache hit rate lower than expected?

Fact caches are usually keyed by inventory hostname — if hosts are re-provisioned with new names/IPs frequently, or the cache backend has connectivity issues, hit rates drop and most runs fall back to a full gather.

Fact Gathering Time Calculator | Calcrivo