Visual Studio ASP.NET Debugging causes SQL Server high CPU when idle

Viewed 492

I have an ASP.NET 4 project using SQL Server 2016 on Windows Server 2012. This is a dev environment with me as the only user. When I run the project in IIS8 and use Visual Studio 2015's Debug -> "Attach to Process" it connects to my w3wp process just fine. However, in Task Manager I can instantly see that the process "SQL Server Windows NT - 64 bit" jumps to a CPU usage of >20% even tough there are no queries. I repeated this several times and it's definitely related to VS-debugging. When I stop debugging it goes back to 0% for a couple of seconds but then jumps back to 20% and stays there.

The problem is that in this state even trivial SQL queries are awfully slow or produce a timeout. So debugging or even opening any DB-backed page of the project becomes nearly impossible.

The only way to relief SQL-Server and make the site usable again is to close the entire Solution in Visual Studio.

Is Visual Studio starting some (unwanted!) hidden SQL debugging when general debugging starts? If so, how can I disable this?

1 Answers

Here is the compiled answer based on above comments above...

The issue was with not enough system memory. This lead to using a lot of, slow, virtual memory that brought the system to a halt. This is a valid answer and should serve as a note for the future if somebody else has this issue.

SQL Server is "supposed" to return memory to the OS but in practice it acts like a greedy little troll. I always set it to use always have at least 2GB available to the OS. The above issue was caused by low memory. Limiting other programs memory access or increasing the available system memory should fix your problem.

Related