I did some basic performance testing here, and the lock as currently
implemented provides a decent performance improvement.

On my machine with 100 hosts, 100 debug tasks, and 25 forks, I found that
removing the lock increased execution time by close to 60 seconds.

Based on that, I'd be hesitant to remove it.

On Fri, Mar 19, 2021 at 5:41 PM al...@moreati.org.uk <a...@moreati.org.uk>
wrote:

>
> ansible.plugins.strategy.StrategyBase._results_lock is acquired to control
> access to StrategyBase._results and StrategyBase._handler_results.
> Specifically
>
> - in ansible.plugins.strategy.results_thread_main() before append() ing a
> result
> - in StrategyBase_process_pending_results() before popleft() ing
>
> However StrategyBase._results & _handler_results are both
> collections.deque objects. From the Python docs
>
> > Deques support thread-safe, memory efficient appends and pops from
> either side of the deque.
>
> Thus AFAICT the lock isn't needed for the deque operations, and could
> possibly be removed. Have I missed something? Is the lock providing another
> protection I've not noticed? Is it there as a belt and braces measure?
>
> If there's no  reason to have it, and interest in removing it, I'll submit
> a PR. Alternatively maybe there's benefit in keeping the lock and using
> wait()/notify() instead of some of the polling.
>
> Regards, Alex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/3a309938-189d-4b8b-b9c4-539afea81984n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-devel/3a309938-189d-4b8b-b9c4-539afea81984n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CAD8N0v8LKs7%2Bb1wgs1zbso3vO251QEEdu4LXcrZ57pXVWj8-Hw%40mail.gmail.com.

Reply via email to