signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
682 stars 84 forks source link

Cache get_link_variables calls for speed improvement #199

Closed tedoc2000 closed 6 years ago

tedoc2000 commented 6 years ago

Took 6 seconds off of maestro command: Originally: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.002 0.002 14.985 14.985 /Users/tedo/sf/signalbox/prod:9() 1 0.000 0.000 7.591 7.591 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/main.py:171(execute) 1 0.030 0.030 7.131 7.131 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/maestro.py:29(init) 1 0.000 0.000 6.521 6.521 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/loader.py:49(load) 6532 0.567 0.000 6.378 0.001 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/entities.py:314(get_link_variables) 228000 1.248 0.000 5.444 0.000 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/entities.py:598(get_link_variables) 1 0.051 0.051 4.779 4.779 /usr/local/lib/python2.7/site-packages/yaml/init.py:64(load) 1 0.000 0.000 4.721 4.721 /usr/local/lib/python2.7/site-packages/yaml/constructor.py:35(get_single_data) 1 0.000 0.000 4.498 4.498 /usr/local/lib/python2.7/site-packages/yaml/composer.py:29(get_single_node) 1 0.000 0.000 4.498 4.498 /usr/local/lib/python2.7/site-packages/yaml/composer.py:50(compose_document)

Now down to: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.002 0.002 8.701 8.701 /Users/tedo/sf/signalbox/prod:9() 1 0.000 0.000 6.561 6.561 /Users/tedo/Library/Python/2.7/lib/python/site-packages/maestro/loader.py:49(load) 1 0.051 0.051 4.813 4.813 /usr/local/lib/python2.7/site-packages/yaml/init.py:64(load) 1 0.000 0.000 4.755 4.755 /usr/local/lib/python2.7/site-packages/yaml/constructor.py:35(get_single_data) 1 0.000 0.000 4.531 4.531 /usr/local/lib/python2.7/site-packages/yaml/composer.py:29(get_single_node) 1 0.000 0.000 4.531 4.531 /usr/local/lib/python2.7/site-packages/yaml/composer.py:50(compose_document) 46416/1 0.109 0.000 4.531 4.531 /usr/local/lib/python2.7/site-packages/yaml/composer.py:63(compose_node) 6306/1 0.064 0.000 4.531 4.531 /usr/local/lib/python2.7/site-packages/yaml/composer.py:117(compose_mapping_node) 135732 0.110 0.000 4.152 0.000 /usr/local/lib/python2.7/site-packages/yaml/parser.py:94(check_event) 358416 0.261 0.000 3.327 0.000 /usr/local/lib/python2.7/site-packages/yaml/scanner.py:113(check_token)

mpetazzoni commented 6 years ago

Nice, thanks!