[mod_python] High Traffic Round 2

Marc D. Murray marcdm at phronein.com
Mon Feb 20 00:37:18 EST 2006


Here we go again with me and my high traffic site that I'm attempting to
deploy using mod_python.

After a VERY stressful week, with a site that goes down every 2 - 5 hrs,
I decided to move away from mod_python.publisher and Sessions totally.

I wrote my own handler that decides which module/page to load based on
the 1st part of the URL. 

After deciding, it loads the module using __import__(module_name)
and executes a function named _dispatch which all of my modules have.

However, it is VERY VERY SLOW. It works fine on my local server but goes
at snail's pace on the production server. 

My home server is an Athlon 1Ghz w/256MB RAM and the production box has
a celeron 2.6 with 512MB RAM.

I'm using memcached to store generated pages, and the cache is managed
by the handler. The memcached client I'm using is the same one python
one linked from the memcached homepage. This means that if a page has
been cached, the module won't even be imported before the output is
grabbed from cache.

So basically, I've designed this thing the best way I know how. I can't
think of any way to make it any more efficient but it still doesn't work
as expected.

I'm really f**king tired right now. and my head hurts.

Marc DM.

PS. Where's the mod_python irc channel? 




More information about the Mod_python mailing list