Topic: Ruby on Rails vs. Django performance

I love Ruby on Rails and it definitely remains my 1st choice for small to medium scale sites. But for sites that aim to be truly huge, I'm not sure anymore that Rails is the best choice. I know Ruby on Rails *can* scale, but the more pertinent issue seems to be: What are the costs of scaling? e.g. how much more hardware would I need in order to scale a Rails app as compared to a Django app?

From what I've been hearing and reading, Django seems to be an excellent Python equivalent of Rails. It also boasts significantly better performance. The main downsides for me would be:

- time to learn it
- less plug-ins
- smaller community?
- less beautiful and concise code

I would estimate that it would add somewhere on the order of 2-5 months to my development time.

There seems to me to be some consensus that Django does perform better than Rails, but I want to know how much better I should expect it to be for say an application similar to Wikipedia. If the costs of scaling Rails as compared with Django are relatively small, I think I'd be okay with sticking with Rails. On the other hand, if scaling with Rails is significantly more costly than with Django, I think I'd make the initial time investment of switching to Django.


Perhaps the most realistic test comparison suggests Django performs 34% better than Rails:
  http://wiki.rubyonrails.com/rails/pages … erformance

A very simplistic "Hello World!" test comparison suggested Django performs around 3 times better than Rails:
  http://www.alrond.com/en/2007/jan/25/pe … rameworks/

Neither of those comparisons, however, involve much more than serving simple pages. For more complex applications, Python vs. Ruby performance will begin to matter much more. Benchmarks suggest Python is 2-3 times faster than Ruby:
  http://shootout.alioth.debian.org/gp4/b … lang2=ruby

And with the Psyco plug-in, Python can be 10, 20, 40 or some tests even suggest 128 times faster:
  http://shootout.alioth.debian.org/gp4sa … lang2=ruby


How much faster do you think Django would be over Ruby on Rails on a large, real-world site?
Also, in terms of your personal preference, time and budget, at what speed ratios would you prefer Rails over Django for a large site?

Re: Ruby on Rails vs. Django performance

I think it is irrelevant.

Scale is about architecture, not language performance.

"An application similar to Wikipedia" has scale issues that have nothing to do with the low-level speed of a specific language.

Most of the scale experience I have had has been on the database level - so you start using memcache, read-write masters and slaves and eventually you will end up sharding your data and throwing everything you knew about relational databases out the window.

I mean, according to the first link you posted, PHP has the worst transaction-count, but PHP is driving sites like Facebook.

All of that said, the only way to work out your costs is to design your architecture and do some tests.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Ruby on Rails vs. Django performance

300 million page views a month on RoR

Re: Ruby on Rails vs. Django performance

I have seen benchmarks between Django and Rails, at the end, the speed difference isn't that big. I think Django was 2x faster than the same equivalent Rails app, this is not amazing when you know all the features Rails provides you with.

The benchmarks between Ruby and Python for displaying a stupid hello world are nonsense, you need the whole thing, like comparing 2 blogging engines in production environment.

Re: Ruby on Rails vs. Django performance

If you want something which is high performance, I would stick with RoR and spend your time focusing on the various caching schemes.

Re: Ruby on Rails vs. Django performance

It is widely known that the current version of Ruby used in Rails does have bad performance, but by the time anyone could build an app and get enough traffic to run into twitter-sized problems, Rails will be running Ruby 1.9 or even 2, which has been shown to have vastly improved performance. Not that I believe Ruby performance is an issue what-so-ever.

I agree with Toby. And to scale Rails hardware isn't usually the main cost, it's the man hours needed to make the optimisations, but that is totally regardless of platform - you still have to pay someone to optimise PHP or Java or Python.

I say stick with Rails.

ThinkRefresh - Free Rails Techniques Screencasts

Re: Ruby on Rails vs. Django performance

These articles are mostly biased. As some said there's big RoR sites, bit django sites, big PHP sites, big whatever sites.

There are plenty of things that you can do to improve performance in rails. From architecture to coding there's plenty of things you can do that will make your rails app fly.

Re: Ruby on Rails vs. Django performance

You are basing the performance off the of the language itself, instead of what you should really base it off of, which is your ability to build and code a fast app. No matter what language you use, there will be performance issues if the app is not coded and optimized accordingly and properly.

Next, the 4 things that you mentioned in your post are 3 reasons too many for me to ever move away from Rails and into something else. I can guarantee you that the performance differences between Django and Rails is minimal at best.

I would say, don't worry about the performance, but instead worry about which is going to allow you to build the app faster, better, and easier. The performance issues can always be resolved.

--Cory

Re: Ruby on Rails vs. Django performance

Thanks for all the replies, this answers most of my questions about whether using RoR for building a web based enterprise application is a good idea or not. I think I can safely bet on RoR.