'Entity Framework - deadlock and transaction level
I have a .Net MVC application using entity framework on SQL Server.
I have a scenario where I have a list of items, and when I click on one of these items, the details open. On this action I also perform an update to increase the number of views on that item.
I was performing a load test and I came up with an issue:
System.Data.SqlClient.SqlException: Transaction (Process ID 69) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
I made some test and notice that if I remove the update the issue goes way.
Looking on the internet I found many suggestion and one that worked for me was to execute the command below:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
The only problem is that, after this modification my queries starts to run very slow. Previous my pages opened in about 500 ms. After this modification this number increased to 3, 4 seconds.
Any ideas? I like to resolve the deadlock issue but don't want to loose performance on general.
Thanks in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
