Azure SQL / EF Performance Issues

I recently ran into some pretty weird performance issues with the SQL Azure / Web Apps / Entity Framework.

It seems that sometimes database accesses (both read and write requests) hang anywhere between a few seconds and a few minutes (!). This happens even when you select a query in a table with 4 columns containing 5 rows of data.

The problem occurs by chance and does not reproduce. Upgrading a DB to a higher level of performance does not seem to have any effect. Both the web application and the sql azure database are in the same region.

The performance graph of a database usually has a flat shell of about 0.5% of resource use with a random spike of up to about 5%, so the problem, of course, is not related to resource limitations.

I would have no idea how to start an investigation of a problem, given its intermittent nature. I would really appreciate any feedback. Last week problem

Could this be due to how the Entity Framework handles DB connections specifically with sql azure? Testing on local SQL Express has never caused anything like this.

+6
source share
2 answers

After resolving performance issues with the Entity Framework, we finally switched to Dapper and saw a huge increase in performance. They have some guidelines on the GitHub page showing the difference in speed.

https://github.com/StackExchange/dapper-dot-net

Also, I'm not sure which version of EF you are using, but if it's EF Core, performance is currently worse than previous versions. Another performance comparison can be found here: https://www.exceptionnotfound.net/dapper-vs-entity-framework-vs-ado-net-performance-benchmarking/ .

+2
source

Well, it looks like I found a solution for my performance problems - and it's as simple as including multiple active result sets ( https://msdn.microsoft.com/en-us/library/h32h3abf(v=vs.110 ) .aspx ) for conjunction.

Some changes in the EF structure must have occurred about 2 years ago - because the problem only occurred after upgrading to 6.1.3. I'm not sure what the original version was, but that was what it was 2 years ago.

Hope this helps someone else. This caused me a lot of grief and cost a large potential project to fail.

0
source

All Articles