Gregory (Grisha) Trubetskoy wrote:

I think it might be interesting to see something like an ANSI SQL-92 compatible session with some suggestions on how it can be easily integrated with your database vendor of choice, but deifinitely not support specific database vendors, except for those whose support exists natively in the Python distribution (which is none at this point).

and is this the path we want to take, or is there something about sqlite that makes it unique?


...so nothing unique about sqlite? If so, I don't think it should be part of mod_python unless/until it is standard in Python, then we can discuss it.

Thinking about the session code, there is at least one big advantage to any SQL backend. One of the bottlenecks in both DbmSession and FileSession is in the expired session cleanup code.

In DbmSession the cleanup code must iterate over *all* of the dbm records and unpickle each one to determine if the session data should be deleted. Needless to say this does not scale at all.

FileSession is better or at least when the cleanup code runs it won't DOS the server. Again, we must iterate over all the session files to determine which ones have expired and should be deleted. I think I put some fairly clever things in there to make it scale, but I know it's not ideal.

Contrast this with the cleanup for a SQL backend which would be as easy as:
   DELETE FROM sessions WHERE expires < current_time - timeout;
assuming the sessions table has the expires and timeout fields updated from the session data when the db record is updated (or inserted).

Thus a SQL backend would scale in a way that DbmSession or FileSession cannot. Granted, this is not unique to sqlite, but it is an argument for have some kind of sql session class.

Regards,
Jim

Reply via email to