Of course, caching static assets is a good way to alleviate the load in your web servers, but in our case the vast majority of traffic comes through our SDKs. As we scale, we are looking at different caching strategies to speed up our API servers in order to increase the throughput our infra can provide.
Caching alone is not enough when you look at speeding up your API services, however. The return values of your endpoints are very likely to change (sometimes very quickly), so the ability to immediately purge those cached values at the CDN edge play an important role in avoiding serving stale data for a long period of time. One of the features we like about Fastly is the instant purging time of the cached assets, which makes it one of the best CDNs out there when it comes to caching APIs. Solutions like CloudFront are less ideal in this case because their purging periods vary from 5 to 15 minutes. We also evaluated MaxCDN, which failed to match such a fast purging speed at the time, though they seem to be moving in that direction now.
In order to reduce the friction of interfacing with Fastly from Java, we contributed with a tiny Open Source wrapper for their API, which can be found in Github.
Take a look and let us know what you think—feedback and feature requests are always welcome.
And if this type of work interests you, we are always looking for great engineers to help us solve complex problems. Check out our job openings to learn more.