views:

357

answers:

3

I know that PHP is still the most popular web programming language in the world. This question just want to bring some of my concerns about PHP.

PHP is naturally bound to C10K problem. Since PHP (generally run in Apache) cannot be event-driven or asynchronous, each HTTP request will occupy at least one thread or process. This makes it resistant to be more scalable.

Currently, a lot of web sites (like Facebook & Yahoo!) with high performance and scalability still depends on PHP in their front end servers. I suppose it is due to legacy reason. Is it possible that PHP will be replaced by language more suitable for C10K?

+1  A: 

Seeing the interest around High Quality PHP Framework like Zend PHP, Symfony, Cake, Solar, and some more, i think PHP is rebirthing.

Its new Object Oriented model allows professional developers to come back to known paradigms and attract much more people who didn't want to come to PHP due to the lake of object oriented support.

By the way, I see an increasing demand to hire professional PHP developper with solid skills and a use of PHP Framework (Symfony and Zend Framework are the most wanted here in France).

PHP is not as slow as we can think, good caching, optimized db request are worth to do it. Nowadays it's also cheaper to buy a buch of RAM than optimize code to speed it up in assembly or C.

Boris Guéry
+2  A: 

PHP uses a Shared Nothing architecture which makes it scale very well.

Will PHP die? I'm not ignorant enough to answer that with a bold No. Each technology has it's time and I am convinced there will be something better, leaner, faster, whatever more suitable for the web than PHP eventually. But will PHP die anytime soon? No, I don't think so. The need for scalability is something most of us wish they had, but truth is, most web applications simply don't have the need.


Related reading that has some more information on PHP's scalability

Gordon
That is not a feature of PHP, since PHP also allows to safe client state on the server with sessions. Shared Nothing has nothing to do with the issue of one thread/process per request.
deamon
@deamon Then the issue of one thread/process per request isn't an issue of PHP either. Downvote the question, not my answer.
Gordon
@Gordon +1 for link and valid answer.
zaf
+12  A: 

Is it possible that PHP will be replaced by language more suitable for C10K?

I would say very unlikely.

Never mind Facebook or Yahoo, the vast majority of web sites are not even close to that stage of popularity. Most web programmers are working on small-to-medium-size projects where really high performance simply isn't needed, and extra performance can be more profitably achieved by throwing more hardware at the problem than by employing more programmers to work on efficiency.

Coding for specialist high-performance socket servers is harder and slower than hacking up a PHP script, so PHP(*) is always going to win. And let's face it, chances are you're going to hit other scaling problems (likely database performance) long before the inefficiency of one-thread-or-process-per-concurrent-connection starts to bite.

C10K? For the vast majority of applications, You Ain't Gonna Need It.

(*: or other similar scripting environments. With the PHP6 debacle and PHP5's continued issues with Unicode and sundry other long-standing language-level problems, other languages and frameworks should gain in popularity at PHP's expense. But not ones that sacrifice ease of authoring for high scalability.)

bobince
+1 C10K? For the vast majority of applications, You Ain't Gonna Need It
nik