If you are running WordPress on a VPS or dedicated server, a quick way to optimize performance is to install a php opcode cache. To understand why, you need to first understand how php processes a request.
A php request goes through the following steps:
For every WordPress page requested, the php engine must go through all 5 steps. A php opcode cache keeps the complied php code in memory, thereby eliminating the 1st 3 steps above. Fortunately for you, installing and configuring a php opcode cache is simple. There are many php opcode caches, but my favorite is the alternative php cache (apc).
Here are the instructions for installing the alternative php cache (apc) on an ubuntu server:
1. Install php-apc
apt-get update apt-get upgrade apt-get install php-apc
2. Configure php-apc by editing the apc.ini file
Add the following to the apc.ini file (where 20 the amount of RAM allocated to your apc cache. I’ll discuss how to find the size needed later):
3. Restart apache
4. Verify Status
To check the status of you apc opcode cache you can install a monitoring script from http://svn.php.net/viewvc/pecl/apc/trunk/apc.php?view=markup by uploading the apc.php script to your web server. Use your web browser to browse to this script page and you will see a dashboard of the status of the apc opcode cache.
One of the items you should pay attention to is the Cache full count. This tells you how many times that the apc opcode cache ran out of memory. You should try to raise the amount of RAM you have allocated to apc to avoid this. On a server that I administer I have the cache set to 60, and this is enough to have WordPress (including plugins and themes) and phpMyAdmin in the apc opcode without ever running out of memory in the cache.
If you have any questions, please leave a comment below.