Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Performance.

Performance

From MoodleDocs
Revision as of 16:36, 30 March 2006 by Antonio Vicent (talk | contribs)

Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system, and Moodle's design (with clear separation of application layers) allows for strongly scalable setups. See Large installations for some large Moodle installations.

Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.

It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster).

Web server performance

  • The amount of RAM on your web server is the strongest factor in performance - get as much as possible (eg 4GB).
  • Linux or Unix is the recommended operating system for the server. They perform much better than Mac OSX or Windows servers at high loads.
  • You are strongly recommended to use a PHP accelerator to ease CPU load, such as Turck MMCache or PHPA.
  • Performance of PHP is better when installed as an Apache module (rather than a CGI).
  • On a Unix/Linux system, performance can be greatly improved by allowing the webserver to use the system zip/unzip commands (rather than PHP-based zip libraries) - visit Admin/Configure/Variables and enter the path to the relevant executables. (Similarly, filling in the path to du will improve Moodle's speed at listing directory contents.)
  • Note that using secure web connections (https rather than http) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.
  • You can increase performance by using the light-weight webserver lighttpd in combination with PHP in fastCGI-mode instead of Apache, due to much lower memory consumption. One single apache process requires more RAM than the whole lighttpd with all of its fastCGI-processes together. Note that this may not be a good solution if you can afford lots of hardware power, because administration takes a little more time.
  • Consider lowering MaxRequestsPerChild in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). Also check the memory_limit in php.ini, reduce it to at least 16M. (Suggested by Rory Allford)

Database performance

Performance of different Moodle modules

Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:

  • The Chat module is said to be a hog in terms of frequent HTTP requests to the main server. This can be improved if you're using a Unix-based webserver by running the chat in daemon mode.
  • Brief report on performance for 55 students simultaneously using Quiz
  • The Moodle cron task is triggered by calling the script cron.php. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. php -f /path/to/moodle/directory/admin/cron.php) efficiency can be much improved.

See also