Okay, it's a bit of an exaggeration to say [varnish][1] changed my life, but it sure did change the speed of my site!
I got from a rotten 6 requests per second with WordPress to a whopping 9500! If you're on Linux and running Apache, installing varnish is a breeze! Especially if you're hosting a well cacheable site like a blog.
[1]: http://varnish-cache.org/
~
I'm running on a Linux Debian virtual server (provided by [Kabisa][2]) with 1 VCPU core and 512MB of memory. Nothing fancy.
Before I was running Apache 2 with PHP and WordPress. Doing the occasional test this gave me (uncached) a performance of about 6 request/second (using apache's `ab` with 10 concurrent connections). With some caching plugins I was able to crank that up to about 15-20 requests a second.
After upgrading my blog to Toto, I got quite a boost to about 30 requests/second. But, my blog doesn't contain any dynamic elements any more and Toto + Rack give you all the handles to implement caching (ETags, Cache-Control headers, etc.). FYI: I'm running Apache2 + Passenger to run Toto.
Since I heard about Varnish a few times before I decided to give it a try and `apt-get install varnish`'ed it on my Debian box (I'm running `squeeze`, thank you).
Now I have a few other sites running on my vps which I don't want to cache just yet. The problem was how do I tell Varnish to only cache ariejan.net, and skip the rest.
Here's the entire configuration for Varnish to accomplish just that:
Yes, that is just two lines! What this does is forward everything you throw at varnish to the server at port 8080. The `vcl_recv` makes sure that if the hostname does not include ariejan.net varnish passes the request forward - no caching.
The second thing I had to do was configure Apache to listen on port 8080 instead of 80 in `/etc/apache2/ports.conf`. Then also make sure to have all your virtual hosts (even those you don't want cached) configured for port 8080 too in `/etc/apache2/sites-available`
Restart apache, restart varnish and you're golden!
When I first ran my `ab` benchmark with 10 concurrent connections I got to about 150 requests per second. But when I really pushed it to a 1000 concurrent connections (`ab` couldn't handle more), I got to a whopping 9500 requests per seconds doing 60k requests! That is **epic**! Oh, and my VPS didn't even break a sweat - system load got up to 1.08 for second or so.