# Optimization - Issue 263

**URL:** <https://forum.ansible.com/t/optimization-issue-263/11468>\
**Category:** Ansible Project\
**Created:** [April 30, 2012, 12:23am UTC](https://forum.ansible.com/t/optimization-issue-263/11468 "2012-04-30T00:23:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [April 30, 2012, 12:23am UTC](https://forum.ansible.com/t/optimization-issue-263/11468/1 "2012-04-30T00:23:47Z")

</div>

I have opened ticket 263 ([https://github.com/ansible/ansible/issues/263](https://github.com/ansible/ansible/issues/263)) to track nice to have optimizations. I had originally thought tarring/untarring files to upload would offer some nice speedups.

After spending some time implementing this, I discovered that the tar/untar takes as long as uploading the extra file, and requires a fair bit of reworking of the code. I was able to accomplish the same speedup by grouping the chmod, execute, and cleanup into a single exec. Further optimization could be accomplished by using a single tmp directory throughout a play, per host, and then cleaning it out at the end.

Two other possible optimizations are to keep ssh and sftp connections open throughout the play, if the fork level is not too high.

If anyone has any suggestions on other ways to speed up the setup & per taks times, I’d like to try to test them out.

Matthew

---

<div class="post-metadata">

**Author:** ![Christopher\_Johnston](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@Christopher\_Johnston](https://forum.ansible.com/u/Christopher_Johnston)\
**Post date:** [April 30, 2012, 1:03am UTC](https://forum.ansible.com/t/optimization-issue-263/11468/2 "2012-04-30T01:03:15Z")

</div>

Maybe under a tmpfs filesystem

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [April 30, 2012, 2:25am UTC](https://forum.ansible.com/t/optimization-issue-263/11468/3 "2012-04-30T02:25:33Z")

</div>

Pull mode local playbooks over git are going to be the ideal optimization for mid to large ranges of hosts, and that is quite easy (and in work). I am not sure we need to try other things.

---

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [April 30, 2012, 2:28am UTC](https://forum.ansible.com/t/optimization-issue-263/11468/4 "2012-04-30T02:28:42Z")

</div>

OK, wasn’t aware those were in the works… that will certainly be quicker and probably makes my work moot :-).

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [April 30, 2012, 2:32am UTC](https://forum.ansible.com/t/optimization-issue-263/11468/5 "2012-04-30T02:32:32Z")

</div>

Sfromm is working on it.
