Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

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

Monday, April 7, 2008

Rails Cast hits 11, err 100.

Pretty cool little contest going on over at railstcasts. There's even an 8Gb iPod touch up for grabs...I've got my tips picked out already, of course, the tricky part is going to be blogging about them.

I encourage anyone who knows anything about Rails to post something, hopefully this contest has a great turnout and the community as a whole will benefit from some of the minds that aren't exactly "mainstream" (The Dr. Nic's, Fowlers, etc...). Not that there's anything wrong with them, I just think the more insight into this framework the better.

Good luck trying to get my iPod!


MINE!

Sunday, March 16, 2008

Oh Noes, Your Business is Under Attack!

A somewhat interesting link came through my RSS reader this morning, it wasn't the well articulated basis of this gentleman's argument, nor was it the catchy title. What really made me think (and laugh) was the first post by a man named Will, who apparently works for the aforementioned company "waging war" upon Ruby/Rails.

I think it speaks volumes if you or the company you work for really has to dive into some random persons personal blog and begin defending yourself when all this guy is doing is giving an opinion. You're putting out a competing product (uh, sure!) and that's great...some will use it many will not. But it really makes me shake my head (knowing some people who work at Zend personally) when I see a Zend'er come out with the gloves up just clutching and grabbing for some traction on their products worth.

Really, if your product was worth a damn in the first place you'd likely have 9 other posts to this one touting the grace and power your product encapsulates. Instead, you put those gloves up because you know you have put out an inferior product and are trying not to be the last kid picked.

Finally, I must admit here that "Will" (IF that IS your REAL name...haha) does a good job of playing the diplomat, trying not to insult the blogger's intelligence and still keep him as a potential client (although, from the sounds of it, he's made his decision).

It's really great to have passion (see my last post) but sometimes you can't let that get in the way of what people outside your click think. Let them have it, if you're right, well then they'll all see in the end when you succeed.

Wednesday, February 6, 2008

Attachment Mania

I'm sitting face to face with a problem...

That problem being the ability to add an attachment to a "message" of sorts. Think of it as attaching a file to a forum post...except not everyone should have access to this file. And we need to do this with Ruby on Rails.

So what do we need?

Well, first and foremost I suggest we create a directory which sits outside the rails app itself. Say:
/var/myapp/attachments

Brad, why in the hell do you want to do that?


Simple, these are very private files which are going to be stored. No one should be able to just key-up the path in the browser to get to them. It will save me the lawsuit and bandwidth.

The second thing we need is to free up mongrel from serving up any static files. Let mongrel handle requests for rails but let nginx handle the static file response. This little nugget will allow us to do such a thing from rails in a clear, concise manner.

The last thing we need is to alter our capistrano script to not whipe our cache of attachments each time we deploy a new version of our rails application.

I'll post a response with my findings, if anyone has any suggestions...well, you know where to post.

Application Throughput is for Closers Only

After reading a few informative posts and some statistics on application deployments and their performance with rails and the growing number of available proxies/webservers, I thought I'd take my shot at putting something fast together on a not-so beefy machine.

Read this article first and then this (Thin), this (Garbage Collection in Rails) and then this (Rails Routing).

Ok, ok, you probably didn't reall all of those...but at least read the first one. My goal is to try to bake all these together with an app that will actually do something outside of "hello, world" and see what type of performance I can juice out of an Ubuntu (Gibbon) box running on a 1.8Ghz AMD and 1.5Gb RAM. I have a fairly lightweight financial management application I've built on rails that is a perfect candidate for this type of experiment.

What's going to be involved? Nginx, Swiftiply, Thin, Postgresql and of course Rails. Now I'd like to mention here that currently (correct me if I'm wrong) there isn't a patch to run Thin via Swiftiply - I plan on changing that now that I don't have to huddle my family into a crawl space due to the 8,000 tornado warnings we had last night. It's like the world didn't want me to implement it!

Anyway, I'll post progress as I make it - if nothing else it's going to be a fun learning experience. Maybe some notoriety will come about from it if I can tie Thin into Swiftiply "un-shittily" (I'm sure someone will bitch about something).

That's all for now.

Thursday, January 17, 2008

More on the pegs story later...

Today, I've found a really great "summarizing" podcast by the gentlemen over at Rails Envy. In the very first episode I listened to, I was introduced to a few really rather interesting gems and plugins in the works.

The first of which is Rack.
Rack provides a common API for connecting web frameworks, web servers and layers of software in between."
-- rack.rubyforge.org

From the little I've read on this, it's a great means for essentially creating your own frameworks in Ruby and the web server of your choice.  Who's feeling entrepreneurial?  Maybe this will be the start of more ruby web-frameworks.   Mmm, probably not.  In my humble opinion I really believe having Rails and Merb is going to be plenty.  My theory on the two becoming the alpha-dogs of ruby web-frameworks is as follows:

Rails will become the entry-level framework where developers new to the "scene" will rails <project> there way towards a more blissful means of web development.  After a while, maybe some of them will want to take the framework in a new direction, get upset with ActiveRecord or simply become filled with rage when many of their patches to Rails are denied.  Where will they go?  What other option is there?  At the moment; NONE really.

Enter Merb.  Once the new kid on the block has matured into a full version and someone steps out of the woodwork stating "hey, x-app I wrote runs Merb and here are some damn-fine performance numbers to back it up", I'm sure the march out of the rails community will slowly but surely begin.  Merb could quite possibly end up being the "hardcore" framework for Ruby programmers and ultimately get the nod as the "Enterprise Ruby" framework.

So what evidence is there to back up such a claim, Bradford?  Well, let's take a look at Engine Yard.  They're positioned right now with a huge capital investment (US$3.5m) and are now able to bring a full (and paid-for) Rubinius team.  On top of which there has been talk of them open sourcing their hosting platform (whose name I can't recall at the moment).  They already employ (and I believe he owns part of EY) the core developer of Merb (Ezra Zygmuntowicz), so what's to stop them from deploying an end-to-end, SUPPORTED technology stack leveraged on these technologies?  Absolutely nothing, that's what!

Only time will tell, but with the recipe for success that Rails personifies for other framework creators - hopefully, I'm right.