Rails, Django, CodeIgniter, Symfony Performance Compared

February 17, 2007

Surely performance is not the prime criteria for selecting a framework. Most people will say developer productivity, ease of maintenance, security and scalability are the most important factors.

I love the Ruby language and its expresiveness. And Rails has been a truly inspiring web framework. This is why I think the web frameworks performance test results run by Alrond (and an update here) are highly disappointing for Rails. In Alrond's tests we find that Django giving up to 4x faster response times, and 2x more throughput. But I guess this is not a surprise, we always knew Python was faster than Ruby by just looking at Debian's language shootout.

I would add a couple of remarks to Alrond's results:

  • Most shared web environments only offer PHP. Some hosting providers offer an old version of Python that will not support Django. So when using shared hosting, PHP is likely to be your only choice. PHP is a useful and proven language if you need to integrate with C/Java/whatever, but perhaps not as expressive nor OO as Ruby and Python. On the performance results side of things, CodeIgniter/PHP tests using a bytecode cache (APC) improve performance by 10x, and make them comparable to Django/Python. Plus CI runs on PHP4, which is what most web hosts out there are running today.
  • If you want/have to avoid PHP, you are probably looking at Rails and Django as your main options. These will require you to use a Virtual Private Host or a dedicated server. Rails and Django don't work well on shared hosting. And if you are like me, on a tight hosting budget, you really want to get that extra performance and be on a framework where it's really cheaper to scale out. This is where Django/Python will shine.

At the end of the day, choosing between one of these web frameworks is actually a language choice. And right now, the only real language contestants for people looking for raw speed and stability are PHP (with opcode cache) and Python. And both seem to deliver comparable performance.

But I would not rule out Ruby completely just yet. JRuby is making a lot progress, and you can even now run Rails with JRuby in Sun's JEE container (glassfish). On the other hand, another interesting similar development which might rock Python is IronPython, which runs Python on the .NET runtime.


blog comments powered by Disqus