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

Christopher Sean Hilton chris at vindaloo.com
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.
 
     http://fileshare.vindaloo.com/SoccerPhotos/page-0001.html

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 libc.so while a threaded python and thus a mod_python built to use it depends on libc_r.so. I believe the thread mentions a patch by you but it may be a different Graham.

     http://osdir.com/ml/apache.mod-python.devel/2008-10/msg00000.html

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 libc.so vs libc_r.so 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?


--Chris

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






More information about the Mod_python mailing list