[mod_python] How to handle memcached connections?

Sebastjan Trepca trepca at gmail.com
Tue Feb 7 15:20:53 EST 2006


Hi!

I'm using memcache to store sessions in it. For now I create a new
connection for each request which is quite inefficient. I'm using
apache2-worker and I tried to store a connection as a global variable
of a module. It worked as long as there were only one conccurent user
on the site. When there were more the sessions started to mix, so one
user got a session of the other etc. Of course I forgot about the
thread thingy :)

So do you have any suggestions on how to handle this the most
efficient way. I was thinking of creating a dictionary with locking
where keys would be thread IDs and values connections. Somekind of
connection pool.

Thanks for help, Sebastjan



More information about the Mod_python mailing list