I have written before of my ongoing obsession with website performance, particularly when it comes to this website. I’ve put some effort into making it fast and reducing its footprint. Indeed, I often just sit and think about the things I might be able do to shave further milliseconds off its load times.1
You wouldn’t think it would matter. After all, this is a website that, on a good day, might see a hundred page views. So why would I bother?
It’s the intellectual challenge that drives me. I’m curious about the mechanics of networking and the complexities of performance tuning. There’s also the small matter of my pride to consider. When I write about website performance it would be ridiculous if my own didn’t perform well.
I recently switched to a new host because I saw the potential for a performance boost and, this past week, I’ve moved my DNS over to CloudFlare to draw on the benefits of a CDN.
Was it worth it? Hell yes!
The purpose of a CDN is to distribute content from the origin server2 to a series of geographically diverse edge servers.3 Why?
My origin server is physically located in England. When I browse my website there are only a small number of “hops” to the server, so I see content delivery speeds in the sub-500ms range. However, the network stack of a user in, say, San Francisco, has to negotiate a journey around half the planet if she is to read my rambling words. With more network hops to negotiate, each introducing a little latency, her browsing on the Perpetual βeta would be somewhat slower than mine.4
The situation changes with a CDN in place. My user in San Francisco won’t necessarily connect to my server at all. She might connect instead to a server in, for example, Los Angeles. She will definitely connect to a server that is physically closer to her location than the origin server. The number of network hops is fewer, the latency is lower and her browsing is faster.
There are other benefits to a CDN: reduced load on the origin server; increased survivability, increased security, increased scalability…
Another cool thing I’ve got with CloudFlare is that this website now supports SPDY.™ This is a next generation web-transport protocol “with particular goals of reducing web page load latency and improving web security,” according to the Wikipedia entry on the topic. It goes on to say:
“SPDY achieves reduced latency through compression, multiplexing, and prioritization although this depends on a combination of network and website deployment conditions.”
Browser support for SPDY is good and improving, so it’s nice to know that I am able to use this to further my performance goals.
I’ll end with another pretty picture: