MediaWiki/Caching

From WCooke
Jump to navigation Jump to search

When I installed MediaWiki on my site, it would take a few seconds for it to render each page. I thought this was a combination of many things, such as accessing the database, php, apache, and my web browser. But, Wikipedia seems to work really fast because they use some kind of cache strategy. So I decided to begin by changing a few parameters for my database server and that didn't seem to fix anything. I remembered something about memcache when I set up MediaWiki, so I decided to start looking into that.

It turns out that there are a few solutions on how to cache PHP pages. The first one I tried was APC and I noticed an immediate speedup in the page loading times. I didn't even have to configure anything. All I had to do was install it. I use Gentoo Linux on my servers and to install it, use emerge:

emerge pecl-apc

The configuration file for APC is put into /etc/php/*/ext/. The default configuration file seems to work fine for me. I may tweak it a little eventually. I would imagine this will also help speedup any other PHP pages on your servers.