11

I'm currently working on a side project (that hopefully will grow into something more), and right now its strictly static front-end stuff; HTML, CSS and jQuery. So in the meantime, I have time to do heavy research on choosing Ruby on Rails vs. Python/Django.

I've read countless articles comparing the two, which usually come down to "what language do you prefer?" and considerations of the development community.

My question here is strictly of a technical nature, comparing the frameworks (and their respective languages) as such:

Between Ruby/Rails vs. Python/Django:

  1. Which run-time performs better (any statistics or real-world examples would be great)?
  2. What are the known scalability problems, and which scales better in the long run (again, any technical documentation or data to represent this would be great)?

I understand that scalability comes down to architecture, so the question is what framework and its respective tools, APIs, plug-ins, community, documentation, etc. "guides" you towards the best scalable web architecture from the "get-go"?

Thanks!

orokusaki
  • 55,146
  • 59
  • 179
  • 257
Michael
  • 415
  • 2
  • 5
  • 7
  • 3
    There is no answer to this question just like there is no answer to the "which is better" question. Both can run on virtuals that can be instantly upscaled when required. However, Rails can be deployed on Heroku which takes care of the mather of scalability in a bit different matter, that you might enjoy. There are many similar solutions for Django but the general opinion seems to be that they're not as nice. In some way and some situations Rails might for now win this one. – Jasper Kennis Sep 25 '11 at 17:39
  • 4
    By the way, the comment above about only Rails being deployed on Heroku is now false. In fact, it became false 3 days after Jasper posted. http://blog.heroku.com/archives/2011/9/28/python_and_django/ – Jordan Jun 18 '12 at 14:02

2 Answers2

13

That's the wrong approach to thinking about the problem.

Scalability on the web comes from expanding the number of application servers rather than speeding up an individual application server.

Ruby and Python are both slow languages with problematic multithreading and problematic garbage collectors. We use them anyway because they are very good at permitting the developer to write simpler programs that do the job better. It's not worth bothering about the question, which of these two runtimes performs better.

So long as you keep good web architecture, where your application server stateless (where all state is kept in the database or in cookies, but not in server-side sessions), you should not care what the actual performance of an individual request is, so long as it is reasonable. Because if your application server is stateless, you can scale that tier horizontally to cope with any need for scalability.

yfeldblum
  • 65,165
  • 12
  • 129
  • 169
  • 1
    This. Rails and Django both perform adequately, if you really wanted to make something super scalable you should probably shy away from web frameworks in general. If it's a 'side project', go with what you like best, there's always caching layers and other changes you can make to scale in a quick way. – Xorlev Sep 25 '11 at 17:47
  • Thanks @Justice; all makes sense. I understand that horizontal scalability of app servers is not related to a single server's performance. Hence, why I asked these as two separate and distinct questions #1 and #2. Cheers. – Michael Sep 25 '11 at 18:15
  • 4
    As I said, the raw performance problems (which are not scalability problems at all) are: Ruby and Python are both slow, have bad multithreading, and have bad garbage collectors - at least compared to other runtimes that have great multithreading and garbage collection capabilities and are fast. If you're looking for raw performance on a single server, go with a .NET or JVM language, or another high-level garbage-collected native-threaded-with-no-GIL runtime such as GHC. Asking which one of two tortoises is the faster seems rather silly. They're both tortoises. – yfeldblum Sep 25 '11 at 18:30
  • 1
    That being said, JRuby/Jython are decent enough substitutes...you've gotta be careful with JRuby/Rails, HAML can hurt your performance if you don't merge in a few patches that remove the reliance on exceptions for flow control. Exceptions are cheap in Ruby, but not as much in JRuby since they use the Java Exception framework. If you can get around that, JRuby has non-GIL threading. :) – Xorlev Sep 26 '11 at 05:22
  • @yfeldblum What is GHC and GIL? – Quazi Irfan May 22 '15 at 02:06
  • python isnt garbage collected, its reference counted. – Shayne Jul 18 '16 at 07:31
  • GIL stands for the Global Interpreter lock. Its basically a way to say "This resource is locked by this thread so back off", and it pauses other threads until its released. The down side is that multithreaded apps only really achieve single threaded performance as a result. GHC, uh I think thats a Haskell thing? Not sure! – Shayne Jul 18 '16 at 07:36
  • this doesn't answer the question. The question asks about performance scalability between two technologies. I have the same question. For someone who is starting a new project it's important to know the benefits and drawbacks of the technology they choose. – FistOfFury Jan 06 '17 at 21:02
7

https://stackoverflow.com/questions/91846/rails-or-django-or-something-else
Does Django scale?
Using Rails as a framework for a large website
https://stackoverflow.com/questions/3042259/django-or-rails
Rails or Django?

...

There are plenty of questions regarding this subject, and none of them answer the question - there's no right answer.

I don't think you should choose a framework on those two metrics. Unless you are building the next Facebook, both will scale to your needs. Similarly both should perform to your needs. Instead have a look at what features of the languages and frameworks appeal to your application etc.

Community
  • 1
  • 1
Timmy O'Mahony
  • 53,000
  • 18
  • 155
  • 177