quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@modpython.org>
Subject Re: [mod_python] Sessions performance and some numbers
Date Fri, 08 Apr 2005 13:56:35 GMT

[also moved this to python-dev]


On Fri, 8 Apr 2005, Nicolas Lehuen wrote:

> Well, I had a go last night, but my brain was a little fuzzy too, so I
> don't mind a double-check. I didn't use the global lock n° 0, which
> would serialize all access to all sessions, but a lock named after the
> session, just like it was done in BaseSession.lock() and
> BaseSession.unlock().
>
> BTW, I'm not sure I understand the current locking system in
> BaseSession : it looks to me as if the lock on the session was held
> for the duration of the whole request (the lock being released during
> the request cleanup). Grisha, is this true ? If this is so, then there
> is no need to lock anything in FileSession, as the BaseSession already
> ensure a proper level of locking.

Yes, there is a lock for the duration of the session. This is to make sure 
that no two requests for the same session are processed at the same time 
(this is a little documented artifact of sessions in other environments, 
e.g. jsp).

The lock 0 is there to serialize access to the DBM. So we have "session 
locks" and "dbm store lock" which serve different purposes.

Since there is a one-to-one correspondence between sessions and files in a 
FileSession, you're right the lock 0 use is probably not appropriate 
(although disk I/O is ultimately serialized by the OS).

However, keep in mind that BaseSession (session locks) is optional (it's 
an __init__ argument), so when session locking is off, you still (and 
especially more so!) need a store lock.

So I guess the bottom line is that FileSession locking is going to be a 
little different :-)

Grisha
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message