# Forks?

**URL:** <https://forum.ansible.com/t/forks/37290>\
**Category:** Ansible Project\
**Created:** [November 1, 2022, 4:47pm UTC](https://forum.ansible.com/t/forks/37290 "2022-11-01T16:47:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [November 1, 2022, 4:47pm UTC](https://forum.ansible.com/t/forks/37290/1 "2022-11-01T16:47:57Z")

</div>

I have my forks set to 50 in ~/.Ansible.CTG and the forks setting seems to work for the first set of boxes, but doesn’t seem to work for the rest. I thought the forks setting would keep $forks connections going until all boxes in the inventory have been touched.

Was I thinking wrong? (I’m running an ad hoc command on 16k boxes.)

Mike

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [November 1, 2022, 5:21pm UTC](https://forum.ansible.com/t/forks/37290/2 "2022-11-01T17:21:51Z")

</div>

Mike

There are dedicated docs pages[1][2] for this topic. I must admit there is a fair bit of missing info in your query.

So to recap what we know:

- ~16k hosts
- forks set to 50
- unknown strategy
- unknown config for async, throttle, serial and the other settings that can affect
- unknown number of running ansible forks/processes on the control node
- unknown if still polling for async
- unknown other things as I am typing this in a hurry

1. [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_async.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html)
2. [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_strategies.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html)

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [November 1, 2022, 5:27pm UTC](https://forum.ansible.com/t/forks/37290/3 "2022-11-01T17:27:51Z")

</div>

I’ll look at the docs you mention. My command is: ansible all -I list -m command -m ‘rpm -qa openssl’. Other than the forks setting and the log setting I’ve not changed the configuration. (forks = 50 and log = /tmp/${USER}-ansible.log

Mike

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 1, 2022, 5:40pm UTC](https://forum.ansible.com/t/forks/37290/4 "2022-11-01T17:40:38Z")

</div>

With 16k hosts, it’s possible that you never actually see the max 50 forks in use. We’ve made some pretty big performance improvements to large host counts, but you might only see somewhere around 30 forks in use, maybe less, even though you have specified a higher count.

The forking limitation is caused by having a high fork count, with a CPU (single CPU core) bound process. Effectively, we have a single process that orchestrates forking, and processing results. The more forks, the more CPU bound that process is. The more hosts you have in inventory, the more CPU is used to calculate variables when spawning workers and processing results.

Once the first sets of results start coming in, the process becomes busier, and is unable to process results and spawn new processes to keep the fork count up. So what happens is results take longer to process, which delays spawning new workers, and before you reach the theoretical max of your 50 configured forks, other forks are exiting, and the process never gets back to the max.

So ultimately, what you have to do is baseline your use case, and adjust forks to a more appropriate level. Decrease forks, or split your inventory into smaller chunks, or do both.

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [November 1, 2022, 5:46pm UTC](https://forum.ansible.com/t/forks/37290/5 "2022-11-01T17:46:34Z")

</div>

Great explanation. Thank you.

Mike

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [November 3, 2022, 1:44am UTC](https://forum.ansible.com/t/forks/37290/6 "2022-11-03T01:44:12Z")

</div>

Installing awx, and ansible-core to support it, gets... a bit  
fraught, if you're a bit leery about just using "pip install" willy  
nilly for everything.

I've been publishing RPM building tools for ansible-core and ansible  
for some time now, at

&nbsp;&nbsp;&nbsp;&nbsp;[https://github.com/nkadel/ansiblerepo](https://github.com/nkadel/ansiblerepo)

I now publish some to build "awxkit", the package which provides the  
"awx" command line tool.

&nbsp;&nbsp;&nbsp;&nbsp;[https://github.com/nkadel/awxkitrepo/](https://github.com/nkadel/awxkitrepo/)

I partly do these because deducing from the ansible installation tools  
that you need to install and use python 3.8 or later, instead of the  
default python 3.6, is work people should not have to do. Nor should  
deployment critical files have to be built up manually on unpredictale  
environments with ever-shifting python dependency chain results.

Unfortunately, I'm afrad that mrmeee's old yum repositories for awx  
seems to be moribund: this might serve as a useful place to start  
from, using the system provided python39 rather than relying on the  
more awkward SCLO provided python tools.

Nico Kadel-Garcia
