This is a Guest post by Ram from Teknobites who blogs about Tech- news, Web 2.0, tools, tips and tweaks. Don’t forget to visit his blog for more news and Subscribe to his blog for regular updates.
WordPress is the best blogging platform available (some may not agree) with hundreds of plugins to tweak for your needs. When you start your blog you may not need to optimize your blog to speedup but once your blog receives traffic or make it to the digg frontpage it is necessary to tweak it so that it runs faster. In this post we will see how we can speedup wordpress blogs with simple steps.
- Themes like K2 are fancy and give a nice feel for the visitor but they consume lot of resources and effect page loading time. Use simple themes with less CSS and Javascript so that your blog runs smoothly. If you have to use AJAX use where it is necessary. You can even optimize CSS and Javascript with tools like CSS Compressor and Javascript Compressor.
- Use plugins which are necessary, remove all unwanted plugins.
- WordPress has a bulit in object cache but it is not enabled by default, you can enable this by adding the below lines to your wp-config.php file. You can notice the difference in performance later.
//enable Object Cache
define(‘ENABLE_CACHE’, true);
//define expiration time
define(‘CACHE_EXPIRATION_TIME’, 900); - WordPress has Gzip compression support you can enable this so that browsers with Gzip support will load your site faster. This function is wp-admin >> Options >> Reading. This should be disabled if you plan to use Wp-cache plugin.
- Use Wp-cache plugin to cache posts in static files. These files are served for future requests with out compiling PHP code and building the page from the database. This is a must use plugin when you are dugg. Remember Gzip compression should be disabled to use this plugin.
- Try to minimize the external scripts on your sidebar these include Mybloglog, Blogcatalog and other javascript widgets.
- You can serve TLA and other affiliate banners from your own server instead of loading the images remotely. (This may consume your bandwidth but you are no longer dependent on external server speed)
- Install PHP Compiler Cache scripts like eAccelerator or Zend Optimizer on your server. These scripts will cache PHP scripts in their compiled state so that the server don’t have to compile PHP scripts each and every time they called from wordpress.
- Enable Mysql query cache: Mysql query cache saves query results and serves it when the same query comes again. You can add the below 2 lines to your /etc/my.cnf file to enable this.
query_cache_type = 1
query_cache_size = 33554432
The query cache parameter tells how much memory to use, in this case it is 32M.
The below tips are only useful if you have a dedicated server.
Now apply some of these tweaks if not all and make your WordPress to run faster. Do let me know if you use any other tweaks to speedup your blog.
Interesting set of tips here, Ram! I need to implement a few of them myself!
OW, wish I had the dedicated server! 🙂
Nice tips, wp-cache is sure one of the good way to optimize download time. But it’s kind of annoying if you try to modify your theme or else because it will not appear immediately. Need to clear the cache and disable it before begin tweaking. 🙂
Nice tips – but people need to be minimalist to take off JS widgets and plugins. I am, for one !
You might also want to take a look at similar post I wrote some time back, and was stumbled heavily:
Have you optimized your blog?
You should add one more bit to #1 – use PHP compression for stylesheet(see my post for details).
Good tips. I can vibe with the whole complicated theme thing too. I think the mess of a theme I use has been slowing things up quite a bit. It doesn’t help either that I had a huge error that was coming up every time someone tried to access my site!
That’s what I get for using a theme that includes a million php files. *rolling eyes*
Wp-cache is a good plugin if you cant afford for hosting but I guess paying 10 to 20$ month is not a big deal and You should be able to host your site nicely.
I had been in dig with 60000 hits in 24hrs with all scripts running including related post . My host never said anything to me on that.
The inbuilt chache property I was not aware of that. I would find in wordpress codex to see more about it
Thanks to Nirmal for this oppurtunuty and to all of you who have commented.
@Sumesh
I am not aware of this, i will check your post. Thanks for the info
@Ashish
You are lucky, when my site is on digg front page it is my mysql server is down for sometime, in that short time i removed K2 theme and implemented few tweaks and then it went well.
@Ram: That was not luck but Because my host is powerful enough to keep up with those affects. I have no optimization done not even css clean up or even Javascript reduction.
It depends largely on your host. I am on shared hosting and pay around 10$ a month thats it.
Interesting tips. I need to check them out in details and optimise my blog with it.
Thanks for this post man! Keep it coming!
I looked around for the inbuilt cache you mentioned there. It has some issues and are really not recommended for shared hosting. Here is a small discussion and using wordpress object cache
# Mark Jaquith
Posted 7/25/2006 at 4:40 pm | Permalink
One of the biggest misconceptions is that the object cache invalidates the need for an output (HTML) cache. It doesn’t. The object cache saves a few MySQL queries and a few PHP cycles structuring the results of those queries, but it still leaves many queries for MySQL, and it still requires that WordPress be fully loaded for each hit. WP-Cache2 is still extremely useful for caching your HTML output.
It should also be noted that not everyone will benefit from using the built-in disk-based object cache. I strongly suggest that you measure execution time and compare. If you have full access to your server (dedicated or virtual), I suggest you look into alternative storage engines for the object cache, such as the ones using Memcached or APC, as this data will return more quickly than from the disk cache.
#2 David Chait
I just wanted to chime in full agreement with Mark. Generally the object cache should NOT be used, unless you know your server setup and performance factors VERY well. It has even been proven detrimental (seriously in certain instances) on shared hosting setups. If you have a dedicated server, then the alternative memory cache engines become useful — but only if you aren’t already running a mysql query cache of a decent size… 😉
#3 Dougal
Mark and David,
Thanks for pointing out more details on possible downsides to using the object cache. I didn’t want to sidetrack into that tangent in my article, partially to keep it short, and partially because I’m not familiar myself with just what factors might be involved. Personally, I am on a dedicated server (at least for all practical purposes), and the object cache works fine for me. But I also use WP-Cache2, MySQL query caching, and the APC PHP opcode cache.
@Ashish
Thanks for the info, i will check that
Nice tips… I particularly liked the two 1) using light themes 2) using wp-cache they surely will prevent server from overloaded.
Nice tips there, Ram. WP Cache plugin will be of great use.
Excellent tips Ram! Keep up the good work. Also, you guys might want to check out the new WP-SuperCache plugin. I am using it and it’s made a good bit of difference.
Aseem
I had forgotten about Gzip compression. Thx for reminding me 🙂
Thanks for the list. I need it at this point in time. Getting tired of waiting for things to load.
Wow, nice tips. I will probably be implementing some of these tips in my blog soon. Bookmarked it for now! 😀
Are u using all technique or which?
Thats a superb guide on speeding the wordpress, but i guess 2.5x versions are already quick enough when compared to the older versions.
I has try some way to make wordpress speed up. But not bring good result to me. I don’t know why?
http://ahblog.co.uk
ya,thats true.i thank you for this info.best of luck from ireland
Oops, what is it?
you should also try Page Speed online by Google which provides suggestions to optimize web pages…must tool for all web masters..