[mod_python] High traffic recommendations

Jim Gallacher jpg at jgassociates.ca
Thu Feb 16 16:36:24 EST 2006


Marc D. Murray wrote:
> On Thu, 2006-02-16 at 12:31 -0500, Jim Gallacher wrote:
> 
> 
>>I suspect changing to FileSession may solve some of your problems.
> 
> Right now, I'm calling Session.Session(req). So I guess it defaults to
> dbm session. 

On *nix, yes.

> And it would put the dbm wherever it feels like.

It's not *quite* that random, but in effect yes. ;) In 3.1.4 it uses 
tempfile.gettempdir() to determine the location. In 3.2 you can specify 
the location with PythonOption session_directory /some/path.

> 
> Changing the cleanup chance was one of the reasons I wanted to subclass
> DBMSession

Did you change the locking scheme as well? Just curious.

> 
>>>Do you guys think I should use the newer version of python when building
>>>mod_python?
>>
>>There are no python 2.4 specific features in mod_python 3.2.7, so from 
>>that perspective it's not necessary. We generally test with both python 
>>2.3.5 and 2.4.
> 
> I was asking this question from a performance perspective actually. I
> was lazy and didn't bother to read the differences between 2.3 and 2.4.
> So when I go to python.org/docs I just use the 2.3 documentation. But is
> 2.4 any faster/smaller/better?

I seem to recall reading somewhere that 2.4 is a few percent faster, but 
I don't think it will be significant.

>>BTW, how do you define high traffic? If you mentioned this before I 
>>missed it.
> 
> According to Webalizer for February:
> Avg Pages per Day: 99521
> Max Pages in 1 day : 310537
> And they're all here looking for *.(jpg|zip|wmv) files. I serve those
> files out of lighttpd though.

How many unique sessions might that represent? ie. how many unique 
records in dbm?

> 
> I just installed a python2.4-mod_python3.2.7 on my test server. I didn't
> change any configuration options. 

Configuration options in Apache, or for compiling mod_python? I hope 
(and assume) you used ./configure --with-python=/usr/bin/python2.4 (or 
whatever) when  you compiled mod_python. Strange things could happen 
otherwise, since the sys.path will be different from where your other 
modules such as ldap live.

> I had to install 2.4 versions for a
> couple modules I use (ldap,lxml,memcache,cheetah), but after that, it
> works. So back to the Python2.4 vs Python2.3.5 question.

Jim


More information about the Mod_python mailing list