The requirement is to be able to launch a playbook on receiving a request (ie on demand). So, if 100 requests are received, it will result in 100 playbooks being executed parallely. You mentioned - Ansible uses about 50MB of memory per playbook. Is there something that can be done to optimize on that ?
On Wednesday, December 12, 2018 at 3:09:32 PM UTC+5:30, Kai Stian Olstad wrote: > > On 12.12.2018 07:53, pradeep.hk wrote: > > I have a requirement to run lots of playbooks parallely on localhost. > > When I run 100 playbooks parallely (a simple one that executes the a > > shell > > command - date) , I see that > > it consumes lot of resources (memory ~ 7GiB and CPU ~ 200%) > > Is this on expected lines ? > > It sound about right. > > For small execution Ansible uses about 50MB of memmory, 50MB * 100 is > about 5GB. > > > But since you are running the same playbook on the same host you could > instead do this > > In inventory add > > [testgroup] > testhost[001:100 > > And in ansible.cfg set fork=100 > > And the playbook > > - hosts: testgruop > connection: local > gather_facts: no > tasks: > - name: Get date > shell: date > register: result > > - debug: > var: result.stdout > > > This will only use a little over 50MB and not GB of memory and a lot > less CPU. > > > Your test case seams to me not very relevant, but if it is, let Ansible > fork and not the OS. > > -- > Kai Stian Olstad > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dbb626c3-813f-4b01-a26c-8c6e46b0cf68%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
