[mod_python] Session data (Sorry for bringing this up again...)

Matthew Wood woodm at equire.com
Tue Jul 3 00:14:32 EST 2001


Hello  all.   I  would  like  to  apologize  for bringing up the whole
session thing again.  However, I have a somewhat specific question.

I guess my question has more to do with persistent data in general.

One of the main reasons that one would keep persistent data is to keep
database connections open.  (Or any connection for that matter)
The other is to keep session data on the users of your site.

Obviously,   the session data can be kept in the database, and the key
to  the  table can be kept in a cookie or passed via the url.  (That's
one way to do it, there are many ways, including a text-file-pickeling
based scheme, but I think that a database would work quite well.)

However,  the  problem  is that you can't keep database connections in
the  database.   All  the other persistent data can be kept there, but
not the database connection.

The  problem  with  persistent  data in general is the multiple memory
spaces  used  by  apache.   But  it  would be a shame to re-create the
database  connection every single time someone logs into a page.  That
just seems ridiculous to me.

This brings me to my question:
Would  it  be appropriate to keep a database connection in each of the
memory  spaces?

Such  a connection is not very dynamic (I think) and thus you wouldn't
have to worry about having different types of connections or different
values of connections in the different memory spaces. (As you would if
you stored session data, that changes often.)

What  would be the down side to such an arrangement?  I would probably
need to create a method to time out the connections, so they don't sit
there  forever  if  I change something...  Is that correct?  What am I
missing?


Once  again, let me apologize for bringing up the session issue again.
I  have read all the posts here for the last few months, and I thought
I would see what the up/down sides to this plan would be.





More information about the Mod_python mailing list