It was a news story that got a little lost around Christmas due to the news about Carrie Fisher coming out at the same time. But for those into their literature, the famed author of Watership Down, Richard Adams passed away on Christmas Eve. A terribly sad bit of news, especially to come at that time of year. However, if you’re wondering there is a connection between this and the rest of this blog post. Tucked away on one of the obituary articles was a link to a very old site I still host for someone. All of a sudden, traffic levels hitting what is still a single personal server unexpectedly leapt about 10 fold for a few hours. And yet the server coped perfectly fine, mainly thanks to Cloudflare taking the strain instead.
Cloudflare is a distributed Content Delivery Network designed to sit almost transparently over the top of a website. It’s something I add to the majority of things I host personally now, although oddly it’s one of those things I’ve always struggled to get any commercial buy-in on despite the benefits to it. As I was putting my sites on a low power server without the fastest internet connection ever, the fact Cloudflare were providing a service which can offload and cache large amounts of the content without even hitting the underlying server, and additionally providing that for FREE just seemed madness not to look at – and despite rumours of my tight Northern roots, I assure you the word FREE was only a 60% factor in my consideration. Indeed about the only reason I could ever see not to use the caching feature would be if you had lots of dynamic content, or a lot of server-side dependent statistics and were more worried about numbers which look good on a spreadsheet than the actual site being snappy. Both of those can be worked around, but it’s less of a ‘flick a switch’ operation.
But even if hypothetically you avoid the caching level stuff, just the DNS services are not to be sniffed at. As this is again a free part of the service, it means it’s suddenly very easy to ditch using the default DNS most domain registrars provide. Particularly useful if you have someone who sells their domain names really cheaply, but who has a control panel that’s about as useful as toffee as a result.
Two very useful things come in with the DNS beyond what you’ll normally find in the control panels of most registrars. Firstly, they have a built in ability to ‘flatten cnames at the root’, or they word it something like that. Essentially if you’ve ever had to move a server you’ll know the pain of having to update the IP address on 20 A records for every domain pointed to that server. Imagine being able to point all those domains to a common CNAME record, have that CNAME pointed to the IP, then just changing the IP in one location if you ever need to move. It’s a fantastic timesaver, and particularly useful if ever dealing with third parties who insist on maintaining their domain records themselves, but who struggle to change IPs when asked, as you don’t even have to wait for them to do it as long as you’re in control of where the CNAME points. Whilst this is always possible on any subdomain, it’s normally not possible to do it on the ‘root’ domain without issues though. Cloudflare came up with their own bespoke solution. I wont pretend to fully understand how it works – It just works!
On top of that, they allow very short TTLs on all the DNS record changes, to the extent of having it propagate changes within a few minutes. When you combine the ability to change a single IP and have every CNAME pointed to it with such a short time window on changes, it’s actually entirely possible to have a lower cost backup server inplace which can be switched over to really quickly if something happens with a main server. This is the setup I have in place – if my main server goes offline and it doesn’t look like I’ll be able to bring it back within a few minutes, I can just jump into Cloudflare’s control panel, swap an A record in one place, and all my personal sites and all email are switched over in minutes to a second server I have running at a separate location. I then just run a live sync over to the second server every morning to keep data reasonably similar.
If you’re not already using it and can’t think of a very good reason to use it, then get in there:- http://www.cloudflare.com