Please help - Server Database Performance Problems

Please help - Server Database Performance Problems

by Matthew Dumont -
Number of replies: 7

Hello,

I am sending out a plea for help. I teach middle years courses and have set up an amazing moodle site for my students for assignment submission and community based activities. The students were able to sign up for an account and use the site concurrently without any problems on the first day. Over 75% of the students used the site that night for homework! They are hooked on having an "online class community" to provide a framework for them (due dates, grades, feedback etc.)

Today after adding a few more resources and assignments, we went to the computer lab and the server gave the following error message:

Error: Database connection failed.
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php

The site stayed down for about 20 minutes (even when nobody was using it). Later on in the day, just to test it again, I had 10 students log in and it worked fine. When the number got up to 15, it crashed for everyone and the error message came back.

My questions:
-Is it unreasonable to expect from a hosting account to be able to run 30 concurrent users? I pay 17.95 US/month
-Can my hosting account fix this by increasing concurrent users or is it the nature of the server (server is too slow period).
-Can anyone recommend a good hosting provider for moodle sites, preferrably with multiple domain capability because I have set up sites for some of my fellow teachers.

It was doing all I had hoped until this problem... If I have to move the site, I hope that it is not too hard to do that.

Thank you in advance for your help.

Average of ratings: -
In reply to Matthew Dumont

Re: Please help - Server Database Performance Problems

by Brett Drinkwater -
Hi Matthew,
First up..... deep breathes, close your eyes, click your heels together and repeat after me "there's no place like home, there's no place like home!"
(sorry for the saturday morning frivolity!) smile

To answer these questions, we probably need some idea about how big a hosting account you have for your $17.95/mth.  Some providers squeeze thousands of hosting accounts on the one box and at times, things can come to a grinding halt, even when you are not doing much on your account.  Would be a good idea to email your hosting support person and ask if they have set a maximum concurrent connection for mysql and if so, what is it?  Are they running a mysql cache? They may be able to assist you in tuning your mysql to perform better....

If you have access to phpmyadmin, you can look at your mysql settings and usage report to get an idea about what is going on. If that is unchartered waters, your host should be able to provide this info for you.

Check out this helpful post by Iñaki Arenaz, which describes how to enable mysql error logging so as to display any errors.

Edit .../lib/setup.php and find the code that reads:
    require_once($CFG->libdir .'/adodb/adodb.inc.php'); // Database access functions

$db = &ADONewConnection($CFG->dbtype);

error_reporting(0); // Hide errors

if (!isset($CFG->dbpersist) or !empty($CFG->dbpersist)) { // Use persistent connection (default)
$dbconnected = $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);
} else { // Use single connection
$dbconnected = $db->Connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);
}

Then add the lines in blue:

    $db = &ADONewConnection($CFG->dbtype);

error_reporting(0); // Hide errors

$db->debug = true;

if (!isset($CFG->dbpersist) or !empty($CFG->dbpersist)) { // Use persistent connection (default)
$dbconnected = $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);
} else { // Use single connection
$dbconnected = $db->Connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname);

Which version of moodle are you using?
The later versions have built in stats capability which, when enabled, can degrade performance on a bottom end hosting account, particularly after a heap of activity.

Things like, chat, quizes and the database crunching stuff can also bring your baby to dummy spit.

There is much help in the forums about tuning your moodle to run leaner, but its a trade off - price verses functionality.

So a bit more info here will save heaps of conflicting advice further down the line.

Best Regards
Brett

Average of ratings: Useful (1)
In reply to Brett Drinkwater

Re: Please help - Server Database Performance Problems

by Matthew Dumont -

Hello Brett and thank you for your reply!

I really wish I could get this fixed for Monday morning. I will move the server if I have to... any known shared hosts that will provide 30 concurrent users for a similar price?

I do have access to phpmyadmin but am not sure what to do when I get there. I have sent my host a question asking them if I could be able to support 30 concurrent users with my account.

I get 2gb storate, 25gb/month transfer, 20 domains (I use several of them), and the newest version of php. I know this is probably pricy but I have several domains set up and when I went shopping for a different host, I had trouble finding one with the right version of php.

I use moodle-1.6 and I don't think that I have stats running (although I do have logs and am finding them useful). It seems having more than 15 users just log in would crash it for about 30 minutes (even if nobody was using it within that time).

I can put in the code, but I really do not want to use the lab with students again as a test... is there anyway I can simulate a high level of database activity this weekend?

Matthew

In reply to Matthew Dumont

Re: Please help - Server Database Performance Problems

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> I really wish I could get this fixed for Monday morning. I will move the server if I have to... any known shared hosts that will provide 30 concurrent users for a similar price?

Even though you have 8h more than most of us in Europe, the weekend will cross your path, I'm afraid. sad

> I have sent my host a question asking them if I could be able to support 30 concurrent users with my account.

Is it confirmed now that the problem is with the limit of of 10 concurrent MySQL querries, and raising that to 30 will solve your problem?

> It seems having more than 15 users just log in would crash it for about 30 minutes (even if nobody was using it within that time).

What a disaster! sad If the provider insists on this limit, please post their name here, you'll save some other Moodlers' pains.

> is there anyway I can simulate a high level of database activity this weekend?

You can simulate activity, whether "this weekend" I don't know ;-(
See for example http://moodle.org/mod/forum/discuss.php?d=53155
In reply to Visvanath Ratnaweera

Re: Please help - Server Database Performance Problems

by Matthew Dumont -

I am not sure because they have not responded yet. They promise 24 hour response, so they have a few more hours.

Thanks for your response! I will post back as soon as I heard back from my hosting provider.

In reply to Brett Drinkwater

Re: Please help - Server Database Performance Problems

by Ralph Patterson -
"...later versions have built in stats capability which, when enabled, can degrade performance on a bottom end hosting account, particularly after a heap of activity."

How do I turn "stats" off or limit its use?

Thanks!  ... I'm in the same boat.
In reply to Matthew Dumont

Re: Please help - Server Database Performance Problems

by Matthew Dumont -

Basically what I have done is moved the server over to midphase.com

I know they allow 50 concurrent users and they seemed to have everything I needed. I hope this works... I guess the next step is a VPS.

In reply to Matthew Dumont

Re: Please help - Server Database Performance Problems

by Ralph Patterson -
"

Basically what I have done is moved the server over to midphase.com

I know they allow 50 concurrent users and they seemed to have everything I needed. I hope this works... I guess the next step is a VPS."




Did this resolve your problem? ... I've got to have a fix asap as well ... how hard is it to migrate the site between hosts?