Database Overload

Database Overload

by allen haney -
Number of replies: 13

Running moodle and not much else on a dual processor intel xeon 2.26 duo, 4gb ram, 64 bit os. Using Moodle 2.4.3 and whatever versions of mysql and apache that came with the installer pack.  Have it set up with 1:1 nat so internal traffic is routed through the local ip and external traffic goes through the public ip.  We plan on using this district wide next year, so I wanted to do a test run of a few classes before we put too much time into moodle.  So far I like it, but yesterday when we had around 20 students try to log in it crashed, I thought it was a fluke so i restarted moodle and it seemed to be ok.  Today again when 20 students logged in it crashed and gave the error on some computers of database overload.  As far as I know i have everything configured correctly.  Is there anything in mysql I need to change?

Average of ratings: -
In reply to allen haney

Re: Database Overload

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

For a start... what operating system are we tallking about? What do you mean by 'installer pack'? If this is xampp or something like it, you should note that these systems are not to be used for production systems; they are optimised for development. What were your test students actually doing? Twenty students all doing their best to overwhelm a system (banging on the reload button) can do it quite easily. Especially if it's Windows.

There's quite a lot you can do with MySQL to tune it to match your server configuration - see Performance

What's that 1:1 NAT thing you are talking about? If you have the string $_SERVER... anywhere in your config.php you are doing it wrong wink

In reply to Howard Miller

Re: Database Overload

by allen haney -

Its windows server 2008.  yes it was the xampp package.  and basically 1:1 nat just means that it keeps internal traffic internal without crossing the router.   i dont have that string in my config.php.  since i have put so much time into its configuration already i would really rather not have to start over.  i dont have that string in my config.php.  i guess i will go through the performance settings and change those things.  but is it even worth it?

In reply to allen haney

Re: Database Overload

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Don't use xampp for a live system. It's for development and testing - that means *1* user not 20!! They even say that on their web site.

A properly configured production site would probably work better - there's mountains of documentation regarding MySQL and PHP on Windows Server online. Windows seems not to be so forgiving of the 'hope for the best' approach as Linux is. I have seen Windows systems brought to their knees by a similar number of users but, as I say, it rather depends on what you told them to do. How realistic is your testing relative to the type of materials you will be deploying in Moodle?

In reply to Howard Miller

Re: Database Overload

by jean-pierre verrons -

I use a Linux server and the response time is still very low

In reply to jean-pierre verrons

Re: Database Overload

by Ken Task -
Picture of Particularly helpful Moodlers

@jean-pierre verrons

You've not mentioned if you are remotely hosted or not ... and if so, on shared system or VPS/VPD so this might not be of any use to you.  Moodle 2 requires some DB tweaking for best performance possible depending upon your situtaton ... period.

I've used mysqltuner on Linux and have seen improvements.

http://www.howtoforge.com/tuning-mysql-performance-with-mysqltuner

'spirit of sharing', Ken

In reply to Ken Task

Re: Database Overload

by jean-pierre verrons -

Hi Ken, thank you for your help. I'm remotely hosted,  so I should probably look with my provider for better performance.

In reply to Ken Task

Re: Database Overload

by Dr. Nellie Deutsch -

Ken, maybe you can help me tweat my DBs or instruct me how to do in a cpanel because the following Moodle sites are very very slow since the upgrade to 2.4: http://www.integrating-technology.org and http://moodle.atlanticuniv.edu

Thank you.

In reply to Dr. Nellie Deutsch

Re: Database Overload

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry, don't host remotely - cept on dedicated systems where one has total and complete access to all setting … php, mysql, apache.  That to mean while I've heard of CPanel, have never used it.  According to what I've been able to find via Google, CPanel doesn't offer any tool to tweak DB's.

Speed in Moodle is a combo of Apache and MySQL and with version 2 of Moodle DB tweaks are a given.  And all the tweaks in the world won't work if the hardware is simply 'not there'.  Not sure anyone should be able to test MySQL speed remotely, so the only thing one could do is test Apache.

According to https://forums.cpanel.net/f189/my-cnf-optimization-155065.html
one can install mysqltuner.
One commenter said:
'there's no pre-baked cookies when it comes to mysql optimization'

However, can do some 'free' remote sleuthing … and here's one observation:

Below clips from commands shown:

curl -I http://www.integrating-technology.org/
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

curl -I http://moodle.atlanticuniv.edu/
Cache-Control: private, pre-check=0, post-check=0, max-age=0

Reference for what that stuff might mean:
http://palpapers.plynt.com/issues/2008Jul/cache-control-attributes/

While hosted on the same service (Softlayer - The Planet?), appears the package/setup might be different?

The atlanticuniv site (one of your paying customers?) seems faster to respond to me.

Curious why I'd be asked … considering support for both are apparently handled by a Moodle Partner and even Howard is listed as Lead Developer (if it's the same Howard!).

Agree with Howard ... hardware is very much involved.  Have a 2 Gig server that's a challenage to keep running now with newer versions of whatever.  Nothing like virtualization where, if one had control over that, could allocate more memory in a matter of minutes.

'spirit of sharing', Ken

In reply to Ken Task

Re: Database Overload

by Dr. Nellie Deutsch -

Thanks, Ken. I thought you had a magic wand that we didn't know about. I disabled the messaging system, but apparently there's a bug that I'm waiting to hear about. 

Peace for all...

In reply to Dr. Nellie Deutsch

Re: Database Overload

by Ken Task -
Picture of Particularly helpful Moodlers

I often come across as being someone who 'knows it all' to some ... couldn't be further from the truth.   Think I've said, in the past, I probably know more about how NOT to do something. ;) 

However, I do 'dig' more than most - even to the point of getting in over my head.  Give myself license to fail.  Firm believer in sharing what I've learned and know ... uhhhh, isn't that characteristic of a life long learner/teacher?

If I did have a 'magic wand' would be loaning it out often! ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Database Overload

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Essentially Nelly has several enormous sites running on a box that's a lot smaller than we would have specified but it already was in place before we took over support. We did hit a bug with SQL optimisation in messaging - the site had nearly half a million messages stored. I've not seen anything like that before.

At the end of the day, you can tweak all you like but if you have a huge site you may well need big hardware.

My magic wand is broken too wink

In reply to jean-pierre verrons

Re: Database Overload

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'm sure I could create a Linux server that is slow without too much trouble. That's not the point. You have to have hardware, software that matches your needs and configure it properly. My experience is that, like-for-like, Linux has somewhat more 'power' (for want of a better word than Windows). However, hardware is cheap compared to wages so it usually comes down to what skills you have to hand.