I have a WPF application that uses an API running on Azure Functions as the backend. The API is written in C# and uses EF to store and retrieve data from an Azure SQL Serverless database. Most of the time the application is very performant. However, users do notice significant delay from time to time. Using AppInsights logs and metrics I have identified that at least some of the problem lies in the fact that in a small but significant number of cases a process that usually takes less than 2 milliseconds and 95% of the time takes less than 170 milliseconds can sometimes take over 15 seconds. In this example case the process is just a simple get entity request where I am retrieving and entity by id. For all these cases the query is identical except for the id may change. And this process is just the time from when the Azure Functions C# code executes a query and gets a response. So this should be just the Azure Functions server requesting data from the Azure SQL server and getting the results. Why would this sometimes take over 15 seconds and how can I fix this.
I have a support ticket open with Azure SQL support but so far they don't have any answers. So, I thought I would ask around.


