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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With