Wordpress can be really slow out the box, especially if (like me) you’re hosting a blog on a shared server. So, what can you do to speed things up?
1.) Keep Updated - install the latest version of Wordpress, no excuses!
2.) Monitor your Stats - by default, wordpress includes the ability to display the number of database calls made per page, and the page execution time. I haven’t seen it able to monitor server loads (how hard the server is working), so I put together a quick plugin to add this ability, along with the full monitoring display code. You can view my short article here. Remember, the smaller the numbers are, the less resources being used, the better your site will load!
3.) Wordpress Cache - now that you’ve got an easy way to monitor your server resources, you could well find that there are many calls to the database per page, along with a few spikes in server load. Wordpress comes with an inbuilt caching mechanism, to stop the datbase being hit so often. By itself, this may not benefit you too much, but I’d say enable it anyway by adding the line of code below to your wp-config.php file:
define(’ENABLE_CACHE’, true);
4.) Proper Caching - this is more advanced, but it works amazingly well. If you’ve ever had problems with slow loading times and stretched resources, you should try out this plugin. It may take some playing about with if you want to keep parts of your site dynamic (it includes the ability to do this), but if you’re comfortable with Wordpress, I’d say give it a try. You can view full instructions, and download the plugin, from the author’s site. Hint: if using this plugin, disable Wordpress’ inbuilt cache.
Update: an updated version of WP-Cache, called WP Super Cache has just been released. It adds a couple of new features, and fixes some bugs associated with the original WP-Cache, so consider using it instead!
5.) Plugin Usage - the Wordpress plugin system is great, but it can start to slow your site down if you install too many that aren’t well put together. Slow database queries can really be a killer (although if you have wp-cache installed, not as noticeable), so only install the plugins that you really need!
6.) Theme Selection - some themes might look nice, but if they contain too many images (resulting in longer downloading times and more http requests) they might not be a good choice. There is a huge selection of wordpress themes out there, and plenty of nice themes that aren’t overly reliant on lots of images. The same goes for any images you add to your site in the form of badges or logos - do you really need them all?
7.) Content Compression - the less time it takes for users to download your blog pages, the better. Wordpress provides gzipping by default in the Options menu, but I always turn it off, since it can cause problems. In truth, any form of content compression can be a problem, depending on the browser used, but I’ve yet to have a problem using the htaccess file. Did you know that not only can you compress your html, but also your css and javascript files as well? If you use a lot of javascript on your site for example, this will make a big difference to many users:
(a) Open up your htaccess file in your wordpress root directory (or create one if your host allows). Below the line RewriteEngine On, add the following code:
## CSS Compression
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{THE_REQUEST} ^(.*).css
RewriteCond %{SCRIPT_FILENAME}.gz -f
RewriteRule ^(.*)\.css $1.css.gz [L]## JS Compression
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{THE_REQUEST} ^(.*).js
RewriteCond %{SCRIPT_FILENAME}.gz -f
RewriteRule ^(.*)\.js $1.js.gz [L]
(b) you can also compress the html by use of the following line at the top of your htaccess file. Remember that this *may* sometimes cause problems, although I have yet to have any myself. Also make sure that Wordpress gzipping is turned off in the Options menu:
php_flag zlib.output_compression On
(c) once your htaccess file is saved, you then need to zip up any javascript or css file you want to compress. If you don’t, the code in (a) will have no effect. I use this utility to zip up the files, and then upload them back into the web folder they came from. Important: make sure you keep the original files there too!
8.) Advanced Server Tuning - this won’t apply to a lot of users on shared servers, since there isn’t much you can do about it. However, having use of a php cache like eAccelerator can dramatically cut server load, and so help speed up your site even further. I have just had my account moved on servage.net to the latest server cluster, specifically because it uses eAccelerator caching, and I can already see the difference in resource usage. If it’s not installed, and you don’t have full access to the server, there is nothing you can do (except beg!).
And going even further, the guys over at NeoSmart have written a couple of plugins to directly communicate with caches like eAccelerator (also includes xcache and memcached). Be aware that not all servers can communicate directly with such a cache, even if it is installed, depending on configuration. Well, that’s about all I can think of right now. Happy tuning!
NB: I did originally write this for another blog (not mine), but it makes more sense to put it here given the subject matter.
ArticleSnatch Blog » Blog Archive » links for 2007-11-08 3:29 am on November 8, 2007 | #
[...] Run Wordpress, Run! | Simon Emery Wordpress can be really slow out the box, especially if (like me) you’re hosting a blog on a shared server. So, what can you do to speed things up? (tags: wordpress cache wp-cache gzip compression content-compression gzip-compression) [...]
links for 2007-11-08 | Crooked Press 4:20 am on November 8, 2007 | #
[...] Run Wordpress, Run! | Simon Emery How to speed up wordpress (tags: worpress speed cache howto) [...]
Keep Running Wordpress | Simon Emery 3:08 pm on December 9, 2007 | #
[...] while ago, I published an article containing a number of methods to help speed wordpress up. It included everything from caching to [...]
Profiling My Blog | Simon Emery 6:51 pm on December 9, 2007 | #
[...] pretty good, since I try to keep load times down to a minimum. I use many of the techniques I listed here to achieve that, from content compression to static caching. If you haven’t already, I [...]
Theme Roundup: Blog Overhaul | Simon Emery 11:37 pm on December 26, 2007 | #
[...] Wordpress optimisation techniques [...]
Uncoommes 7:41 pm on October 20, 2008 | #
Hey,
My Name is, George
great posts on here
check out my page:
http://5htUGa.spaces.live.com/