Search code examples
phppythonprocesswebuptime

PHP non-persistent process design vs Python/Java


Currently I'm considering between these 3 languages for a project that will require a very high uptime (uptime is more important than performance).

I've been a PHP developer for some time and wouldn't mind switching to a "better" language such as Python or more (possibly) more professional such as Java but there is one thing holding me back:

In PHP suppose one user creates some malformed/strange request that causes my code to crash - only that single user will be affected. Other users can continue making requests since each HTTP request invokes a new PHP process.

Consider Python or Java: if a user crashes my backend code, there is only a single process running and the entire webapp goes down which would be a disaster.

My question is, is there a word that describes these two different approaches to web programming? Also, am I missing anything obvious, or does PHP really have this great of an advantage over Python/Java/other persistent process approaches and if so, why doesn't Python adopt this approach?


Solution

  • What I was looking for was someone to point me to an article like this:

    http://www.electricmonk.nl/docs/apache_fastcgi_python/apache_fastcgi_python.html

    Python can run persistently in the background via WSGI, and there can be many interpreteres waiting for a request. If one of the interpreters crashes, this is not a problem as other interpreteres are waiting, and because Apache can automatically restart any interpreter that crashes.

    Python can also be invoked manually on every request similar to PHP, but this is slower.