Hardware and performance

Update on PHP-accelerators

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Visvanath Ratnaweera
Update on PHP-accelerators
Group Particularly helpful Moodlers
Next to CPU and RAM, PHP-accelerators boost the performance of heavily loaded sites. The problem is that there are so many of them! And on top of that, they may not like to work together ;-(

Please post your recommendations on PHP-accelerators for Moodle here. And don't forget to mention the hardware, system software and the Moodle version.
Average of ratings: -
Frankie's the name, Moodle's my game!
Re: Update on PHP-accelerators
Group Particularly helpful MoodlersGroup Plugin developers


I'm using eAccelerator And I am pleased with its performance. I allocated 50Mb RAM for it on my Linux VPS system.

My system specs: VPS 512Mb RAM, CentOS release 5.5 (Final), Apache 2.2.3,PHP Version 5.2.17 and MySQL.

Didn't try the other accelerators. Time factor. Also "if it ain't broken, don't fix it".

Frankie Kam

Average of ratings: Useful (3)
Picture of Bob Puffer
Re: Update on PHP-accelerators
Group Plugin developersGroup Testers

Very helpful discussion topic.  Wondering if we could have folks list constituent base (number of active courses, number of active users)?

Average of ratings: -
Picture of Chris Fryer
Re: Update on PHP-accelerators

We're using APC.  Simple to install on new Debian/Ubuntu installations

$ sudo apt-get install php-apc

Configure it to use a shared memory segment big enough to hold the Moodle code.  On our 1.9 installation, 32MB (the default) is way too small, 64MB not quite enough.  So I configured it to use 96MB.


This may be bigger than the maximum shared memory segment allowed on your system (/proc/sys/kernel/shmmax), but if apc has been compiled with mmap support, it can use a shm segment of practically any size.

Also set apc.max_file_size to something bigger than the default 1MB, otherwise it won't cache files like lib.php, weblib.php and moodlelib.php.

Some stats from our site:

472.59 cache requests/second
6362 unique logins in the last 24 hours
1288 active courses

Average of ratings: Useful (2)
Picture of Visvanath Ratnaweera
Group Particularly helpful Moodlers
Hi Chris

Thanks for the instructions. I'm testing APC now. Haven't gone through a heavy peak yet.

I have to make sure that exams (quiz) work properly. Do you, or others, have experience with quizzes with embedded videos?
Average of ratings: -
Picture of Visvanath Ratnaweera
Group Particularly helpful Moodlers
Almost forgot to report back. APC [1] is simple to install under Debian "Squeeze", easy to configure.

The installation could be as simple as
# apt-get install php-apc
# zcat //usr/share/doc/php-apc/apc.php.gz /var/www/moodle/admin/
(The webpage http://your.site/moodle/admin/apc.php will display the APC INFO.)
# /etc/init.d/apache2 restart

The configuration is through /etc/php5/conf.d/apc.ini (don't forget to restart apache).

There's page of its own for APC and Windows: http://docs.moodle.org/en/Installing_APC_in_Windows

I have not done any direct comparison, with and without APC. This benchmarking [2], dated 2008, reported an improvement by a facter of 3 for Drupal.

[1] http://www.php.net/manual/en/book.apc.php
[2] http://2bits.com/articles/benchmarking-drupal-with-php-op-code-caches-apc-eaccelerator-and-xcache-compared.html
Average of ratings: -
Rodolfo Matos
Re: Update on PHP-accelerators

We use memcached in a 8000+ users Moodle (1.9.x).

Allmost all accelerators have a catch somewhere. Actually, if one caches just the *.css files it would gain a lot over not caching at all. And for that you just need to tweak the web server.

But in Moodle, if you have a course with more than 100 teachers, a cache would be of no consequence. Or -at least- it's performance could be severily cripled...

We have a special case course, that is made of more than 170 teachers and around 800 students/participants.

In that situation, that course just to load takes around 13secs. A "normal" course (with 4 or 5 teachers and around 200 to 300 students) loads in 0.13 secs.

Since every environment is different, one should test and measure different implementations, I think that there are no "one size fits all" sollution.

Average of ratings: Useful (2)