Moodle Health Check: Performance
Some of the performance-related information collated in this section has been derived from http://docs.moodle.org/en/Performance.
P1 zip path set (Chapter 11)
Setting the path for compressing files accelerates backups and other zip operations. It further reduces the load on your server as the specified zip executable is used.
Go to Server settings and specify the ZIP Path location. On Unix systems, this is usually /usr/bin/zip
.
P2 unzip path set (Chapter 11)
Setting the path for uncompressing files accelerates restore and other unzip operations. It further reduces the load on your server as the specified unzip executable is used.
Go to Server Settings and specify the UNZIP Path location. On Unix systems this is usually /usr/bin/unzip
.
P3 du path set (Chapter 11)
This will accelerate the display of directory content, especially if it contains a lot of files. It reduces the load on your server as the specified executable is used.
Go to Server settings and specify the du Path location. On Unix systems, this is usually /usr/bin/du
.
In all the three settings we just discussed, if you set the path incorrectly, Moodle will malfunction. Change this path to its correct location.
P4 Enable language menu caching (Chapters 8 and 11)
This saves a lot of memory and processing power. If enabled, the language menu takes a few minutes to update after languages have been added or removed.
Go to Language settings and turn on Cache language menu.
P5 Minimize installed language packs (Chapters 8 and 11)
Large number of installed language packs can potentially reduce performance.
Check if all installed languages are required and all language packs have been installed. Remove the ones that are not necessary.
P6 Set appropriate Cache level (Chapter 11)
If load has to be reduced on the database, the cache should be activated. Internal caching is suitable for medium-traffic sites.
If you do not have eAccelerator or mmemcached installed, choose internal as your cachetype. It makes use of the record/internal cache.
If you have a single server and have compiled eAccelerator with shared memory support, set the cachetype to the eaccelerator option.
If you have a separate memcached server, then the cache type should be set to memcached and a CSV list of server IP addresses should be entered.
P7 Enable record/internal cache (Chapter 11)
Use the cache to store database records. Cache type (the previous setting) should also be set for this setting to have an effect.
Go to Performance settings in the Server section and change the Record cache setting to Yes.
P8 Record Cache TTL (Chapter 11)
The value specifies the time-to-live for cached records (in seconds). Default value is 10 and it is recommended that the value should not exceed 15.
Go to Performance settings in the Server section and change the Record cache TTL value to 10.
P9 Internal maximum cache (Chapter 11)
The value specifies the maximum number of records to keep in the internal cache. This will enable a primary cache for database records without using any database engine cache. The lower the value, the less the memory used. The recommended value is 50.
Go to Performance settings in the Server section and change the Int. cache max value to 50.
P10 memcached hosts set (Chapter 11)
It is a comma-separated list of hosts that are running the memcached daemon. This setting only applies when memcached is used.
Go to Performance settings in the Server section and specify a comma-separated list of hosts in the memcached hosts field.
P11 memcached hosts naming (Chapter 11)
While specifying hosts, use IP addresses to avoid DNS latency. This setting only applies when memcached is used.
Go to Performance settings in the Server section and specify a comma-separated list of hosts in the memcached hosts field.
P12 memcached use persistent connections (Chapter 11)
Use persistent connections for memcached servers. Use carefully as it can make Apache/PHP crash after a restart of the memcached daemon. This setting only applies when memcached is used.
Go to Performance settings in the Server section and change the memcached use persistent connections setting to Yes.
P13 Large logfiles (Chapters 9 and 11)
Moodle collects usage data from all activities taking place once a user is logged in. Moodle records detailed logging information about each action that takes place in its system. Each record or hit contains data about who (user) did what (action) when (date and time) and where (IP address). While this information is valuable for monitoring and tracking activities, it can potentially create a huge log file.
Go to Cleanup settings in the Server section, and change Keep logs for from Never to a shorter value such as 365 days.
P14 Avoid https for all Moodle pages (Chapters 10 and 11)
Using secure web connections (https rather than http) carries a higher processing burden; both for the web server and the client (caching cannot be used as effectively, so the number of file requests will increase dramatically). For this reason, using https for all Moodle pages is not recommended.
Change your web connection from https to http.
If you require a degree of security at the login stage, you can enable https just for the login screen by turning on Use HTTPS for logins in the HTTP security settings in the Security section.
P15 Minimize active Moodle filters (Chapter 11)
Having too many Moodle filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency (the time taken for each page impression) of your site.
Go to Filters | Manage filters in the Modules section and hide all filters that are not required.
P16 Enable text cache (Chapters 8 and 11)
For larger sites or sites that use text filters, this setting will speed things up. Copies of texts will be retained here in their processed form for the time specified. Setting this too small may actually slow things down slightly, but setting it too large may mean texts taking too long to refresh (with new links, for example).
Go to in Filter | Manage filters in Modules and set Text cache lifetime to 1 minutes or 30 seconds.
P17 Disable text cache for all strings (Chapters 8 and 11)
Filtering all strings, including headings, titles, navigation bar, and so on is only useful while using the multilang filter. Otherwise, it will just create extra load on your site for little gain.
Go to Filter | Manage filters in Modules and turn off Filter all strings.
P18 Use chat server deamon
The normal chat method involves the clients regularly contacting the server for updates. It requires no configuration and works everywhere, but it can create a large load on the server with many clients. Using a server daemon requires shell access to Unix, but it results in a fast scalable chat environment.
Go to the Chat settings in the Activities section and change chat_method to Chat server daemon. Make sure that the chatd process is running on your operating system.
P19 Use streamed chat if possible
Chatroom updates are normally served efficiently using the Keep-Alive feature of HTTP 1.1, but this is still quite heavy on the server. A more advanced method is to use the Stream strategy to feed updates to users. The Stream strategy is much better approach (similar to the chatd method).
Go to the Chat settings in the Activities section and change chat_normal_updatemode to Stream. Make sure that the feature is supported by your server.
P20 Chat refresh parameter setting
The chat activity refreshes the list of users at regular intervals to detect who has joined the active chat. The smaller the value (in seconds), the bigger the load of traffic to the server.
Go to the Chat settings in the Activities section and change chat_refresh_userlist to 10 (default).
P21 Chat old ping setting
The chat activity refreshes the list of users at regular intervals to detect who has disconnected. The value (in seconds) is an upper limit, as usually disconnects are detected very quickly. Lower values will be more demanding on the server. If you are using the normal method, never set this lower than 2 * chat_refresh_room!
Go to the Chat settings in the Activities section and change chat_old_ping to 35 (default).
P22 Chat refresh room setting
The chat activity has to refresh the chat room. Setting this to a lower value (in seconds) will make the chat room seem quicker, but it may place a higher load on your web server when many people are chatting.
Go to the Chat settings in the Activities section, and change chat_refresh_room to 5 (default) if the Chat method is Normal. It is set to 2 if the Update method is set to Stream.
P23 Maximum chat clients
If a chat daemon is used, Moodle can limit the number of simultaneous clients connected to a chat. The lower the value, the lesser the load on the server.
Go to the Chat settings in the Activities section and change chat_servermax to 100 (default).
P24 cron script calling method (Chapters 2 and 11)
The Moodle cron task is triggered by calling the script cron.php
. If this is called over HTTP (either 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 (for example, php -f /path/to/moodle/directory/admin/cron.php)
efficiency can be improved to a better level.
Change your crontab entry to invoke the cron task by using php.
P25 Smart pix search (Chapter 8)
When enabled, icons are served through a PHP script that searches the current theme, then all parent themes, and finally the Moodle /pix
folder. This reduces the need to duplicate image files within themes, but has a slight performance cost. The feature is still in an experimental stage and should be avoided in a production environment.
Go to the Experimental settings in the Miscellaneous section and turn off Smart pix search.
P26 Statistics (Chapter 9)
If statistics is enabled, Moodle's cron job will process the logs and gather some statistics. Depending on the amount of traffic on your site, this can have a negative impact on performance.
Unless required, statistics should be disabled in the Server settings.
P27 Use slash arguments (Chapter 11)
Files (images, uploads, and so on) are provided via a script using "slash arguments" (the second option under HTTP settings). This method allows files to be easily cached in web browsers, proxy servers, and so on.
Unless your PHP server does not allow slash arguments, this should be enabled in HTTP settings.
P28 Don't return all default role users (Chapter 6)
This setting prevents all users from being returned from the database due to deprecated calls such as get_course_user
for the site course if the default role provides that access. Check this if you suffer a performance hit.
Go to User policies setting in Permissions section and turn on Don't return all default role users.
P29 Disable grade history (Chapter 8)
Disable history tracking of changes in grades-related tables. This may speed up the server a little and conserve space in database.
Go to Cleanup settings in the Server section and set Disable grade history. If you enable grade history, you might want to reduce the Grade history lifetime, which is specified underneath.