[mod_python] Performance Problem

Graham Dumpleton grahamd at dscpl.com.au
Thu Aug 18 06:08:18 EDT 2005


Combined responses for some of your questions spread over multiple 
emails.

> Does using global variables in mod-python handler affect the 
> performance ?

No.

This is because the variable is still local to the module as it exists
within a specific interpreter. A global variable is NOT shared between
processes or multiple interpreters within the same process. I make this
point as based on past questions, some have had the misconception that
they are.

> Does importing a module inside a mod-python handler affect the 
> performance ?

Presuming that you are using "import" statement, not that you would 
notice.

Any overhead is the same as if you had done the same thing in a regular
Python script. This would amount to a check of sys.modules on subsequent
requests, ie., dictionary lookup, to see that the module had already 
been
loaded. The module is not loaded more than once.

I can't comment on performance issues related to the specific packages
you are using.

Graham



More information about the Mod_python mailing list