Update: Thin, Mongrel and all of the variants have been replaced by a much better solution.
The Quick Background
First there was Zed’s excellent (and much appreciated) baseline work that establish Mongrel as the front runner in ruby hosting. Something I’ve been using for well over a year in production behind nginx. From that baseline evolved a few hacks: Evented Mongrel and Swiftiply Proxy.
The problem is that they were just that — Hacks that monkey patched the source code. Bye-bye needed updates. As much as I liked the perf gains from running them, it was not a great production solution.
Enter the Geneticist
So late last year Marc-Andre Cournoyer starting playing around doing what I’ve wanted to, but owning a business and raising a family, didn’t have time to do. He made event driven Mongrel a practical solution for production hosting. Enter the world of Thin –it takes the best of Mongrel, Event Machine & Rack, mashes them together and poof we have a new contender. Check out the specs on the official website.
It’s getting good community traction too. We’ve seen 8 versions since early January and a big uptake in the Google group.
I’ve been using it in development and staging with great success. With Mongrel, I could run 2-3 hours and then restart in development mode. With Thin, I’ve actually run 16+ with no notice of slowdown. The memory footprint on this is also much smaller than Mongrel. That’s a nice side effect.
As a testament, I’m actively building out identical Dell PowerEdge 1950 8 core Xeon boxes (2 procs x 4 cores each). They are running 8 CentOS 4.6 VMs under VMWare with nginx load balancing to 10 Thin clustered servers on each VM. 160 Thin instances makes for some serious Rails and Merb hosting. Ok, I’ll stop glowing and shut the fuck up.
Note: I tried CentOS 5.1 first. The support just isn’t there yet as I kept hitting walls with VMWare. Stick with 4.6.
Installation & Usage
Minimum Requirements include either Ruby 1.86 or 1.9. Love that last bit about 1.9.
sudo gem install thin
If you are running in dev mode on your local machine, it’s easy.
As the gem is still adding features, check out the official docs for setup in production environments. We’re monitoring these with Monit incase of failure.
Wait! Coding in Ruby is Enjoyable, why isn’t Hosting?
Of course it is! Just look at these great code names for the releases:
0.6.4 – Sexy Lobster
0.6.3 – Ninja Cookie
0.6.2 – Rambo
0.6.1 – Cheesecake
0.5.4 – Flying Mustard*
0.5.3 – Purple Yogurt
0.5.2 – Cheezburger
0.5.1 – LOLCAT
*That’s my favorite.
So it’s not THAT enjoyable. Keep reading.
Where Do We Go From Here?
While this is much better than what we’ve had to date, I still consider this a minor evolution in Ruby hosting while we wait for a better solution. I believe that the next revolution is coming with Rubinius, it’s just no where near ready for prime-time yet.
Can you say multi-threaded Ruby with direct Apache support? Engine Yard is betting their business on it.