By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

What's with "long running processes" ?

P: n/a
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?

Sep 18 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

Sep 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.