quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Gallacher <jg.li...@sympatico.ca>
Subject Re: [mod_python] Sessions performance and some numbers
Date Sat, 09 Apr 2005 17:27:34 GMT
dharana wrote:
> Nicolas Lehuen wrote:
>> I was thinking about this particular optimization, and it seems ok,
>> provided the session is saved each time it is accessed. is there an
>> access time that could be checked otherwise ?
> The session is only saved after a .save() call, like MemorySession and 
> DbmSession do. If you load a session and don't .save() it, it won't have 
> the _accessed field updated (If I understood correctly the code).

Absolutely. But the point of sessions is to save some state information 
on the server across requests, isn't it? Why wouldn't you save it? If 
you are not saving, why bother with sessions at all? Just put it all in 
a cookie and be done with it. Or am I missing something? (I hope that 
doen't sound like a rant. It really isn't. :)

On the other hand, if we end up using the file mtime to track session 
access there is an optimization available. Something like:

if dict._is_dirty:
     sess._is_dirty = False

Any application code that modifies the session data would be responsible 
for setting the _is_dirty flag.

This could save a whole lot of pickle dumping time on a busy site if the 
session data tends not to change between requests. Of course, handling 
it this way invalidates the secondary check of the session expiry I 
talked about earlier.


View raw message