# Ansible Windows Connections - 4 second initialization? Pipelining?

**URL:** <https://forum.ansible.com/t/ansible-windows-connections-4-second-initialization-pipelining/17890>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 2, 2015, 8:35am UTC](https://forum.ansible.com/t/ansible-windows-connections-4-second-initialization-pipelining/17890 "2015-04-02T08:35:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amir\_Luzon](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@Amir\_Luzon](https://forum.ansible.com/u/Amir_Luzon)\
**Post date:** [April 2, 2015, 8:35am UTC](https://forum.ansible.com/t/ansible-windows-connections-4-second-initialization-pipelining/17890/1 "2015-04-02T08:35:30Z")

</div>

Hi guys,

I’m doing a POC of Ansible for my company. We have a mixture of Linux and Windows servers.While playing around with windows i found that just running a simple powershell script which does “exit 0” will take about 4 seconds every time.

I am not sure why this is the case, i tried to enable Pipelining but it seems that this is for SSH connections only and not for windows Powershell connections.

here is an example run i did:

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
base | Unzip Package --------------------------------------------------- 24.62s  
Update Web.Config2 ------------------------------------------------------ 3.85s  
Update Web.Config1 ------------------------------------------------------ 3.82s  
Update Web.Config3 ------------------------------------------------------ 3.78s

The “Update Web.Config” tasks just run the simple powershell script which basically does nothing.

Since we are testing Ansible as a viable CI component I will need to solve this or else Ansible will not be viable for our usages due to the overkill of 4 seconds per task.

Can anyone please assist?

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [April 2, 2015, 1:22pm UTC](https://forum.ansible.com/t/ansible-windows-connections-4-second-initialization-pipelining/17890/2 "2015-04-02T13:22:11Z")

</div>

Hi Amir,

The biggest issue here is that the pywinrm library uses urllib2, which doesn’t natively support keep-alive connections. Due to the way PowerShell remoting works, each command requires at least 4 HTTP requests and must make a new connection for each one.

I have a fork of pywinrm using requests instead, which seems to help significantly with performance. I need to find time to finish up a few parts of it, but you’re welcome to try and see how it works for you.
