ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

Re-order logic around testing for group_in_use so that the test is on… #5880

Closed bloob00k closed 7 years ago

bloob00k commented 7 years ago

…ly run if it is actually required.

This gives a massive speed-up in the event that you have a large number of instances nad groups in the VPC.

Current code iterates over every instance in the vpc and then over every group on each instance, whether or not this is required. In the 99.9% of cases when it is not required this is wasted effort, and if there are are a large number of instances it takes a very long time. In our environment where we have 1500 instances, making this change reduced the time to execute from 35 seconds to 7 seconds, which adds iup very quickly if there are multiple ec2_group tasks.

I believe there are further optimisations that could be made as well, but this is good enough for now.

This repository is locked

Please open all new issues and pull requests in https://github.com/ansible/ansible

For more information please see http://docs.ansible.com/ansible/dev_guide/repomerge.html

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.