tl;dr; The global average response time of serving an image from my NYC DigitalOcean server compared to a CDN is almost 10x.
KeyCDN is a CDN service that I use for side-projects. It's great. It has about ~35 edge locations . I don't know much about how their web servers work but I can't imagine it's much different from the origin server. In principle.
The origin server is my DigitalOcean (6 vCPU, 16 GB RAM, Ubuntu 14) droplet. It's running an up-to-date CloudFlare build of Nginx and the static images are served straight from (SSD) disk with a 4 weeks TTL (
max-age=2419200,public,immutable). The SSL is done with LetsEncrypt and I'm somewhat confident the Nginx is decently configured and uses HTTP/2.
So the CDN, on
songsearch-2916.kxcdn.com, is basically configured to front any requests to
songsear.ch. If the origin has cache-control headers, KeyCDN knows it can hold on to it for a while, but it's not a guarantee that it will for the full time specified in the
cache-control. Either way; how does it compare?
I picked a random static asset URL. It's a 32 KB JPEG file. Its origin URL and its CDN URL are:
Next, I set up a Hyperping monitor on both URLs as
GET requests. For the regions (regions from where Hyperping will do pings from), I picked the following:
(I wish I had selected all 12 possible regions when I started but now it's too late for lazy me)
Then, I let Hyperping
these URLs for a while and behold, here are the numbers:
Average response time:
That's a 10x difference!
Mind you, the "average response time" is across all regions. It doesn't reflect what people get. If 90% of your visitors are from Australia, the average response times would, of course, be very different. But as an example, the origin server is in New York and there, the average response time is 26 ms vs. 105 ms which is a 5x difference.
Here are some screenshots from Hyperping:
KeyCDN's server is clearly fast and worth doing. It's unsurprising that it performs better far away from New York but it's surprising how much faster it is at serving than the origin when pinged from New York (5x difference).
The site is still NOT fronted by a CDN because, apart from the images, almost all content is un-cacheable. However, I need to do more research and experimentation with putting everything behind a CDN and being meticulous with setting
no-cache headers on dynamic stuff and using async tools to invalidate CDN caches when appropriate.