如何提高.NET中的WMI性能?

时间:2022-06-01 05:41:40

I've inherited code that makes numerous remote WMI calls. When I repeatedly pause execution and look at the call-stack it's almost always in a ManagementScope.Connect() call. A new connection seems to be made with each WQL query.

我继承了许多远程WMI调用的代码。当我反复暂停执行并查看调用堆栈时,它几乎总是在ManagementScope.Connect()调用中。每个WQL查询似乎都会建立一个新连接。

Despite limited trial and error, I haven't found any big wins yet in improving the performance of the WMI calls.

尽管试验和错误有限,但我还没有找到任何改善WMI调用性能的大赢家。

I've tried caching previous results, reusing connections, and avoiding the dreaded "select *". These haven't given me the performance improvements that I'd like. I'm interested to understand the impact of environment on WMI performance, but the code needs to run in a wide variety of environments that are probably beyond my control.

我已经尝试缓存以前的结果,重用连接,并避免可怕的“选择*”。这些并没有给我带来我想要的性能提升。我有兴趣了解环境对WMI性能的影响,但代码需要在各种可能无法控制的环境中运行。

If any, what are the do's and don't's of performance oriented WMI access in .NET?

如果有的话,.NET中面向性能的WMI访问有什么作用和不做什么?

1 个解决方案

#1


Not my area of expertise, but this might be of some help:

不是我的专业领域,但这可能会有所帮助:

WMI: Improving your WMI application performance in fan-out scenario

WMI:在扇出场景中提高WMI应用程序性能

"In this blog, I will talk about three different ways of connecting to a remote machine using WMI to perform multiple WMI operations, and their performance differences."

“在本博客中,我将讨论使用WMI连接到远程计算机以执行多个WMI操作的三种不同方式,以及它们的性能差异。”

#1


Not my area of expertise, but this might be of some help:

不是我的专业领域,但这可能会有所帮助:

WMI: Improving your WMI application performance in fan-out scenario

WMI:在扇出场景中提高WMI应用程序性能

"In this blog, I will talk about three different ways of connecting to a remote machine using WMI to perform multiple WMI operations, and their performance differences."

“在本博客中,我将讨论使用WMI连接到远程计算机以执行多个WMI操作的三种不同方式,以及它们的性能差异。”