<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fechevarria</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fechevarria"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/Special:Contributions/Fechevarria"/>
	<updated>2026-04-11T06:46:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=64353</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=64353"/>
		<updated>2009-10-13T18:10:40Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* MySQL performance */ Update MySQLTuner link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made as has any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
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), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[[Server cluster]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* See the [[Moodle.org configuration]]&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* A warning about the previous performance tip.  Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites.   The issue is that if a web server&#039;s KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not.  As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server.  This is easily reproduced with postings to the Moodle forums.   Using MSIE, connect to an ssl-enabled Moodle site.  Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds.   You will see a browser error message, and your post content will be lost.  In some cases, doing this will even crash the Windows TCP stack on the client machine. &#039;&#039;&#039; So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds&#039;&#039;&#039;.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd] (or [http://nginx.net/ nginx])in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://mysqltuner.com/ MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; if you feel there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) 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&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many 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 of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;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&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. 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. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.png -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.gif -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.jpg -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle: [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance] forum&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajność]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=61514</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=61514"/>
		<updated>2009-08-12T18:41:37Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Moodle Image Optimization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made as has any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
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), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[[Server cluster]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* See the [[Moodle.org configuration]]&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* A warning about the previous performance tip.  Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites.   The issue is that if a web server&#039;s KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not.  As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server.  This is easily reproduced with postings to the Moodle forums.   Using MSIE, connect to an ssl-enabled Moodle site.  Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds.   You will see a browser error message, and your post content will be lost.  In some cases, doing this will even crash the Windows TCP stack on the client machine. &#039;&#039;&#039; So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds&#039;&#039;&#039;.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd] (or [http://nginx.net/ nginx])in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://wiki.mysqltuner.com/MySQLTuner MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; if you feel there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) 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&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many 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 of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;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&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. 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. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.png -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.gif -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.jpg -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajność]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=61513</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=61513"/>
		<updated>2009-08-12T18:40:11Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Lighttpd performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made as has any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
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), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[[Server cluster]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* See the [[Moodle.org configuration]]&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* A warning about the previous performance tip.  Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites.   The issue is that if a web server&#039;s KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not.  As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server.  This is easily reproduced with postings to the Moodle forums.   Using MSIE, connect to an ssl-enabled Moodle site.  Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds.   You will see a browser error message, and your post content will be lost.  In some cases, doing this will even crash the Windows TCP stack on the client machine. &#039;&#039;&#039; So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds&#039;&#039;&#039;.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd] (or [http://nginx.net/ nginx])in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://wiki.mysqltuner.com/MySQLTuner MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; if you feel there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) 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&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many 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 of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;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&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. 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. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.png&#039; -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.gif&#039; -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.jpg&#039; -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajność]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=61428</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=61428"/>
		<updated>2009-08-11T19:15:07Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: updated to recent Fedora in combination with Moodle 1.9.x requirements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Lighttpd meets all the base requirements for Moodle and provides most common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. Be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install PHP (preferably with an accelerator) and FastCGI according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
===Fedora 9, 10 &amp;amp; 11 Example===&lt;br /&gt;
Lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Under the respective sections, edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory, uncomment the FastCGI module and the &#039;&#039;fastcgi module&#039;&#039; section; be sure the &#039;&#039;bin-path&#039;&#039; points to the PHP FastCGI executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_fastcgi&amp;quot;,&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Client cache control and expiry is very flexible, uncomment the expiration module directive and add the following into /etc/lighttpd/lighttpd.conf for expiry control of common types of static files, change the number of days to meet your needs.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# Module load order is important, the mod_expire should be listed before mod_compress when both are active.&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_expire&amp;quot;,&lt;br /&gt;
## Client cache control section.&lt;br /&gt;
# mod_expire - image files expire 2 days after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(gif|GIF|jpg|JPG|png|PNG|swf|SWF|ico|ICO)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 2 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# mod_expire - includes expire 1 day after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(css|CSS|js|JS)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 1 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# Some versions of lighttpd may require the following directives for full functionality, uncomment if needed.&lt;br /&gt;
# etag.use-inode = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-mtime = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-size = &amp;quot;enable&amp;quot;&lt;br /&gt;
# static-file.etags = &amp;quot;enable&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and students&#039; perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU and multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /tmp/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot;&lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/tmp/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, the standard memory pool setting of 32MB for [http://us2.php.net/apc Alternative PHP Cache (APC)] is fairly low for Moodle, edit /etc/php.d/apc.ini and increase it to 64 or 128 depending on server load and total available memory.  Increasing this setting can increase the speed of page generation made from within the opcode cache on even modest equipment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apc.shm_size=128&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=126176  Debian/Ubuntu configuration, performance comparison vs apache2]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=50890</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=50890"/>
		<updated>2009-02-13T20:29:11Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Fedora 6, 7, 8 &amp;amp; 9 Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Lighttpd meets all the base requirements for Moodle and provides most common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. Be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install PHP (preferrably with an accelerator) and FastCGI according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Under the respective sections, edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory, uncomment the FastCGI module and the &#039;&#039;fastcgi module&#039;&#039; section; be sure the &#039;&#039;bin-path&#039;&#039; points to the PHP FastCGI executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_fastcgi&amp;quot;,&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Client cache control and expiry is very flexible, uncomment the expiration module directive and add the following into /etc/lighttpd/lighttpd.conf for expiry control of common types of static files, change the number of days to meet your needs.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# Module load order is important, the mod_expire should be listed before mod_compress when both are active.&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_expire&amp;quot;,&lt;br /&gt;
## Client cache control section.&lt;br /&gt;
# mod_expire - image files expire 2 days after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(gif|GIF|jpg|JPG|png|PNG|swf|SWF|ico|ICO)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 2 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# mod_expire - includes expire 1 day after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(css|CSS|js|JS)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 1 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# Some versions of lighttpd may require the following directives for full functionality, uncomment if needed.&lt;br /&gt;
# etag.use-inode = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-mtime = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-size = &amp;quot;enable&amp;quot;&lt;br /&gt;
# static-file.etags = &amp;quot;enable&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and students&#039; perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot;&lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, the standard memory pool setting of 32MB for [http://us2.php.net/apc Alternative PHP Cache (APC)] is fairly low for Moodle, edit /etc/php.d/apc.ini and increase it to 48 or 64 depending on server load and total available memory.  This setting alone can shave 300ms off each page generation made from within the opcode cache.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apc.shm_size=64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49713</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49713"/>
		<updated>2009-01-29T18:30:36Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Fedora 6, 7, 8 &amp;amp; 9 Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Lighttpd meets all the base requirements for Moodle and provides most common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. Be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install PHP (preferrably with an accelerator) and FastCGI according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Under the respective sections, edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory, uncomment the FastCGI module and the &#039;&#039;fastcgi module&#039;&#039; section; be sure the &#039;&#039;bin-path&#039;&#039; points to the PHP FastCGI executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_fastcgi&amp;quot;,&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Client cache control and expiry is very flexible, uncomment the expiration module directive and add the following into /etc/lighttpd/lighttpd.conf for expiry control of common types of static files, change the number of days to meet your needs.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# Module load order is important, the mod_expire should be listed before mod_compress when both are active.&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_expire&amp;quot;,&lt;br /&gt;
## Client cache control section.&lt;br /&gt;
# mod_expire - image files expire 2 days after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(gif|GIF|jpg|JPG|png|PNG|swf|SWF|ico|ICO)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 2 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# mod_expire - includes expire 1 day after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(css|CSS|js|JS)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 1 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# Some versions of lighttpd may require the following directives for full functionality, uncomment if needed.&lt;br /&gt;
# etag.use-inode = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-mtime = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-size = &amp;quot;enable&amp;quot;&lt;br /&gt;
# static-file.etags = &amp;quot;enable&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and students&#039; perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot;&lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49711</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49711"/>
		<updated>2009-01-29T18:26:02Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Lighttpd meets all the base requirements for Moodle and provides most common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. Be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install PHP (preferrably with an accelerator) and FastCGI according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Under the respective sections, edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory, uncomment the FastCGI module and in the &#039;&#039;fastcgi module&#039;&#039; section, be sure the &#039;&#039;bin-path&#039;&#039; points to the PHP FastCGI executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
&amp;quot;mod_fastcgi&amp;quot;,&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Client cache control and expiry is very flexible, uncomment the expiration module directive and add the following into /etc/lighttpd/lighttpd.conf for expiry control of common types of static files, change the number of days to meet your needs.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# Module load order is important, the mod_expire should be listed before mod_compress when both are active.&lt;br /&gt;
&amp;quot;mod_expire&amp;quot;&lt;br /&gt;
## Client cache control section.&lt;br /&gt;
# mod_expire - image files expire 2 days after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(gif|GIF|jpg|JPG|png|PNG|swf|SWF|ico|ICO)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 2 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# mod_expire - includes expire 1 day after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(css|CSS|js|JS)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 1 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# Some versions of lighttpd may require the following directives for full functionality, uncomment if needed.&lt;br /&gt;
# etag.use-inode = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-mtime = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-size = &amp;quot;enable&amp;quot;&lt;br /&gt;
# static-file.etags = &amp;quot;enable&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and students&#039; perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49355</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49355"/>
		<updated>2009-01-25T19:03:14Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Fedora 6, 7, 8 &amp;amp; 9 Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Note Lighttpd meets all the base requirements for Moodle and provides most of the common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. You are encouraged to be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
A notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type, e.g. making a jpg image stay in the browser cache for a week, older versions of Lighttpd specify folders to be cached.  Versions with &#039;&#039;ETag generation&#039;&#039; support provide full expiry mechanisms and control.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Client cache control and expiry is very flexible, uncomment the expiration module directive and add the following into /etc/lighttpd/lighttpd.conf for expiry control of common types of static files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# Module load order is important, the mod_expire should be listed before mod_compress when both are active.&lt;br /&gt;
&amp;quot;mod_expire&amp;quot;&lt;br /&gt;
## Client cache control section.&lt;br /&gt;
# mod_expire - image files expire 2 days after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(gif|GIF|jpg|JPG|png|PNG|swf|SWF|ico|ICO)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 2 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# mod_expire - includes expire 1 day after first access&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;\.(css|CSS|js|JS)$&amp;quot; {&lt;br /&gt;
     expire.url = ( &amp;quot;&amp;quot; =&amp;gt; &amp;quot;access 1 days&amp;quot; )&lt;br /&gt;
}&lt;br /&gt;
# Some versions of lighttpd may require the following directives for full functionality, uncomment if needed.&lt;br /&gt;
# etag.use-inode = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-mtime = &amp;quot;enable&amp;quot;&lt;br /&gt;
# etag.use-size = &amp;quot;enable&amp;quot;&lt;br /&gt;
# static-file.etags = &amp;quot;enable&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and students&#039; perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=49250</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=49250"/>
		<updated>2009-01-23T00:40:15Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made as has any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
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), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
*  See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase web server performance by using the &#039;&#039;&#039;light-weight webserver&#039;&#039;&#039; [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://wiki.mysqltuner.com/MySQLTuner MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 &lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 &lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; as there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) 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&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many 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 of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;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&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. 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. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you hvae huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.png&#039; -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.gif&#039; -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname &#039;*.jpg&#039; -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajność]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49078</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49078"/>
		<updated>2009-01-21T03:01:26Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Note Lighttpd meets all the base requirements for Moodle and provides most of the common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. You are encouraged to be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
A notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type, e.g. making a jpg image stay in the browser cache for a week, older versions of Lighttpd specify folders to be cached.  Versions with &#039;&#039;ETag generation&#039;&#039; support provide full expiry mechanisms and control.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and the student&#039;s perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49077</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=49077"/>
		<updated>2009-01-21T02:51:38Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: Lighttpd is stable and robust. This page does not need disclaimer after disclaimer. We&amp;#039;ve run Moodle 1.6 through 1.9 on lighttpd since 2006; replacing all Apache installations--both simple and complex&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Note that while Lighttpd meets all the base requirements for Moodle and provides most of the common webserving features; however, it is not intended to replace Apache feature for feature. If your needs extend further than Moodle, be aware of lighttpd&#039;s differences and limitations as well as level of knowledge and support necessary and available. You are encouraged to be certain it meets all of your needs before deploying in a production environment.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
A notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type, e.g. making a jpg image stay in the browser cache for a week, older versions of Lighttpd specify folders to be cached.  Versions with &#039;&#039;ETag generation&#039;&#039; support provide full expiry mechanisms and control.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and the student&#039;s perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48745</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48745"/>
		<updated>2009-01-10T07:49:30Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint that works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)]. It is an alternative to Apache and IIS particularly well suited to systems with low resources, especially RAM -- ideal when using virtual private server (VPS) hosting services. Even on hosts with plenty of resources, Lighty is as fast as Apache if not faster and worth considering.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
A notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type, e.g. making a jpg image stay in the browser cache for a week, older versions of Lighttpd specify folders to be cached.  Versions with &#039;&#039;ETag generation&#039;&#039; support provide full expiry mechanisms and control.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and the student&#039;s perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48744</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48744"/>
		<updated>2009-01-10T07:43:41Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint. It is an alternative to Apache and IIS, particularly well suited to systems with low resources, especially RAM. Lighttpd is ideal for people using VPS hosting. Even on hosts with plenty of resources, Lighty is just as fast as Apache if not faster and well worth considering.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
lighttpd works well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)].&lt;br /&gt;
&lt;br /&gt;
A notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type, e.g. making a jpg image stay in the browser cache for a week, older versions of Lighttpd specify folders to be cached.  Versions with ETag generation support provide full expiry mechanisms and control.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and the student&#039;s perceived response time, especially for off-campus and distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# NOTE: a comma (,) is necessary when other active modules follow this one,&lt;br /&gt;
# unnecessary when this is the final active module in the server.modules directive&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; #, &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48743</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48743"/>
		<updated>2009-01-10T07:30:30Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint. It is an alternative to Apache and IIS, particularly well suited to systems with low resources, especially RAM. Lighttpd is ideal for people using VPS hosting. Even on hosts with plenty of resources, Lighty is just as fast as Apache if not faster and well worth considering.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
It has been found to work well with PHP accelerators like [http://eaccelerator.net/ eAccelerator] and [http://us2.php.net/apc Alternative PHP Cache (APC)].&lt;br /&gt;
&lt;br /&gt;
One notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type e.g. making a jpg image stay in the browser cache for a week. Lighttpd will only let you specify folders to be cached.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including the PHP accelerator [http://us2.php.net/apc Alternative PHP Cache (APC)], using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves network speed and perceived response time, especially for distance learners.  Compression should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# a comma may or may not be necessary depending on whether other active modules are listed after&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; &lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and consider increasing the maximum server submission size (individual courses can still be limited lower than and up to this limit within Moodle itself, if needed).  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48727</id>
		<title>lighttpd</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=lighttpd&amp;diff=48727"/>
		<updated>2009-01-09T20:01:07Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.lighttpd.net/ Lighttpd] (a.k.a. Lighty) is a lightweight webserver with a small memory footprint. It is an alternative to Apache and IIS, particularly well suited to systems with low resources, especially RAM. Lighttpd is ideal for people using VPS hosting. Even on hosts with plenty of resources, Lighty is just as fast as Apache if not faster and well worth considering.&lt;br /&gt;
&lt;br /&gt;
Installation varies according to platform, so if the following example doesn&#039;t apply to your server configuration, check the official instruction page [http://trac.lighttpd.net/trac/wiki/TutorialInstallation here].  You will also need to install php (preferrably with an accelerator) and fast-cgi according to [http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP these] instructions.&lt;br /&gt;
&lt;br /&gt;
It has been found to work well with PHP accelerators, for example [http://eaccelerator.net/ eAccelerator].&lt;br /&gt;
&lt;br /&gt;
One notable difference between Lighttpd and Apache is the expires directive that controls the caching of content. Apache allows you to set the expiry by file type e.g. making a jpg image stay in the browser cache for a week. Lighttpd will only let you specify folders to be cached.&lt;br /&gt;
&lt;br /&gt;
===Fedora 6, 7, 8 &amp;amp; 9 Example===&lt;br /&gt;
&lt;br /&gt;
On the latest versions of Fedora, lighttpd is a part of the official repository and can be installed using yum to meet all of Moodle&#039;s base requirements, including a PHP accelerator [http://us2.php.net/apc APC] using the following command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install lighttpd lighttpd-fastcgi mysql php php-mysql \&lt;br /&gt;
php-pecl-apc php-gd php-mbstring php-xmlrpc php-pdo ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Edit /etc/lighttpd/lighttpd.conf to point to the Moodle root directory and the &#039;&#039;PHP-CGI&#039;&#039; area to activate and point to PHP&#039;s fastcgi executable, under the respective sections:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## a static document-root example&lt;br /&gt;
server.document-root        = &amp;quot;/home/moodle-1.9/&amp;quot;&lt;br /&gt;
#### fastcgi module&lt;br /&gt;
fastcgi.server             = ( &amp;quot;.php&amp;quot; =&amp;gt;&lt;br /&gt;
                               ( &amp;quot;localhost&amp;quot; =&amp;gt;&lt;br /&gt;
                                 (&lt;br /&gt;
                                   &amp;quot;socket&amp;quot; =&amp;gt; &amp;quot;/tmp/php-fastcgi.socket&amp;quot;,&lt;br /&gt;
                                   &amp;quot;bin-path&amp;quot; =&amp;gt; &amp;quot;/usr/bin/php-cgi&amp;quot;&lt;br /&gt;
                                 )&lt;br /&gt;
                               )&lt;br /&gt;
                            )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since Moodle maintains its own logs and reporting tools, you can disable lighttpd&#039;s server-level logging by commenting out (put a # mark in front of) the following lines in /etc/lighttpd/lighttpd.conf, as follows under the respective sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
# &amp;quot;mod_accesslog&amp;quot;&lt;br /&gt;
#### accesslog module&lt;br /&gt;
#accesslog.filename          = &amp;quot;/var/log/lighttpd/access_log&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your server has CPU cycles to spare, enabling compression improves perceived response time, especially for distance learners and should be separated at the HTTP and PHP levels to maximize CPU cycles (especially on multiple-CPU or multi-core systems).  First uncomment the compression module in /etc/lighttpd/lighttpd.conf, create a directory for the compressed file temporary store (in this example, it&#039;s /home/compress.tmp) and enter it along with the types of files to compress (do not include PHP mimetypes here), as follows under the respective sections:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## modules to load&lt;br /&gt;
&amp;quot;mod_compress&amp;quot; &lt;br /&gt;
# a comma may or may not be necessary depending on whether other modules are listed after&lt;br /&gt;
#### compress module&lt;br /&gt;
compress.cache-dir         = &amp;quot;/home/compress.tmp/&amp;quot;&lt;br /&gt;
compress.filetype          = (&amp;quot;text/plain&amp;quot;, &amp;quot;text/javascript&amp;quot;, &amp;quot;text/css&amp;quot;, &amp;quot;text/xml&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Second, edit /etc/php.ini to enable compression on the PHP output and increase the maximum server submission size (individual courses can still be limited below and up to this limit within Moodle itself).  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zlib.output_compression = On&lt;br /&gt;
post_max_size = 32M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [http://tracker.moodle.org/browse/MDL-14638 Networking issue related to lighttpd]&lt;br /&gt;
* [http://en.wlmp-project.net/downloads.php WLMP project downloads for Windows packages]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=48724</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Performance_recommendations&amp;diff=48724"/>
		<updated>2009-01-09T16:35:53Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made as has any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
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), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
*  See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase web server performance by using the &#039;&#039;&#039;light-weight webserver&#039;&#039;&#039; [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://wiki.mysqltuner.com/MySQLTuner MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 &lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 &lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; as there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) 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&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many 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 of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;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&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. 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. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you hvae huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajność]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Cron&amp;diff=48704</id>
		<title>Cron</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Cron&amp;diff=48704"/>
		<updated>2009-01-09T02:54:32Z</updated>

		<summary type="html">&lt;p&gt;Fechevarria: /* Using a cron command line in Unix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cron assists some of Moodle&#039;s modules to perform tasks on a scheduled basis. For example, the cron process might tell Moodle to check all discussion forums so it can mail out copies of new posts to people who have subscribed to that forum. &lt;br /&gt;
&lt;br /&gt;
The primary Moodle script that does all this is located in the admin directory, and is called cron.php. However, it can not tell itself to run, so you need to set up a mechanism where this script is run regularly (eg every five or ten minutes). This provides a &amp;quot;heartbeat&amp;quot; so that the script can perform functions at periods defined by each module. This kind of regular mechanism is known as a &#039;&#039;&#039;cron service&#039;&#039;&#039;. The service can be part of a webhost or can be something run from a different server or computer.&lt;br /&gt;
&lt;br /&gt;
==Overview of cron==&lt;br /&gt;
===Script overview===&lt;br /&gt;
&lt;br /&gt;
The cron.php script looks through the mdl_modules table (assuming the default table prefix is mdl_) in the Moodle database for modules scheduled to have their cron functions run; it then looks in each such module directory for a function called module-name_cron in the lib.php file and runs it.  It also looks through the mdl_block table for blocks scheduled for their cron methods (object functions) to be run; it then, for each such block, runs the cron method for a new object associated with that block (I&#039;m omitting details for the benefit of non-programmers; programmers can read admin/cron.php for themselves). These files (the lib.php files and the files where the block classes are defined) can contain cleanup functions, email functions or anything that needs to be run on a regular basis. For example, cron will trigger the system to create the backups of courses at the time specified in the administration settings. It also triggers any messaging module or forum email notifications, but not all functions are called each time the cron runs. Some functions, such as unenrolling students who have not logged in or deleting old copies of log files, are only run occasionally. The cron.php file has a section which will randomly call these core tasks approximately 1 in 5 times the cron runs.&lt;br /&gt;
&lt;br /&gt;
===Invocation===&lt;br /&gt;
There are now (1.9) a number of options with respect to how one can invoke cron.php. First off, one can password the invocation of cron.php via its URL. This means whether one calls the script via a browser through an application like wget or curl, or via your own code to the web daemon, the script will not run unless the password is provided,  and this would be transmitted in clear text.&lt;br /&gt;
&lt;br /&gt;
You can also now bar invocation by URL be selecting cronclionly. This sets Moodle so that cron.php cannot be invoked by the Moodle URL. See the illustration below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Moodelcronadmin.png]]&lt;br /&gt;
&lt;br /&gt;
While this is identified as CLI (command line interface) this is a bit misleading in that it does not mean that you have to be sitting at a shell account entering the command. If you enable this switch you can invoke cron.php through any set of batch or script files you wish,  but it must be invoked via its correct location in the operating systems file structure.  This can be especially frustrating for those not used to scripting in that environment is not typically provided.&lt;br /&gt;
&lt;br /&gt;
===Cron service location and timing===&lt;br /&gt;
Note that the machine performing the cron &#039;&#039;&#039;does not need to be the same machine that is running Moodle&#039;&#039;&#039;. For example, if you have a limited web hosting service that does not have a cron service, then you might choose to run cron on another server or on your home computer. All that matters is that the cron.php file is called regularly.&lt;br /&gt;
&lt;br /&gt;
The load of this script is not very high, so 5 minutes is usually reasonable, but if you&#039;re worried about it you can reduce the time period to something like 15 minutes or even 30 minutes. It&#039;s best not to make the time period too long, as delaying mail-outs can slow down activity within the course. Remember that mail-outs also wait for the editing time to expire before being queued for sending.&lt;br /&gt;
&lt;br /&gt;
===Testing cron and manual trigger===&lt;br /&gt;
&lt;br /&gt;
First, test that the script works by running it directly from your browser: &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If cron is called from the command line by any user logged in to your Moodle it will create a temporary admin environment in order to run and then log the user out. You can disable command line running of cron by disabling the appropriate section in the cron.php file.&lt;br /&gt;
&lt;br /&gt;
Now, you need to set up some of way of running the script automatically and regularly.&lt;br /&gt;
&lt;br /&gt;
==Managing Cron on Windows systems==&lt;br /&gt;
&lt;br /&gt;
There are two different ways for setting-up Moodle cron.php on Windows systems:&lt;br /&gt;
&lt;br /&gt;
*Use the &#039;&#039;&#039;Moodle Cron package&#039;&#039;&#039;. The simplest way is to use this little package [http://download.moodle.org/download.php/sourceforge/MoodleCron-Setup.exe MoodleCron-Setup.exe], which makes this whole thing very easy by installing a small Windows service. Run it and forget about it! :-)&lt;br /&gt;
*Use a &#039;&#039;&#039;Scheduled Task&#039;&#039;&#039;. If you prefer to use the built-in Windows Scheduler or are having trouble with moodle-cron-for-windows package, you can use wget for windows or php from the command line and setup a scheduled task. Just follow these steps:&lt;br /&gt;
** Choose either the &#039;&#039;&#039;php.exe/php-win.exe (command line binary)&#039;&#039;&#039; or &#039;&#039;&#039;wget&#039;&#039;&#039;&lt;br /&gt;
::The php.exe or php-win.exe binary (for PHP version 5 or later) is installed in your php folder (e.g. c:\php) will give you better performance when running the cron script.&lt;br /&gt;
::If you want to use wget, download a compiled version of wget for windows from the native GNU Win32 ports (http://unxutils.sourceforge.net/), from Heiko Herold&#039;s wget for windows page (http://xoomer.virgilio.it/hherold/) or Bart Puype&#039;s wget for windows page (http://users.ugent.be/~bpuype/wget/). If you use Heiko Herold&#039;s package, copy all of the .DLL files to your C:\Windows\system32 directory. Copy the wget.exe file to c:\windows (this makes sure wget is always in the search path).&lt;br /&gt;
:* Setup a &#039;&#039;&#039;Scheduled Task&#039;&#039;&#039;. &lt;br /&gt;
:: - Go to Start &amp;gt;&amp;gt; Control Panel &amp;gt;&amp;gt; Scheduled Tasks &amp;gt;&amp;gt; Add Scheduled Task.&lt;br /&gt;
:: - Click &amp;quot;Next&amp;quot; to start the wizard:&lt;br /&gt;
:: - Click in the &amp;quot;Browse...&amp;quot; button and browse to c:\php\php.exe or c:\windows\wget.exe and click &amp;quot;Open&amp;quot;&lt;br /&gt;
:: - Type &amp;quot;Moodle Cron&amp;quot; as the name of the task and select &amp;quot;Daily&amp;quot; as the schedule. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Select &amp;quot;12:00 AM&amp;quot; as the start time, perform the task &amp;quot;Every Day&amp;quot; and choose today&#039;s date as the starting date. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Enter the username and password of the user the task will run under (it doesn&#039;t have to be a priviledged account at all). Make sure you type the password correctly. Click &amp;quot;Next&amp;quot;.&lt;br /&gt;
:: - Mark the checkbox titled &amp;quot;Open advanced properties for this task when I click Finish&amp;quot; and click &amp;quot;Finish&amp;quot;.&lt;br /&gt;
:: - In the new dialog box, type the following in the &amp;quot;Run:&amp;quot; text box: &amp;lt;pre&amp;gt;c:\windows\wget.exe -q -O NUL http://my.moodle.site/moodle/admin/cron.php&amp;lt;/pre&amp;gt; or &amp;lt;pre&amp;gt;c:\php\php-win.exe -f c:\moodle\admin\cron.php&amp;lt;/pre&amp;gt; Replace &amp;quot;c:\moodle&amp;quot; with the path to your moodle directory or &amp;quot;my.moode.site&amp;quot; with the name of your site.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:: - Click on the &amp;quot;Schedule&amp;quot; tab and there in the &amp;quot;Advanced...&amp;quot; button.&lt;br /&gt;
:: - Mark the &amp;quot;Repeat task&amp;quot; checkbox and set &amp;quot;Every:&amp;quot; to 5 minutes, and set &amp;quot;Until:&amp;quot; to &amp;quot;Duration&amp;quot; and type &amp;quot;23&amp;quot; hours and &amp;quot;59&amp;quot; minutes.&lt;br /&gt;
:: - Click &amp;quot;OK&amp;quot; and you are done.&lt;br /&gt;
* &#039;&#039;&#039;Test your scheduled task&#039;&#039;&#039;. You can test that your scheduled task can run successfully by clicking it with the right button and chosing &amp;quot;Run&amp;quot;. If everything is correctly setup, you will briefly see a DOS command window while wget/php executes and fetches the cron page and then it disappears. If you refresh the scheduled tasks folder, you will see the &#039;&#039;Last Run Time column&#039;&#039; (in detailed folder view) reflects the current time, and that the Last Result column displays &amp;quot;0x0&amp;quot; (everything went OK). If either of these is different, then you should recheck your setup.&lt;br /&gt;
* &#039;&#039;&#039;Logging cron output&#039;&#039;&#039;. You may want to log the output of the cron script as it executes, in case you see the job is producing errors, backups are not being completed or users are experiencing delays in receiving forum emails. To do this, adjust the command so that it uses the php.exe and stores the output in a file called (for example c:\moodle\admin\cron.log). Here is an example of the php.exe command:&lt;br /&gt;
&amp;lt;pre&amp;gt;c:\php\php.exe -f c:\moodle\admin\cron.php &amp;gt; c:\moodle\admin\cron.log&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Managing cron on web hosting services==&lt;br /&gt;
&lt;br /&gt;
Your web-based control panel may have a web page that allows you to set up a cron service process. &lt;br /&gt;
&lt;br /&gt;
===CPanel cron service===&lt;br /&gt;
If you are using CPanel, login then look for &amp;quot;Advanced&amp;quot; category towards the bottom of the page. Click on Cron Jobs -&amp;gt; Advanced (Unix style). Enter the following for the cron to run every 30 minutes.&lt;br /&gt;
&lt;br /&gt;
 Email address for output: emailaddress@mydomain.con&lt;br /&gt;
 Minute:*/30&lt;br /&gt;
 Hour:*&lt;br /&gt;
 Day:*&lt;br /&gt;
 Month:*&lt;br /&gt;
 Weekday:* &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Command: wget -q -O /dev/null http://www.mydomain.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click Commit Changes. Check your email for the output. &lt;br /&gt;
&lt;br /&gt;
[[Image:Cpanel-cron-setup.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Other systems cron service===&lt;br /&gt;
For other systems, look for a button called &amp;quot;Cron jobs&amp;quot;. In there you can put the same sort of Unix commands as listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have permissions to run the &#039;wget&#039; command on the server, you can use this php command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/php -q /real/path/to/script/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
For example: &lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/php -q /home/username/public_html/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t know what is the real path of your Moodle folder you can use the PHP command realpath.&lt;br /&gt;
&lt;br /&gt;
Another alternative, if you do not have permission to run the &#039;wget&#039; command, may be to use a curl command.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
curl --silent --compressed http://mydomain.com/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
==Using a cron command line in Unix==&lt;br /&gt;
&lt;br /&gt;
There are different command line programs you can use to call the page from the command line. Not all of them may be available on a given server.&lt;br /&gt;
&lt;br /&gt;
For example, you can use a Unix utility like &#039;wget&#039;:&lt;br /&gt;
&lt;br /&gt;
 wget -q -O /dev/null &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in this example that the output is thrown away (to /dev/null).&lt;br /&gt;
&lt;br /&gt;
A number of users of Moodle have found that &#039;wget&#039; sometimes fails. Especially if you have trouble with email digests not being sent on a daily basis to all users, an alternative command that solves the problem is:&lt;br /&gt;
&lt;br /&gt;
 php &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same thing using lynx:&lt;br /&gt;
&lt;br /&gt;
 lynx -dump &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt; &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
Note in this example that the output is thrown away (to /dev/null).&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can use a standalone version of PHP, compiled to be run on the command line. The disadvantage is that you need to have access to a command-line version of php. The advantage is that your web server logs aren&#039;t filled with constant requests to cron.php and you can run at a lower I/O and CPU priority.&lt;br /&gt;
&lt;br /&gt;
 /opt/bin/php /web/moodle/admin/cron.php&lt;br /&gt;
&lt;br /&gt;
Example command to run at lower priority:&lt;br /&gt;
&lt;br /&gt;
  ionice -c3 -p$$;nice -n 10 /usr/bin/php /moodle/admin/cron.php &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
===Using the crontab program on Unix===&lt;br /&gt;
&lt;br /&gt;
All that Cpanel does is provide a web interface to a Unix utility known as crontab. If you have a command line, you can set up crontab yourself using the command:&lt;br /&gt;
&lt;br /&gt;
 crontab -e&lt;br /&gt;
&lt;br /&gt;
and then adding one of the above commands like:&lt;br /&gt;
&lt;br /&gt;
 */30 * * * * wget -q -O /dev/null &amp;lt;nowiki&amp;gt;http://example.com/moodle/admin/cron.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first five entries are the times to run values, followed by the command to run. The asterisk is a wildcard, indicating any time. The above example means run the command &#039;&#039;wget -q -O /dev/null...&#039;&#039; every 30 minutes (*/30), every hour (*), every day of the month (*), every month (*), every day of the week (*). &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;O&amp;quot; of &amp;quot;-O&amp;quot; is the capital letter not zero, and refers the output file destination, in this case &amp;quot;/dev/null&amp;quot; which is a black hole and discards the output. If you want to see the output of your cron.php then enter its url in your browser. &lt;br /&gt;
&lt;br /&gt;
* [http://linuxweblog.com/node/24 A basic crontab tutorial] &lt;br /&gt;
* [http://www.freebsd.org/cgi/man.cgi?query=crontab&amp;amp;apropos=0&amp;amp;sektion=5&amp;amp;manpath=FreeBSD+6.0-RELEASE+and+Ports&amp;amp;format=html Online version of the man page] &lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;beginners&#039;&#039;&#039;, &amp;quot;EDITOR=nano crontab -e&amp;quot; will allow you to edit the crontab using the [http://www.nano-editor.org/dist/v1.2/faq.html nano] editor. Ubuntu defaults to using the nano editor.&lt;br /&gt;
&lt;br /&gt;
Usually, the &amp;quot;crontab -e&amp;quot; command will put you into the &#039;vi&#039; editor. You enter &amp;quot;insert mode&amp;quot; by pressing &amp;quot;i&amp;quot;, then type in the line as above, then exit insert mode by pressing ESC. You save and exit by typing &amp;quot;:wq&amp;quot;, or quit without saving using &amp;quot;:q!&amp;quot; (without the quotes). Here is an [http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html intro] to the &#039;vi&#039; editor.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=41827 Cron - can someone give me a quick confirmation of function?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97684 Cronjob Question]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97457 Slow cron : avoiding simultaneous cron]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Cron]]&lt;br /&gt;
[[fr:Cron]]&lt;br /&gt;
[[nl:Cron]]&lt;br /&gt;
[[sk:Cron]]&lt;br /&gt;
[[pl:Cron]]&lt;br /&gt;
[[ja:Cron]]&lt;/div&gt;</summary>
		<author><name>Fechevarria</name></author>
	</entry>
</feed>