Permalink
Browse files

ansible: serialize calls to ModuleDepService.

Concurrent calls to ModuleDepService would cause significant wasted
work, as potentially all pool threads run the same uncached module dep
scan.

Without:
         3243581 function calls (3233009 primitive calls) in 4770.672 seconds

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2523    0.011    0.000   39.849    0.016 services.py:409(scan)

With:
         2801561 function calls (2800042 primitive calls) in 5166.843 seconds

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2506    0.009    0.000    1.967    0.001 services.py:411(scan)

Ignore timing variance due to problems with the test job.
  • Loading branch information...
dw committed Jul 31, 2018
1 parent a05835c commit d62e6e2a7fc4642cb95ddbe81438bc3e37cffd9d
Showing with 2 additions and 0 deletions.
  1. +2 −0 ansible_mitogen/services.py
@@ -388,6 +388,8 @@ class ModuleDepService(mitogen.service.Service):
Scan a new-style module and produce a cached mapping of module_utils names
to their resolved filesystem paths.
"""
invoker_class = mitogen.service.SerializedInvoker

def __init__(self, *args, **kwargs):
super(ModuleDepService, self).__init__(*args, **kwargs)
self._cache = {}

0 comments on commit d62e6e2

Please sign in to comment.