Long pause before powershell scripts are executed on Server 2008

Hi,

We deploy a number of console applications to servers in two different environments that are run using the Windows task scheduler. Our process for this is to disable the task, deploy the new package, change the task exe and then re-enable the task. We’ve done the disable, change and enable using powershell tasks.

One of the servers we deploy to is still running Server 2008 R2 and when the deployment is to this machine we notice a 15-16 second delay between when the task starts and when the powershell gets executed. On our Server 2012 machines this same delay is 3-4 seconds.

Looking at the attached screenshot you can see the time delay between “Executing script on ‘X’” and our first writing of output to the console (which is the first thing done in the powershell script).

Is there anything that can be done to remove this delay? It ends up adding ~10 minutes to our total deploy time.

We’re running Octopus 3.3.1 and all tentacles are up to date. The difference is Server 2008R2 vs 2012R2, although there is still a delay with 2012, just not as long.

Thanks!
Jeremy

Hi Jeremy,

Thanks for reaching out. Couple of troubleshooting questions:

  • Is the slowdown consistently happening only on the 2008 R2 machines? If it is, which version of Powershell are these machines running?

  • How many machines are involved in your deployment between 2008R2 and 2012R2?

  • If you use the Script Console to run the script write-output "hello world from $($env:computername)" on one 2008R2 and one 2012R2, do you get the same behavior you are describing? (slower in 2008 than in 2012)

  • If you remote into a 2008R2 machine an open a Powershell console, how long does it take until the prompt is available for you to start typing a command?

Best regards,
Dalmiro

Hi Dalmiro,

  1.   Yes, the slow down only happens on the 2008 R2 server, of which we have one instance. Running the command $PSVersionTable.PSVersion on that server outputs the version as 3.0
    
  2.   We have four machines in the deployment process. Three are 2012R2 and one 2008R2. The pause is consistent over all the 2012R2 at 3-4 seconds.
    
  3.   Using the script console to run the “hello world” script I got the following results over three runs (total time as reported by octopus):
    

a. 2008R2 – 41seconds, 16 seconds, 16 seconds

b. 2012R2 – 7 seconds, 3 seconds, 3 seconds

  1.   Remoting onto the 2008R2 server and opening a Powershell console is about 1 second before the prompt is available.
    

There are the raw logs from Octopus for the last run of the script in the console.

2008R2

Task ID: ServerTasks-3457
Task status: Success
Task queued: Thursday, March 10, 2016 1:12 PM
Task started: Thursday, March 10, 2016 1:12 PM
Task duration: 16 seconds
Server version: 3.3.1+Branch.master.Sha.e396cf22d54f41a30788b619666a8517ea60d2b9

                | == Success: Script run from management console ==
                |
                |   == Success: Run script on: Advance2go ==

13:12:24 Verbose | Octopus Deploy: Calamari version 3.3.1+Branch.master.Sha.25c4524418a3a9922cde6da7ebf074dba37ea326
13:12:32 Verbose | Name Value
13:12:32 Verbose | ---- -----
13:12:32 Verbose | PSVersion 3.0
13:12:32 Verbose | WSManStackVersion 3.0
13:12:32 Verbose | SerializationVersion 1.1.0.1
13:12:32 Verbose | CLRVersion 4.0.30319.18408
13:12:32 Verbose | BuildVersion 6.2.9200.16398
13:12:32 Verbose | PSCompatibleVersions {1.0, 2.0, 3.0}
13:12:32 Verbose | PSRemotingProtocolVersion 2.2
13:12:32 Info | hello world from ADVANCE2GO
13:12:33 Info | Exit code: 0

2012R2

Task ID: ServerTasks-3459
Task status: Success
Task queued: Thursday, March 10, 2016 1:13 PM
Task started: Thursday, March 10, 2016 1:13 PM
Task duration: 3 seconds
Server version: 3.3.1+Branch.master.Sha.e396cf22d54f41a30788b619666a8517ea60d2b9

                | == Success: Script run from management console ==
                |
                |   == Success: Run script on: Aus-WEB1 ==

13:13:18 Verbose | Octopus Deploy: Calamari version 3.3.1+Branch.master.Sha.25c4524418a3a9922cde6da7ebf074dba37ea326
13:13:19 Verbose | Name Value
13:13:19 Verbose | ---- -----
13:13:19 Verbose | PSVersion 5.0.10105.0
13:13:19 Verbose | WSManStackVersion 3.0
13:13:19 Verbose | SerializationVersion 1.1.0.1
13:13:19 Verbose | CLRVersion 4.0.30319.34209
13:13:19 Verbose | BuildVersion 10.0.10105.0
13:13:19 Verbose | PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
13:13:19 Verbose | PSRemotingProtocolVersion 2.3
13:13:20 Info | hello world from AUS-WEB1
13:13:20 Info | Exit code: 0
Thanks.

Hi Jeremy,

Thanks for taking the time to share all that info. I’ve setup a 2008 machine @ my home lab (its been a while since I’ve used 2008) with a very similar configuration as yours and tested this for a while. The machine responded in time with only a 1sec delay compared to the 2012 boxes on the same deployment.

This leads me to believe that the delay may be due to windows environmental reasons, and the fact that I didn’t get it was because my 2008 server was brand new (as much as an 8yr old OS can be).

How long ago was this 2008 server provisioned? The logic next step would be to migrate that 2008 server to 2012, but i’m pretty sure you already thought about that, right?

Dalmiro

Hi Dalmiro,

Thanks for looking into that for me anyway. We will be retiring that server at some point, so this is another reason to do it sooner.

Thanks,
Jeremy