Slow performance on Windows 2016 Server

Recently migrated SQL database from 2008 to 2016 (SQL 2008 to SQL 2014); the issue appears to be on the Operating System as i have run several tests that prove this.  I run a simple script that runs a for loop counting from 1 to 16000 to emulate a rudimentary write to disk. When i run this script on a 2016 server it takes almost 6 minutes to complete where as it is instantaneous on a windows 2008 server.  

The purpose of the test was to prove that there is additional overhead on a Server 2016 box versus the 2008.

1.      2008 server
      a.      On the <host> network
            i.      Result = instant
      b.      Off the <host> network
            i.      Result = instant

2.      2012 server
      a.      On the <host> network
            i.      Result = 35 seconds
      b.      Off the <host> network
            i.      Result = Test 1 - 15 seconds (SSD) ;
            ii.      Result = Test 2 - 29 Seconds

3.      2016 server
      a.      On the <host> network
            i.      Result = 5 minutes
      b.      Off the <host> network
            i.      Result = 6 minutes

We know it is not the disk or the amount of memory and CPU
Is there anything i can do to the windows server 2016 box to increase its performance and remove the "overhead"???

Server OS is Server 2016 - 4 vCPU w 2 Cores & 50 GB Ram
Virtualization - Vmware 5.5 U2
SQL server 2014

here is my script that i have been testing with
#Powershell Script#
#
$file = "C:\testlog.txt"
    
Remove-Item –path $file

$d = Get-Date -Format G

Write-Output $d >> $file



for($i=1 
    $i -le 16000 
    $i++){
    
       Write-Output $i >> $file
    
    }

$d = Get-Date -Format G

Write-Output $d >> $file
#End

Open in new window

Marka MekapseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Adam BrownSr Solutions ArchitectCommented:
I've done some testing on this, and have found that the difference is that Powershell in 2016 is significantly less efficient when opening and closing a file. This is a powershell issue. If you run the code below, you'll discover that it runs really fast in both OSes. This difference between your script and mine is that I'm utilizing the streamwriter class, which keeps the file open until it is explicitly closed. This is not Server 2016 overhead, it's differences between Powershell versions.

try
{
    $stopwatch = [system.diagnostics.stopwatch]::StartNew()
    $path = "C:\user\counting.txt"
    del $path
    $stream = [System.IO.StreamWriter] $path
    $i=0
    do{
        $stream.write("$i`r`n")
        $i++
    }while ($i -le 16000)
}
finally
{
    $stream.close()
    $stopwatch.Elapsed
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Marka MekapseAuthor Commented:
Thank you!  that put a lot of questions to rest

Thank You
Adam BrownSr Solutions ArchitectCommented:
I also found a different script that performs an IO benchmark (Original is here but it is buggy as crap, so I fixed some bugs and attached the debugged version)

This is a more realistic drive IO test that does things at a more fundamental level. If you run this script against both systems, you should see much more realistic speeds and that they're very close (unless you have significantly different Disk architecture).

The difference we're seeing with using the >> operation is likely due to increased complexity and more features in Powershell on 2016 than other version. I don't know exactly what the cause is, but it is a matter of how we're interacting with the files.
disktest.ps1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2016

From novice to tech pro — start learning today.