WordPress users have always had problems with their blog not loading when their blog posts have been dugg. Because of the very high traffic the blog goes down with MySQL errors, PHP errors etc.. But WordPress is a powerful blogging engine and you can take it to any levels you wish.. I am going to talk about how you can optimize your wordpress blog so that it can withstand any kind of load.. This topic has been widely debated in the past so i’ll just do a brief rundown to what has already been discussed and then pass over to tips that haven’t really been discussed so far.
- Reduce DB Calls
- Remove Plugins which are not in use
- Use WP-Cache
While these tips are pretty much enough for everybody, but in case you want to extract that extra bit of juice from your wordpress blog then read on..
<link rel="stylesheet" type="text/css" media="screen" href="/style.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="/style.css.php"/>
Once you have done that add the following to the very top of the
<?php ob_start ("ob_gzhandler"); header("Content-type: text/css; charset: UTF-8"); header("Cache-Control: must-revalidate"); $offset = 604800 ; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() $offset) . " GMT"; header($ExpStr); ?>
and this to the very top
Advantages : Right now the Homepage of dailyApps is at 14KB and by enabling gzip it comes down to 4KB. The Main CSS file is 7KB and after gzip compression it comes down to 2KB. The Urchin Tracker JS file is 21KB and it comes down to 6KB. See the huge savings there.. gzip compression is a must have for anyone who wants to save bandwidth.
Disadvantages : At high server loads gzip compression can actually kill your server so you might want to disable gzip compression at high server loads.
- Cache Images, Scripts Server side rather than depending on the Browser to do so..
# Begin Cache Control
ExpiresByType text/css A2592000
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
You can see that the number of requests as well as amount of data transfer has been reduced significantly which directly results in better performance of your wordpress blog.
- Remove Etags
Etags are tags that is sent out by the Server to the browser to see if a file has changed. Etags can be quite buggy at times and it is best to simple HTTP caching for better performance. For more details on this see this page. To remove Etags just add the following code to the end of your
By doing this you are making sure that the Objects are cached properly and there is no ambiguity whatsoever regarding the request of the object.
- Use Image Sprites
Image Sprites can be extremely helpful in reducing HTTP requests. For more details on how to use Image Sprites see this excellent howto written by Paul Stamatiou.
Well this is it.. Using these tips I am sure you can extract that extra bit of Juice from your WordPress installation. Remember most of the things that I have talked about here are related to HTTP requests and caching, so first time visitors will not see any kind of improved load times when they visit your blog. But after that, it improves the performance of the blog to some extraordinary levels..
Do comment and tell me how these tips have helped you to increase the performance of your WordPress blog.
P.S. Also note that these techniques will work pretty much well for any website or blog that runs on Apache.