Recently, we've been encountering connection time out issues on our Moodle site. We have seen Moodle be sluggish in performing before but now we're getting connections that are timing out. It is happening very frequently too. I've raised this issue with our hosting provider Rackspace. We're on their cloud sites hosting (not the server hosting). They have been telling me that the issue lies with these slow SQL queries on the MYSQL database in regards to how Moodle handles sessions. They have sent me the slow logs and I can see that Moodle is running these SELECT GET_LOCK queries on the database that are taking up to almost 2 minutes to complete.
I've pored over Moodle's performance recommendation guide:
http://docs.moodle.org/22/en/Performance_recommendations
There's a limited amount of things I have access to as we're not hosting the server ourselves. I've increased the php memory limit to 512M as well as done a few other minor performance tweaks (decreasing the log life time, disabling track read posts, auto mark read, etc). There are some other things such as disabling automatic backups that I have done. The other thing I changed that I thought would help was changing the session handling from database to file based sessions. However, changing that didn't seem to have much of an effect either. We're still getting connection timed out issues.
What Rackspace was telling me was happening is that our Moodle site is trying to load something, most likely running a query on the database that is taking too long to complete. The load balancer on Rackspace sees that it is taking too long and closes the connection because no data is being sent back after the initial request.
We're running Moodle version 2.4.5 (Build: 20130708).
We've been running Moodle for a couple of years now on Rackspace with no issues. We've had sluggish performance before but never to the point where our connections are timing out.
Can anyone provide any clues as to where I can start resolving this issue? Thank you very much!