Error: Database connection failed

Error: Database connection failed

by Chad Outten -
Number of replies: 6

we seem to be overloading our mysql db in its current state & are getting the dreaded "Error: Database connection failed..." message. the moodle install concerned has approx 3000 users, 200 concurrent. we're running mysql on a dedicated box with 3GHz xeon 1 GB RAM & have virtualised moodle across 3 other servers with similar specs.

ive attached our my.ini file. other info...

moodle 1.9 beta 2 (database session setting enabled)
mysql 5.0.45 (myISAM engine)
php 5.2.0 (Zend optimiser)
IIS 6 (ISAPI mode; 20 threads; recycle 15 mins)
win 2003 server

-----

we'd appreciate any thoughts in terms of how we can further tweak mysql, php to improve database performance & page loading speed. thanks in advance & good karma to you!

Average of ratings: -
In reply to Chad Outten

Re: Error: Database connection failed

by Kyle Brown -
One problem I see is 1GB for the MySQL server with 200 concurrent users? If this isn't a typo, then I believe that is your problem.

I have a problem similar to yours but not with 200 concurrent users. You need, I believe, 1GB of RAM for every 50 concurrent users, or something like that. Take a look at this moodle doc, I think it will help.

http://docs.moodle.org/en/Installing_Moodle#How_many_users.3F

Then again your other problem could be you are running Windows. big grin

Now that I think about it, there is some truth there. Windows uses a GUI and it will take up about 256 MB of RAM (at least for XP Pro), so you only have about 768 MB for you to play with.

Either way you look at it, you need more RAM (I think, can someone confirm that for me?)
In reply to Kyle Brown

Re: Error: Database connection failed

by Chris Potter -

Consider that confirmed. smile

With the overhead of a GUI, there's a reduced amount of RAM available of course.We're running Server 2003 with 8GB of RAM for our max 300 or so concurrent users (I can't imagine that many as we only have about 40-50 at a time, but it's possible, so we planned for future usage).

Things are going well for us, but Apache has been giving us headaches over memory leak issues.

You're definitely going to need more horsepower for 200 concurrent users, at least IMHO.

Good luck!

In reply to Chad Outten

Re: Error: Database connection failed

by Mitja Podreka -
Picture of Translators
I have a similar user load and the problem I've noticed is a huge "sessions2" database table. After not emptying it for a while it grew over 1 GB in size and that caused MySQL server to crash and Moodle giving the same "Error: Database connection failed..." message. After clearing it and restarting MySQL server Moodle worked as usual.
Another thing you could do is installing PHP accelerator which will ease the load off your servers. I've done it and CPU usage went down by almost 50%. http://docs.moodle.org/en/Performance#PHP_performance
In reply to Mitja Podreka

Re: Error: Database connection failed

by Rob Hudson -
I'm having similar problems with my sessions2 database table.

Any idea why it is filling up?

Cheers

Rob
In reply to Chad Outten

Re: Moodle Performance

by Chad Outten -
update to our performance issue here. tuned a couple things that now have our moodle 'firing on all cylinders'. performance is MUCH better! big grin

according to network monitor > cpu, paging & RAM weren't working hard at all > so really didn't seem to be a hardware issue, more likely system config

what i've done...

  1. changed IIS from ISAPI to fastcgi
  2. installed eAccelerator 0.9.5

NOTE: AFAIK fastcgi needs to be in 'thread safe' mode to work properly with eAccelerator

Cheers, Chad
In reply to Chad Outten

Re: Performance Issues

by Chad Outten -
i should also mention, we upgraded from moodle 1.9 beta 2 to 1.9 stable wink