How do I resolve “Timeout expired … connection from the pool” errors in Azure Managed SQL?

I’m running an application against an S2 Azure Managed SQL instance (50 DTUs) with EF Core 8.0. There is no custom SQL or custom connection manager in use. During peak traffic periods, I see this error:

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

At peak times, there are around 120 connections. After the peak subsides, everything returns to normal. Does anyone have experience troubleshooting this issue specifically in Azure SQL, and is there a way to test if there’s a connection leak? Also, are there any Azure mechanisms to scale down during off-peak times and scale up for higher loads? Any recommended best practices, tools, or code patterns that could help me handle these peak times? Thank you in advance!

Read more here: Source link