[mod_python] Windows performance problem

Graham Dumpleton graham.dumpleton at gmail.com
Sun Jun 1 21:49:25 EDT 2008


2008/6/1 William Chapman <jeddahbill at gmail.com>:
> I'm new to this list, but have been using mod_python successfully for three
> years in a web app served by both Linux (Ubuntu) and Windows (XP sp2 32bit
> AND 64bit).  I use two hosts to serve: one for testing (semi-public); one
> for development.  Both hosts are dual-boot (Linux/Windows) and will serve
> the identical web app installation from the same (NTFS file system)
> directories.
>
> My problems started when the development host went belly-up and I rebuilt
> the computer.  The Windows installation was upgraded (?) from 32bit to 64bit
> XP sp2.  (I don't know if going to x64 Windows is part of the problem; I
> doubt it.)  Upon bringing up the new development host, all went well with
> the Linux side, but under Windows, the web app is perfroming poorly.  The
> application accesses take much too long.  Historically, the Windows & Linux
> installations were comparable, and I never had performance complaints.  Now,
> the new Windows installation is 5x to 10x slower than previously.  To
> emphasize, the mod_python is "working," but very slowly, and comletely
> unlike my previous experience with Windows/Apache/mod_python, not to mention
> my current testing host which is fine.

Have you tested speed of serving static files? That is, is it a
mod_python specific problem or a problem with Apache as a whole?

> The setup (all installed from binaries):
> Windows XP x64 sp2
> apache 2.2.8
> mod_python 3.3.1
> Python 2.5.2 (installed separately)
>
> Note:  I am not exactly sure of the order in which I installed
> Apache/mod_python & Python 2.5.  Could this matter?
> I did uninstall and reinstall mod_python but performance/symptoms didn't
> seem to change.
>
> The only clues:
> Three lines together from apache error.log (long lines - STRETCH BROWSER)
> (file also attached) (also see Graham's email here.):
> [Fri May 30 17:38:57 2008] [error] python_init: Python version mismatch,
> expected '2.5', found '2.5.2'.
> [Fri May 30 17:38:58 2008] [error] python_init: Python executable found
> 'C:\\Program Files (x86)\\Apache Software
> Foundation\\Apache2.2\\bin\\httpd.exe'.
> [Fri May 30 17:38:58 2008] [error] python_init: Python path being used
> 'C:\\WINDOWS\\system32\\python25.zip;C:\\Python25\\Lib;C:\\Python25\\DLLs;C:\\Python25\\Lib\\lib-tk;;C:\\Program
> Files (x86)\\Apache Software Foundation\\Apache2.2\\bin'.
>
> I have read several of the threads from the list on this subject and am
> confused about the following points:
> (1) In the "Python version mismatch" error, the "found" version matches the
> version of Python I installed on the Windows machine.  mod_python "expected
> 2.5".  Where is that supposed to come from?  I could not find Python 2.5 at
> http://python.org.

You obviously used a prebuilt version of mod_python for Windows. That
prebuilt version used Python 2.5 when compiled. That is what it means.

> (2) Apparently the "Python version mismatch" error message is not enough to
> stop mod_python from working, because it is "working."

On Windows, because Python is obtained via a DLL, the warning can be
ignored as APIs will be compatible. In other words, doesn't matter
that mod_python was originally compiled for older patch revision.

> (3) The "Python executable found" error message points to
> "...\\Apache2.2\\bin\\httpd.exe"  This does not look like a "Python
> executable."  (?)

Outputing this was thought to be a good idea, but not actually of much
use. What it is simply showing is that Python is running embedded
inside of Apache httpd executable. In other words, not standalone
python.exe.

> (4) The "Python path being used" error message specifies a series of paths.
> Where do those paths come from?  Can I affect those values?

To a degree. See PythonPath directive, although changes may with this
may not show up in startup messages as they are applied later. You can
also change it by fiddling Windows registry, but you shouldn't do that
if you can help it.

> Taken as a
> whole it doesn't match the system path environment variable I'm able to set
> as a Windows user.

This is not the PATH variable, it is related to Python module search path.

> Random thought: I always thought that mod_python included an embedded Python
> interpreter, but reading suggests mod_python links to Python libraries.

Both observations are true. Python is used in embedded mode, but code
comes from DLL.

> My analysis:  I suspect that the principle benefit of a mod_python
> installation is not being realized.  It seems that the interpreter is having
> to be restarted for each access.  Is there another explanation for the poor
> performance?

Your understanding is wrong. A new interpreter is not created on each request.

There is obviously still something wrong with your configuration or
perhaps with the web application which only manifests with this
configuration.

Start out by seeing if Apache as a whole is working okay by testing
static file serving.

Graham


> At any rate I would greatly appreciate any suggestions or insights you might
> have!!
>
> With many thanks,
> -- Bill Chapman
>
>
> _______________________________________________
> 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