[BangPypers] cgi help

Noufal Ibrahim noufal at gmail.com
Wed Oct 6 14:52:33 CEST 2010

On Wed, Oct 06 2010, Senthil Kumaran wrote:

> On Wed, Oct 06, 2010 at 04:57:15PM +0530, Noufal Ibrahim wrote:
>> "Loading the interpreter" is a general term. Interpreters do various
>> things when they start which can significantly affect performance
>> (searching module include paths is one example).
> CGI scripts have be to executed by an interpreter process.  And CGI
> handling webserver modules, like mod_python/mod_perl invoke an
> interpreter instance as process for handling each request.  
> The blurb from the Wikpedia did mention about what I was trying to say
> as heavy weight operation.
> http://en.wikipedia.org/wiki/Common_Gateway_Interface#Drawbacks
> And better way in Python at the moment is WSGI.

Definitely. I totally agree with you. However, if (for whatever reason),
you have to use CGI, perl outperforms python. 

CGI is not all bad news either. One nice thing for example is that
memory leaks and stuff, if there, will last only for one single request
and won't really hurt the webserver as opposed to with a persistent
process where they will accumulate. Ian Bicking talked about some of
these over here

> The perl vs python comparison on shell is interesting and could be due
> to variety of reasons, but I am not sure if this performance
> comparison is conclusive for using perl on webserver instead of
> python. I have not come across this argument earlier. If it is
> something which people consider, it would be interesting to know.

If I needed low startup times, I'd think twice before using python. It's
getting better over the years but thanks to the perl attitude of
sacrificing clarity and legibility for performance, they have a really
fast (and unmaintainable) interpreter.

I don't think it's conclusive but I'd be willing to bet that a simple
page served using cgi using Python and Perl would perform quite
differently based on this alone.

I've been bitten by this repeatedly at my previous workplace. The fact
that the Python site-packages were served off an NFS mount didn't help

> Perl+CGI has been there and is quite mature, that could be a probable
> argument.

That's quite possible. I personally quite like perl in some
situations and still indulge from time to time. :)


More information about the BangPypers mailing list