Interview Prep/Ansible/Performance and Scale

What changes when the inventory has 10,000+ hosts?

AdvancedProductionPerformance and Scale
Answer

Parsing and variable merging become noticeable, and each fork's memory grows with the size of hostvars.

  • Prefer plugin compose/keyed_groups over thousands of per-host host_vars files.
  • Keep group_vars small and avoid embedding large data blobs in variables.
  • Cache the inventory and sync it separately from job runs (AWX inventory sync schedules).
  • Always run with --limit or a targeted host pattern, and use job slicing in AWX to split one job template across many workers.
  • Be careful with hostvars-wide loops (see Jinja2 cost) and gather_facts on every host.

time ansible-inventory --list > /dev/null tells you quickly how bad parsing is.

All Ansible questions Roadmap: Ansible

More on Performance and Scale