Interview Prep/Ansible/Performance and Scale

How do you diagnose a slow playbook step by step?

IntermediateProductionPerformance and Scale
Answer
  1. Run with profile_tasks and note the top tasks and the gap between the end of the last task and the recap.
  2. If time is spent before the first task, check inventory loading (time ansible-inventory --list) and fact gathering.
  3. If it is spread over many tasks, check per-task SSH overhead: ControlPersist, pipelining, DNS delay on the target (UseDNS), slow shell profiles.
  4. For a single slow host, run -vvv against it and compare with a fast host.
  5. For slow tasks, run the same command by hand on the target to see if Ansible is the cause at all.

A frequent hidden cause is reverse DNS or GSSAPI auth making each SSH login wait a few seconds.

All Ansible questions Roadmap: Ansible

More on Performance and Scale