The Ease of Making Your Site Faster on Fastly (an Amazing CDN)
Performance is king. Despite that I’ve got this blog on some pretty ancient under-powered equipment. The first server was a 10 year old HP desktop with 2 gigs of RAM sitting in my garage. The new one is pretty old too, although a bit more powerful. That being said I knew I wanted this blog on Fastly. Between the protection from Layer 3 and 4 attacks and their impressive performance it was something that I had to do. And it was so easy I still shake my head at times . . .
It is all very simple, and there were a few other basic steps I did along the way. For starters you sign up for Fastly. They buy bandwidth in huge volumes, so odds are they can handle your traffic cheaper than you would out of your normal data center. And it is so simple – two steps, or three if you are disciplined and test everything before making changes.
Once signed up, you answer 3 straightforward questions:
- Name the service. So you can recognize it in the UI.
- What domain will be pointed to Fastly. So it could be a single domain like blog.ericburnsonline.com or even a wildcard like *.ericburnsonline.com. Whatever traffic matches the domain name will be routed to this service and follow whatever additional rules you choose to configure. (And those rules can almost always be done via the UI. Or you can leverage VCL if you want.)
- What is the IP Address or Hostname of the origin where Fastly should go to get content it doesn’t already have in its cache.
From there you can test using an easy DNS trick. They’ve got the link in the UI and like everything else it is clear and simple. Testing isn’t required here, but I’ve learned to always test everything. You can also test with curl commands or by changing your own DNS but that goes beyond the scope for this posting.
Once you know your site is working it is just a matter of changing your DNS to match the entries Fastly provides. They use these patterns to decide where to route your traffic. So if you don’t have customers in areas where bandwidth is more expensive you can route everything to the main locations (US and EMEA) with the lowest costs. More of that visibility and control – where are your customers coming from, and is it worthwhile to spend more money on even quicker performance?
I did do two additional steps in setting up my blog on Fastly. Since this is a WordPress blog I leveraged the WordPress plugin that automatically does a specific purge when content changes. So if I add a new post it purges the main page plus the one for the current month. If a user adds a comment? Just that page is purged. Did I change the theme? All the html (but none of the images) gets purged! So when the next user requests the newer material Fastly goes to my server and grabs it once. (Can you get any more “Event Driven” than that?)
The other step that I did was to leverage Fastly’s public-ip-list to program my firewall to only accept web connections from Fastly and my own IP range. I know that “security through obscurity” is a fallacy, but it would be challenging for an attacker to figure out my IP address and do a DDoS attack against my server. I’m not a big enough target anyway. And if you are in certain data centers it is possible to get a direct connection to Fastly’s equipment – shielding you from an origin targeted DDoS attack.
You might note that I called Fastly an amazing CDN. Not all CDNs are the same. There’s a “modern” one out there that claims to be make your sites “faster” – but by default doesn’t cache html. It is true that images and JavaScript can take up a lot of time to download. But if you still have to go back to origin (the actual server) for the html you’ll never be as fast or dependable as Fastly. (Mull over the chart above while you think about the implications of not caching HTML.)
And I interviewed at another CDN that was on built on SSDs like Fastly. Their website claimed real-time operations and instant configuration. I asked how fast they could purge content or push out configs to all their servers. His response was “Listen – all CDNs deliver basically the same thing when it comes to performance for items like that.” But he wasn’t willing to give me performance metrics without signing an NDA. An NDA? Fastly will gladly tell you how quickly you can purge content – and it is so fast you can cache content you wouldn’t be able to cache on any other CDN. (Read the Hotel Tonight case study for a great example!)
Fastly pioneered the concept of Event Driven Content, and as far as I know no one else has the same level of performance that allows you to actually cache that kind of content. Only static content can be cached on the other players. Besides purging content globally in milliseconds, you can also roll out configuration changes worldwide in seconds. And the logs are as close to real time as you can get. Visibility and Control. No one provides it like Fastly.