I'm getting query timeouts from my app service, but not locally with the same connection string.

Nelson Mills 0 Reputation points
2024-02-29T19:18:17.4066667+00:00

There was an issue in the QA environment for an app I'm working on. It is an app service that uses a SQL Server db in Azure.

We were doing some regression testing, and we used the application/db more heavily than normal. I think this caused us to use too many DTUs, and we got throttled. All of our queries using a specific view (that usually take 5s) started timing out (>30s). Other queries weren't timing out. I increased the amount of DTUs from 5 to 10, and it fixed the problem temporarily. It seems to be timing out again though.

Question: When this issue happens to the app service, I am able to run the application locally, with the same connection string to the db, and it works perfectly. Why would the queries not be timing out when running the app locally if they are timing out for our QA app service? both are connected to the same db in Azure.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,846 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 13,075 Reputation points
    2024-03-02T07:14:04.3466667+00:00

    The Azure App Service may be sharing resources (CPU, memory, I/O) with other applications or services within the same App Service Plan. This could cause resource bottlenecks, especially during heavy load, leading to query timeouts. As you suspected, if your Azure SQL Server database's DTU allocation is insufficient for the workload, throttling can occur. This would result in queries slowing down or timing out.

    • Use tools like ping and traceroute from both your local machine and the Azure App Service (you can use the Kudu console in the App Service for this) to compare network paths and latency to the SQL Server.
    • Consider temporarily deploying your application to an Azure VM within the same region as your database to see if that eliminates the network factor.
    • Utilize the Azure Portal's monitoring tools to examine CPU, memory, and I/O usage of your app service during periods of timeouts.
    • Check the DTU metrics of your Azure SQL Server database. Look for patterns of peak usage that correlate with the timeouts.
    0 comments No comments