I switched my blog over to use CloudFlare today. I'll be honest, most of the reason for trying it out was curiosity into what it was exactly. My site handled the load from being on the top of ycombinator on a single heroku dyno without wincing, so to be honest, CloudFlare couldn't have offered me much. It was a total curiosity decision, not a business one.
What is a CDN? CloudFlare's CDN Architecture
Skip this section if you already know.
I'm going to use the word 'CDN' a lot in this post. If you don't know what a CDN is, it's a caching service. Say you have a file on your site, like I have my css for this site right here: http://jeffdickey.info/assets/application.css
If you access my CDN (assets.jeffdickey.info) you download it through the CDN instead of my server: http://assets.jeffdickey.info/assets/application.css
Same file, it's just going through the CDN, the CDN gets the file from my server, then the CDN delivers that to you. If a lot of people are requesting the file at the same time, it just hangs onto it so my server doesn't get pinged.
And the CDN is a zillion times faster than my web server.
So it offloads the work of my server, scales limitlessly (for all intensive purposes), and makes the site super fast. It's a win for everyone.
That's with Amazon's CloudFront (way too similar of a name) which is a much more traditional CDN, CloudFlare is different. So, onto my CloudFlare experience:
Now I recklessly reconfigured everything
What is CloudFlare? This was my big question. I watched their 5 minute intro video, and didn't learn a damn thing. It was pretty (I liked the evil devil dude!) but honestly, I didn't learn a thing. There was mention about the server going offline and the site staying live, spam prevention, SEO enhancement and other things, but I felt like they were offering all these great things without anything to back it up.
So then I had 2 options, either read some copy, or say "fuck it, we'll do it live". You can safely assume what I did next.
I had no clue what I was doing. It became clear to me though, that all CloudFlare really does is replace your DNS server. Then magic.
The setup process is insanely good. Easy signup form, you point CloudFlare to your current host, it finds all your DNS info, you just look through it, make sure it looks good, then you mark which ones you want 'CloudFlare optimized' (whatever that is) and change your nameservers over. It's so well done, anyone could do it.
I'm not sure I've ever had so much fun with setting up an architecture component in my life.
Alright, so hopefully I learned something
I got an email a few minutes later letting me know my nameservers had switched over. I reset my DNS, checked out my site, it was still running, and immediately was wondering what the hell I did.
I think this is really where it differentiates itself from other CDNs. All the CDNs I know of you have to setup a different server, you can CNAME it so it's like assets.yourdomain.com, but you can't have the CDN and the content both running on the same host. The benefit here is that it's super easy to setup. You don't even have to think about it at all. The minification on top of that is huge. I remember I spent quite a bit of time working on the minification part of a build process for a major CMS. It kills me that kids these days can click a button to minify their shit.
After I did a bit of research, this whole thing was a freaking accident. That's hilarious.
There is a few other cool features, I really like how it shows me how much the CDN is actually saving me in bandwidth and things as well.
Some of the cool ones:
- It can munge the email addresses on a site so that email scrapers can't find them
- Purty analytics showing how well the site and CloudFlare is doing
- Can cache with or without querystring params (I don't think any other CDN does that)
- Preloader can preload 200 of your most accessed content (requires paid account)
- IP geolocation in the HTTP headers
- Can warn you if google analytics isn't working correctly
Another big plus, there is 0 vendor lock-in here. You can easily migrate to any other CDN. Nothing I have done I feel like has been permanent to my project.
CloudFlare won't help many sites with scaling issues. It helps with static files and front-end performance, but can't do anything to scale your application tier. That's okay, it's impossible for them to do that reliably anyways. If you're on a CDN and you're having scaling issues, CloudFlare will not help you.
I also feel super uncomfortable with this whole thing. There just feels like way too much magic for me. Everything about it just screams snake oil to me. It appears to not be snake oil, but something is off. It might be the loss of control, it might be the copy, it might be just that CloudFlare does so much for free. I'm not sure.
How does CloudFlare handle caching? I have the hash of my static content embedded in the filename, so invalidation isn't a problem for me, but what if I didn't? How and how long does it take to get a new version of a cached file? What exactly happens if my server goes down? I clicked a checkbox that will keep it up, but what the hell does that actually do? If the server 500's it shows an old version?
Will it work with S3? Maybe that's a specific question, but I'm still using CloudFront for my S3 assets.
Is it fast?
Too hard to tell. My site is already pretty freaking fast, and I was already using a CDN. CloudFlare is a good first CDN, because it's easy to configure. If you're on another one, I see no reason to come over to CloudFlare.
Looking at others tests, this seems to agree with what I said. Those that weren't on a CDN were amazed at how fast it made their site (well, duh) and those that were on a different CDN were disappointed at CloudFlare.
Who the hell are these 'big guys' and what 'tools' do they have?
This sort of bothers me, on CloudFront's twitter, they state:
CloudFlare brings the performance and security tools previously reserved for the Internet giants to the rest of the web for free.
But what? I have no clue what performance and security tools they're even talking about here. I don't have much else to add to that, it just confuses me.
CloudFlare works. I was really apprehensive about it at first. Although I think that I am not the target market, I think webmasters with less of a technical background would only be more apprehensive. It almost seems too good to be true. They say on their site though:
On average, a website on CloudFlare
- loads twice as fast
- uses 60% less bandwidth
- has 65% fewer requests
- is way more secure
All for free!
It's not snake oil. I bet you could even get better numbers than that on a popular site. We all know CDNs are great. I rarely setup any site where I don't use one. CloudFlare just found a way to let essentially anyone set one up. Then they throw on a couple more awesome features on top of that. There are some drawbacks, but the fact that it's... you know... free... and has absolutely no vendor lock-in, there is no reason I can think of you shouldn't use it.
To CloudFlare: Please put more of the 'how' in your copy. Could just be a link or something, but if you're going to say something is faster, or safer, or better, I'm never going to believe you until you can prove it.
EDIT: In editing this article, CloudFlare's site
actually went down for me. Doesn't add a ton of reassurance for me, but
my site is fine. They do claim 5 nines of availability. (99.999%)