Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low performance #12239

Closed
lberruti opened this issue Sep 3, 2015 · 35 comments
Closed

Low performance #12239

lberruti opened this issue Sep 3, 2015 · 35 comments
Assignees
Labels
affects_2.0 This issue/PR affects Ansible v2.0 bug This issue/PR relates to a bug. performance support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@lberruti
Copy link
Contributor

lberruti commented Sep 3, 2015

ISSUE TYPE

Bug Report

COMPONENT NAME

core

ANSIBLE VERSION
devel
ansible 2.0.0 (detached HEAD b2cb3153f1) last updated 2015/09/03 230737 (GMT +200)
lib/ansible/modules/core (detached HEAD bbcfb1092a) last updated 2015/09/03 230739 (GMT +200)
lib/ansible/modules/extras (detached HEAD b8803306d1) last updated 2015/09/03 230739 (GMT +200)
config file =
configured module search path = /root/ansible/library
CONFIGURATION

none

OS / ENVIRONMENT

Debian 7

SUMMARY

Hi, unfortunately version 2.0 seems slow down.
With a real playbook: v2 run within 32 secs, v2, stable-1.9 19 secs.
Same conditions (target machine, control machine), no network congestions (local net), no network downloads.

STEPS TO REPRODUCE

time ansible-playbook -i hosts simplespeedtest.yml > /dev/null

---
# simplespeedtest.yml
- hosts: localhost
  tasks:
    - command: echo 1
    - command: echo 2
#  and so on
    - command: echo 30
EXPECTED RESULTS

ansible stable-1.9
ansible 1.9.3 (detached HEAD 066b707) last updated 2015/09/03 23:19:28 (GMT +200)
lib/ansible/modules/core: (detached HEAD dccef8f89a) last updated 2015/09/03 23:17:15 (GMT +200)
lib/ansible/modules/extras: (detached HEAD 25595b4ecc) last updated 2015/09/03 23:17:15 (GMT +200)
configured module search path = /root/ansible/library
real 0m2.608s
user 0m1.776s
sys 0m0.464s
real 0m2.476s
user 0m1.656s
sys 0m0.468s
real 0m2.497s
user 0m1.688s
sys 0m0.444s

ACTUAL RESULTS

real 0m3.848s
user 0m2.484s
sys 0m0.496s
real 0m3.524s
user 0m2.208s
sys 0m0.376s
real 0m3.926s
user 0m2.396s
sys 0m0.544s

@abadger abadger added this to the v2 milestone Sep 7, 2015
@geerlingguy
Copy link
Contributor

I'm seeing the same results, using the following playbook:

---
- hosts: localhost
  connection: local

  tasks:
    - command: echo 1
    - command: echo 2
    - command: echo 3
    - command: echo 4
    - command: echo 5
    - command: echo 6
    - command: echo 7
    - command: echo 8
    - command: echo 9
    - command: echo 10
Ansible 1.9.3 Ansible 2.0.0 devel delta
1.640s 2.187s 29% slower

With sudo, deltas are about the same for me.

Real-world playbook operating on a local VM with sudo (specifically, this one - ran vagrant up --no-provision, then time vagrant provision):

Run Ansible 1.9.3 Ansible 2.0.0 devel delta
Initial provision XYZs XYZs % slower
2nd provision (no changes) 11.997s 884.760s 195% slower

All tests were averages of 3 runs.

I didn't complete the initial provision with Ansible 2.0.0 because it was excruciating, and I stopped waiting after about 15 minutes. I let the idempotent provision go after doing the initial provision with 1.9.3, and it was also excruciating. I did it three times, and each time it took more than 14 minutes. CPU was basically idle the entire time.

@geerlingguy
Copy link
Contributor

I wonder if #12477 and #10523 may be related.

Checking out revision 81bf88b resulted in much more reasonable timings; for the real-world playbook, the no-changes provision took only 14.372s. I'm checking later revisions now.

@geerlingguy
Copy link
Contributor

For me, it looks like the culprit was ac98fe9 — before this commit, the setup task takes just a moment. On that commit, and for every commit since, it takes 10+ seconds for the setup task, then 10+ seconds for every successive task.

@geerlingguy
Copy link
Contributor

And just as soon as I finish diagnosing the problem... one of the commits from the past couple hours (between 89a78ba and 587054d) seems to have fixed the issue. Disregard my comments above.

@jimi-c
Copy link
Member

jimi-c commented Sep 23, 2015

