San Francisco-based Fastly is a versatile cloud company with some big-name customers: New York Times, Spotify, Reddit, Github, Imgur, Airbnb, TicketMaster and more.
Fastly’s CDN follows the reverse proxy model, similar to Cloudflare. Instead of giving you a ‘cdn.mydomain.com’ address where you can store specific files, Fastly routes all website traffic through its servers. To make this work you must update the CNAME record for your site with the domain registrar, but after that it ‘just works’, no website code changes required.
Once configured, the system operates much like any other CDN. When someone visits your site, Fastly checks their location and fetches content from the nearest point of presence (PoP). The company offers powerful PoPs spread all around the world – 18 PoPs in North America, 2 in South America, 8 in Europe, 5 in Asia, 6 in New Zealand and Australia and 1 in Africa – so most web users should get a speedy response.
Fastly has highly configurable support for video caching. It can deliver any HTTP-based media streaming protocol, including HLS, HDS, HSS and MPEG-DASH.
Fastly’s server specs are a highlight, with 24TB of SSD storage, 768GB RAM and 4 x 25 Gigabit Ethernet connections each. This all contributes to some seriously impressive real-world performance figures, including the ability to purge everything in the cache – that’s globally, in every single PoP – in 150ms or less.
The company uses this speed to enable the caching of ‘event-driven’ content. The idea is that even website objects which are updated very frequently – news headlines, stock prices – can be served by the CDN for a short time, then invalidated and reloaded almost as soon as it’s updated on your origin.
The caching flexibility continues with ‘surrogate keys’, a versatile method of tagging, grouping and processing related website objects. You could use this to purge the cache of all the images relating to your latest special offer, for instance, while leaving other content intact. Cloudflare has something similar in its Cache-Tags, but they’re reserved for the Enterprise plan – Fastly gives you surrogate keys as standard.
When you do clear the cache, Fastly works to reduce the impact. Its Origin Shield feature designates a specified PoP to handle requests in the event of a cache miss. If you clear the cache, your shield pulls content from the origin, and other PoPs then access the shield, preventing your server getting hammered by update requests from around the world.
A powerful Image Optimizer is available as an optional add-on. This goes way beyond the simple file and quality optimizations you might get with Cloudflare and others. It can resize images, crop or trim them, change orientation, convert format and more. Tie this all together with Fastly’s Varnish Configuration Language and you can intelligently deal with all kinds of image handling decisions at the edge, for example serving a user a WebP image when you detect they’re using Chrome.
Fastly is a pay-as-you-go service with a $50 (£38) per month minimum charge, and a pricing structure similar to Amazon Cloudfront.
Bandwidth is charged at variable rates, depending on the region. North America and Europe are priced at $0.12 per gigabyte for the first 10TB, Australia and New Zealand are $0.19, Brazil and South Africa are $0.28. Prices drop by around $0.04 per gigabyte for traffic beyond 10TB.
You’re also charged for the total number of requests (the number of files downloaded). Prices range from $0.0075 to $0.016 per 10,000 requests, again depending on region (that’s a flat rate for both HTTP and HTTPS requests).
Fastly provides a simple Pricing Estimator to give you an idea of your monthly bill. Enter your likely bandwidth and number of file requests to see the results.
As you can see from the $50 (£38) minimum charge, Fastly isn’t targeting the smaller site, and if you only need a few hundred gigabytes of traffic you’ll be better off almost anywhere else. But the service becomes far more competitive as your bandwidth rises, particularly above 10TB a month.
Having to guesstimate pricing is always a problem, but Fastly helps a little by offering $50 (£38) of traffic for free. This might translate to 400GB of bandwidth and 200,000 file requests, for example. That’s enough for testing, and if you use it on your site for a few days you’ll also get an idea of future running costs.
Signing up with Fastly takes only a few seconds. Enter your name, company, phone number, email address and password and that’s essentially it (you’re not asked for payment details until your free traffic allowance has been used).
A Create Service button enables configuring your first site. This process starts with entering a name, domain name and IP address (or hostname). Fastly allows setting up a private connection to your origin server using TLS, and provides options to choose your TLS port and define how to verify the TLS certificate.
The configurability and attention to detail continues in the next step, when you set a DNS CNAME record to point traffic to Fastly. This doesn’t just involve copy-and-pasting a single fixed host. Instead you choose a hostname based on your TLS needs, whether HTTP/2 is enabled, whether you’re routing traffic through the US and EU PoPs only (cheaper) or using the entire global network. Check the documentation to see how it works.
Once your new DNS settings have propagated (this might take up to 24 hours, though usually much less), the CDN should kick in. The Stats panel on the dashboard shows you real-time data on cache activity including bandwidth, origin latency, requests, errors and hit ratio, and a world map highlights exactly where your requests are coming from.
Tweaking and configuring Fastly is a very different experience to many CDNs. There are no long lists of simple checkboxes along the lines of ‘click here to turn this feature on/off’. Fastly is far more focused on giving you vast low-level control over service behaviour.
Take GZip compression, for instance. Most CDNs give you access to this as a simple switch. Fastly also allows defining exactly which file extensions and content types you’d like to compress. It has a built-in normalization scheme to ensure GZip doesn’t break some legacy browsers, and you can customize the normalization algorithm if you like.
It’s much the same when it comes to manipulating HTTP headers to customize how your content is served. Instead of point-and-click canned options, Fastly delivers fine-tuned low-level control over what you modify and how, right down to RegEx support to perform find-and-replace operations on header text.
This approach gives you a huge amount of flexibility. An example: suppose your origin server sometimes returns 404 errors, just temporarily. You probably don’t want those to be cached for the full 24 hours, right? With Fastly, you can address the issue by creating a cache object which changes the TTL (time to live) value to five minutes if the system has a received a 404 response code.
Still not enough? Fastly’s caches are based on Varnish, which is fully configurable through Varnish Configuration Language. When you choose options in Fastly’s web dialogs, the service is generating VCL code underneath. But if you prefer, you can view or edit this code manually, or add custom VCL of your own.
As you’ve probably guessed, this isn’t a system for beginners, but more demanding types will love Fastly’s vast configurability. There’s some detailed documentation, too, although even experts might wish it had more examples.
Assessing which is the fastest CDN for you is very difficult, because there are so many variables involved. The locations of your visitors and origin server, the applications you’re using, the type and sizes of the files being cached, and how often they need to be refreshed. Factor in bonus features the CDN might offer, like image optimization, and the only way to find out for sure is to try the service for yourself.
You may be able to get some clues at a site like CDNPerf, which compares CDN response time based on real user monitoring data over billions of tests. It’s only the response time, and tells you nothing about what happens afterwards, so you shouldn’t take this as anything but the most basic indicator. But it’s also the best data we have, and if your CDN needs are simple, it’ll give you some idea of what to expect.
In July 2017 Fastly rated second place for response times in the US, out of a field of 24 (MaxCDN topped the list). UK performance was also excellent, with Fastly achieving equal first place alongside MaxCDN and Level3.
Worldwide speeds are mostly good, with some exceptions. Fastly takes first place in Australia, but is a below-par 16th in India. Comparing performance by continent shows Fastly scoring a mid-range 12th in both Asia and Africa, but delivering notably better results everywhere else.
Fastly is an enterprise-level CDN which gives professional users the power and flexibility to handle almost any situation. You’ll need some knowledge and experience to set it up, though – novices and undemanding users should look elsewhere.