Nov112007

Reality Check

Filed under: rails mongrel 

A request that pops up on the Nginx mailing list every so often is the ability for Nginx to restrict backend servers in a clustered proxy to each receiving only one request at a time. This request invariably comes from someone using Rails who has discovered that Rails isn't thread-safe and can therefore only handle one request at a time.

For some reason I was under the impression that Mongrel was intended to help solve (or at least work around) this issue, so I decided to get a bit more info from the Mongrel site.

It was there that I found this gem:

Rails is not thread safe so if you have long running actions then you can potentially block the server. Keep in mind that this is the case for any server, it’s just more pronounced for Rails.

Okay, seriously. There is so much wrong with this statement that the question isn't whether or not to laugh at it, but whether or not to find the author's phone number, call him up, and laugh in his face.

First off, while I'm less than certain the author intended to say this, the awkward structure of the paragraph could lead some to believe that no servers are thread-safe. Fact is, with the exception of potential programming errors, all servers are thread-safe (either fully reentrant or protected with locks to force serialization at critical points). Rails and perhaps a few homework assignments from mediocre junior college students being the exceptions.

While I doubt the author truly meant to assert the above, I am certain he meant to convey the fact that all servers are potentially susceptible to dropping requests when there aren't enough resources to handle them all. Obviously this assertion is true at some level. Where the falsehood lies is where the resource constraint comes from. With Rails, there is a single shared resource that is constantly exhausted whenever there's a request: it's Rails itself. With other servers, you'd have to exhaust system resources such as RAM, threads, TCP sockets, CPU time, etc. Other servers don't have bottlenecks designed into them. Claiming all servers have this problem is akin to defending the Corvair because all cars can explode under the right circumstances.

This shortcoming in Rails is so ridiculous that it literally leaves me agog that anyone would even consider using it for anything but the simplest of toys.

One of the things I find tremendously funny is how the Python community is always criticized for having too many web frameworks. The core concepts of Rails has been reimplemented in Python at least a dozen times. Apparently it just isn't that difficult to do. Apparently it's not difficult to write a threaded or asynchronous server either, since all of these servers were able to handle multiple simultaneous requests just fine.

Seriously, if you love Ruby, I can understand. But Rails? How far must someone put their head up their own ass in order to be able to overlook how fundamentally flawed it is?

You know what? I don't want to know. I only hope that Igor doesn't put too much work into adding this retarded "feature" to Nginx.



0 comments Leave a comment


Oct192009

Ruby on Rails: disappointing applications

Filed under: ruby rails fail 

I don't program in Ruby. I don't write Rails apps. Still, now and again I see apps written in Ruby that look useful so I think "I know, I'll give this a try". To date, this has been an utter loss.

  1. Typo. 300MB of RAM for an absolutely minimal blog framework? Seriously? Wordpress has approximately 1434 times the features and runs in a fraction of the memory. It's undoubtedly faster too, but I haven't bothered to measure.
  2. PowerDNS on Rails. Installation instructions are remarkably simple. Turns out this is because they are sorely incomplete. But this turns out to be moot because it simply doesn't work in any case. I filed a bug report but I'm not holding my breath as most of the bugs listed are months old.

Admittedly, two apps isn't a representative sample by any means. Still, 0 for 2 isn't a good start and doesn't encourage me to invest the time in trying others.

As an aside, I learned a few months ago that "rails" is slang for lines of cocaine (yes, I'm not that up on the drug subculture these days). In any case, I'm suddenly enlightened as to the origins of RoR and DHH's oddly self-aggrandizing attitude.



0 comments Leave a comment




Copyright © 2007, Cliff Wells