[mod_python] mod_python slowness

Jack Diederich jack_diederich at email.com
Tue May 13 15:35:10 EST 2003

> I'm pretty sure this is not a DNS problem.  I can break down each loop
> that calls the database, and it shows 0.7 seconds per row returning
> instead of like 0.03 seconds.  The dns servers are all configured
> correctly for both forward and reverse lookups, and I do not have the same
> problems in PHP (other the fact that PHP is crap compared to python - but
> it's not this slow).

Are you doing anything wierd like running apache or progres
through inetd (so it has to start a new process for every
request)?  Or are you doing a new database connection for
each row?

If the identical python program takes 1/10th the time running
stand-alone I think the DNS was one the right track - it must
be a network related problem.

You might also want to print to the resulting page the time
the process took from start to finish.  If the page is very
complicated it might look slower even if it isn't.

You can also try commenting out all the database calls and
timing the stand alone and mod_python versions.  That will
at least allow you to narrow down the problem.  Also consider
using 'strace' on the stand alone and the apache version.
Compare the system calls between the two to see if something
pathological is happening in the mod_python case.

Sign-up for your own FREE Personalized E-mail at Mail.com

More information about the Mod_python mailing list