Ask HN: Is PHP more scalable than Ruby or Python?
Edit: I just realized how generic my post was... so I want HN to weigh in on something a friend said:
"PHP is more scalable than Ruby and most languages"
//start old post Let me preface this with: I'm not trying to start a language war.
I have very little experience coding, but have learned enough (some may say 'caught') PHP to get by.
I want to take it a step further but I'm getting thrown in a thousand different directions. I want a language/framework that's fairly straightforward and somewhat scalable.
I am looking at Python/Django, but getting pulled towards Ruby/Rails by friends - and some people saying that PHP is more scalable than either Python or Ruby and I should be looking at the Cake or CodeIgniter frameworks.
Can someone push me in the right direction? I want to invest the time in a language but I'm not sure which to start with. //end old post
Scalability for web applications has -nothing to do with the programming language-. PHP, Ruby, Python, ASP.net, they all use the same strategies to scale. Three things: cache religiously, index well, and refactor your database queries.
Take it from me: I've worked on a Java site with over 2 million monthly uniques. I built a Ruby on Rails app from the ground up that grew to over 15 million pageviews a day. I also helped build a PHP-backed api the handled a few million hits a month.
I'm sick and tired of the "X scales better than Y" debate. It's pointless.
Don't freak out about it. This is not like getting married.
First the easy advice: If you have friends pulling you toward Ruby and Rails... learn Ruby and Rails. Momentum is a good thing. Comradeship is a good thing. Don't worry: If it turns out in two years that we'd all rather be using Python and/or Django, we can switch. It will still be there.
Now we begin to edge toward personal opinion: I'd avoid sticking with PHP. Not merely because PHP is often like a parody of a programming language, but because variety is the spice of life. Learn something different. Take a look at how other languages do things.
Now, if you really want to stay out of a language war, ignore anyone who goes on about the "scalability" of their chosen language. Most of those claims are just posturing, backed up with no relevant data. [1] If your PHP friends won't shut up about their language's unbeatable super speed, show them the first fifteen minutes or so of Yehuda Katz's Merbcamp keynote:
http://www.merbcamp.com/video/katz3.mp4
... and once they're done rending their garments and throwing things at the screen tell them to take some data and go argue with someone who cares. You've got better things to do.
---
[1] Why do most language scalability arguments have such dubious data to back them up? Because, as others have taken pains to point out, languages don't scale: application architectures scale. If your webapp is much more complex than "Hello, World" its efficiency will depends on a host of factors, of which the speed of any particular language construct is usually a tiny one.
Any mainstream language you choose will be scalable enough.
Spend some time reading online rails and django documentation. Either one will be fine for you to learn.
My personal opinion is that Python is easier to learn for a beginner, but not by much. Ruby has http://hacketyhack.net/ which is a fun way to learn, and Python has http://www.diveintopython.org/ which is a tremendous (and free!) resource.
I say flip a coin and roll with it. They're both great languages and both frameworks are great for learning.
[Errr... The submission changed after my response was entered, sorry if it seems a bit off-topic.]
Scaling software has much more to do with the architecture of the software than with the language.
It is possible to write software in any language that scales poorly as well as to write software that scales very well.
Right now I'm working on a site that pulls in about 1/2 million uniques daily written in Java (chosen by the programmer before me), before that that same site was written in PHP.
Ruby, perl, PHP they're all just different hammers, a good programmer should be able to write scalable web applications with all of the above, but will find a matter of personal preference (or historical accidents) to make the decision.
In the beginning it is probably smarter to learn how to program in a language for which there is a market, not to focus so much on scalability issues because when just starting out getting paying work is probably more important.
Another issue when learning how to code is to learn how to write clean code, I know I'm showing my age here but you could do worse than to have a look at the source code to the GNU utils package, there is a ton of 'good' code in there that will help you to develop a legible style. That will come in handy in any language, scalable or not :)
I assume you're asking about scalability in terms of pages per second or whatever, but what you should be more worried about is the scalability of your development effort. As other posters have said, speed of the platform is not the issue.
Rather you should consider what platform you think you can get the most done in the shortest amount of time - having friends that use the same platform counts for a lot. Similarly, many people think (including myself,) that you can get more done faster using RoR or Django than you can PHP, particularly if your project has any complexity.
Just made a very similar thread to this!
Why are you worried about scalability when you're just learning to program?