WordPress with a Content Delivery Network (CDN)

Using Content Delivery Network (CDN) with WordPress

A brief for a recent project included a requirement for the site to be fast.

I always optimise my WordPress installations so it’s delivering cached pages to visitors. The benefit of caching is that the pages load faster as the size of the page requests are smaller. This is because the database queries are stored and do not have to be ran each time a visitor requests a page. Such technique is essential for a CMS like WordPress; otherwise the site is going to take a long time to load and your visitor/customer is going to go elsewhere.

The difference for this site it was an image intensive site for photography meaning big images had to be loaded regularly – even more of a problem. The solution then, a Content Delivery Network (CDN).

The products

Amazon Web Services

My CDN of choice was Amazon’s Cloudfront. Files are stored on Amazon S3 and Cloudfront then distributes them when requested. There are others on the market but just through Amazon’s reputation I chose them. I’d be open to using others in the future but only if I could see a real difference.

The details

When a new image is uploaded through the media uploader it is pushed out to the Amazon S3 bucket. The Amazon S3 bucket therefore is a mirror image of the uploads folder in wp-content.

When a visitor hits the site, they are served the image from Amazon S3 which is faster than most other web servers. There’s also the added benefit that the images can be requested at the same time as other files from the web server which means more requests can happen concurrently – again, speeding things up.

The benefits

The hosting package I use for my client is a standard package – so it’s not necessarily the quickest. If my client wanted to have quicker hosting then they’d be looking at £30 per month, instead of £60 a year – a massive difference and something most clients would not be prepared to do.

With Amazon S3 and Cloudfront you are only paying for the amount of requests per files, rather than a flat fee. This invariable costs less due to the ‘Pay-as-you-Go’ type billing.

My costs for the last month for this site and Ally’s site were $0.78 so it hasn’t exactly broke the bank, and the speed, well there’s no doubt it’s much faster.

Do you need help setting up an CDN for your site, or do you need other areas of your site speeding up? Get in contact and I’ll be able to help you out!

 

Posted on September 10, 2011 in Content Management, WordPress

Comments are closed.