Using EF Core 3.1, we're having issues with calls to BeginTransactionAsync()
.
The code is implemented like this:
With BeginTransaction implemented like this:
Most of the time it takes 1-4 milliseconds, but every now and then it takes a lot longer:
The above example shows just above 1 second, but I've seen numbers as high as 15 seconds.
Our database is Azure Elasic pool in the premium tier. Max CPU usage is not above 60% for the entire pool nor is eDTU usage, so clearly this is not a CPU issue. What could be causing this?
It does not appear to be happening in any specific interval and the issue appears in all databases in the elastic pool. (It's a multi tenant app with a database per tenant). The issue appears to happen when multiple transactions are created at the same instant (or very close to) as seen at 05:55:18.745, but other times it's working just fine as seen at 05:55:15.704
Does BeginTransactionAsync()
cause any form of locking in the database?
Our app is running in Azure App Services using linux containers. The database is in the same azure region as our containers.