Sunday, April 27, 2008

thin, mongrel, evented mongrel and...Rodan?

I doubt I'll single-handedly spread the word about the caveats of using event-driven web servers (thin, evented mongrel), but I can at least give people Googling something that they may stumble upon while doing research. I want to keep it short and sweet.

If you're going to run an event-driven web server like thin or evented mongrel you have got to be careful about any requests that could run "long". File uploads, reports, and long atomic updates could leave your event chains blocked until they complete.

What this post is not...
1. It's not about Rodan, I'm just crazy and felt like putting that in the title; get over it.
2. It's not about why thin is better than mongrel or why mongrel is better than thin.

What this post is about weighing the options between these two great web servers so that you can make the right decision.

So, a couple things...
1. I use thin. And it is awesome. And I am lucky that I can use it on a site that has little "blips" for requests. So it hauls complete and utter ass.
2. I also use mongrel. And it too is awesome. And in this particular case, I DO have some long-running requests.

So what does it come down to - just educate yourself on the right tool for the right job. Don't jump ship on something just because it's the new, hip thing. I did just that when thin first started making ripples and then once site volume picked up, *poof* my requests sat in la-la land just waiting to be picked up. Anyone having flashbacks to when they were 13 waiting for their Mother to come pick them up from the mall?

I hate to jump around, but it's just how I write...I'm getting better[?]. Thin has support (oh and merb does too) to defer any long-running requests. So, as long as you're willing to configure thin and tell it which controler:action to defer to a threaded model you'll keep on servin' up those hoe-cakes just as fast as the surfer requests'em. WTF?

I should give the love here as to what triggered this post - the fine folks over at softies on rails had a quickie about thin and mongrel.
So please, weigh the differences - neither of these fantastic ruby-based servers should get any flame for under-achieving if you misuse them.

Related links...http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin
Strengthening the Ruby Ecosystem II: Merb

No comments: