I've come across a high-traffic app which occasionally hits various scaling timeout issues I'm trying to diagnose. The app has these settings in the SQL connection string:
Min Pool Size=5;Max Pool Size=100;Connect Timeout=8;Connection Lifetime=30;
This of course means there are a minimum of 5 connections in the pool at all times, as confirmed by PerfMon.
But if I understand the Microsoft docs correctly, the Connection Lifetime setting is going to destroy any closed connection which has existed for more than 30 seconds:
When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime.
As these 5 (or more) connections are constantly used, am I right in thinking that none of them will ever live beyond 30 seconds? Thus every half a minute or so, my application is going all the way back to SQL to handshake 5+ brand new connections?
PerfMon suggests the number of connections never drops below 5, so I've no evidence of the above taking place (unless it's visually instant). Have I misunderstood?
In addition, this ancient article confirms the lifetime check is only performed on Close(), so this setting would have no benefit on addressing any connection leaks whatsoever?