[mod_python] Sessions performance and some numbers

dharana dharana at dharana.net
Wed Apr 6 15:31:32 EDT 2005


Hello,

I've just started using mod_python, I wrote my own handler and some modules.

After a bit of work i saw what I believed was bad performance, and I
started profiling.

What I've found is this:

ab -n 100 http://localhost/not_found.html
Trying to fetch non-existant file, that is, just apache: 623 req/sec)

ab -n 100 http://localhost/python_bare.py
It's only contents are "def handler(req): return": 324 req/sec

ab -n 100 http://localhost/python_session.py
Contents of python_session.py
---------------
def handler(req):
   from mod_python import Session
   req.sess = Session.Session(req)
   req.sess.save()
   return
---------------

8 req/sec !!!!

As we can't use MemorySession on Linux (Linux is multiprocess, right?)
what are the possible alternatives? Would a custom FileSession ala PHP
be faster?

I found an old post from 2001 where some people recommended using a
custom Session Server but I don't know if this recommendation still holds.

Server:
Hardware: CPU 1ghz, 1Gb RAM 133Mhz, 7200 rpm ATA hdd and negligible load
Software: Debian stable, apache 2.0.52 prefork, mod_python 3.1, python 2.4

Thanks in advance for any advice.


PD: Just for the record, a similar php_bare test with "function test() {
return; } test();" and in the same conditions brought 316 req/sec.

-- 
Juan Alonso
http://gamersmafia.com | http://laflecha.net




More information about the Mod_python mailing list