3

I've been playing around with Rails (version 3) for a few months now and I understand the framework fairly well. However, I have yet to develop a large website which offers lots of database access and user interaction.

I'm fairly skeptical of the following:

  • The Speed and Scalability of Ruby (I've heard that its up to 10 times slower than most other server-side languages).
  • The extra background processing that Rails as a framework (multiple levels of abstration).
  • The lack of enterprise-level web apps that run on Rails (the only ones that I can think of Groupon, Github and Hulu).
  • The complexity of the environment (nginx > mongrel > rails > ruby > website).
  • The behind-the-scenes SQL operations (I know that these can be optimized, but I'm sure that I'll miss some).

For these reasons, I'm unsure whether to continue using Rails or to switch to something that is built ontop a more performant language .. say Java Spring.

Please advise :)

nathanvda
  • 49,707
  • 13
  • 117
  • 139
matsko
  • 21,895
  • 21
  • 102
  • 144

3 Answers3

12

There are tons of large sites and infrastructures in production that use Rails. This question has also been asked to death over the years of Rails being actively used for all manner of web apps, large and small.

Short version is that it is not the fastest language around but despite that scales fine if you know what you are doing. And you should have enough money to hire people that know what they are doing if you actually have any problems of scale.

Scaling any webapp is hard, use the language/framework you know. Programmer happiness is king.

Alex Wayne
  • 178,991
  • 47
  • 309
  • 337
10

You can get good performance with Ruby. Easy:

require 'inline'

inline :C do |builder|
  builder.c <<-C_CODE

  void run() {
    // Write your entire application in C here
  }

  C_CODE
end

run

Problem solved ;)

d11wtq
  • 34,788
  • 19
  • 120
  • 195
8

Not the speed and scaling discussion again?

In webdevelopment the things that are the slowest is the network communication (receiving the request, getting al your data back), the database (getting all your data from the database), and most of the times it is not about the computation time at all.

While it is true that Ruby and Ruby on Rails seem more focused on programmer happiness, I think that every decent web-application built in .NET or Java has as many levels of abstraction.

The complexity of the environment? I think you mean deploying? There are a lot of options, but the most used options are Passenger (very easy deployment on top of an apache or nginx), or Torquebox. Torquebox for the moment is the fastest, best scaling solution (based on JBoss Application server), and several big names in the Ruby community are calling Jruby the implementation of choise to deploy your applications. While AFAIK the commonest deploy still is using REE (Ruby Enterprise Edition) and Passenger.

Unless you know you are going to have to do serious mathematical, cpu-intensive operations, I think the question you should ask yourself is: which framework/language will give me the quickest result?

If you are very proficient in Java/Spring, that might be the answer for you. But if your only worry is performance in general, I would say: do not hesitate and go for Ruby on Rails. It is a pure joy to develop in. The ruby community is really awesome if you would encounter any issues: support is just a post away.

And to conclude, I want to add a few very big sites using Rails: LinkedIn is using rails (and jruby), and Twitter still is using Rails for their frontend.

nathanvda
  • 49,707
  • 13
  • 117
  • 139
  • But you can save money by high performance server. For instance, single nodejs instance will be able to server 40x times more regular http request than rails. In that case, you only have to worry about scaling DB, and not so much about web framework stack. – user482594 Nov 01 '12 at 07:02
  • Could you give us the link to the benchmarks/articles for that number (40x), I am interested in reading that. nodejs is very interesting but I would only switch for very specific areas. Rails does all my asset handling, caching, session management, activerecord. Things that imho nodejs does not handle. And you get the weird callback-programming. But, if I would be doing heavy client-side js, then nodejs could get interesting again. Well, some framework on top of it I mean :) – nathanvda Nov 03 '12 at 00:15
  • It is not hard to test it. You just need a basic nodejs app and some default rails application. I used EC2's m1.small instance to test performance. If my memory is correct, ree 1.8.7 with passenger and rails 3.0x did about 15 request/second while nodejs 0.8.x took 600 request/second. The gap will be bigger as the number of cores in the system increases. With nodejs, I did not have to launch many http instances. – user482594 Nov 03 '12 at 21:00
  • 1
    A basic nodejs app does nowhere near the same as a rails app does for you. But granted: if you need low-level speed ... But I wonder: how does sinatra compare? – nathanvda Nov 04 '12 at 11:40