How to install Supercache for Wordpress

From EZP Knowledge Base

Jump to: navigation, search

What is Supercache?

(Excerpt from the official plugin page):

This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.

The static html files will be served to the vast majority of your users, but because a user's details are displayed in the comment form after they leave a comment those requests are handled by PHP. Static files are served to:

1. Users who are not logged in.
2. Users who have not left a comment on your blog.
3. Or users who have not viewed a password protected post. 

The majority of your visitors will be served static html files. Those users who don't see the static files will still benefit because they will see regular WP-Cache cached files and your server won't be as busy as before. This plugin will help your server cope with a front page appearance on digg.com or other social networking site.


How to Install Supercache:

Login to your Wordpress administration panel, navigate to "Plugins", select "Add new", search for "WP Supercache", click "Install Now", activate the plugin and begin setting your supercache settings. Start by turning supercache on, I'd also recommend the use of the compression option as well as mobile support. (If you have server level compression happening already, do not enable compression within supercache itself.)

Next, make sure your .htaccess mod_rewrite rules are updated with supercache's rules. The .htaccess file needs to be readable and writable by the web-server. To automagically add supercache's rewrite rules to your .htaccess file click "Update Mod_Rewrite Rules" button after enabling supercache. If your mod_rewrite rules are incorrect or unreadable, a warning will displayed on the supercache settings page alerting you to this fact.


Troubleshooting:

If for some reason supercache fails to actually cache your wordpress blog, here's a few tips for troubleshooting:

Make sure the cache folder is readable and writable by the webserver: chmod -R 755 wp-content/cache/supercache/
Delete wp-content/wp-cache-config.php and wp-content/advanced-cache.php (they will be regenerated by disabling and enabling the supercache plugin from within wordpress)

Check wp-config.php for "define('ENABLE_CACHE', true);" comment-out this entry if it exists.
You can check to see if caching is in effect by viewing the page source on your wordpress blog and scrolling down to the bottom of the source code, you should see something like this:

Cached page generated by WP-Super-Cache on 2010-00-00 00:00:00 


Note: if your migrating to a different domain name with the same wordpress site, delete the cache folder and reinstall supercache from scratch. Otherwise you will run into problems (mainly the lack of caching).


Benchmarks:

Wordpress blog with supercache disabled:

Requests per second: 62.79 [#/sec] (mean) 


With Supercache enabled:

Requests per second: 320.96 [#/sec] (mean) 

As you can see from the benchmarks, the server throughput has substantially increased, enabling more requests to be processed. What isn't shown here is how much the load on the server went down during the benchmark testing. Overall, Supercache can make a significant positive difference to the performance of your wordpress website.