Isolated: Was: [mod_python] ModPython + Virtual Hosting Apache2 instance = poor performance.

Christopher Sean Hilton chris at
Sun Mar 7 21:42:44 EST 2010

On Mar 7, 2010, at 6:06 PM, Graham Dumpleton wrote:

> You said you were using PHP, so you cant use worker MPM with Apache.
> You can still use mod_wsgi with prefork MPM, just ensure you run WSGI
> application in daemon mode of mod_wsgi to avoid issues discussed in
> article. Do note though that you can't use mod_wsgi with a Python
> installation which hasn't been compiled with thread support. You also
> cannot use daemon mode with a APR library for Apache that doesn't have
> thread support.

Thanks for the tip, That would have been a real huge problem. 

> Rebuilding Python without threading should not cause such a dramatic
> improvement especially considering I recollect you had only loaded
> mod_python and not used it. I would suggest your rebuilding has seen
> some other change. I also don't know what earlier post you are talking
> about as there was no such post in this current thread on mod_python
> list.

I didn't make any quantitative measurements. Here's what I observed:

Browsing this page with the "broken" configuration took approximately 1min to load all of the thumbnails. In the "fixed" configuration it loads instantly. N.B. that I'm looking at this over 100Mbit LAN.

The thread Martin pointed to seemed to conjecture that the problem has to do with apache under FreeBSD being single threaded and thus depending on while a threaded python and thus a mod_python built to use it depends on I believe the thread mentions a patch by you but it may be a different Graham.

I confess that I didn't understand the whole thing. What I took from it is that I'm going to have problems using a non-threaded apache with a threaded mod_python. I tested this conjecture by building a fresh FreeBSD install with fresh installs of apache 2.0.63, python2.6 and mod_python. And I can make the problem appear and disappear by simply changing the configuration of the python 2.6 build from threaded to non-threaded. I feel that I may have the logic about the reason wrong. I think its a weird vs issue. But I'm confident that I've trapped the problem. 

To tell the truth it doesn't matter. My end goal is to run Django and nowadays Django want's mod_wsgi so I'm moving over there. What I'm learning talking to you is that as far as performance goes python want's a worker MPM apache which php cannot do. 

One of the things I did yesterday was download NetBSD 5.0.2 Sparc64 which I can use on my Netra T1 downstairs. Perhaps my solution is to just build a separate webserver for my python/Django needs?


                                       "There will be an answer, Let it be."
                                                          chris at

More information about the Mod_python mailing list