I have a .NET 4.0 Winform and a .NET 4.0 Windows Service which both connect to a SQL 2005/2008 database through LINQ to SQL. It runs nice and fast on our test environment with a perfect clone of production data, but on the Production environment, it runs really slowly and has low CPU usage and bandwidth usage. I also noticed hundreds of SQL timeouts a day, even for the smallest queries on a well-indexed database. So I fired up the Profiler...
I found that sp_reset_connection accounted for one third of total SQL CPU duration and 90% of all total SQL calls during a 10-minute capture under load.
I have Admin access on the Application server the service runs on. I have next to no access on the terminal server where they run the Winform, nor to the SQL server.
What causes sp_reset_connection to run so often?
Found some other pages about this, one suggested this:
For your connection reset, open your DataContext connection before working with it and close it at the end.
db.Connection.Open()
... work...
db.Connection.Close()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With