Interview Prep/Ansible/Performance and Scale

How do you choose the `forks` value?

BeginnerProductionPerformance and Scale
Answer

forks is the number of hosts processed in parallel. The default 5 is conservative. We raise it to 20 to 50 on a decent controller and measure.

[defaults]
forks = 40

Limits are the controller's CPU and memory (each fork is a Python process, often 50 to 100 MB), network and SSH connection capacity, and the targets (for example hammering one package mirror or API). Beyond roughly 100 forks, returns diminish and you should look at splitting runs across several controllers instead.

All Ansible questions Roadmap: Ansible

More on Performance and Scale