Topic: Rails vs. PHP with a Framework


I have been learning Ruby on Rails for a while, and would like to begin an open source project with it.

Before Rails I used mostly PHP, and was almost ready to leave it and start personal projects on Rails, however scalability does seem like a big problem.

Is it really?

This story of Twitter troubles: … by-vs-php/

Dealt with the issue.  And now PHP has many Rails like Frameworks, including Zend Framework which seems very promising, and Symfoni.

So it is harder than ever to commit to Rails for an application that will scale.

Any advice on this?  Any people familiar with the Twitter story?

Thanks and God bless you this New Year,

Joseph Hurtado
from Toronto

Re: Rails vs. PHP with a Framework

Here's the deal. Twitter fixed all of it's issues without dealing with Ruby or Rails. It had to do with their server/database architecture.

I don't know how many times I've said this and other people as well, scaling really doesn't have much(it has some) to do with a language, it's about server setups and the database architecture/setup. (i don't mean any offense, this is just a commonly misunderstood problem)

The one big down fall of rails is deployment. If are not knowledgeable about server setups, proxy configurations, etc. then it might pose some challenges. But, on the flip side, if anyone is going to do web development, they better learn about server setups and become very comfortable with them because it will help you greatly in understanding how to optimize your application for greater performance, regardless of the language you choose.

May God also bless you this new year! smile

Re: Rails vs. PHP with a Framework


I did read recently on Twitter problems, and as you said most were not Rails related except that at the time apparently Rails could only connect to one database instance at a time.  Now this is no longer an issue.

However, for good reason, or no reason, Rails is getting a reputation of being slow, especially when compared to PHP or even .Net.

Do you know if Rails 2.x has improved on this, or can anyone comment on Rails improvements on the performance side of things, since the framework/language themselves are very good?

Thanks, and Happy New Year Robert!


from Toronto

Re: Rails vs. PHP with a Framework

Ryan Heneise  |  Art of Mission  |  Now with extra-strong Donor Tools mojo

Re: Rails vs. PHP with a Framework

Ryan, good link thanks for sharing it.

Also here is a good link of an upcoming book about Rails performance, from the writer's own blog, I think is the same who wrote the infoq article:



Re: Rails vs. PHP with a Framework

Funny how history repeats itself.. When I started with Java in '96, the C/C++ guys were complaining about performance of the JVM and scared many early adopters. Those of us that knew it was a huge leap from writing cross-platform C/C++ desktop apps or CGI scripts on the web side stuck with it. It didn't take long for Sun and IBM to develop a JIT compiler, which made Java quite fast! In the mean time, we used what Java offered us to make our work more productive.

I see it as multiple issues: 1) don't make poor architecture decisions that cause issues at large scales (ala Twitter), 2) don't worry about scalability if you aren't going to need it, esp with personal projects or smaller niche applications, and 3) expect Ruby to get faster over time, making web request processing even faster.


Re: Rails vs. PHP with a Framework


Agree 100% I am going forward with Rails.  I want to do an open source project, with a potential for a LOT of users, so it can be niche, but it could be big, so performance was an issue.

Now however I think you are totally correct, Rails is higher in simplicity, and getting places faster than any other web framework I can think of, it has some flaws, but apparently not as bad as previously reported.

Now... who knows if Rails 2.x brought new performance goodies?!

God bless you all, and thanks for the advice!


Re: Rails vs. PHP with a Framework

Googled "Rails 2.0 Performance": … art-1.html

"Bear 270, young man. Bear two, seven, zero, over." - Musings of a flight simulator guru, me.

Re: Rails vs. PHP with a Framework

There are some performance enhancements in rails 2.0, but much of the things you've probably heard about are either Ruby VM being slow or Rails not being thread safe. Ruby 1.9 has an amazing leap forward in speed with YARV, but currently it isn't production ready.

You have several options, you could use JRuby and run Rails on Glassfish which is much faster than mongrel, you could use a normal setup: Apache, mod_proxy, mongrel_clusters, or you could do nginx, swiftiply and eventdriven mongrel.

Just make sure you write smart code, like any language you use. Also, if you need threading for your application, then check out Merb. Merb is incredibly fast and thread safe (written in Ruby). Merb 1.0 (first merb 0.5) is coming on the horizon soon that will be incredibly lean. I've been spending a lot of time talking with the merb core, writing some patches for merb and writing merb plugins/applications - it's a very nice framework and is quite fast, faster than rails. So, it's another possibility.

It all comes down being smart about how you developed and your server setups. Gzip and cache your js and css (and let the browser cache these for you), setup asset servers (1-2 machine using xen to have several servers that can all be sub-domain'd and load balanced, if more than 1 server), use caching in your application, don't make hundreds of needless sql queries, don't have functions calling functions calling functions calling functions, etc. Use design patterns when appropriate, stick the MVC architecture, use those helpers and keep your logic out of the views; skinny controllers, fat models, etc. If it makes sense, cluster your database - in other words, pay close attention to every aspect of your development.

Re: Rails vs. PHP with a Framework

Yeah, like Robert said, a huge amount of performance can be gained without even touching your app, per se. I just read High Performance Websites and it was really eye opening. It talks about how on average, the html portion of viewing a page (what the rails app generates) accounts for like 12% of the user's waiting time, and that it makes a lot of sense to take the effort to properly set up gzipping and caching of assets and tuning your web server to set far out expiration dates and the like. I'd recommend checking it out, along with the yslow firefox plugin. Good post Robert.

check out - beautiful web-based church management