[mod_python] Advantages of running non web oriented script using mod_python

Sean Davis sdavis2 at mail.nih.gov
Thu Oct 16 12:35:00 EDT 2008


2008/10/16 Leeron Shalev <leeron at devunity.com>:
> The execution will probably be frequent, and figuring I'll have the same
> problem with exec() as with CGI was exactly what made me post
> this question to the list.
> The thing is, I'm wondering will using mod_pythin do much of a difference if
> most of the operation is not at all web oriented.

mod_python does not require the python interpreter to start on every
script invocation--that is the main performance difference between it
and CGI or exec().  That said, there are a number of other
alternatives besides mod_python if you do not need to interact with
apache.  You could set up a simple XMLRPC server (or any other daemon
process) or use mod_wsgi as a couple of examples.

Sean


> On Thu, Oct 16, 2008 at 5:27 PM, Clodoaldo Pinto Neto
> <clodoaldo.pinto.neto at gmail.com> wrote:
>>
>> 2008/10/16 Leeron Shalev <leeron at devunity.com>:
>> > I'm currently working on something else, and just pondering the
>> > python-to-php issue, so yes, please do get back to me later with the
>> > rest of
>> > the details.
>> > The thing is, I'm sure it will work - I'm just asking if anybody has a
>> > word
>> > of wisdom on which of the approaches will work best.
>>
>> If the script will be executed frequently then the exec() will have
>> the same performance problem that CGI has, that is, the interpreter
>> will be loaded and discarded at each call. If it is not frequent then
>> i guess there wouldn't be much difference.
>>
>> Regards, Clodoaldo
>>
>> >
>> > On Thu, Oct 16, 2008 at 5:05 PM, Clodoaldo Pinto Neto
>> > <clodoaldo.pinto.neto at gmail.com> wrote:
>> >>
>> >> 2008/10/16 Leeron Shalev <leeron at devunity.com>:
>> >> > Hello list :)
>> >> > I love python, and have some experience using mod_python.
>> >> > The thing is I have a web site that is based heavily upon PHP.
>> >> > I have a specific task (Involving file manipulation and some
>> >> > libraries
>> >> > that
>> >> > are implemented better in python than in PHP) that I'm planing on
>> >> > using
>> >> > a
>> >> > python script for.
>> >> > At start I thought I'll use mod_python for it, but the integration
>> >> > with
>> >> > the
>> >> > DB and PHP objects soon became to much of a pain in the ass.
>> >> > So the the two main options I'm now considering are:
>> >> > 1. Using PHP for everything else and calling the python script using
>> >> > PHP's
>> >> > exec() function.
>> >> > 2. Using PHP for everything else and calling the python script via
>> >> > apache
>> >> > and mod_python. (using php fopen() or something).
>> >> > As I said, the final python script is mainly for manipulating the
>> >> > filesystem
>> >> > and not really a web oriented script -
>> >> > Do you think I'll have any benefits from using method 2 (in terms of
>> >> > performance and concurrency) ?
>> >> > Any help, thoughts or advice will be much appreciated.
>> >>
>> >> I have an old php site in which the chunck of code that executes a
>> >> certain task was a bit convoluted (as usual in php) and as i wanted to
>> >> change it i wrote it in python and it works nice. It is called as a
>> >> web service and returns some lists (as text not html) which are loaded
>> >> into arrays in php. I don't remember how exactily i did it as i have
>> >> no access to the server now. In some hours i can check it and return
>> >> to you if you still haven't figured it out.
>> >>
>> >> Regards, Clodoaldo
>> >>
>> >> > Cheers,
>> >> > Leeron
>> >> > _______________________________________________
>> >> > Mod_python mailing list
>> >> > Mod_python at modpython.org
>> >> > http://mailman.modpython.org/mailman/listinfo/mod_python
>> >> >
>> >> >
>> >
>> >
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list