Getting current number of connections in connection pool

  • Thread starter Thread starter Wayne Xu
  • Start date Start date
W

Wayne Xu

Is there a way to get current number of SQL connections in connection pool?

I want use it for monitoring purpose. My connection pool randomizely maxed
out and it is affecting production.
 
There are several perf counters that reflect usage. Fire up perfmon and look
at .NET CLR Data. Or use the PerformanceCounter class if you want run-time
stats within your app.

In any case, make sure you're properly disposing of connections as quickly
as possible after they're used, like:
using(SqlConnection con = new SqlConnection(...))
{
// use connection here.
}
 
Mickey,

Thank you for quick reply. Yes I added "using" clause in all the places,
which extended my production time, keeping live from daily to weekly.
But the connection max out problem still happen. I described you in the
other email.
Monitoring the connection pool is my last hope to control the problem.

Thanks again!
Wayne
 
Back
Top