The Great CloudFlare Experiment

A while back, I was toying with the idea of switching my site from AWS’ Cloudfront to CloudFlare. Cloudfront itself is pretty great, but it requires (for my usage, and at the time I set it up, anyway) my domain to be hosted on AWS’ Route53, which basically quadruples the amount of money the site costs to host - up to a whopping ~70c USD/month. By exploiting CloudFlare’s free plan, I could slash that back down, and probably further (since a fair bit of my content almost never changes, so I could exploit very long edge-cache times and cut down on S3 requests as well). Since my router can use CloudFlare for dynamic DNS as well, I basically had nothing to lose by trying it.

Nothing except 200~400ms it seems.

I don’t care enough to change it back, but the TTFB on CloudFlare, even on cache hits, is quite high. I’m not sure if the paid plan brings that down (I would understand if free plan clients were given a lower priority or something), but the TTFB of cache-hits can sometimes be as high as 600ms. That’s pretty high for a short batch of static HTML, and I’m quite sure Cloudfront was never that slow.

Do I care? Well no, not really. My site is still - all things considered - lightning fast, with Pingdom claiming that from the USA, my site is “Faster than 98% of tested sites”, and the primary thing holding me back from a total page load time of under a second in almost all cases is Google Maps’ static API, not anything on my domain. The other thing holding me back, in general, is images I host at Imgur, Flickr, and elsewhere.

Since storage from S3 is relatively cheap and I can again abuse Cloudflare’s (albeit limited, on free plans) Page Rules to set really log edge cache times, I might wind up self-hosting all my images and possibly even the Google Maps images (since I really only use a handful of different locations and they more or less are completely static). It’s utterly hilarious to me that self-hosting images is the fast option, I’ve avoided doing that since the days of 10 and 100mbps server connections, because hosting high-res photos tears through bandwidth. CDNs have really changed things, haven’t they?

Self-caching Google’s map images will present it’s own set of problems - not the least of which I imagine could be copyright, I’ll have to check whether that’s even okay. Once that problem’s solved, the other will be actually doing it, I suspect I’ll have to get my hands dirty and write a Pelican module to do it for me.

Anyway, I think while it’s grossly more expensive for my use case, I have to begrudgingly admit that AWS’s Cloudfront is a slightly better product than Cloudflare’s free offering (is that such a surprise, really?). I’ll stick with CloudFlare for the time being as it does the job well.

Horsham, VIC, Australia fwaggle



Filed under:


Horsham, VIC, Australia

Navigation: Older Entry Newer Entry