Brian Adkins
3/7/2007 8:37:00 AM
Sam Smoot wrote:
> On Mar 6, 10:18 pm, Brian Adkins <lojicdotcomNOS...@gmail.com> wrote:
>> Brian Adkins wrote:
>>> When running a test that primarily involves loading up a few MySQL
>>> tables with ActiveRecord objects, I was surprised to see the Ruby CPU
>>> utilization at 93% and the MySQL CPU utilization at 7%. I would expect
>>> this workload to be heavier on MySQL than that.
>>> [...]
>> I just moved my test code into a controller and ran it via:
>>
>> mongrel_rails start -e production
>>
>> Similar CPU characteristics except that Mongrel wasn't able to fully
>> utilize my dual core CPU (I suppose because of the serialization of
>> Rails code due to lack of thread safetyness).
>>
>> So the unit test (1093 records -> table1, 1093 records -> table2, 1
>> record -> table3) took 5.5 seconds to complete and the identical test in
>> a controller with Mongrel in production mode took 27.4 seconds!
>>
>> Yeah, I know I can have a cluster of Mongrel processes, and that's how I
>> run for real, but I'm still a little bummed with these results :(
>>
>> I've switched my company's development from 100% Java to 100% Ruby, and
>> I still believe that was a good decision because of productivity gains
>> and joy, but I do miss some of the runtime performance of Java and the
>> ease with which I could spin up a thread to do some background process.
>> I'm glad BackgrounDRB has been provided, but it's not quite the same.
>>
>> Hopefully future versions of Ruby/Rails will provide some more runtime
>> performance and concurrency - I'd be glad if I could just fork in Rails
>> without trouble, but I don't think that's the case.
>>
>> For now, I don't have more customers than a Core 2 Duo can handle, so
>> it's not exactly on the critical path for me yet :) In fact, I'm glad
>> MySQL isn't on the critical path because overcoming that seems much more
>> difficult than having a bunch of Apache/Mongrel processes running.
>>
>> Brian
>
> Ruby is a slowish language right now, but this isn't really Ruby's
> fault.
Yeah, I remember when I first saw the computer language shootout stats!
I was bummed that my new favorite language performed so poorly, but then
I recalled the early days of Java (I started with 1.02) and gained some
perspective.
> Rails is just incredibly slow, and the problem only seems to be
> getting worse. You could spend some time trying to speed it up, but
> there's some really broad design decisions that make that pretty
> difficult. If you can live with the performance, then I guess I'd just
> do so with the expectation that a future release will improve
> performance.
I'm pretty sure I can live with the performance - I think a few fast web
server machines in front of a fast MySQL machine will do fine, and I'm
not close to needing that yet.
> If you can't, you might try looking into some of the
> alternatives? It's a tough choice...
When I switched from Java to Ruby, I knew I was giving up some runtime
performance and gaining much in other areas. Then I discovered Lisp and
realized, "wow, it's powerful *and* fast" :) However, I think it would
take too much work for me to get a Lisp environment to the point of
being as productive for me as Ruby on Rails is currently (reminds me of
Python web dev several years ago, maybe older), and I really do enjoy
programming in Ruby.
Python is a fair amount quicker than Ruby, but I like Ruby better, and
the speed difference doesn't appear to be huge - I did get used to the
white space, but I still don't like it in principle. It's interesting
that I learned Python first, but at the time (2 to 3 yrs ago), I didn't
feel the web frameworks were ready, so I jumped into Ruby via Rails
(common story) and then discovered that I like the feel of the language
better - it has some warts, but it's still a blast to program in. The
Python frameworks seem to have progressed significantly since then.
I just took a look at Smalltalk, but despite Seaside's success, I don't
think it's quite ready (plus I just got away from an IDE heavy
environment with Eclipse), and despite the super duper IDE capabilities,
I don't feel it warrants the learning effort for me now - maybe later.
So all in all, I'm pretty darn happy with Ruby/Rails at present. I have
been on a language research blitz recently though (many, many hours) - I
think it's motivated by Ruby's strengths and not its weaknesses. The
logic goes something like this, "I was surprised about how much better
Ruby is than Java, so I wonder if I could make that kind of jump again"
- I guess I'm just greedy, not to mention susceptible to "the grass is
always greener on the other side of the fence"
I must say that everything I've read about Paul Graham's Arc indicates I
would be very pleased with it. No idea when it will be completed, but
I'd say it has a great shot at getting some traction.
If there's an alternative I haven't mentioned that you feel is actually
viable as a contender, feel free to pass it on.
Brian