views:

529

answers:

2

Can anyone comment on which is more scalable between RoR and PHP? I have heard that RoR is less scalable than PHP since RoR has a little more overhead with its MVC framework while PHP is more low level and lighter. This is a bit vague - can anyone explain better?

+8  A: 

MVC is the acronym for Model-View-Controller, a well known and common design pattern, that aims to achieve a clear distinction between your business logic (e.g. the Model) and the presentation layer (View and Controller). This has been covered extensively on the web and SO, so just give it a search.

RoR is a framework revolving around MVC and ActiveRecord built on top of the programming language Ruby, like Zend Framework or Symfony is a framework built on top of the programming language PHP. Comparing the scalability of a framework to a language is comparing apples and pears.

As for the scalability of RoR: yes, RoR was critizised for scaling badly in 2008 when Twitter had some performance problems with it. This was refuted by a number of people soon afterwards. And while I am not rooted within the RoR community, my guess is, RoR does scale, if you do it properly. But keep in mind, that the need for scalability is something most of us wish they had, but really don't.

So unless you have to make an important business decision between using Ruby or PHP, don't bother about how they scale. And if you have, consider hiring consultants over asking here. And never ever waste your time in flamewars between languages.

Gordon
+1 "never ever waste your time in flamewars between languages". use whatever fit your skill and need. even there is scientific proof of PHP is more scalable than RoR (or vise versa), so what!? does that mean anything to _your_ application?
ohho
This is an interview question. Does anyone have an academic rather than practical answer to the question?
Daniel
@Daniel like what? Scalability is not just a matter of picking a language or a framework. It's an architectural question and involves the entire stack. The fastest programming language will not scale when used with inefficient code, a slow database or a weak server, etc.
Gordon
+1  A: 

Edit: Gordon +2. +1 for answer and +1 for the comment! :)

Scalability for a framework is restricted to caching, session stores, reduction on the number of HTTP requests, even UI parts of the App like creating sprites, caching js files etc! You might use RoR/ZendPHP/CakePHP whatever it still is the same thing in the end. The advantage of using RoR is the it follows pure MVC paradigm. Its easier to concentrate on your business logic rather than waste time on configuration. That is where RoR succeeds over any other framework.

Scalability also deals with the ORM used by a framework. The faster the read/write operations the better is the performance. But if you don't want to use a full fledged framework you can always go for micro-frameworks like sinatra, camping etc that reduce the overhead a bit. Rails also has introduced Rails Metal which is built on rack which can for example be used for recursive tasks, and thereby increasing your performance.

In reality scalability of an app deals mainly with your hardware more than the software involved. It also deals with how you organize your data in the database. For example Google uses BigTable rather than an RDBMS (the likes of MySQL, PostGreSQL, SQLlite3 etc) for faster read-write. It ultimately depends on your app.

I would suggest you spend time seeing this presentation by Adam Wiggins, founder of Heroku:

Horizontal Scalability via Transient, Shardable, and Share-nothing Resources

Shripad K