Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote WMI query slow

Tags:

c#

wmi

I'm working on a program that queries three different servers in order to get CPU and LogicalDisk information.

Each server I query returns me values in 6 to 15 seconds (depending on the server). So it takes a total of 31 seconds to get all my values (15 sec for the first server, 6 for the second and 10 for the third).

I tried to multi thread each query, it reduced the execution time of 1 second for each server, so I don't think it's the solution.

I also tried to run queries directly with powershell in servers:

  • First server : it took 10 seconds (instead of 15) to retrieve informations

  • Second server : it took 10 seconds (like when I do it remotely) to retrieve informations

  • Third server ) it took ~1 second (instead of 6)

Here are my queries:

SELECT LoadPercentage From WIN32_Processor

SELECT Size, FreeSpace From WIN32_LogicalDisk

My Question is: is there something to do on my servers to make queries easier ? I already tried to desactivate the firewall and the antivirus.

PS: I'm querying Windows 2003 R2 server, Win XP pro and Win 7 server, each in the same domain as my local computer.

like image 343
rafatic Avatar asked Jun 26 '14 08:06

rafatic


1 Answers

Perhaps it might speed up the whole thing by using CIM instead of WMI.

Here you can find a performance comparison: http://community.spiceworks.com/topic/332657-powershell-cmdlet-performance-get-wmiobject-vs-get-ciminstance

Of course you can get a specific CimInstance in C#, too: https://msdn.microsoft.com/en-us/library/dn313201(v=vs.85).aspx

like image 150
Peter Schneider Avatar answered Sep 22 '22 07:09

Peter Schneider