Content Delivery Networks//
If your website is somewhat media heavy, there are various ways that you can speed things up. For example, videos can be hosted on sites such as YouTube or Vimeo and for other forms of media, there is the option of using a Content Delivery Network.
A Content Delivery Network (CDN for short) is defined as:
“a geographically distributed network of proxy servers and their data centers. The goal is to distribute service spatially relative to end-users to provide high availability and high performance.” Wikipedia
This means that when you upload an image to your website it is copied over to the CDN and whenever someone then views that image, it will be served by the CDN rather than the website directly. There are several benefits to this:
- Your website processes fewer requests thus reducing the strain on the webserver
- Your images are served from a server or proxy server with many, many times more power and bandwidth than your website
- The image is served from a server near to the user. E.g. A user in Asia accessing your website would retrieve images from an Asian CDN proxy server and a user in Europe would retrieve it from a European CDN proxy server.
We are making use of Amazon’s CloudFront CDN service which allows us to serve images via this CDN directly from Amazon’s S3 storage service. To use this, we simply create an S3 bucket and upload all the site’s media to it.
Once this is done, we can then create a CDN on CloudFront that serves images from this ‘bucket’. This gives us a specialised CloudFront URL for this purpose which is something like this:
If you know something about DNS, you can then map a CNAME to this so that images can be served from the CDN via a friendlier URL such as images.yoursite.co.uk.
With WordPress sites, it is relatively simple to handle the interaction between WordPress and the CDN using a couple of plugins. These are:
Amazon Web Services which allows WordPress to use the AWS APIs and
WP Offload S3 Lite which automatically copies any new image to the S3 bucket if it is uploaded via the Media Library.
WP Offload S3 Lite allows you to map your content to the CDN and the S3 bucket in a straightforward manner.
Nearly all major websites are making use of CDNs for serving media now. If you go to amazon.co.uk, right click on any image and select ‘open in new tab’, you will find that they are being served from something like https://images-eu.ssl-images-amazon.com
If you have any questions about a CDN, please email Jordan he’ll be able to give you a technically sound and reliable answer.