I've recently migrated a Moodle site running against PostgreSQL from a
single server, running FreeBSD, to a webserver and a database server (spec's below).
After upgrading to beefier hardware & current releases of software (notably PHP 5.3.1) we had several instances where Apache stopped responding. The error_log showed:
We upped the MaxClients setting from 150 to 225. Since then, we are seeing episodes of high CPU usage (>98%) which effectively prevents Apache from responding again.
We haven't been able to trace this condition to any specific user activity. It doesn't appear to be a gradually building phenomenon, as the machine can hum along nicely for hours, then suddenly spike and stay spiked. We have observed that it seems to happen pretty reliably when 12 - 15 users are taking quizzes simultaneously, but it happens at other times as well.
This did not happen under our previous configuration, running PHP 5.2.6. However, after migrating to the two new servers, we upgraded PHP on the old server (now sparingly used by another Moodle instance) to 5.3.1 and have experienced one occasion when Apache stopped responding there as well.
Searching the forums, bugtracker & web has shown others with somewhat similar problems reported (see references below) but no definitive solutions. I'm wondering whether their problems are related to this version of PHP?
The error_log is logging other PHP errors (below) which appear to be only warnings. During automatic backups, tens of thousands of:
and
errors have been logged in the space of a few minutes, bloating the logfiles.
Before I roll back to an earlier version of PHP (probably PHP 5.2.12) - has anyone any better suggestions?
Thanks!
Error Messages:
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/moodlelib.php on line 1255
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/moodlelib.php on line 1256
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
[Thu Feb 04 01:20:04 2010] [error] [client #.#.#.#] PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /htdocs/moodle/lib/statslib.php on line 912
Configuration:
- two virtual machines, both running CentOS 5.4, Linux version
2.6.18-14.10.1.el5 both with 3 Gb RAM and two dual-core
Intel processors allocated to each. A SAN is providing 200 Gb storage for each.
- the web server is running Apache 2.2.14 & PHP 5.31 with eAccelerator v0.9.6-rc1 and Suhosin v0.9.29.
- the database server is running PostgreSQL 8.4.1, with pg_hba.conf set up
to trust the webserver on port 5432.
- both Apache & PostgreSQL are set to accept 225 max connections, otherwise
the conf's are pretty much default.
- web server is running OpenSSL for secure login, but serving general html
pages without https.
- tcp_keepalive_time in both is default 7200 seconds (which, as I read in
various posts, etc., shouldn't really matter anyway, but...)
- we are running against an external LDAP server, using OpenSSL for logins only.
Forum & bug tracker references:
Massive server problem - Nick Oliver Jan 12, 2010
http://moodle.org/mod/forum/discuss.php?d=141359
Moodle installed with xampp- High CPU usage for 50 concurrent users -Sayak Sarkar Jan 8, 2010
http://moodle.org/mod/forum/discuss.php?d=141108
Current Server = 5 users max... need a new server? - Josh Jones Jan 8, 2010
http://moodle.org/mod/forum/discuss.php?d=141053
Hanging while loading profiles - Tim Hart - Dec 25, 2009
http://moodle.org/mod/forum/discuss.php?d=140505
Apache stops processing - Renato Ardigo - Dec 9, 2009
http://moodle.org/mod/forum/discuss.php?d=139563
convert_urls_into_links() is converting inside image tags
http://tracker.moodle.org/browse/MDL-21168
convert_urls_into_links() causing slowdown/timeouts
http://tracker.moodle.org/browse/MDL-21296