Increasing the speed with which a page loads involves aspects (i) the server configuration and (ii) the web pages (or wordpress) configuration.
First, lets look at how we can speed up the time that it takes for the server to respond.
(i) Using nginx instead of apache:
My personal experience has been that nginx responds to page requests faster than apache and consumes lesser memory. While this may not be noticeable in normal times, it becomes a crucial factor when there is a huge traffic rush towards your site. When I post something, I also send out an email to all the subscribers and also tweet about it. If the topic is interesting, there is usually a huge surge of traffic within just a few moments of posting. When I was using apache, my site would frequently crawl and collapse. However, with nginx, my site remains cool as a cucumber even with thousands on concurrent visitors onboard.
(ii) Using memcache:
Memcache reduces database load by caching database objects. I use it with nginx and it works very well. Memcache is used by all the big-ticket sites like Facebook, Youtube, Twitter etc and so there is no reason why you should not have it on your site even if you get only a fraction of the traffic that the big sites get.
(iii) Proper configuration of nginx, php etc:
One can spare oneself of the botheration of tweaking the configuration by using a pre-configured auto-installer. While there are a number of auto-installers available, my personal favourite is centminmod which loads nginx, php, APC (or xcache), memcache, Mysql and Mariadb. It is nicely configured to work straight out of the box and consumes very less memory (RAM). My 128 MB RAM VPS is powered by centminmod. The other auto-installers like lnmp.org and its variations in rockia.com and ruchirablog.com are also noteworthy for their ease of use and extent of efficiency.
(iv) Optmize Database (through phpmyadmin):
The mysql database gets jumbled up frequently, slowing down the response time. There is a very easy way to optimize the mysql database with phpmyadmin. Just one click of the button and it is done.
It can also be done through the command line.
Now, lets look at how we can speed up the wordpress site.
(v) Cache plugin: Cache plugins are absolutely essential because they convert the php pages into plain html pages and avoid the server having to be asked to serve the page.
The best cache plugin for wordpress is Quick Cache because it does not require any complicated configuration and is ready to use. The other popular cache plugins for wordpress are WP Super Cache and W3 Total Cache.
By using any of the cache plugins, you will notice an immediate quickness in the speed with which the pages are loaded. This enhances visitor experience and also leads to better search rankings.
(iv) Optmize Database (through DB Optimizer plugin):
An easier way to optimize the database (if you don’t want to do it through phpmyadmin) is the WP Database Optimizer Tools. The advantage of this plugin over phpmyadmin is that it can also remove post revisions, trash posts, spam comments apart from optimizing the database tables.
(v) Cloudflare CDN:
If you have visitors coming in from several countries, Cloudflare’s CDN (Content Delivery Network) is a must-have. Cloudflare works by caching the web pages on their own servers and diverting traffic there instead of to your servers. The advantage is that visitors located closer to cloudflare’s servers will get served faster and the load on your server is reduced. Cloudflare has a free option that one must try.
The downside to cloudflare is that if the bulk of your visitors are local (relative to where your server is located), then diverting them to cloudflare’s servers may actually increase the response time and make your site seem slower.
The other CDNs are Amazon Cloudfront and MaxCDN.
(vi) Avoid Sharethis and Addthis plugins:
One must avoid plugins that need to communicate with their own servers to work. Sharethis and Addthis need to communicate with their respective servers to store data on how many requests your site has received. The problem with this is that if the remote site is down or slow, it directly impacts the load time of your site.
(vii) Use low resolution images: High resolution images can take quite a while to load. WordPress offers the ideal solution for this. You can upload high-resolution images to your site but choose to show the thumbnails or mid-size images in the post. A visitor who wants to see the full image has to click on the thumbnail to see it.
(viii) Avoid external comment systems: WordPress has an inbuilt comment system which is very efficient. External comments systems like Disqus & IntenseDebate increase load time without appreciable increase in efficiency.
since you suggest to drop apache for nginx. you can also use nginx for caching! no need for another layer like varnish
Thanks for the article , is very useful.
Really good guide 🙂
Thanks again for your succinct information. It *IS* a minefield out there in the Cyberbog.
I've only just stumbled across your Site today following up from another succinct post of yours on WHTalk.
I'm a non-geek forced into the D-I-Y-zone as so many people have failed to be able to do – or even explain – requirements of my small intentions (with high hopes 🙂 ).
Such as this post of yours on optimizing a WP site .
I've been thinking of going WP and giving up on my old standby: wysiwygWebBuilder as WP has developed such enormous plugin abilities.
BUT it has been daunting looking at the THOUSANDS of options and hearing of failures under ANY real pressure, unless the WP Site is "toughened".
Thanks again and like that other guy: I'll be baaaack!
Thank you for sharing those tips!
Abel