More Blog Optimization
About four years ago, I did some optimization on the blog, drastically speeding up load times. Since then, I’ve made some more changes that helped even more. I’ll outline them here.
1/ I installed nginx and started using it as my primary webserver instead of apache httpd. Apache is great and easy to set up, but nginx is basically as easy these days and is much higher performance from what I’ve read and experienced.
2/ I installed php-fpm. One downside of nginx compared to apache is it doesn’t have a super-easy-to-install mod_php-like plugin, so this meant I needed a standalone php interpretter. I hooked up nginx to php-fpm following steps similar to these (I don’t remember which guide I actually consulted).
3/ I stopped using Memcache. Blasphemous, since I’m on the Memcache Team at Facebook, right? Not really. My blog runs on a single server, not across thousands. Memcached is high performance in a distributed system, but keeping everything within a process (eg, the php process) is even better. Instead, I’m now using an exclusively APC-based cache that is working better than the memcache-based cache.
These days, pages seem to generate in about a quarter second which is pretty hard to beat. The next step I’ll take will probably be installing hhvm, which recently got fastcgi support added. Maybe tenth-of-a-second load times are possible?