Geography in web page performance
New year, new possibilities, as we say in Norway. Which is why I have relaunched my blog using Gatsby.js. I could write a blog post about that, but I am not going to do that today. There is a lot of tutorials on how to set up Gatsby with Drupal (one of my personal favorites is this one from Lullabot), and there is even an official page in the Gatsby.js documentation.
I could probably write many blog posts about different aspects I tweaked and looked at in the migration, but one field I feel is not often talked about is geography and performance.
With regards to servers, many Drupal sites (at least basic ones) are probably geographically limited by the actual server that is supposed to serve the web requests, and the location of this particular server. With a static site, made for example with Gatsby.js, you can deploy it to a Content Delivery Network (CDN) and have the same static html files on servers all around the world. This could mean that a website visitor from Tokyo to your static site could get a response from a server in Tokyo. The traditional Drupal site however might be on a server in Ireland, and then a visitor from Tokyo would quite often have to send their request all around the world to get responses.
This idea is not very new. In fact, there are several providers that let's you deploy your static site on their CDN for free (more or less). They will then serve your static HTML from different parts of the world, depending on the visitor. What a world to live in. But instead of comparing their service and the user experience of deploying, I decided to compare them by which ones were being performant from all parts of the world. A geographic performance cup if you like.
The competitors in the cup are:
- Surge.sh
- Zeit Now
- Netlify
- S3 with Cloudfront (a service from Amazon Web Services - AWS)
Instead of doing a very long analysis, let's just start with the results!
The fastest service is S3 with Cloudfront. S3 is a static file storage, and Cloudfront is the CDN service from Amazon.
In the same way I could write many things about my migration to Gatsby, I could also speculate and write many things about this result. Instead I want to just show some animated gifs about interesting aspects of the different geography results for the providers. I am going to do them in reverse order, best result last.
Fourth place: Surge.sh:
Third place: Netlify:
Then, slightly behind on second place, Zeit Now:
Lastly, the winner, here is AWS S3 with Cloudfront:
Conclusions and reflections
The numbers are one thing, but let's talk a bit about their significance. The tests were performed from AWS datacenters, and the 2 services scoring highest is either an AWS service (S3/Cloudfront), or uses AWS for their service (Zeit Now). Meaning the actual numbers does not necessarily mean that Netlify is 144% slower than S3/Cloudfront. It also does not mean I think any of these services have been proven to be better or worse than others.
I think it means that now that we are able to serve static HTML pages for our blogs or websites in a somewhat dynamic way, we can make the performance more democratic and less unfair. I don't want to discriminate readers of my blog based on their location (or anything else for that matter). Performance matters, but performance also differs from different parts of the world.
I guess what I am trying to say is: Let's make the world a better place by thinking about everyone that lives there, no matter where they live. So I will finish this post with an animated gif about just that. The world.