Is there a way to check the current connection pool size in SQL Server? I am not talking about the max connection pool size, but the current pool size. Let's say the max pool size is 100 and there are 49 connections open, it should now show me either 51 available or perhaps 49 consumed.
So, is there such a query?
A connection pool is created for each unique connection string. When a pool is created, multiple connection objects are created and added to the pool so that the minimum pool size requirement is satisfied. Connections are added to the pool as needed, up to the maximum pool size specified (100 is the default).
From the JDBC Connection Pool—>Monitoring tab, you can view information about the state of each deployed instance of the selected connection pool. That is, for each server on which the connection pool is deployed, you can see current status information about the connection pool.
So much of this stuff seems to be outside of what is directly accessible from dmv's. I'm sure someone more informed than myself can get you better answers.
This is as close as I could get.
SELECT des.program_name
, des.login_name
, des.host_name
, COUNT(des.session_id) [Connections]
FROM sys.dm_exec_sessions des
INNER JOIN sys.dm_exec_connections DEC
ON des.session_id = DEC.session_id
WHERE des.is_user_process = 1
AND des.status != 'running'
GROUP BY des.program_name
, des.login_name
, des.host_name
HAVING COUNT(des.session_id) > 2
ORDER BY COUNT(des.session_id) DESC
This will aggregate your connections by login and from each host and app. This will give you an idea of how your connections are currently being pooled. If you know your max amount off hand, you can subtract the connections from it and it could give you the number of connections remaining in each pool.
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