# fetch command takes very high CPU usage on ansible 1.3.3

**URL:** <https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695>\
**Category:** Ansible Project\
**Created:** [October 16, 2013, 5:25pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695 "2013-10-16T17:25:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack1](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jack1](https://forum.ansible.com/u/jack1)\
**Post date:** [October 16, 2013, 5:25pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/1 "2013-10-16T17:25:23Z")

</div>

Our ansibe playbook was running fine under ansible 1.2.3.

After we upgraded ansible server to 1.3.2/3, the fetch command is running much much slower. Check the EC2 instance where ansible server installed, the CPU usage is hanging on 99% or above for very very long time.

The file size to fetch is about 54 MB. it was taking seconds to fetch at 1.2.3, but now it takes more than 15 minutes at 1.3.3

Thanks  
Jack

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [October 16, 2013, 7:02pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/2 "2013-10-16T19:02:37Z")

</div>

I believe the mechanism by with fetch works was changed between these releases so it would support working through sudo. I’m not sure of all the details though…

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 16, 2013, 7:54pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/3 "2013-10-16T19:54:46Z")

</div>

Are you trying to fetch a very large file with sudo?

I would suggest not doing that.

You see, SFTP/SCP doesn’t normally even support sudo, so with “fetch”, we pull that file into RAM, and it’s expected to be used with small files, if you are sudoing.

But you shouldn’t attempt to pull big files with sudo for sure.

Could it set up a temporary fileserver and stream it? Totally, though a lot of work would be involved. I am open to patches but I don’t see it being an immediate priority for us just because fetch is not frequently used.

---

<div class="post-metadata">

**Author:** ![jack1](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jack1](https://forum.ansible.com/u/jack1)\
**Post date:** [October 16, 2013, 8:32pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/4 "2013-10-16T20:32:05Z")

</div>

the file is about 54 MB. but at 1.2 it was working and much faster.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 16, 2013, 8:50pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/5 "2013-10-16T20:50:55Z")

</div>

I’m pretty sure you probably weren’t doing it via sudo in 1.2 and it only had the one way to do it, and you happened to have permissions.

You may set

“sudo: no”

on the task and disable sudo.

I bet the rest of your play is sudoing.

---

<div class="post-metadata">

**Author:** ![jack1](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jack1](https://forum.ansible.com/u/jack1)\
**Post date:** [October 16, 2013, 9:04pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/6 "2013-10-16T21:04:10Z")

</div>

Thanks a lot for your quick responses and helps.

After we remove the sudo for fetch command, the speed is super-fast now. So I think that our work-around will be to not use “sudo” for the fetch command.

Thanks  
Jack

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 16, 2013, 10:35pm UTC](https://forum.ansible.com/t/fetch-command-takes-very-high-cpu-usage-on-ansible-1-3-3/13695/7 "2013-10-16T22:35:57Z")

</div>

Great!

I have considered it maybe printing a warning for large files, though this would require it checking the file size before transfer in sudo mode.

May be a good thing to do to avoid surprises.

If you want to open a feature idea on github – it would be easier than doing a file server.
