Write web apps in Python?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Apr 20 17:00:09 CEST 2010


Bryan a écrit :
> Bruno Desthuilliers wrote:
>> Gilles Ganault a écrit :
>>> Apart from the ease of having the application run at all times, I'd be
>>> curious to read about an application that was written in PHP and then
>>> a long-running process and see if performance improved.
>> I'm not sure there's a way to do such a thing in PHP, at least in a way
>> that wouldn't make the whole benchmark totally meaningless.
> 
> I think you guys got some incorrect info about PHP. A variety of
> execution options are available, such as FastCGI and in-server
> modules. 

mod_php, yes, but that doesn't change anything to the fact that it has 
to rebuild the whole world on each and every request. Not the same as a 
true long-running process.

So, yes, you COULD write a cli PHP app, daemonize it, and add a mod_php 
/ FastCGI / whatever request handler to interface the cli app with the 
web server, but that would be kinda pointless, wouldn't it ? FWIW, 
that's what I was thinking about when asserting it would "make the whole 
benchmark totally meaningless".

> PHP frameworks generally allow and encourage application code
> to be independent of the underlying plumbing.

This is debatable at best. PHP code (except cli PHP code of course) is 
written without any care for persistent global state, concurrency 
issues, race conditions etc - because it's written with the idea that 
the code serving a request will be runned in total isolation. CGI 
heritage here, obviously. And please note I'm not criticizing this 
design- just pointing one of it's consequences.

> Many large,
> sophisticated, high-volume web apps are in PHP.

Did anyone pretend otherwise ?

> We like Python 'round here, but PHP, Ruby, Perl, Java, and others are
> viable languages for web apps.

Did anyone pretend otherwise ?

> Each has its distinguishing features --
> how efficiently a web app gets invoked is not among them. It's not a
> language issue.

Well, when it comes to PHP, yes, it's somehow built in the language - 
PHP was designed from the ground to be a server page language, and to 
have each request served in total isolation (cf above).

> What was the theory here? Did we think the PHP
> community too stupid to understand FastCGI?

Bryan, I'm afraid you're reacting to something that was nowhere written 
in this thread.




More information about the Python-list mailing list