[mod_python] Custom handler thread safety

Huzaifa Tapal huzaifa at hostway.com
Thu Feb 3 16:54:31 EST 2005


Hello All,

 

I wrote a custom mod_python handler that kind of mimicks the cgihandler but
really is an extension to a web framework we have in house.  Just to be
safe, I implemented thread locking into the handler before any request is
processed.  The application is running on a debian box running Apache 2
multithreaded with mod_python 3.13.  We are gaining huge performance
increases by caching our template objects and db connection objects.

 

The problem I am running into is that if I run through the application, each
request takes on average 300 ms to process.  However, when we benchmark with
20 concurrent users, the average goes up to around 2200 ms.  I am very sure
that this is due to a thread locking shared objects in memory which results
in another thread waiting for the lock to be released.

 

If I take the thread locking mechanism out then we run into problems with
there being too many connections being made to the MySQL db if the cached
connection is being used and then the db starts dropping connections.

 

Any help would be much appreciated.  Even if there are any other good
handlers out there other than cgihandler and publisher.

 

Hozi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050203/714c4f21/attachment.html


More information about the Mod_python mailing list