apache:session and mod perl

[prev] [thread] [next] [Date index for 2004/12/30]

From: Chris Ochs
Subject: apache:session and mod perl
Date: 07:42 on 30 Dec 2004
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

(message missing)

apache:session and mod perl
Chris Ochs 07:42 on 30 Dec 2004

Re: apache:session and mod perl
Octavian Rasnita 08:00 on 30 Dec 2004

Re: apache:session and mod perl
Chris Ochs 08:09 on 30 Dec 2004

Re: apache:session and mod perl
Perrin Harkins 17:57 on 30 Dec 2004

Re: apache:session and mod perl
Chris Ochs 21:15 on 30 Dec 2004

Re: apache:session and mod perl
Perrin Harkins 22:04 on 30 Dec 2004

Re: apache:session and mod perl
Chris Ochs 05:44 on 31 Dec 2004

Re: apache:session and mod perl
Chris Ochs 07:41 on 31 Dec 2004

Re: apache:session and mod perl
Chris Ochs 17:51 on 31 Dec 2004

Re: apache:session and mod perl
Perrin Harkins 23:40 on 03 Jan 2005

Generated at 12:16 on 16 Jan 2005 by mariachi v0.52