Showing posts with label hoecakes. Show all posts
Showing posts with label hoecakes. Show all posts

Saturday, August 2, 2008

Merb does it again...

Remember in the old days when you'd create what I can only explain as a "temporary session" in Rails to notify someone ONCE on a page of something? It could have been a form validation error, a success, just anything that you needed to toss up to the user temporarily. Still with me?

Merb now has this wonderful "message" implementation which they've hooked onto the redirect method. So, by calling:

redirect '/some/path', "We're gonna need a bigger boat..."


You receive a variable "message" that contains your message (conventional, right?). It's basically marshalled and plopped into the querystring and then deserialized into the var. I really like this over the Rails method...but, following what the Pug says - I'm not pitting merb against rails.

.erawtaolB !lleh eht tahw ,naem I .noitatnemelpmi laivirt a hcus ekil smees siht nehw o/i pu gnitae ,snoisses pmt etaerc ot tnaw uoy od lleh eht yhw si gniyas m'I llA

It's late, I'm wiped out and that's the "best" I could do for humor.

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