Friday, 3 January 2014

How To Boost Your Website’s Performance With W3 Total Cache And A CDN

How To Boost Your Website’s Performance With W3 Total Cache And A CDN

How To Boost Your Website’s Performance With W3 Total Cache And A CDN

If I pause for three entire minutes before responding to any question you ask me, how long do you think it’ll take before you get sick of our conversation? That’s exactly how you should look at the speed of your website. This article will help you boost your site speed and avoid forcing your visitors to wait.
There are many reasons why speed matters so much. One is obviously user experience. You’ve probably experienced it yourself – doing some Google query, visiting a site that promises an answer, and then sitting there waiting for over several excruciating  minutes for the poorly optimized page to load.
However, it goes beyond mere user experience. Google judges the quality of your site based on your page load time. Getting judged by Google as a low-quality site because your pages load slowly will end up hurting your site quite a bit in the long run: you will be listed lower in the search listings, and fewer people will visit your website.
So, taking some time to perform proper maintenance and optimize your website will have tremendous payoffs over the long term. In this article, I’m going to outline how you can tweak the settings of W3 Total Cache for WordPress to speed up your website. James described the basic setup of W3 Total Cache a few years ago, but in this article I plan to go into much more detail, including setting up a Content Delivery Network that’ll further boost your site speed and enhance user experience.

Optimizing W3 Total Cache for WordPress

While tweaking the settings in your WP Admin panel and your web hosting control panel, it’s always a good idea to take a backup of your site first. There are many ways to accomplish this, either using plugins like UpdraftPlus, which Kev recently reviewed, or the WordPress Backup plugin, which I’ve reviewed. If you don’t want to use plugins, just use the SSH command line approach, or you can use a web server app like MySQLDumper to do the job.
Once that’s done, it’s time to do a quick benchmark speed test for your site.  Dave LeClair recently reviewed PageSpeed Insights, which remains the tool most webmasters turn to first to check their site performance. In my case, PageSpeed showed me that I have a lot of work to do to improve my site performance.

site cache1   How To Boost Your Websites Performance With W3 Total Cache And A CDN

It’s always good to get a couple of independent benchmarks done, so I also turned to Pingdom to run a speed test on my blog.  Again, performance was pretty horrid.
site cache2   How To Boost Your Websites Performance With W3 Total Cache And A CDN Pingdom reported back that my site is slower than 72% of all other websites that have been tested at Pingdom. That’s pretty sad!

I had installed W3 Total Cache years ago and set it up with the basic settings as James described in his post (mentioned above), but I never actually took the time to go through and learn the plugin and how to optimize it.

Ideal W3 Total Cache Settings

As James mentioned, you should always at least enable Page Cache, the top setting on the W3 Total Cache settings page, and select “Disk (enhanced)” from the Page Cache Method. This setting will create static cached pages for every page on your site that gets loaded on the reader’s end, so the next time they visit the page it will not be dynamically loaded every time.
site cache3   How To Boost Your Websites Performance With W3 Total Cache And A CDN
This one change alone can dramatically improve the performance of your site.  The second is the Browser Cache setting, which you’ll see further down the settings page.  What does this setting do? Essentially, it tells the browser to download images, CSS, JavaScript, and any other static files on the page into a temporary folder so that subsequent pages will use those same static files from the browser cache rather than re-downloading them from your website every time. To enable this, click “Enable” in the Browser Cache section.

site cache4   How To Boost Your Websites Performance With W3 Total Cache And A CDN
Then, click “Browser Cache” under the W3 Total Cache “Performance” section on the Admin panel. I typically enable everything except for caching 404 errors. The important thing is to ensure the first three items are enabled as defaults.

site cache5   How To Boost Your Websites Performance With W3 Total Cache And A CDN
With W3 Total Cache configured, it’s time to do another benchmark to see how things have improved.

Benchmark After W3 Total Cache Set Up

Running PageSpeed Insights, I discovered that the score for both Mobile and Desktop increased 10 points, and Desktop rose out of the read zone.
site cache6   How To Boost Your Websites Performance With W3 Total Cache And A CDN
Pingdom revealed the biggest increase.  Performance went from 72% slower than most other sites, up to 52% faster than most other sites!
site cache7   How To Boost Your Websites Performance With W3 Total Cache And A CDN

This is a tremendous improvement, thanks to W3 Total Cache, but there are some more things you can do to optimize the performance of your website.

Your Web Server Should Compress Content

