Blistering speed is paramount at Beamly, and we’re always looking for ways to shave milliseconds off our API response times.
A major factor in helping us to achieve this has been our use of a CDN for all traffic. We used Amazon Cloudfront when we first launched, but as we’ve grown have found it lacking in a number of areas:
- Invalidations: It can take up 15 minutes to invalidate an object, and every object must be invalidated individually
- Configuration: Over and above routing different paths to a set of backends, there’s very little manipulation you can perform
- HTTP Verb Support: Up until recently only supported a handful of HTTP verbs, limiting the APIs we could route via it
- Monitoring: Again up until recently Cloudwatch provided no metrics, and was limited to dumping gzipped log files in an S3 bucket, providing almost no insight and making it difficult to optimise
- Cost: We were also fed up of having to stump up $1200 a month to use custom SSL certs ($600 per certificate, but we rebranded from Zeebox to Beamly back in April and most of our API calls still go via the old domain)
We’d been evaluating a number of alternate CDNs for a while, but Fastly stood out: Not only were latencies almost half of AWS for some regions (most notably Australia), but purges are instant, they provided live, per second analytics, have a solid API, but the jewel in the crown is the ability to upload custom VCL (Varnish configuration language).
We’ve used Varnish as a reverse proxy from the very beginning and have found it instrumental in not only helping to massively improve our cache hit rate but also being able to seamlessly manipulate requests from old or buggy clients on the fly. Now not only could we do this at the edge but we could version this configuration along with our code: We can add random hacks that help us deprecate old API versions at the edge and deploy this custom VCL as part of our pipeline.
We’ d been incrementally moving services over to Fastly over the last few weeks, but following the global cloudfront outage on November 27th we redoubled efforts and ditched it entirely.
We’re delighted with the speed, flexibility, and the support team at Fastly, but one of the only things on my wishlist was a summary of all services and key statistics: Luckily the Fastly API allowed us to rustle up something pretty quickly, so we’re happy to share it: fastlydash (available on github) is a simple python script that will generate an HTML summary of all your Fastly services and upload it to S3: We hope someone else finds it useful: pull requests welcome!