# major ssh slowdown after 1.3.4

**URL:** <https://forum.ansible.com/t/major-ssh-slowdown-after-1-3-4/14486>\
**Category:** Ansible Project\
**Created:** [February 4, 2014, 2:49pm UTC](https://forum.ansible.com/t/major-ssh-slowdown-after-1-3-4/14486 "2014-02-04T14:49:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefano\_Debenedetti](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Stefano\_Debenedetti](https://forum.ansible.com/u/Stefano_Debenedetti)\
**Post date:** [February 4, 2014, 2:49pm UTC](https://forum.ansible.com/t/major-ssh-slowdown-after-1-3-4/14486/1 "2014-02-04T14:49:23Z")

</div>

Hi,

today I upgraded from Ansible 1.3.4 to 1.4.4 and noticed a major slowdown in my playbooks using ssh between virtual machines on the same VirtualBox host.

Here’s a simple test with ping showing what I mean:

root@ansible:~/test/deploy# ansible --version  
ansible 1.3.4

root@ansible:~/test/deploy# time ansible -i test -m ping test-host-2 -c ssh -vvvv  
 ESTABLISH CONNECTION FOR USER: root  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1391890971.81-192496444342081 && echo $HOME/.ansible/tmp/ansible-1391890971.81-192496444342081’”]  
 REMOTE\_MODULE ping  
 PUT /tmp/tmpDzkccX TO /root/.ansible/tmp/ansible-1391890971.81-192496444342081/ping  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-1391890971.81-192496444342081/ping; rm -rf /root/.ansible/tmp/ansible-1391890971.81-192496444342081/ \>/dev/null 2\>&1’”]  
test-host-2 | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

real 0m0.392s  
user 0m0.124s  
sys 0m0.032s

root@ansible:~/test/deploy# ansible --version  
ansible 1.4.4

root@ansible:~/test/deploy# time ansible -i test -m ping test-host-2 -c ssh -vvvv  
 ESTABLISH CONNECTION FOR USER: root  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1391890986.05-221773170470374 && echo $HOME/.ansible/tmp/ansible-1391890986.05-221773170470374’”]  
 REMOTE\_MODULE ping  
 PUT /tmp/tmptXIMKK TO /root/.ansible/tmp/ansible-1391890986.05-221773170470374/ping  
 PUT /tmp/tmpjViJP5 TO /root/.ansible/tmp/ansible-1391890986.05-221773170470374/arguments  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-1391890986.05-221773170470374/ping /root/.ansible/tmp/ansible-1391890986.05-221773170470374/arguments; rm -rf /root/.ansible/tmp/ansible-1391890986.05-221773170470374/ \>/dev/null 2\>&1’”]  
test-host-2 | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

real 0m2.412s  
user 0m0.148s  
sys 0m0.036s

I tried the same test with the current github HEAD and in the best case it’s still much slower than 1.3.4:

root@ansible:~/test/deploy# ansible --version  
ansible 1.5 (devel 2267503c53) last updated 2014/02/04 14:20:20 (GMT +200)

# new SSH plugin

root@ansible:~/test/deploy# time ansible -i test -m ping test-host-2 -c ssh -vvvv  
 ESTABLISH CONNECTION FOR USER: root  
 REMOTE\_MODULE ping  
 EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391891219.83-137866337554858 && echo $HOME/.ansible/tmp/ansible-tmp-1391891219.83-137866337554858’”]  
 PUT /tmp/tmpu\_xAge TO /root/.ansible/tmp/ansible-tmp-1391891219.83-137866337554858/ping  
 EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-tmp-1391891219.83-137866337554858/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1391891219.83-137866337554858/ \>/dev/null 2\>&1’”]  
test-host-2 | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

real 0m2.556s  
user 0m0.160s  
sys 0m0.048s

# old SSH plugin

root@ansible:~/test/deploy# time ansible -i test -m ping test-host-2 -c ssh\_old -vvvv  
 ESTABLISH CONNECTION FOR USER: root  
 REMOTE\_MODULE ping  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391891284.37-266812075342423 && echo $HOME/.ansible/tmp/ansible-tmp-1391891284.37-266812075342423’”]  
 PUT /tmp/tmpAmk9Z\_ TO /root/.ansible/tmp/ansible-tmp-1391891284.37-266812075342423/ping  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, “/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-tmp-1391891284.37-266812075342423/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1391891284.37-266812075342423/ \>/dev/null 2\>&1’”]  
test-host-2 | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

real 0m2.386s  
user 0m0.152s  
sys 0m0.020s

# new SSH plugin with pipelining=True

root@ansible:~/test/deploy# time ansible -i test -m ping test-host-2 -c ssh -vvvv  
 ESTABLISH CONNECTION FOR USER: root  
 REMOTE\_MODULE ping  
 EXEC [‘ssh’, ‘-C’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=40033’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘test-host-2’, ‘/bin/sh -c /usr/bin/python’]  
test-host-2 | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

real 0m1.412s  
user 0m0.132s  
sys 0m0.044s

Is this major slowdown after 1.3.4 expected?

thanks ciao  
ste

---

<div class="post-metadata">

**Author:** ![Stefano\_Debenedetti](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Stefano\_Debenedetti](https://forum.ansible.com/u/Stefano_Debenedetti)\
**Post date:** [February 25, 2014, 4:31pm UTC](https://forum.ansible.com/t/major-ssh-slowdown-after-1-3-4/14486/2 "2014-02-25T16:31:11Z")

</div>

Sorry to reply to myself but in case anyone is interested I just noticed that the ssh slowdown has been fixed on the day after my mail by a commit very appropriately commented as “Fix slow ssh”:

[https://github.com/ansible/ansible/commit/75b7a1d9c7f088a9ec5a43e618139f6276cf6a4a](https://github.com/ansible/ansible/commit/75b7a1d9c7f088a9ec5a43e618139f6276cf6a4a)

Unfortunately the commit hasn’t made it to any released version yet.

Thanks lberruti for the fix, it does solve the issue here.

ciao  
ste

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [February 25, 2014, 10:21pm UTC](https://forum.ansible.com/t/major-ssh-slowdown-after-1-3-4/14486/3 "2014-02-25T22:21:12Z")

</div>

1.5 releases in a few weeks.

Strangely this doesn’t slow everyone down and it’s very curious you’d see this, but you don’t have to wait long.
