Well it’s been a while since my last blog due to the summer holidays and the fact that we have been very busy at Pentia.
Anyway here is my next installment in my “How to kill Sitecore” trilogy.
We recently took over a website that was having a lot of performance issues, and when I looked in the log files I noticed that the database connections were timing out.
So initially investigated if there was an issue with the SQL server, but after profiling and monitoring the database it appeared to have no performance issues, but I noticed that some of the exceptions were coming from the Heartbeat task.
What I believe the heartbeat tasks does among other things is to establish a connection for all the connections defined in the connections section, so that when the first request comes in the database connection is ready to retrieve the data from the SQL server.
The solution had a lot of include files some of which defined connections to databases that no longer existed.
So what happens when you have 4 connection strings that contain a reference to a databases that does not exists, well the hearth beat runs every minute and therefore creates 4 new connections every minute.
The connections were setup to timeout after 20 minutes which meant that after 20 minutes the heartbeat task had created and was waiting for 80 connections.
The problem is that the default max number of connections is 100, which left only 20 connections for the actually data providers that were configured correctly and when the site was busy this was not enough so they started to timeout, which in turn caused the site to run very slowly 😦
To be honest it would of helped and been a lot quicker to find this error if .NET cast an CONNECTION POOL HAS REACHED IT MAX!!
But once this issue was found and I removed the unused connections, the site ran a LOT faster.
I’m curious if you have any thoughts or insights into why the heartbeat would be holding onto a SQL connection? I would have thought that it would have immediately closed the connection after it performed it’s action.
That was the problem the connection wasn’t valid so it took time to time out as the worker process received no response
That’s the point it opens a connection and waits until it times out as the sql server does not exists
So every minute it made a new connection which would take 20 minutes to time out so it tried over a period of 20 minutes to make 80 connections at the same time.
Hello mate nice bllog