Question

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?

Was it helpful?

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.

OTHER TIPS

This is not a language specific problem. This is a problem how you test your software before you put it into your live environment. And how you desgin your server infrastructure.

If you have a bug in your Software that crashes the server you should fix it. Even PHP can crash the complete server if there is a strange bug in mod_php/your code.

If you don't want to have a single point of failure you must build a high availability setup. at least 2 Loadbalancers (for example with keepalived), 2 Webservers, 2 Databaseservers, 2 ...

Also you want to use something like God or mon to monitor your processes and to react on sudden death of needed services.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top