At LUNS Ltd. we have done some measurements recently and I think it worth sharing our findings with Moodle community.
Having enhanced JMeter testplan generation plugin originally developed by James Brisland, we used it to run performance tests on Forum, Chat and Quiz activities in 1.9 and HEAD (2.0) versions. Each testplan included all steps required to perform the task (logging in, navigating to required page, posting in chat/forum or submitting quiz). Test was done with 10 threads (simultaneous users) and each user made 5 posts in corresponding activity (in Quiz only one submission was done). Static content retrieving (images, css) are not included in the testplan, so the time only reflects php script output rendering on the client side.
All tests were done on dev-box: Intel(R) Core(TM)2 Duo CPU E8600 3.33GHz, 8GB RAM, Debian/GNU "squeeze", Kernel: Linux 2.6.26-2-vserver-amd64. Web and database server are two different vhosts run on the same systems: Apache 2.2.16-3, php5 5.3.2-2, mysql-server 5.0.51a-24+lenny4.
Now the results. The average page performance results (mean time in milliseconds spent on each page retrieved throughout the testplan) are shown in the table below:
Moodle 1.9 | Moodle 2.0 | |
Forum |
435 (σ=146) |
1450 (σ=351) |
Chat AJAX | 298 (σ=191) | 668 (σ=586)* |
Chat Accessible | 438 (σ=225) | 1660 (σ=503) |
Quiz | 471 (σ=172) | 2086 (σ=742 |
* Navigation was slower than actual chat communication.
The same result presented on the graph:
Next table shows the summary of perfomance on some pages:
Moodle 1.9 | Moodle 2.0 | |
1. moodle/login/index.php |
780 (σ=211) |
1450 (σ=351) |
2. moodle/course/view.php | 476 (σ=112) | 1600 (σ=158) |
3. moodle/mod/forum/view.php | 346 (σ=78) | 1485 (σ=174) |
4. moodle/mod/forum/discuss.php | 349 (σ=103) | 1435 (σ=158) |
5. moodle/mod/chat/view.php | 288 (σ=73) | 1328 (σ=116) |
6. moodle/mod/chat/gui_basic/index.php | 312 (σ=98) | 1234 (σ=257) |
7. /moodle/mod/chat/gui_header_js/jsupdate.php |
289 (σ=124) | 384 (σ=123) |
8. moodle/mod/quiz/view.php | 385 (σ=98) | 1532 (σ=187) |
9. moodle/mod/quiz/attempt.php | 472 (σ=114) |
3139 (σ=141) |
An image with the same data:
You may notice Moode 2.0 is not as fast as its previous version - as results suggest, on the most pages we run test with, version 2.0 is significantly slower. Generated JMeter reports can be downloaded from here (csv files).
Next, we have done a brief investigation of what makes Moodle 2.0 that slow. Profiling was done using XDebug PHP extension on the server side, while moodle/mod/forum/view.php?id=X page was open in browser. Profiling dump files (results) are avialable for download from here (cachegrind.out.tar.gz). You may view these files with any cachegrind viewer (KCacheGrind or WinCacheGrind).
It appeared that page rendering (blocks rendering in particular) causes the most significant delays.
The screen-shot below shows the function calls in Moodle 1.9 ordered by running time (the figure in the first column is 1/1000000 fraction of second, e.g. 932269 means 932 millisec.):
The function calls in Moodle 2.0
If I logged in as admin, which means there will be more items in the blocks and probably more permission checks has to be done (just an assumption, I am not that familiar with Moodle code), even more time is required:
I conclude at this point. Results above indicates that Moodle 2.0 might need some performance optimisation prior to release in order not to diminish its good reputation.
Relevant links:
JMeter test results and XDebug profiling dump files,
Enhanced JMeter testplan generation plugin,
Profiling PHP scripts with XDebug.