An article by Google engineers at Google Developers describes just how important compressing web content is in order to conserve Internet bandwidth. In fact, their article starts out with the dramatic statement, “Every day, more than 99 human years are wasted because of uncompressed content.”
If you don’t want to contribute to wasting your readers’ time, then you may want to explore your web hosting account for any tool marked as “Optimize Website” in the CPanel.  In here, you will find that it defaults to “Disabled”. Go ahead and change that to “Compress all content” and click “Update Settings”.
site cache82   How To Boost Your Websites Performance With W3 Total Cache And A CDN
This will require a slightly higher load on the web server CPU, but the trade off in saved bandwidth is well worth it. Just keep a close eye on your server (or notify your host what you’re doing) just to be sure the CPU load increase isn’t too significant.

Running another bookmark test, I notice that this change has increased my performance by another 5%.
site cache9   How To Boost Your Websites Performance With W3 Total Cache And A CDN
Of course, there’s still more you can do. Specifically, you can sign up for a Content Delivery Network (CDN) service.

Why Using a CDN Boosts Performance

A Content Delivery Network is a service that has servers located all over the world. When you sign up for a CDN service, the static content like images, CSS files, and JavaScript all gets cached on multiple web servers around the world. When a user visits your website, the CDN service redirects visitors to the web server located closest to their geographic location.
This means if you have a web hosting account with headquarters and a data center in Houston, Texas, a reader from Australia will not have to wait for a connection to load between their browser and the web server in Texas; a CDN server will provide them with the content in a fraction of the time.
W3 Total Cache lets you set up a CDN on the main settings page under the Content Delivery Network section.
site cache10   How To Boost Your Websites Performance With W3 Total Cache And A CDN

In my case, I’ve signed up for a MaxCDN account. These aren’t free accounts, but they are fairly affordable. For a website width monthly bandwidth of around 500 GB per month, you’re looking at around $40 per month, and upgrading to a 1 TB business account is only around $80 per month. You’ll need to set up a “Pull Zone” in your CDN account.
If the option is there, always enable Compression to cut down on bandwidth use.
site cache11   How To Boost Your Websites Performance With W3 Total Cache And A CDN

Once your Pull Zone is in place, the service will give you the CDN URL you’ll need to set up CDN in W3 Total Cache.
site cache141   How To Boost Your Websites Performance With W3 Total Cache And A CDN
Using the CDN URL from your CDN account, go back to WP-Admin on WordPress and go to the CDN Configuration menu. Type in the URL into the field for “Replace site’s hostname with:”

site cache16   How To Boost Your Websites Performance With W3 Total Cache And A CDN

If you’re using the newest version of W3 Total Cache, this section may look a little different. You’ll find an “Authorize” button that you can use to directly get an API key.  You also have the ability to add multiple sub-domains from your site that will queue using the single CDN URL, but you’ll need to add the CNAME and then add those in your own domain hosting account — but that’s beyond the scope of this article. The above is a simple setup for a blog without sub-domains.
Don’t brush this off if you care about SEO!  While adding a CNAME in CDN settings and under your domain hosting account isn’t required to use a CDN, you’ll want to take advantage of it so that the hosted image files show up under your existing domain name rather than some other CDN domain. Failing to do this properly could significantly drop your indexed pages and search engine impressions, so tread carefully!
Save all settings, clear your cache. If it’s set up correctly, you’ll see that the CDN is enabled.
site cache17   How To Boost Your Websites Performance With W3 Total Cache And A CDN


Once this is enabled properly, go ahead and run another performance test. This time around there was a pretty nice increase – a 7% bump in speed again, thanks to CDN caching.
site cache15   How To Boost Your Websites Performance With W3 Total Cache And A CDN
This performance increase may actually be even more significant for people who live further away from your hosting company’s data center. Since I’m in the U.S., I saw a 7% performance boost, but someone in Europe or Asia may see a double-digit performance increase when visiting your site now. There’s no better way to serve your international audience better than this.

One last but very important thing to keep in mind when you’re using a CDN service like this is that many of your content – particularly your image files – will be served up from a different domain. The last thing that you want is for Googlebot to crawl that other domain, identify it as duplicate content of your original site, and then drop your ranking authority based on that false information. To avoid this, you need to disallow robots from crawling the CDN version of your pages and files. CDN services will offer an SEO area where you can enable this, such as MaxCDN which has this under SEO Settings where Robots.txt can be enabled and the Disallow robots.txt entry configured.
seo cdn   How To Boost Your Websites Performance With W3 Total Cache And A CDN

As you can see, there are a lot of ways to beef up the performance of your website. W3 Total Cache or other WordPress caching plugins will certainly help you do that, but don’t think it’ll do everything for you. In addition to installing a caching plugin, you’ll want to make sure you’re compressing files on your web server; you’re making use of a CDN; and you’re exploring suggestions offered by the Google Pagespeeed tool to constantly improve your site. It’s a job that never really ends, but it’s well worth the effort.
Article by: Ryan Dude

No comments:

Post a Comment