What does the `throttle` keyword do?
BeginnerProductionPerformance and Scale
Answer
throttle: N limits how many hosts run a specific task or block at the same time, regardless of forks. Use it to protect a shared resource: a database that handles a handful of migrations, a rate-limited API, or a package mirror.
- name: Register with service discovery
ansible.builtin.uri:
url: "https://registry.example.com/nodes/{{ inventory_hostname }}"
method: PUT
throttle: 5
It is different from serial, which batches the whole play and not one task.
More on Performance and Scale
Why can Ansible be slower than a shell script for 100 servers, and what dominates the time?BeginnerHow do you choose the `forks` value?BeginnerWhat is SSH pipelining and why does it help?BeginnerWhich SSH settings matter for performance and stability?IntermediateHow do you find out which tasks are slow?BeginnerHow do you reduce the cost of fact gathering?Intermediate