[mod_python] Windows performance problem

William Chapman jeddahbill at gmail.com
Wed Jun 4 13:45:58 EDT 2008


A follow-up on my "Windows performance problem":

The problem was caused by the unexpected performance difference between the
Linux and Windows versions of a JSON package - simplejson.  **** It had
nothing at all to do with mod_python. ****  It turns out that simplejson's
"speedup" feature was not functioning properly with Windows.  To acheive
better performance I needed to convert several performance-critial sections
of my mod_python handler to use cjson instead.

I would like to put in a good word, however, for both the cjson and
simplejson packages.  They are both excellent.  simplejson has more
features, is well documented, and very flexible; cjson is simpler, somewhat
less flexible, and much faster.

Thanks again to Graham and Dominique for keeping me properly focused (away
from mod_python).  Who knows for how long I would have wandered in the
wilderness?!

On Mon, Jun 2, 2008 at 11:21 AM, William Chapman <jeddahbill at gmail.com>
wrote:

> Graham & Dominique,
>
> Thanks for your responses and fresh insights!
>
> Progress so far:
> Per your suggestion, I have tested the Windows XP (x64) & Linux
> installations for static file serving performance, and found both to be
> equally excellent.  Actually, I think the Windows is even a bit livelier
> than the Linux.
>
> Next step I'm considering:
> (1) Reinstall Apache, Python, and mod_python, with versions to match those
> installed on the Windows side of my alternate host.  Because I generally
> always choose the latest versions of everything I install, the older host
> machine is probably a version or so behind.  I might learn something there.
>
> Other information about my environment:
> My web application uses sqlite (pysqlite binding) - and a few other Python
> packages - but sqlite is the only one involved that's a performance driver.
> Dominique mentioned the possible impact of other web application software
> dependencies.  Because I use sqlite, I'll also include it in the list of
> software to reinstall, possibly reverting to an older version.
>
> By the way, I checked the Apache error logs on the (older) test-host and
> the mod_python error messages are NOT present.  I believe it's running
> Apache 2.5.1 versus 2.5.2 on the new (problem) development-host.
>
> Thanks again for your help.  I will post progress to the list.
> Hasta la vista, ciao,
> -- Bill Chapman
>
>
> On Sun, Jun 1, 2008 at 6:49 PM, Graham Dumpleton <
> graham.dumpleton at gmail.com> wrote:
>
>> 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
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080604/012653db/attachment.html


More information about the Mod_python mailing list