WordPress is an excellent blogging/news website platform as a whole, but has been criticized for being a bit of a performance dog. One of my websites which is powered by WordPress receives between 100,000 and 200,000 unique visitors a month. I’ve gotten a few nasty emails from the two hosts that I’ve had the site on during the last year for taking up too much of the shared server’s CPU usage. Fortunately the poor performance of the base WordPress installation can be mitigated with a few different performance optimization plug-ins and techniques.
Here are a few things that I’ve done to get my WordPress installations’ performance in check:
Minimize Plug-In Usage - Many WordPress users, including myself, have the bad habit of running 20 to 30 different WordPress plug-ins at once. Each plug-in that you have installed adds to the amount of work that the server needs to do to load pages on your website. Keep the number of WordPress plug-ins that you have installed to a minimum.
One of the Plug-Ins that has been considered a “worst offender” is the popular All-In-One SEO Plug-in, so much so that DreamHost has banned its users from using the plug-in. Some would dispute the claim that it’s a performance nightmare, however you are probably better off to build your SEO optimizations into the template itself rather than using a third-party plug-in.
Word Press Super Cache – Super Cache is a plug-in that creates static HTML files which will load for your users instead of dynamically generating post HTML on each page load. This plug-in is a great help for sites that get featured on social bookmarking sites or have a few popular articles that get hammered.
Super Cache also supports a more traditional caching method (the one that came with the “WP Cache” plugin) for servers which do not support Super Cache. The downside to the “cache” method is that it does require loading a PHP script, whereas the “super cache” method requires nothing in terms of executing server-side scripts on a cached page load.
Word Press Object Cache – WordPress has a built in object cache which was added in version 2.5. The “Object Cache” will cache the results of different database queries that WordPress makes. For example, when any of the pages on your site loads, it will need to populate the site’s blog-roll and any widgets from the database. By enabling the object cache, you can cache the results from queries, minimizing the amount of database queries that WordPress needs to make.
To enable the WordPress object cache on yours site, edit your WP.Config file and add “define(ENABLE_CACHE, true);” to your list of “defines”. This may be added by default to later versions of WordPress.
To read more about the Object Cache, read this article on NeoSmart.NET.
Optimize Your PHP.INI File – Optimizing your PHP configuration file can improve the performance of your site. ElliotBack.com has some suggestions about what changes you might want to make to your configuration file, which will disable some modules which may not be needed for your website. He also offers a link to this more complete guide to optimizing your PHP.INI File.
Use a PHP Compiler Cache – You can make use of a PHP Compiler cache which will save scripts in a compiled format so they are not being recompiled each time they’re called from a page load on WordPress. The compiler cache will save your PHP scripts, including your WordPress files in a compiled state, eliminating the overhead caused by the compilation of your PHP files. Two popular PHP compilers are APC & eAccelerator that you may want to investigate, but it’s probably not worth it to go through the process of using these tools unless you have an extremely high traffic website.
Choose a Good Web Host – This won’t make your WordPress install run any faster, but choosing the right host from the get-go can minimize the need to spend a lot of time tweaking your site’s performance. Not all host are the same. Most hosts will shove you on a shared server with dozens of other websites, which isn’t a bad thing, because shared hosting allows you to get web hosting for much less than you would have had to if you bought your own web-server. The difference lies in how many websites a host will try to shove onto a single server.
Before choosing a web-host, search for the name of the host followed by “WordPress issues” or “Wordpress Problems” to see if current customers of the host are having performance issues with their WordPress sites.
Hardcode Values in Your Template – By default WordPress values use PHP functions on each page load to calculate the server path of where your template files are. Digging into WordPress suggests that you should replace these with hard-coded values to improve performance. We’re not sure how much of a benefit using hard-coded values will provide and probably isn’t necessary for smaller sites, but will probably provide some sort of assistance for sites with substantial traffic levels.
MySQL Database Optimization with PHPMyAdmin - Your web host probably provides you PHPMyAdmin access, which will allow you to run a built in optimization function on your tables. Weblog Tools suggests that going through the process will provide a nice performance boost. EarnersBlog.com agrees that it’s also worth doing. It’s probably worth trying, but make sure to back up your database first.
More often than not, installing Super Cache and getting rid of un-necessary plug-ins will be more than enough to make 95% of sites run at more than acceptable performance levels. If you’ve got a large site, as in that you are receiving hundreds of thousands of unique visitors each month, then it probably makes sense to start looking at some of the other optimizations suggested in this article.