Apache Mod-Python - Re: svn commit: r290569 - /httpd/mod_python/trunk/lib/python/mod_python/SQLiteSession.

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > September 2005 > Re: svn commit: r290569 - /httpd/mod_python/trunk/lib/python/mod_python/SQLiteSession.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: svn commit: r290569 - /httpd/mod_python/trunk/lib/python/mod_python/SQLiteSession.
Jim Gallacher

2005-09-22, 8:47 pm

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).
>
>
>
> ...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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com