Question
MaxPoolSize vs. Connection Lifetime: Which Better Prevents Intermittent Pool Exhaustion?
Kavi Finch
0 reputation · 12 Jun 2024, 00:43 UTC
50K views0
Goal
Identify the most effective mitigation for intermittent SqlClient pool exhaustion in a .NET application.
Constraints
- Server resources are limited; excessive pooled connections can strain memory and CPU.
- Connection leaks (unclosed SqlConnection objects) are suspected but not confirmed.
- Latency must remain acceptable under burst traffic.
Uncertainty
Both MaxPoolSize and Connection Lifetime are configurable, but their trade‑offs under real‑world load are unclear. Increasing the pool size postpones exhaustion but may mask leaks; a short lifetime forces recycling, potentially increasing churn.
Questions
- When intermittent exhaustion occurs, should the first line of defense be raising
MaxPoolSizeor setting a non‑zeroConnection Lifetime? - How does a short
Connection Lifetimeimpact connection churn and overall latency during peak periods? - What is the net effect on server resource consumption when combining a high
MaxPoolSizewith a shortConnection Lifetimeversus a low pool size with a long lifetime?