We have a single WebAPI
instance that performs CRUD operations on its AzureSQL using EF6.
We have very low traffic (around 20 req/sec) and normally it takes around 15-150ms for each request. We consistently see that every 45 - 60 minutes that some requests take around 13 seconds each.
The DB is very small – around 6mb. On the SQL logs we see that the queries take around 15ms to run.
Can anyone can help me what it’s the problem?
In both examples, the stopwatch shows 13+ seconds while the DB logs show 15ms
Stopwatch watch = Stopwatch.StartNew();
var result = await Repository.EntitiesSet
.Where(entity => entity.PrimaryKey == PrimaryKey); }
.ToListAsync();
Logger.LogDbAccess(callData(), watch.ElapsedMilliseconds);
return result;
And
Stopwatch watch = Stopwatch.StartNew();
var result = await Repository.EntitiesSet
.FirstOrDefaultAsync(t => t.secondaryId.Equals(secondaryId));
Logger.LogDbAccess(callData(), watch.ElapsedMilliseconds);
return result;