User:GregRundlett/How to make MediaWiki fast

based on/thanks to User:Aaron_Schulz/How to make MediaWiki fast

Intro

 * 1) Of course you read the fine manual, right? Manual:Performance tuning
 * 2) benchmark and test with Apache Bench
 * 3) learn and use debugging; especially the profiling part


 * 1) Use cache.
 * 2) To LocalSettings.php, add (replace paths as needed):
 * 3) Set $wgCacheDirectory (above) for use with interface message caching. Make sure that the webserver has permission to make files there.
 * 4) Set up varnish or squid servers if possible. Otherwise, at least enable file caching.
 * 5) Set up Memcached if possible. If you do, set $wgMainCacheType and $wgParserCacheType to CACHE_MEMCACHED in LocalSettings.php instead. This is recommended if you have a cluster of servers.
 * 6) Run   if you use file caching (not squids).
 * 7) Set $wgJobRunRate to 0 and set up a crontab or shell script to run jobs (like this with this for example). With $wgJobRunRate at 0 and the above changes, you should be able to avoid db hits on many requests.
 * 8) Set $wgDiff and $wgDiff3 to gnu diff utility (download as needed). This is recommended. The default PHP diff code is slow and crashy.
 * 9) Edit the MediaWiki:Aboutsite and MediaWiki:Pagetitle system messages by changing  into your site name. This avoids extra parsing on each hit.
 * 10) If you really need hitcounters, use $wgHitcounterUpdateFreq instead of the $wgDisableCounters setting above.
 * 11) Set up a 404 handler for $wgLocalFileRepo. If not, then at least set $wgShowArchiveThumbnails = false.
 * 12) Set $wgSessionsInObjectCache to true to avoid the default PHP session handler, which uses files and serializes page views for the same user. This also lets thumbnails be rendered in parallel if 404 handling is enabled.
 * 13) In the webserver's php.ini file. Make sure realpath_cache_size is set, perhaps to 512k or more.
 * 14) Consider enabling EnableMMAP and EnableSendfile in httpd.conf (for Apache). Please read the Apache docs for NFS and compatibility issues first.
 * 15) [MySQL] Set your mysql server config files to only use server modes corresponding to $wgSQLMode (default is "" for no modes). Restart the mysql server, and then set $wgSQLMode = null.
 * 16) Use FastStringSearch (if you are on a version prior to PHP5.5).
 * 17) If using SQLite, there a going to be many editors working at a time, and you are willing to sacrifice SERIALIZABLE atomic transactions (key parts of MediaWiki will still use them), you can add this to the bottom of LocalSettings.php:
 * 18) If using SQLite, run   and execute.