1

In SQL Server 2014 is there a way to group connections by the connection pool that belong to? We are trying to find out if a specific application is leaking connections and hitting the default max pool size of 100.

In this doc on Connection Pooling it states that each pool is defined by the exact connection string used to establish the connection. However, I am unable to find anything in the sys table that allows me to see that.

The closest I have groups by loginname and program_name:

select rtrim(p.loginame) 
 ,p.program_name
 ,count(*)
from sys.sysprocesses p 
group by p.loginame, p.program_name
order by count(*) desc

Thanks in advance!

Ola Ström
3011 gold badge3 silver badges10 bronze badges
asked Sep 6, 2017 at 20:30
1

1 Answer 1

1

You can get a little closer if you add host process id but I don't think you'll be able to get an actual connection pool count 100% from server data because many connection string attributes are processed on the client and never sent to the server. This might be close enough for your needs, though.

SELECT
 s.login_name
 , s.host_name
 , s.program_name
 , s.host_process_id
 , COUNT(*) AS connection_count
FROM sys.dm_exec_sessions AS s
GROUP BY
 s.login_name
 , s.host_name
 , s.program_name
 , s.host_process_id;

A client-side exception like "timeout period elapsed prior to obtaining a connection from the pool" should be raised when the pool size is reached an another connection cannot be acquired within the connection timeout limit.

answered Sep 6, 2017 at 20:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.