Manual:Performance tuning

Overview
This page provides a quick overview of ways to improve the performance of MediaWiki.

Configuration settings
Large sites running MediaWiki 1.6 or later should set $wgJobRunRate to a low number, say 0.01. See Manual:Job queue for more information.

Database configuration and setup
For a heavy concurrent write load, InnoDB is essential. Set  to reduce lock contention, at the expense of introducing occasional inconsistencies. Use memcached, not the default MySQL-based object cache.

HTTP caching proxies and HTTP acceleration

 * See Manual:Squid caching and Manual:Varnish caching

Simply put, HTTP accelerators/caching proxies (such as Squid and Varnish) store copies of pages sent out by the web server. When a cached page is requested, the accelerator serves up the copy instead of passing the response on to the web server. This can tremendously reduce the load on the web server. When a page is updated, the copy is removed from the accelerator's cache.

Memcached

 * See Memcached

If you have enough available RAM, you should use memcached, which will require at least 80MB or more of RAM, about 60MB for code plus whatever you need for cache. The user interface text will be cached by memcached, as will logins and partially completed pages.

Multiple servers
The database software and web server software will start to fight over RAM on busy MediaWiki installations that hosted on a single server. A logical step, once other performance optimizations have been made, it to put the database and web server on separate servers (or, in some cases, multiple separate servers.)

Opcode caching

 * See PHP_configuration

Opcode caches store the compiled output of PHP scripts, greatly reducing the amount of time needed to run a script multiple times.

Output caching

 * See Manual:File cache for instructions on enabling and configuring rendered page caching

MediaWiki pages can be computationally expensive to render. MediaWiki has an optional file caching system that stores the output of rendered pages. For larger sites, using an external cache like Squid or Varnish is preferable to using the file cache.