How I Made my Blog 2.3x Faster
blog.alexbrowne.info
blog.alexbrowne.info
I know HN loves these frameworks, but seriously, the JVM is waaay faster... Too bad there wasn't a dead simple JVM or Java based blog engine.
Any time you're serving up gzipped static pages instead of loading any language runtime, JVM or not, you're going to see huge speedups.
Better?
First of all, the language syntax is awful and incomprehensible.
Then there's the Byzantine deployment process (although, to be fair, it seems endemic to modern web development; it's just more obvious in Ruby since most Ruby programs are web apps).
Finally, the startup for a Ruby application is incredibly slow -- worse than Java ever was, even in the Bad Old Days running 1.2 on a 300-ish MHz Pentium II (which was a state-of-the-art desktop at the time).
Hint: If someone makes a post to the Github issue tracker for your web application saying "Increase timeout from 30 seconds to 300 seconds" [1], a one-line patch changing a number from 30 to 300 does not count as solving the problem. There is no reason that a web app should ever have an expected load time greater than 30 seconds.
The only user generated content on a blog are usually comments. With just a bit of added caching headers, I'd say that 99+% of all page hits on a blog can be served out of Varnish. You can even use rack-cache if you don't mind the performance penalty. If you're ok with using e.g. Disqus (as Octopress does) for comments, you can serve 100% of them and just purge the cache when adding new content. This would probably also work when doing a purge for new comments. This way, you have to do the dynamic computation exactly once per page and you're done.
Adding the CDN properties of cloudfront to S3 is nice, but Cloudflare seems to provide a very similar solution for "regular" sites.
I'd say this is similar to comparing AOT compilation (Jekyll) vs JIT (dynamic generation + caching).
I still have a Github.com pages account that uses Jekyll because its free, but since its so damn cheap I may convert this to AWS stack as well.
The largest problem I was running into was permissions and invalidating the CF CDN. I am thinking of rolling a simple Markdown editor using node-webkit and scripting up some things to automate everything.
BTW, I meant the PageSpeed Service for GAE [1], which seems like it's basically CloudFlare running mod_pagespeed on all requests.
[1] https://developers.google.com/appengine/docs/adminconsole/pe...
My main use case was a CDN, as I'm not sure if Google pushes the GAE files to various locations.
GAE edge caching is poorly documented, here's what I've found so far:
[1] https://groups.google.com/forum/#!topic/google-appengine/6xA...
[2] https://code.google.com/p/googleappengine/issues/detail?id=2...
[3] https://groups.google.com/forum/#!msg/google-appengine/8QgEU...
[4] https://groups.google.com/d/msg/google-appengine/8QgEUBOiNFw...
Blogger was static too. It was just a cloud based DB. You gave it an FTP name/pass and it logged into your site and uploaded the new files.
Maybe that can be Web 4.0 - Any ideas for Web 5.0? ;)
The key part is that, for public content (and blog posts tend to be public), the Rack Cache can be used to serve these pages directly from the cache store (usually Memcache) with minor database traffic needed, even for people who have never seen this content.
That last part was the surprise for me - surely ETags are only used by return visitors! Rack Cache makes ETags work for new visitors too.
I think I can get my blog to run almost as fast as a static site, and I'm working towards getting that done and documenting it as I go.
(In addition, Heroku seems to be adding Varnish headers to my responses. They say they don't use Varnish in Cedar apps, but this is clearly not correct)
Sure, my site is just "my stuff", quotes and links I collect, maybe a rambling here and there. Therefore my comment is not quite on-topic, it's not the same kind/league of site. But I just can't find anything exciting in pure speed, I want something that I like when I look at it and use it, not something I like because I know it's very popular. I like having variable and filterable views on content, user preferences, etc. too much.
I don't want to pretend I'm some kind of artist; I'm a shoddy coder, and not a great designer either. My CMS is unusable for anyone except me I'm sure. But still I take pride and enjoyment in whatever it is I'm doing, and at the very least I would encourage everyone to make something that is about ideas and features more than performance, even if as a secondary/private site. Minimalism is sometimes overrated. It may be more effective when dealing with many people, but it's also a bit sterile. So maybe do both, one for business, the other for inspiration.
Also, the document itself is just one fairly small piece of the whole puzzle.
Maybe it's just me?
(I know it's a pretty hefty post, hence the tl;dr at the top. No one is forcing you or even asking you to read the whole thing)
As someone who lives in South America I've gotten used to sites loading in 2+ seconds, but this one feels almost instantaneous.