views:

3227

answers:

10

Why is PHP considered more scalable than python?

I've heard may times that one of the reasons PHP is "better" than python is that PHP is more easily scalable, and that Yahoo proves that(assumig Yahoo still uses PHP).

Whats the difference between PHP and Python when it comes to scalability?

-- edit --

well, i have no evidence, the question arose after a discussion with a friend.

-- edit2 -- here: http://www.oreillynet.com/ruby/blog/2007/09/7%5Freasons%5Fi%5Fswitched%5Fback%5Fto%5Fp%5F1.html , even if this dosent say anything about scaling..

+4  A: 

In my own mind, it's not the language that matters, as much as how that language is used, and how the applications, are well written to be more scalable.

And also important is how well it works with the databases, and file i/o, what caching methods are available...

At least that's my 2 cents.

crosenblum
So you think a well written application in COBOL will stack up exactly with a well written application in Java and that will stack up with an application written in Haskel? Programming languages matter, because they are tools, and if you have *the* tool for the job, your job will be easier. Don't go around nailing screws because you only like one language. Just my 10 cents.
voyager
Yes. A well written application in Cobol will stack up to a well written application in Java. If the platform is an IBM mainframe, doing what COBOL is designed to do.
Lennart Regebro
@Lennart Regebro: we agree completely.
voyager
Quite true. Even if you do find that perfect language, you will still produce crap if your hire crap programmers that don't have a clue.
Graham Dumpleton
+8  A: 

What some folks like to say is this.

PHP is embedded within Apache, and uses relatively little memory.

Python is less often embedded within Apache, and uses more memory than PHP. Python is sometimes run as a separate daemon process. (It can also be embedded, so one could run head-to-head tests, FWIW. It's not worth much trying to do head-to-head, more on that below.)

We don't use PHP, so I don't have numbers. However, the daemonized Python (via mod_wsgi) runs our transactions fast enough that I can't easily put together a load test because my laptop can't pump enough transactions through the VPN and Firewall to measure anything other than VPN delays.

Further, as our usage grows, we simply add Python daemon instances through simple Apache changes to handle the workload. If we eventually outgrow the VM, we'll simply split the Apache front-ends from the Python backends onto separate VM's. We can't foresee a limit to this kind of growth -- more Apache, more Python daemons.

You can't easily compare PHP and Python because the approach to a web application is generally quite different. PHP is programming language, template language and HTTP handler in one single bundle. Python is just a language. You have to add a template processor (there are many) and an HTTP handler (there are many) to have a comparable toolset.

S.Lott
Check out this blog post http://blog.curiasolutions.com/2009/09/the-great-web-development-shootout/ . Some perf. comparisons between PHP and Python. For instance, mod_wsgi is able to serve more requests per second than PHP.
codeape
also... http://blog.curiasolutions.com/2009/09/the-great-web-technology-shootout-round-2-php-deserves-a-helping-hand/#more-278
Quamis
+46  A: 

Well, Google uses a lot of Python, so there goes that argument...

Scalability is a complex issue, and can never be reduced to saying that X is more scalable than Y. Scalable how? Memory? Speed? Storage? It's like saying that PHP is greener than Python, or the other way around. It's just utter nonsense.

Lennart Regebro
I wish I had more votes for you.
Pinochle
Allow me to provide some more.
Sam152
http://stackoverflow.com/questions/1567212/in-which-field-python-language-is-used/1567257#1567257
voyager
+1 for the response I'd give. Took the words right out of my mouth.
wheaties
Yes, google use python: http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e
DaNieL
+22  A: 

Languages, libraries and frameworks don't scale. Architectures do.

If you design a solid architecture. If you are able to make it evolve quickly. It will scale.

Yahoo! uses PHP, Google uses Python. But both use C/C++ for resource intensive processing, because you won't use an interpreted language for that anyway.

Now the real deal is, which one will let your team scale the most easily ? Since I worked with Python and PHP a lot, I tend to think that the first one leads to a much easier to debug / maintain code. And when your project will grow, your team will follow, so its an important point to take in consideration.

e-satis
+1  A: 

A nice article by Jeff Atwood: PHP Sucks, But It Doesn't Matter

fabrik
+2  A: 

Check out my article on scalability: http://www.tomhoad.com/blog/?p=23. I would argue that the way you design your app or site, and the principles you employ when building it, are far more important than what language or framework you're using.

There's more to scalability than language or framework.

Tom
A: 

To be honest, the answers are really interesting here, I was really glad to see less flame wars, and more people showing honest desire to hone their craft....

And to me that's always the highest value...

crosenblum
..this should be an comment, not an answer..
DaNieL
A: 

Little old but compare performance between php (symfony) and python framework (django). An element of reponse.

http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/

Youenn
A: 

PHP is really no match to Python. I have been PHP developer for 3 years and switched to python because i feel Python is more like a hybrid language. Because of python flexibility features i can easily scale.

Language features don't "scale". There is nothing objective in this answer.
viraptor
A: 

I write both PHP, and Python, and I except at both, but I prefer Python. So please, educate yourself, and stop talking shit.

Php Programmer