perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Ochs <snackt...@gmail.com>
Subject apache:session and mod perl
Date Thu, 30 Dec 2004 07:42:52 GMT
This question could go to one of several different lists, but I
thought this might be a good place to start.

I have an application based on mod perl and the Template Toolkit.  For
session tracking I am using Apache::Session with the postgresql
backend store.

The issue I am having is that the postgresql store doesn't do any
locking, which is causing some requests to read bad data, but I really
want to keep the database as the backend store because it will scale a
lot better if we need to have multiple servers access the same session
data.

What is happening is when a page that is loaded loads other pages
(such as a frameset), sometimes the request for the first page doesn't
finish before the other requests have already read the session data. 
It goes like this.

- Request 1 fetches session
- Request 2 fetches session
- Request 1 changes some session information
- Request 1 writes out session info
- Request 2 writes out session info

In our case a flag stating whether a user is logged in or not is
stored in the session.  If Request 1 logs out a user, Request 2 flags
the user as logged in again when it writes out the session data.

Solutions I have thought of so far include..

1. Switch back to file based sessions, not what I want.

2.  Switch to BerkelyDB sessions.  Have had problems with database
contention previously though which locks up the session manager so I'm
uneasy about that one.

2. Keep a separate pool of cached connections just for the session
database, and have those connections use a transaction isolation level
that guarantees no dirty reads.  Would use up a bunch of database
connections.

3.  Use the mysql backend store which supposedly has locking, but I
already use postgresql and would rather not have to depend on two
databases for one application.

Any other ideas on possible solutions?

Chris

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message