Interview Prep/Ansible/Performance and Scale

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.

All Ansible questions Roadmap: Ansible

More on Performance and Scale