What's with "long running processes" ?

  • Thread starter Bruno Desthuilliers
  • Start date
B

Bruno Desthuilliers

walterbyrd a écrit :
I understand that Python has them, but PHP doesn't.

Really ?
I think that is because mod_php is built into apache, but mod_python
is not usually in apache.

Language etc aside, what the difference between mod_php and mod_python
(or mod_whatever) from apache's POV ?
If mod_python was built into apache, would
python still have long running processes (LRP)?

mod_php is not more 'built into' apache than mod_python. Both are
extension modules for apache. FWIW, when apache is configured to use
mod_python, it starts a first python interpreter process at startup,
then some more python "sub-interpreters" when needed, according to your
configuration.
Do LRPs have to do with a Python interpreter running all the time? Or
is it something else?

The notion of "long running process" is nothing Python-specific. The
most basic way to deliver dynamic content from a web server like apache
is to use CGI - which means that on each http request, the web server
starts a new (Python | Perl | PHP | Whatever) process. A more elaborate
solution is to have another process running independently, and some way
for both processes (web server and application) to communicate. This was
is usually known as a "long running process".
I also understand that LRPs are the reason that shared hosting is less
common, and more expensive for python than php.

Yes and no. You can use Python with apache without a LRP - either with
CGI or mod_python - but the first solution is very inefficient, and the
second is not really appropriate for shared hosting given how mod_python
works. Also, while LRPs have a big advantage (you don't need to rebuild
the whole world for each and every request), they have a couple
drawbacks when it comes to shared hosting. The first one is that your
host must provide some way to manage (run/stop/restart/monitor) the
process. The second is that, while CGI scripts are (more or less) under
control of the web server (IOW : they won't hang out forever), it's not
true for LRPs. Which means that a program error (ie: an endless loop
allocating memory on each iteration...) can potentially bring the while
server down. Not that there are no ways to limit the risks and
consequences, but this requires much more work for the host (and believe
me, shared hosting administration is not simple...).
The LRP have a major
effect on how many users can packed onto a single server.

Not necessarily. From a purely technical POV, they are usually less
wasteful wrt/ resources than CGI or mod_php.
As to LRPs: does it matter if you're using mod_python, fastcgi, wsgi,
scgi, cgi, or whatever?
>
Obviously, I am a little foggy about LRPs, can somebody help me out?

You can help yourself out, by installing apache on your own machine and
learning the different ways to deploy web applications with it. While
you won't have the same constraints as a shared hosting admin, you'll at
least get a better understanding of the whole damn thing.
 
W

walterbyrd

I understand that Python has them, but PHP doesn't.

I think that is because mod_php is built into apache, but mod_python
is not usually in apache. If mod_python was built into apache, would
python still have long running processes (LRP)?

Do LRPs have to do with a Python interpreter running all the time? Or
is it something else?

I also understand that LRPs are the reason that shared hosting is less
common, and more expensive for python than php. The LRP have a major
effect on how many users can packed onto a single server.

As to LRPs: does it matter if you're using mod_python, fastcgi, wsgi,
scgi, cgi, or whatever?

Obviously, I am a little foggy about LRPs, can somebody help me out?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top