How can I diagnose intermittent connection pool exhaustion in EF Core when using connection resiliency retry strategies?
0 reputation · 04 Jun 2021, 13:18 UTC
Diagnosing intermittent connection pool exhaustion in EF Core applications that rely on connection resiliency retry strategies is challenging because the execution strategy masks underlying pool limits by automatically retrying failed commands. This can make it unclear whether observed failures stem from transient errors or from exhausted pool resources.
When using the SQL Server provider with ConnectRetryCount=0 and EnableRetryOnFailure, the default pool size and limits are not directly exposed, and there is uncertainty about how to differentiate retries caused by transient faults from those caused by pool exhaustion without disabling resiliency. Understanding the exact conditions that trigger pool exhaustion requires visibility into pool usage and checkout times.
What metrics or diagnostics can be enabled to observe actual connection pool usage and checkout times in EF Core when connection resiliency is active? How can I distinguish between transient errors that trigger retries and genuine pool exhaustion events without disabling the execution strategy? Are there recommended ways to log or expose pool exhaustion occurrences while retaining the benefits of connection resiliency?