Pairon, Commentator, Google Gulp, and the old chesnut Holy Google Satellite!
Apr 04

“Rails can be very fast”

Ruby, Tech Add comments

Justin Gehtland has opened himself up to some critique after boldly coming out with some performance numbers wrt an application that he ported from Java to Rails.

There are definitely areas in which you could jump on the numbers, but I would rather not try to make this a “which is faster: Java or Rails”, but consider that, as he says… Rails can perform fine.

One of the big points though is the fact that there IS a large difference between performance and scalability.

Also, the tests that Justin has had time to do are only a small slice. It would be great if we had resources to do some serious performance work. Maybe like the PetStore? ;)

Brian Mc has some great thoughts in Expressiveness Matters. It is particularly interesting to hear him talk about caching in the platforms, and his C/ocml story :)

NOTE: Brian also is your friend if you are a Lucene user, thanks to his Lucene/Spring integration

16 Responses to ““Rails can be very fast””

  1. Mike Spille Says:

    This pretty much says it all:

    Lines of Code
    Rails: 1164
    Java: 3293

    Number of Classes:
    Rails: 55
    Java: 62

    3K lines of code? 62 Java classes? Why are people getting excited over such a trivial app?

    Now all the other information makes sense – indeed, if he wrote this in C he could probably do 80% of it in 3 days!!!!

  2. Justin Gehtland Says:

    Mike –

    You’re probably right. I probably COULD do 80% of it in three days in C. If only that were interesting.

    And, if you bothered to read the entire post, I pointed out that the “time to implement” comparison was bogus.

    Oh, well, can’t please some people ever, I guess.

  3. Justin Gehtland Says:

    Hey, Mike, forgot the smiley in my last comment, there. I understand where you are coming from, though, and if I were dripping with free time, I’d try it in C just to be thorough. :)

    Dion — that’s why I asked. Since I can’t just post the code, and turn it into Petstore, is there anything of critical interest to you that I could run and post?

  4. Mike Spille Says:

    For the record I think people are right that Java can be a bit of a pain in some areas, and that for a large class of applications of relatively small size it won’t matter very much what language you use. Ruby, Java, PHP, and Perl people could all argue bitterly and it wouldn’t matter – because the app is small enough that it really doesn’t matter.

    It would be much more interesting to see the results for truly meaty applications. I know from personal experience that Java works on applications >500K SLOCs. I’ve yet to see any credible evidence that this is true for Ruby.

  5. Justin Gehtland Says:

    Bit of a chicken and egg on that one, unfortunately. I spoke to a group of CxO’s recently on just this topic, and they were fervently opposed to bankrolling any kind of large-scale development on Rails (or anything Ruby or Python derived, for that matter). But, 500K LOC is the kind of app that needs a serious bankroll, so I guess it is up to the open source community to deliver something that makes the case.

    I do disagree, however, about the notion that small apps “don’t matter”. In the web app world, there are a LOT of apps that will never approach 500K, and a lot of developers who will never work on an app that size, and having a toolset that makes your job easier and more fun is a huge benefit.

    Oh, and Dion, sorry to monopolize your blog comments.

  6. Dion Says:

    Hi guys :)

    It definitely would be great to see some huge projects on Ruby. Dave T has developed some fairly beefy ones, but I don’t know if it ~500k SLOCs.

    My guess is that we will slowly get there. How many projects have you worked on that started as a fairly reasonable size web app, and then over time grew and grew. Before you know it you look around and have a substaintial application. Just the nature of the beast.

    I do not believe there is anything about Ruby (the language) which makes it unwieldy in a project that big. At that point the bulk of it will be how cleanly you design the application!

    One of my worries for Ruby adoption is that people can’t just leave the VM. There needs to be a good answer to this, which is why Groovy got people excited, and other languages on the VM :)

    Time will tell.

    Dion

    ps. Justin: my pleasure to have you here :)

  7. Justin Gehtland Says:

    Yikes!!! /.’d. I hope TextDrive doesn’t boot us off now…..

  8. Eric Burke Says:

    I’m pretty much of the opinion that Ruby is probably plenty fast enough for most web apps, just as Java is. Running the Java version through OptimizeIt or JProbe should be a simple task. I’m sure similar profilers exist for Ruby. It would be interesting to know why one is outperforming the other rather than speculating.

  9. Mike Spille Says:

    Justin, I strongly disagree. The vast, vast, vast, vast, vast majority of programmers I have worked with in my career are much closer to the 500K mark than the 3K mark.

    The plain fact is that an application with 3K lines of code is just not very intersting, and you just can’t draw that many conclusions from it. I don’t mean to be insulting Justin but a 3K app is trivial, plain and simple.

  10. Justin Gehtland Says:

    Mike, you are certainly entitled to that opinion. I don’t find the work we’ve done on this application “trivial” by any stretch of the imagination, but it isn’t the size now that it will eventually be, either.

    But the bigger question is: where is the fuzzy line between a smallish web app and a biggish enterprise web app? Is 25K still trivial? 50K? What about 100K? From where I sit, working concurrently on a 3KLOC Ruby app and a, now, ~350KLOC Java app, I can *definitively* say that there are things in that Java app that I can’t do in Ruby. But most of them I wouldn’t even dream of wanting to do in a smaller app, and by smaller, I mean half the size and a quarter of the users. So Rails would work fine there.

    Someday I’ll get the chance to find out, I hope. In the meantime, I only have what I have.

  11. Mike Spille Says:

    Justin, thanks for the response – now stop playing word games. :-) You say a 350K app is not trivial and does things you can’t do in Ruby. OK, we’ve established one end of the scale.

    We know you have an app that’s 3K lines in Java, ~1K in Ruby. Those 3K lines in Java were strung out over several months (5 if I recall correctly), the Ruby stuff was banged out in 3-4 days. This is the other end of the scale.

    Unfortunately, you cannot extrapolate from one end to the other. So you saying that “Rails would work fine” in an app a half the size would appear, to me, to be guesswork. Based on translating a 3K line Java program into a 1KLine Ruby one, you’re now confident in saying you can take a 150K Line Java program and make it run equally well on Rails?

    Come again? The tiny amount of time you spent writing that 1K Line Ruby program is sufficient for you to bet on a 150K line project?

  12. Justin Gehtland Says:

    I’m at least as confident saying that as you are saying that you *can’t* do your 500KLOC app in Ruby. Which is to say, neither of us has any knowledge of the realities of that middle ground. I’m saying, given what I know of Rails so far and the kinds of projects I’ve worked on, yeah, I can definitely see Rails scaling into the middle somewhere. I don’t know exactly where, so I had to pick some kind of target number, or I’d just be accused of being vague again. ;)

    Where I *don’t* see it scaling is apps that have XA transactional requirements, and apps that need a lot of legacy connections (to mainframes, etc.) and apps that need corporate “no one ever got fired for choosing Java” support. But there are lots of projects out there that don’t have any of those requirements, and I can definitely see Rails reaching those projects.

    Side note, kind of strange that I’ve seen your name in a lot of the circles I hang out in, but this is the first time we’ve directly interacted. And all on Dion’s blog comments, nonetheless.

  13. Mike Spille Says:

    Justin, Dion loves playing the middleman of the Java world :-)

    Back to the case at hand….a couple of comments:

    1) From everything I’ve read about your experiment what it really came down to was a few cases. With caching disabled clearly you were mySql bound. With caching enabled in Rails you cached at the page level – and hence barely executed any code at all. A strong case can be made that you tested only the caching performance of a single user hitting Rails, but that you didn’t test any other aspect of Rails or Ruby.

    Likewise, the Java no-cache vs. cache numbers clearly show that your Java caching code is horrible – I mean really horrible.

    If you wished to show anything meaningful, turn on page-level caching for Java. You may also want to revisit the use of Hibernate for a project with <100 classes overall!

    2) A single guy coding part time creates <2K lines of Ruby code in a few days. Based on this you feel qualified to say how this will scale to a team of several people going into at least the tens of thousands of lines? Again I must ask – what is it about a guy working alone pumping out a minor small app? How does that experience translate into, say, 5 people working on a 100,000 line app? Or 3 people working on a 50,000 line app? I would say it doesn’t, it doesn’t at all.

  14. Justin Gehtland Says:

    I have freely admitted that the caching on the Java side wasn’t up to snuff, that I had done nothing but enable the default caching in the different app layers. I think I made that point abundantly clear, and go out of my way to say that I don’t take these numbers to mean the Java performance sucks. Rather, I take them to mean that, hey, lookie here, turns out Rails is in the ballpark, that’s a happy thing!

    (As an aside, I’ve heard some anti-Hibernate bigots say that using Hibernate for anyting OVER 100 classes is silly, its amazing how much difference of opinion there is in the world)

    As for point two, well, no, I’ve been working in the Rails app for around two months now. And I’m making an honest guess about how I think it would go. I suppose I could just sit back and say “Well, I have no firsthand knowledge, so even though I’ve been doing this for a long time, I can’t possibly make any educated guesses about whether or not this will succeed.” But, let’s ask it the other way:

    “What is it about a guy who has never touched a technology that makes him able to say it can’t be done?”

    You have your assumptions about what’s possible. I’m basing an educated guess on personal experience with a lot of major Java and .NET development under my belt.

    I could be wrong. I might be right. But if I don’t make some guesses about what’s possible, I’ll never do anything, will I?

  15. Denni Says:

    http://aa.com
    http://www.aab1004.com

  16. free ringtones Says:

    Hi, very interesting site. I really like it.
    http://newestringtones.awardspace.com/nextel_ringtone_program/ nextel ringtone program http://newestringtones.awardspace.com/nextel_ringtone_cd/ nextel ringtone cd http://newestringtones.awardspace.com/nextel_i90_ringtone/ nextel i90 ringtone http://newestringtones.awardspace.com/nextel_i710_ringtone/ nextel i710 ringtone http://newestringtones.awardspace.com/mobile_mobile_nextel_phone_ringtone_t/ mobile mobile nextel phone ringtone t http://newestringtones.awardspace.com/nextel_i95_ringtone/ nextel i95 ringtone http://newestringtones.awardspace.com/i870_nextel_ringtone/ i870 nextel ringtone http://newestringtones.awardspace.com/download_nextel_ringtone_software/ download nextel ringtone software http://newestringtones.awardspace.com/i560_nextel_ringtone/ i560 nextel ringtone http://newestringtones.awardspace.com/free_nextel_i710_ringtone/ free nextel i710 ringtone http://newestringtones.awardspace.com/nextel_ringtone_converter/ nextel ringtone converter http://newestringtones.awardspace.com/nextel_mp3_ringtone/ nextel mp3 ringtone http://newestringtones.awardspace.com/nextel_i530_ringtone/ nextel i530 ringtone http://newestringtones.awardspace.com/free_music_ringtone_for_nextel_phone/ free music ringtone for nextel phone http://newestringtones.awardspace.com/free_nextel_cell_phone_ringtone/ free nextel cell phone ringtone http://newestringtones.awardspace.com/free_ringtone_for_nextel_boost/ free ringtone for nextel boost http://newestringtones.awardspace.com/nextel_ringtone_and_wallpaper/ nextel ringtone and wallpaper http://newestringtones.awardspace.com/sprint_nextel_ringtone/ sprint nextel ringtone http://newestringtones.awardspace.com/free_nextel_real_ringtone/ free nextel real ringtone http://newestringtones.awardspace.com/free_nextel_i530_ringtone/ free nextel i530 ringtone

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'

Loading...