Serving Q42.com images from a CDN with Google Cloud Storage

As you may know, the Q42 site has been running on Meteor since early 2013. We published the source code and wrote a blog post introducing it which was pretty well received.

Meteor is an interesting platform but it comes with its own set of challenges. One of those challenges is getting the page loaded as soon as possible and making sure assets (like images, videos, etc) are served as quickly as possible. Since the Q42 site is hosted with Meteor’s default hosting at meteor.com, we felt this could be faster.

As luck would have it, we happen to have some experience with serving assets fast using third parties since we use Google App Engine quite a bit in client work. So we decided to try serving the Q42 site’s assets from the Google Cloud Platform’s Cloud Storage.

It turns out this is really easy to set up — we had it working in about five minutes. Here’s a quick guide on how to do it by fellow Dutchman Maarten-Jan Kallen. And here’s a basic overview of the technical layout of Cloud Storage buckets by Google.

So now all the assets on the Q42 site are served from the Google CDN! And you don’t even know it, because Google was nice enough to let us map the server address to http://static.q42.nl. It’s just faster.

You can take a look at our updated deploy script for the site on Github — one of the things we realised we had to take care of was making sure the /public Meteor folder no longer gets deployed to the site, since we don’t need it there anymore. It’s still relevant for local development, however, so we’re keeping it in the repository.

So what were the results of doing this? The most obvious one is that the Q42 site feels a lot faster now — images and other assets arrive within less than 100 milliseconds where before, hosted on Meteor, they would take a little longer. Also, by excluding the /public folder, deploying to meteor.com is a lot faster since the tarball that gets uploaded is significantly smaller.

Mostly though it was just fun to figure out how to get Cloud Storage up and running while still being able to keep our rad new Meteor setup. It worked and only took a few hours of work on a Friday evening.


Check out our Engineering Blog for more in-depth articles on pragmatic code for happy users!