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.
thin start
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.
Hey Greg,
thx a lot for the great review! I’m glad you like my project, specially the codenames 😉
I agree that Thin is just a minor evolution from mongrel for deployment, but it’s the best thing possible w/ the current tools. I hope too that Rubinius changes the game for something better.
@Marc — Thanks for the review and the great work!
UPDATE: I’m now running thin on a closed beta for http://www.just1word.com. We switched over from Mongrel just today and we’re very pleased about the results. I’m sure I’ll have more to come on this.
Hi I had a question about your 1950 setup. We are currently running centos 5.4. with gems installed. We are seeing a performance loss with the setup. Is there a reason why you went with centos 4.6? We did a load test on the vm with only 200 persistant connections and it failed with a load avg of 12. Do you have any tips on how to improve the vm?
Thanks in Advance!
CentOS 5.1 was out, but we had issues getting it installed. We’ve also updated these boxes to VMWare ESXi and gained quite a bit of performance back at the VM level with IO.
As much as I like mongrel/thin, it’s a pain in the ass to monitor. Apache has alot of overhead and is slow. Currently, nginx with Passenger is the best setup for fast rack based apps.