ADO.NET 连接池中有多少个可用连接
是否可以(从 ASP.NET 应用程序)检查 ADO.NET 连接池当前有多少个连接正在使用中以及有多少个可用(当前未使用)?
Is it possible (from an ASP.NET application) to check how many connections of the ADO.NET connection pool are currently in-use and how many are available (not currently in-use)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试过性能计数器吗?
http://msdn.microsoft.com/en-us/library/ms254503。 aspx
NumberOfActiveConnections:当前正在使用的活动连接数。
NumberOfFreeConnections:连接池中可用的连接数。
You have tried with Performance Counters?
http://msdn.microsoft.com/en-us/library/ms254503.aspx
NumberOfActiveConnections: The number of active connections that are currently in use.
NumberOfFreeConnections: The number of connections available for use in the connection pools.
有多少可用完全取决于连接字符串中的“最大池大小”设置(对于 SqlClient 至少如此)
请参阅 MSDN。
不确定从代码中如何知道有多少个到服务器的物理连接是打开的,您可能需要使用服务器端的某些东西来检查。 (例如来自 Sql Management studio 的活动监视器)
How many are available is all down to the "Max Pool Size" setting in the connection string (For SqlClient at least that is)
See MSDN.
Not sure from code how to tell how many physical connections to the server are open, you may need to use something from the server side to check that. (E.g. Activity Monitor from Sql Management studio)