Python as a Server vs Running Under Apache
Jean-Paul Calderone
exarkun at divmod.com
Sun Jan 1 18:22:59 EST 2006
On 1 Jan 2006 14:44:07 -0800, mojosam <zjw1hu702 at sneakemail.com> wrote:
>I guess I'm a little confused, and this certainly comes from not yet
>having tried to do anything with Python on a web server.
>
>I remarked once to a Python programmer that it appeared to me that if I
>had a web page that called a Python program, that the server would:
>1. Load Python
>2. Run the program
>3. Unload Python
This is true of any CGI. It is part of the definition of CGI.
>
>Then the next time it has to serve up that page, it would have to
>repeat the process. This seems inefficient, and it would slow the site
>down. The programmer confirmed this. He said that's why I should use
>mod_python. It stays resident.
There are lots of ways to write web applications aside from CGIs. mod_python is one.
>
>Is this advice accurate? Are there other things to consider? Isn't
>there just some way (short of running something like Zope) that would
>keep Python resident in the server's RAM? This is a shared server, so
>the web host probably doesn't like stuff sitting around in RAM.
Using Twisted, FastCGI, SCGI, or even BaseHTTPServer in the standard library will address /this/ particular issue (there are lots of other solutions, too, not just these four). Some of them may address other issues better or worse than others.
Jean-Paul
More information about the Python-list
mailing list