@geerlingguy yeah actually ran into and fixed that while looking at #12477. But I agree, that issue is most likely related to this one. I do not think #10523 is, as that's reported against a much older version and most likely has no relevance to this bug.

@jimi-c
Copy link
Member

jimi-c commented Sep 24, 2015

Hi @lberruti, I've created the feature branch https://github.com/jimi-c/ansible/tree/issue_12477_performance_improvements_hostvars, if you'd like to test to see if it corrects your issue as well (as we believe they may be related).

Thanks!

@jimi-c jimi-c added the needs_info This issue requires further information. Please answer any outstanding questions. label Sep 24, 2015
@lberruti
Copy link
Contributor Author

Hi @jimi-c, here the results:

test 1.9.4 7fbaf3a 2.0 b2cb315 2.0 12df9f2 issue_12477_performance_improvements_hostvars
simple1 real 0m4.493s real 0m5.790s real 0m5.985s
simple2 real 0m4.065s real 0m5.912s real 0m5.937s
simple3 real 0m4.129s real 0m5.894s real 0m5.998s
simple4 real 0m4.164s real 0m5.681s real 0m5.996s
simple5 real 0m4.359s real 0m5.775s real 0m5.939s
production playbook real 0m6.842s real 0m35.875s real 0m32.516s

I run "production" playbook with tags: v2 shows a lots of "skipped include" that surely slow (see also #12240)

@jimi-c jimi-c removed feature_idea needs_info This issue requires further information. Please answer any outstanding questions. labels Sep 28, 2015
@srgvg
Copy link
Member

srgvg commented Oct 6, 2015

With my large inventory, these slowdowns are especially noticeable when skipping tasks, and are related to large inventories with lots of hosts and lots of variabales.

FYI, some metric from my inventory:

$ ansible all --list-hosts |wc -l 
1048
$ ansible all -m debug -a var=hostvars |wc -l 
19843405

$ ansible-playbook main.yml --list-tasks |wc -l 
636
$ ansible-playbook plays/provisioning.yml --list-tasks |wc -l 
25

I have a reference test where I run a job --limited to two hosts, that only skips tasks (as I don't pass it a needed --extra-var).

  • With ansible v2 beta1 this takes 38s
  • Same, but pointing to a subset of the inventory that has only 6 hosts takes 9s
  • The same job with 1.9.2 takes 2.6s, and that is mostly is the inventory init

@jimi-c jimi-c self-assigned this Oct 8, 2015
@Yannig
Copy link
Contributor

Yannig commented Nov 1, 2015

Same problem for me with playbook of mine.

ansible 2.0.0 (devel f528ad1848) last updated 2015/11/01 09:23:49 (GMT +200)
  lib/ansible/modules/core: (detached HEAD 211196bdf6) last updated 2015/10/26 09:59:00 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD 5d4474a2b2) last updated 2015/10/26 09:59:00 (GMT +200)

I use virtual machine on my local machine and execution time is exploding:

  • Ansible 1.9.2:
real    0m5.391s
user    0m2.143s
sys     0m0.177s
  • Same playbook with last version of Ansible:
real    1m24.713s
user    1m9.727s
sys     0m1.193s

Here is the top consuming function using python profiler (python -m cProfile -s time):

         126890788 function calls (118898006 primitive calls) in 123.621 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   142521   14.315    0.000   14.315    0.000 {compile}
      796    8.672    0.011    8.672    0.011 {time.sleep}
  5905718    5.592    0.000   12.481    0.000 nodes.py:164(iter_child_nodes)
   939117    4.342    0.000    8.299    0.000 lexer.py:593(tokeniter)
 21243618    4.216    0.000    4.525    0.000 {isinstance}
 11698910    3.785    0.000    5.272    0.000 nodes.py:148(iter_fields)
12651198/12609538    3.598    0.000    3.733    0.000 {getattr}
2344975/219508    2.929    0.000   38.092    0.000 visitor.py:34(visit)
  4428632    2.663    0.000    2.663    0.000 {method 'match' of '_sre.SRE_Pattern' objects}
   109754    2.568    0.000   32.071    0.000 compiler.py:757(visit_Template)
  1930165    2.264    0.000    3.600    0.000 compiler.py:492(write)
   540390    2.262    0.000    3.335    0.000 nodes.py:127(__init__)
1621626/329300    1.720    0.000    7.675    0.000 nodes.py:184(find_all)
   938603    1.719    0.000   11.837    0.000 lexer.py:548(wrap)
540504/109754    1.693    0.000    5.120    0.000 visitor.py:58(generic_visit)
109754/6337    1.511    0.000  112.109    0.018 __init__.py:387(_do_template)
  1633119    1.479    0.000    1.881    0.000 lexer.py:240(test)
275110/150    1.456    0.000  112.848    0.752 __init__.py:263(template)
  2344975    1.367    0.000    2.764    0.000 visitor.py:26(get_visitor)
  4043689    1.319    0.000    1.319    0.000 {method 'write' of 'cStringIO.StringO' objects}
1877206/938603    1.278    0.000   14.650    0.000 {next}
   938603    1.205    0.000   13.729    0.000 lexer.py:342(__next__)
    98750    1.205    0.000    1.205    0.000 {posix.listdir}
   109792    1.189    0.000    5.053    0.000 compiler.py:1212(visit_Output)
    16381    1.176    0.000    8.435    0.001 safe_eval.py:29(safe_eval)
1058208/329338    1.122    0.000    7.732    0.000 visitor.py:41(generic_visit)
  1048357    0.982    0.000    1.684    0.000 lexer.py:230(__new__)
  2533322    0.930    0.000    0.952    0.000 {setattr}
   109754    0.926    0.000    2.392    0.000 environment.py:323(overlay)
  1102383    0.894    0.000    4.965    0.000 compiler.py:507(writeline)
109830/109754    0.869    0.000   25.694    0.000 parser.py:843(subparse)
   204192    0.738    0.000    5.703    0.000 parser.py:544(parse_primary)
   109754    0.698    0.000    3.519    0.000 nodes.py:219(set_environment)
  1111639    0.685    0.000    0.992    0.000 compiler.py:512(newline)
   109754    0.651    0.000   90.472    0.001 environment.py:514(compile)
   147831    0.629    0.000    4.952    0.000 __init__.py:332(all)

I'm using a couple of roles template, include, with_dicts iteration. I'll try to create a role to reproduce this behaviour.

@Yannig
Copy link
Contributor

Yannig commented Nov 2, 2015

Here is some bench I have done against 3 differents playbooks with latest version of #13000:

Playbook v1.9.4 v2 No patch v2 Patch _do_template v2 Patch hostvars Both
issue-vars.yml 2.673 22.868 5.212 6.232 3.161
no-vars-mapping.yml 0.55 2.391 2.380 2.399 2.349
real-playbook.yml 3.098 87.115 14.628 20.146 8.121

issue-vars.yml and no-vars-mapping.yml can be retrieved at the following location: https://github.com/Yannig/ansible-issue-low-speed

As you can see, with both patch, ansible is about 10 times faster with my real playbook and 7 time faster with issue-vars.yml.

@jimi-c
Copy link
Member

jimi-c commented Nov 5, 2015

I've just merged in another set of patches as well, which addresses some of the issues here. For very large variable sets with large numbers of hosts, it would now be recommended to set var_compression_level in the defaults section of ansible.cfg (or the environment variable ANSIBLE_VAR_COMPRESSION_LEVEL) to a value between 1-9 (9 being the best/slowest compression available to the zlib library). Reducing the # of forks is also advised under this situation.

In my extreme stress test (1000 hosts with 20K variables in group_vars/all), things continued running smoothly albeit slowly. I had to use a single fork due to the huge memory use involved with this many hosts and variables (approximately 2GB of RAM, which means 2GB on the main thread and 2GB on the worker).

Please give devel a try again using the above option and a reduced number of forks and let us know how things work out.

@Yannig I am also looking at merging your branch now, just wanted to get some of this other stuff merged first.

@Yannig
Copy link
Contributor

Yannig commented Nov 6, 2015

@jimi-c : nice !

I think the commit you did to compress vars between workers and main python process can result in a huge performance improvement (particularly on huge inventory where hosts groups take a lot of space in memory). I will take a look later.

@jimi-c
Copy link
Member

jimi-c commented Nov 6, 2015

@Yannig yeah, that was the biggest problem I found - seralizing that large amount of data and thus duplicating it in memory.

@jimi-c
Copy link
Member

jimi-c commented Nov 7, 2015

The hostvars caching improvement (#13000) has been merged now as well.

@bcoca
Copy link
Member

bcoca commented Dec 11, 2015

making note here of other performance issue #13510

@lberruti
Copy link
Contributor Author

I rerun my simplespeedtest.yml:

stable-1.9 stable-2.0 v2.0.0-0.8.rc3 devel
real 3.86 4.91 4.70 4.75
sys 1.31 2.27 2.16 2.18
user 2.39 3.70 3.52 3.54

Production playbook:

stable-1.9 v2.0.0-0.8.rc3
real 6.51 14.25
user 4.04 10.47
sys 0.76 2.56
Profiler (python -m cProfile -s time)
stable-1.9
         2212574 function calls (2179912 primitive calls) in 6.317 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      169    1.635    0.010    1.635    0.010 {select.select}
     1582    0.276    0.000    0.510    0.000 {method 'get_single_node' of '_yaml.CParser' objects}
    42369    0.188    0.000    0.391    0.000 constructor.py:55(construct_object)
       58    0.168    0.003    0.168    0.003 {built-in method poll}
     2046    0.160    0.000    1.234    0.001 task.py:46(__init__)
    42369    0.113    0.000    0.153    0.000 resolver.py:140(resolve)
    14724    0.110    0.000    0.165    0.000 __init__.py:1487(combine_vars)
   274396    0.103    0.000    0.103    0.000 {isinstance}
    23759    0.103    0.000    0.103    0.000 {posix.stat}
       15    0.094    0.006    0.094    0.006 {method 'write' of 'file' objects}
     9948    0.092    0.000    0.146    0.000 posixpath.py:321(normpath)
      437    0.088    0.000    0.088    0.000 {compile}
      237    0.086    0.000    0.086    0.000 {posix.read}
     7565    0.086    0.000    0.133    0.000 plugins.py:159(find_plugin)
4198/4178    0.075    0.000    1.211    0.000 template.py:335(template_from_string)
    25375    0.072    0.000    0.107    0.000 posixpath.py:68(join)
v2.0.0-0.8.rc3
         6601656 function calls (5768428 primitive calls) in 14.073 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    21593    4.069    0.000    4.069    0.000 {time.sleep}
381294/1085    0.876    0.000    2.697    0.002 copy.py:145(deepcopy)
239120/97655    0.537    0.000    1.688    0.000 base.py:103(_generic_g)
510364/310565    0.493    0.000    1.918    0.000 {getattr}
454947/454942    0.448    0.000    0.455    0.000 {hasattr}
     4444    0.320    0.000    0.667    0.000 base.py:142(_initialize_base_attributes)
   238558    0.312    0.000    0.410    0.000 {setattr}
34713/1050    0.293    0.000    2.670    0.003 copy.py:306(_reconstruct)
    34713    0.238    0.000    0.532    0.000 copy.py:234(_deepcopy_tuple)
   482958    0.229    0.000    0.471    0.000 {isinstance}
    34713    0.210    0.000    0.242    0.000 {method '__reduce_ex__' of 'object' objects}
   162925    0.197    0.000    0.273    0.000 copy.py:267(_keep_alive)
   616415    0.180    0.000    0.180    0.000 {method 'get' of 'dict' objects}
44808/37886    0.179    0.000    0.930    0.000 block.py:270(_get_parent_attribute)
34932/34499    0.172    0.000    0.709    0.000 copy.py:253(_deepcopy_dict)
    55452    0.145    0.000    0.242    0.000 abc.py:128(__instancecheck__)

@lassizci
Copy link

lassizci commented Jul 15, 2016

Running (with insignificant modifications performance wise) this: https://github.com/resmo/ansible-role-sshd with inventory of 120 servers took 1m55s on ansible 2.1.0.0 and 48s on 1.9.6 when there was no changes. In practice that's not a huge issue, but with a playbook that takes 20 minutes to run (firewall rules using ufw module and hostvars) it might easily take couple hours with ansible 2.1 to complete, granted there's enough memory to actually run it (in my case 8GB isn't enough).

@jimi-c
Copy link
Member

jimi-c commented Jul 19, 2016

@lassizci have you tested with any of the 2.1.1 RCs? There is a fix or two in there which improves the CPU and memory usage.

@lassizci
Copy link

@jimi-c haven't had a chance yet, but will try it out.

@lassizci
Copy link

with v2.1.1.0-0.3.rc3 the memory consumption seems much lower compared to 2.1.0.0, so OOM killer no longer steps in in a middle of playbook run (compared to 2.1.0.0). The same run (without changes) that took 27m with 1.9.6, still took 2h10m with v2.1.1.0-0.3.rc3. CPU and memory usage are still significantly lower with 1.9.6 compared to RC. The playbook uses conditionally included task files where all the tasks use ufw module with with_items having various amounts of concatenated groups.

@jimi-c
Copy link
Member

jimi-c commented Jul 20, 2016

@lassizci can you provide a playbook/inventory example which reproduces the slowness for you? Do you have a lot of:

  • hosts
  • groups
  • group_vars
  • host_vars
  • tasks

Any details in helping reproduce it are appreciated.

@jimi-c
Copy link
Member

jimi-c commented Jul 20, 2016

@lassizci oh, and any changes to your ansible.cfg, such as fact caching changes, etc. which may differ from the stock config.

Thanks!

@lassizci
Copy link

@jimi-c came up with a test role that follows pretty much the same pattern than the real one I'm having issues with (sure with a complete rewrite it could be fixed in that particular case...) and it seems to have the same characteristics considering cpu and memory usage. The repo can be found here: https://github.com/lassizci/ansible-perftest

I just have a /etc/hosts entry to run the playbook on localhost. The amout of dummy hostvars somewhat reflects my scenario. We have about 400 variables for all group and just a few on host level.

My ansible.cfg doesn't differ much from the default. I have:

[defaults]
forks          = 15

[ssh_connection]
pipelining = True

ansible 1.9.6 took 40 seconds and 2.1.1.0-0.3.rc3 8m33s

@lberruti
Copy link
Contributor Author

@lassizci I run a sligthy modified version of your environment (only local connections, less hosts)

The repo is here: https://github.com/lberruti/ansible-perftest

ansible 1.9.6 took 6 seconds and 2.1.1.0-0.5.rc5 1m51s

Here the results (with profiling infos): https://gist.github.com/lberruti/3c27d72c1be579e8f3883bba50e018f0

@jimi-c
Copy link
Member

jimi-c commented Jul 28, 2016

@lassizci I believe your issue is probably related to this: #16749. There is definitely a degradation in performance with very deeply nested includes. I know the reason, but have not had a chance to address it yet (and it's still quite a bit slow with a few preliminary patches I attempted).

@lberruti
Copy link
Contributor Author

@jimi-c Unfortunately there are perfomance issues also without "includes"

Here the perftest rewritten without includes: https://github.com/lberruti/ansible-perftest/tree/no_includes

Here the results: https://gist.github.com/lberruti/3c27d72c1be579e8f3883bba50e018f0#file-perftest-no_includes

ansible 1.9.6 took 6 seconds and 2.1.1.0-0.5.rc5 43s

@turb
Copy link
Contributor

turb commented Aug 2, 2016

FYI, we had blocking performance problems making Ansible 2.0 and 2.1.0 unusable for us (Ansible was quickly starting to wait forever on some IO or semaphore).

Good news: it seems fixed in 2.1.1, although we don't know the root problem and what fixed it.

edited
After some execution time, we have ERROR! A worker was found in a dead state, caused by oom-killer. A simple "apt" after setup makes ansible-playbook consume 2GB.

If I add more memory to the system, I end up a few executions later with ERROR! Unexpected Exception: [Errno 12] Cannot allocate memory, which looks like #16837, except I only have a ten slaves.

@jimi-c
Copy link
Member

jimi-c commented Aug 4, 2016

@lberruti check out my performance improvements branch: https://github.com/ansible/ansible/compare/performance_improvements

In your test case above, execution time went from over 26s to ~9.5s on my system. This is still quite a bit slower than 1.9.x on my system (which runs in about 2.5s), however it's quite an improvement (the include issue is also fixed there).

@lberruti
Copy link
Contributor Author

lberruti commented Aug 5, 2016

@jimi-c now perftest runs both tests (include/no_includes)

play includes no_includes
1.9.6 5.6 2.2
performance_improvements 36.1 8

Here the complete results: https://gist.github.com/lberruti/4283cb336b0d0cb1950b94bf3e92ab62

@jimi-c
Copy link
Member

jimi-c commented Aug 8, 2016

Full results from my system:

[jamesc@jimi ansible-perftest]$ ./perftest.sh 
******************** stable-1.9
*** perftest
         396004 function calls (390728 primitive calls) in 2.839 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     4987    1.839    0.000    1.839    0.000 {posix.waitpid}
      310    0.392    0.001    0.392    0.001 {posix.fork}
     1020    0.069    0.000    0.069    0.000 {method 'recv' of '_multiprocessing.Connection' objects}
       10    0.025    0.003    2.456    0.246 __init__.py:1375(_parallel_exec)
       17    0.025    0.001    0.025    0.001 {time.sleep}
      310    0.024    0.000    0.457    0.001 process.py:116(start)
real    0m2.958s
user    0m14.396s
sys 0m2.309s
*** perftest_no_includes
         355526 function calls (350255 primitive calls) in 1.157 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1512    0.608    0.000    0.608    0.000 {posix.waitpid}
       99    0.115    0.001    0.115    0.001 {posix.fork}
      342    0.029    0.000    0.029    0.000 {method 'recv' of '_multiprocessing.Connection' objects}
  840/173    0.013    0.000    0.037    0.000 sre_parse.py:395(_parse)
      634    0.010    0.000    0.015    0.000 sre_compile.py:256(_optimize_charset)
        7    0.009    0.001    0.009    0.001 {time.sleep}
real    0m1.273s
user    0m4.682s
sys 0m0.754s
******************** devel
*** perftest
         6341406 function calls (6223428 primitive calls) in 32.139 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2089   11.105    0.005   11.105    0.005 {time.sleep}
     2445    5.265    0.002    5.265    0.002 {method 'flush' of 'file' objects}
  2241272    2.675    0.000    3.361    0.000 {setattr}
    42101    2.652    0.000    5.091    0.000 base.py:153(_initialize_base_attributes)
    46377    1.007    0.000    1.007    0.000 {posix.urandom}
      301    0.894    0.003    0.894    0.003 {posix.fork}
real    0m32.277s
user    3m22.266s
sys 0m7.436s
*** perftest_no_includes
         1166777 function calls (1131693 primitive calls) in 4.132 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      173    0.901    0.005    0.901    0.005 {time.sleep}
      643    0.667    0.001    0.667    0.001 {method 'flush' of 'file' objects}
     3878    0.231    0.000    0.409    0.000 base.py:153(_initialize_base_attributes)
       95    0.186    0.002    0.186    0.002 {posix.fork}
   200913    0.184    0.000    0.233    0.000 {setattr}
     4910    0.171    0.000    0.171    0.000 {posix.urandom}
real    0m4.274s
user    0m22.145s
sys 0m1.944s
******************** performance_improvements
*** perftest
         1695765 function calls (1513189 primitive calls) in 11.559 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      999    5.137    0.005    5.137    0.005 {time.sleep}
     2443    1.000    0.000    1.000    0.000 {method 'flush' of 'file' objects}
      300    0.967    0.003    0.967    0.003 {posix.fork}
109096/70188    0.457    0.000    0.751    0.000 base.py:113(_generic_g)
174645/108413    0.190    0.000    0.490    0.000 {getattr}
    15766    0.159    0.000    0.159    0.000 {method 'copy' of 'dict' objects}
real    0m11.711s
user    1m15.415s
sys 0m5.191s
*** perftest_no_includes
         801742 function calls (754378 primitive calls) in 2.990 seconds
   Ordered by: internal time
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      255    1.303    0.005    1.303    0.005 {time.sleep}
      641    0.233    0.000    0.233    0.000 {method 'flush' of 'file' objects}
       94    0.215    0.002    0.215    0.002 {posix.fork}
      414    0.099    0.000    0.102    0.000 encoder.py:212(iterencode)
21974/14021    0.064    0.000    0.109    0.000 base.py:113(_generic_g)
    51192    0.038    0.000    0.052    0.000 {isinstance}
real    0m3.126s
user    0m15.830s
sys 0m1.726s

So much improved over devel (especially with includes), though obviously still slower than 1.9.x. I'm not sure why the performance of the no_includes on the perf branch is so low on your system though.

@ansibot ansibot added the affects_2.0 This issue/PR affects Ansible v2.0 label Sep 8, 2016
@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. and removed needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. labels Apr 4, 2017
@gundalow gundalow modified the milestone: 2.2.0 Apr 13, 2017
@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@ansible ansible deleted a comment from ansibot Dec 4, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 1, 2018
@sivel
Copy link
Member

sivel commented Jun 20, 2018

In the current devel version of ansible, this 30 command playbook takes a little over 13 seconds for me.

I'm going to go ahead and close this issue out.

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this as completed Jun 20, 2018
@ansible ansible locked and limited conversation to collaborators Jun 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.0 This issue/PR affects Ansible v2.0 bug This issue/PR relates to a bug. performance support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests