There must be a thousand posts out there about “boosting” the speed of your WordPress blog but it seems not much of them can show the before and after, the actual effect.Also most posts are pretty general on using the W3TC (W3 Total Cache) plugin but forget about the details and difficulties when configuring the W3TC plugin.
So, first let me show you what you can expect if you follow the steps in this post and are willing to spend 40 bucks.
Pretty impressive huh? SangatPedas went from an average loading time of 2,500 ms to just 500 ms, thatâ€™s 5 times faster! I gotta be honost, I also changed my theme and got rid of some plugins but I gained by far the most with correctly implementing minify and CDN using W3TC.
However, I definitely want to emphasize the importance of a good theme and a limited use of plugins. The techniques explained in this post are about how to load a chunk of data, but when the chunk of data is smaller to begin with you already have aÂ head start. Just open your website in Firefox using Firebug and youâ€™ll be amazed how time consuming some plugins and especially the social media integrations are. I decided to kick out the Google Plus button simply because one average it lead to a 1 second longer loading time which for such a functionality is way too much.
The basics of W3 Total Cache
W3TC consists of many separate parts which together form probably the best product for supercharging the performance of your WordPress blog. The configuration of most of the separate components is pretty straight forward and self explanatory. Before installing W3TC itâ€™s a good idea to chmod 777 your .htaccess but donâ€™t forget to change it back after. This will allow the plugin to automatically make the changes to your .htaccess needed for the plugin to work.
Just enable it and choose disk basic as page caching method. The plugin will request to make some changes in your .htaccess, just choose auto-install. Page cache is nice but donâ€™t expect wonders if your site has only few visitors and you have decent hosting.
Now here it becomes interesting, basically minify, as the name suggests, minifies but also combines files in one. Now if youâ€™re like me in a country where bandwidth is still a luxurious item this is where you can make the big wins and instantly cut off a significant amount of loading time, really significant if executed correctly. Just start with making the following settings for starters, these are the default settings and are pretty much the way to go:
This is the part where you will need Firebug which allows you to analyze what js and css files are loaded and have to be added to the lists. Just open your site in Firefox and activate Firebug under “Tools -> Web Developer -> Firebug -> Open Firebug” and reload your page. Now choose “Net” from the Firebug menu bar and then in the bar below “CSS” which should look something like this:
Now just add the css files to the minify list in exact the same order, enable minify Â and css minify, empty your page cache and reload your page again in Firefox. It should look something like this now:
Because the template is pretty neat and tidy we didnâ€™t win much in size, but there are lots of nice looking but crappy “premium” templates out there so your win could be much more. But more important is that the number of requests have decreased from 17 to 9. The reason why this is so important is that the http protocol limits the number of concurrent connections between your browser en theÂ web serverÂ to 4, meaning the less requests the faster the page will load.
Database Cache and Object Cache
Just enable and choose “Disk” for cache method, donâ€™t expect wonders for an average WordPress blog unless you have some database intensive plugins running and lots of visitors.
This one is the most easy to setup (just enable it) but also one of the most rewarding caching methods. Once enable most of your files (js, css, images etc) will be cached locally by your visitorâ€™s browser and it will supercharge the user experience.
I just love this functionality just because itâ€™s cool to use and because it will really boost your site performance world wide when you pick the right provider. CDN stands for Content Delivery Network and basically is a cloud like system in which a string of servers located in various regions around the world cache and deliver your content. I chose MaxCDN as CDN provider mainly because of itâ€™s price and the default integration of this provider in W3TC.
Just follow these steps and your website performance will truly boost to the max.
1. Create an account at MaxCDN
2. Create a pull zone and add 4 hosts for your domain like static1.yourdomain.com, static2… etc. You could add more hosts but W3TC seems to get lost when you add more than 4 hosts;
3. Create an API key for this zone, you can do that under “Manage Account -> API”. Click “Add key”, select individual zone and in the dropdown select your zone.
4. Create the hosts in your DNS and CNAME them to the temporary URL given by MaxCDN. Wait 10 minutes before trying to ping them because your provider probably needs time to activate them. Pinging to soon can cause wrong DNS cache and then you have to wait a few days before itâ€™s corrected;
5. In the tab “General” in W3TC select “NetDNA / MaxCDN” as provider but donâ€™t activate CDN yet;
6. You to the tab “CDN” in W3TC and enter your API id and key from MaxCDN;
7. Add your hosts to the host list, maximum 4 because of a bug in W3TC when adding more;
8. Save your settings and click “Test NetDNA”, if all should go well you should get a green “Pass” after which you can enable CDN in the tab general settings and once more empty your page cache.
After you have done all this you should do a speedtest in Pingdom just to make sure everything loads well. Iâ€™ve had the situation where on my laptop everything loaded well but in fact there were problems with my zone which were easily revealed by Pingdom.
So whatâ€™s the effect? Well check the before loading times according to Pingdom (detailed analysis of best score):
And now the after loading times (detailed analysis of best score):
So average load time without CDN is 3.4 sec, average load time with CDN is 1.7 sec meaning the use of CDN cut loading time in half winning a stunning 1.7 sec load time! Before implementing minify and CDN average load time was 5 sec so in total all the steps in this post will bring the load time of your WordPress blog down to 35% of what it is before. Donâ€™t forget that this is not only much appreciated by your visitors by search engines love fast loading websites!