Huh, I would not have guessed that. Thanks, I'll try that next time I can't
explain the presence of some code.

On Mon, 22 Mar 2021 at 15:39, Matt Martz <[email protected]> wrote:

> 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 [email protected] <[email protected]>
> 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 [email protected].
>> 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
>


-- 
Alex Willmer <[email protected]>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CABv%3DZQH-LDJWHK8nLP%3D9iTW12ot%3DFh8aLDdnXGRxJzwmHP00jQ%40mail.gmail.com.

Reply via email to