Hello
I'm currently working on retrieving stats for our VMs through PowerCli and I found that there is a huge performance difference between the Linux and Windows version.
The same request is taking 3m32s on Windows and 27m7s on Linux.
Which means that the Linux version is useless in this case.
Same version of Powershell-Core on the 2 servers, same version of Powercli.
Is this lack of performance linked to Powershell Linux or to Powercli Linux ?
If it's linked to PowerCli Linux, is there a way to optimize performance at this level ?
The goal is to be able to run this request on Linux (in less than 5 min) in order not to have another Windows server for that... (cost of licence, etc...)
Linux (Centos 7)
PS /root> get-psversion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
6 1 0 preview.2
PS /root> get-powercliversion
PowerCLI Version
----------------
VMware PowerCLI 10.1.0 build 8346946
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055
PS /root> $VMs = Get-Vm
PS /root> $VMs.count
685
PS /root> $metrics = "cpu.ready.summation","cpu.costop.summation","cpu.latency.average","cpu.usagemhz.average","cpu.usage.average","mem.active.average","mem.usage.average","net.received.average","net.transmitted.average","disk.maxtotallatency.latest","disk.read.average","disk.write.average","disk.numberReadAveraged.average","disk.numberWriteAveraged.average","net.usage.average","disk.usage.average","disk.commandsAveraged.average"
PS /root> Measure-Command {$Stats = Get-Stat -Entity $vms -Stat $metrics -Realtime -MaxSamples 15 -ErrorAction SilentlyContinue | Group-Object -Property {$_.Entity.Name}}
Days : 0
Hours : 0
Minutes : 27
Seconds : 7
Milliseconds : 923
Windows (Windows 2016)
PS C:\Program Files\PowerShell\6-preview> Get-PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
6 1 0 preview.2
PS C:\Program Files\PowerShell\6-preview> Get-PowerCliVersion
WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.
PowerCLI Version
----------------
VMware PowerCLI 10.1.0 build 8346946
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055
PS C:\Program Files\PowerShell\6-preview> $Vms = Get-VM
PS C:\Program Files\PowerShell\6-preview> $VMs.count
685
PS C:\Program Files\PowerShell\6-preview> $metrics = "cpu.ready.summation","cpu.costop.summation","cpu.latency.average","cpu.usagemhz.average","cpu.usage.average","mem.active.average","mem.usage.average","net.received.average","net.trans
mitted.average","disk.maxtotallatency.latest","disk.read.average","disk.write.average","disk.numberReadAveraged.average","disk.numberWriteAveraged.average","net.usage.average","disk.usage.average","disk.commandsAveraged.average"
PS C:\Program Files\PowerShell\6-preview> Measure-Command {$Stats = Get-Stat -Entity $vms -Stat $metrics -Realtime -MaxSamples 15 -ErrorAction SilentlyContinue | Group-Object -Property {$_.Entity.Name}}
Days : 0
Hours : 0
Minutes : 3
Seconds : 32
Milliseconds : 110
Best Regards,
You did notice that the PowerCLI 10.1.0 compatibility matrix only lists PowerShell Core 6.0.2, not 6.1.0.
Do you see the same differences in execution time when you use PowerShell Core 6.0.2 on both platforms?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I switched to 6.0.2 on the Linux server. (The prod microsfot repo pushing by default a preview powershell version )
But no luck. Still more than 26 minutes to run the request...
PS /root> Measure-Command {$Stats = Get-Stat -Entity $vms -Stat $metrics -Realtime -MaxSamples 15 -ErrorAction SilentlyContinue | Group-Object -Property {$_.Entity.Name}}
Days : 0
Hours : 0
Minutes : 26
Seconds : 46
PS /root> Get-PSVersion
Major Minor Patch PreReleas BuildLabel
eLabel
----- ----- ----- --------- ----------
6 0 2
And I have tested with 6.0.2 also on Windows :
Days : 0
Hours : 0
Minutes : 3
Seconds : 42
So same differences...
PowerShell on Linux tends to be somewhat sower (see for example More about Linux vs Windows hosted ASP NET Core applications in Azure Application Service Plan).
But the difference in execution time you are seeing is way above those.
I'll do some further testing as well.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I did some more tests on a platform with more recent pCPUs and a better vCPU to pCPU ratio.
~30% performance boost for the Windows test
0~2% performance boost for the linux test...
Also something I noticed, memory used by powershell process at the end in Windows : 600Mo, in Linux 800Mo
Next thing I will try I guess is another distrib than Centos, wilth a more recent kernel.
(Centos is so late on this part...)