Accelerate Your Content Delivery With KeyCDN
In this tutorial, I'm going to introduce you to KeyCDN, a fast, simple, affordable and reliable content delivery network (CDN) that'll make you want to use it on all your sites.
If you don't know what a CDN is, KeyCDN's simplicity makes it a perfect choice for newbies. It's also well suited for experienced system administrators—whether you appreciate the great user interface or its low prices, or make use of the API.
What's a Content Delivery Network?
A content delivery network is a system of geographically distributed servers. These global servers maintain replicas of your content automatically. The primary benefits of a CDN are about performance and high availability.
CDNs accelerate websites or data delivery by greatly reducing loading times around the world. Content is served from the closest edge server available. A so-called edge server lowers latency as it is closer to end users, and the closer a server is, the less congestion there is along the way. See also: What is a Content Delivery Network (CDN)?
Image credit: Content Delivery Network (Wikipedia)
What Is KeyCDN?
KeyCDN is a cloud-based service provider which focuses exclusively on delivering fast, affordable, reliable, easy to use content delivery networks.
Within just a few minutes, you can sign up for KeyCDN and optimize any website, including WordPress sites.
KeyCDN offers all the basic CDN features with a variety of other capabilities. Its user interface is simple and intuitive. And I appreciate its advanced reporting and real-time logging capabilities.
How Does It Work?
Prior to researching this tutorial, I was an Amazon AWS CloudFront customer. AWS is always improving but its user interface designs are still overly complex and its CDN product overpriced. After using KeyCDN, I quickly switched over all my sites.
Not only does KeyCDN's globally optimized network deliver content to my readers faster, but it also greatly reduces the number of requests and load on my own server.
How Much Does It Cost?
You can try out KeyCDN for 30 days with its free trial. After that, you're billed only for CDN traffic and storage. This is unlike Amazon CloudFront, which is not only more expensive, but also charges fees per HTTP request. In fact, I found that KeyCDN would be at least half as expensive as Amazon.
Here's a breakdown of typical costs:
Cached content is not subject to storage charges. Storage pricing applies only for Push and VOD Zones. Storage pricing is $0.90/GB/month.
Additionally, there is:
- no minimum commitment
- no minimum usage
- no extra cost for Zones
- no charges for HTTP Requests
- no fine print
Getting Started With KeyCDN
I encourage you to give KeyCDN's free trial a run. Sign up at the KeyCDN website and follow along below:
Here's the initial view of the dashboard:
Once you activate your account by clicking on the email verification link, you'll see this:
These links make it very easy to have questions answered as you proceed in your setup.
Should You Push or Pull?
If you're a newbie or don't know, I recommend starting with Pull. A Pull Zone fetches (pulls) the requested content from your web server and caches the assets on the KeyCDN edge servers. In most cases a Pull Zone is the preferred option for any content management system (CMS). See also How to Create a Pull Zone.
A Push Zone requires that you upload your content to the KeyCDN storage cluster and distributed from there to the edge servers. They support FTP(S) or rsync over SSH to upload your data. Push Zones are mainly used for distributing files larger than 10MB or for files that rarely change (such as documents, videos, etc.). See also How to Create a Push Zone. There is an additional charge for storing data in Push Zones.
Setting Up Your First Zone
You can set up a zone using the dashboard, Zones > Add Zone:
Here's an example with data. I'm creating a pull zone jr for my Jeff Reifman site:
KeyCDN also offers a variety of advanced features including GZip compression, to further speed page downloads and reduce bandwidth:
And there's optional support for SPDY and SSL. It's nice that you can leverage KeyCDN's shared SSL without the complexity of installing your own certificate:
Says Wikipedia: "SPDY manipulates HTTP traffic, with particular goals of reducing web page load latency and improving web security. SPDY achieves reduced latency through compression, multiplexing, and prioritization."
Managing Your Zones
Here's what it looks like after you create your zone:
The progress bar shows the time it takes to pull the content off your server into the CDN. In my case, a mirror of my site is being created at jr-faf.kxcdn.com.
KeyCDN offers guides to set it up with your website:
- Custom CDN Integration
- WordPress CDN Integration with W3 Total Cache
- WordPress CDN Integration with WP Super Cache
Using KeyCDN With WordPress
Using a CDN with WordPress requires a plugin such as W3 Total Cache or WP Super Cache. I use W3TC.
To configure KeyCDN with W3TC, you have to visit the Performance > General Settings dashboard—confusingly not the Performance > CDN page:
Then, visit the Performance > CDN page and provide your KeyCDN zone name:
Going Further With W3 Total Cache
You can multiplex your reader's access to KeyCDN by taking advantage of four different zones enabled by W3TC.
At my domain registrar, I set up four CDN subdomains, e.g. c1.jeffreifman.com, pointing as CNAMEs to my KeyCDN zone name:
Then, I provide these four zone aliases to W3TC:
Now, W3TC will cause WordPress to divide the page source requests across four different KeyCDN aliases. This allows browsers to multiplex the requests, and is often faster than sourcing just one KeyCDN zone alias.
You may also want to read my Tuts+ tutorial: Optimizing WordPress with Varnish and W3 Total Cache, which can help you in conjunction with KeyCDN.
Page Headers and Cache Control
You can also configure KeyCDN in conjunction with W3TC to automatically purge content of a specific age from the KeyCDN edge network. This ensures that your users receive the most up-to-date content. See also Expire Header and Cache-Control.
If you need full control of this timing, it may be best to use a push zone.
However, KeyCDN has a simple user interface for immediately purging your cache. This can be great for site updates and troubleshooting:
Reporting is one of the KeyCDN Dashboard areas that really shines. It's so richly featured and simple. Here's the basic traffic view by zone or across zones:
Here are the top files and the total bandwidth generated by requests for them:
Here's traffic by geolocation:
And displayed in table form:
KeyCDN also offers real-time logs. You can watch traffic requests come in live:
And if you need a detail view, it's a click away:
You can also integrate KeyCDN's raw logs for processing with other services and tools such as LogEntries.com. See Get your CDN logs without a syslog server.
KeyCDN also offers Video on Demand (VOD) services. A VOD Zone can be used to stream videos over Real Time Messaging Protocol (RTMP). You can use a Push Zone if you want to stream over HTTP. See also Stream Data from a VOD Zone.
If you have questions, KeyCDN has a friendly Knowledge Base and Support area to help you:
My first support contact was resolved quickly.
Automating KeyCDN With Its API
The KeyCDN API allows users to manage zones and receive reports in a straightforward, programmatic way, using conventional HTTP requests. If you're an experienced system administrator running a number of sites, you can use the KeyCDN API to automate your service requests:
I really enjoyed getting to know KeyCDN and decided quickly it was a great solution for my publishing needs. It's fast, simple, easy to use, affordable and fully programmable. It offers a variety of advanced features and outstanding reporting. There's not much here not to like.
Source: Tuts Plus