You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Jones <ke...@develop.com> on 2001/03/31 11:07:10 UTC

Session Persistence

How do I enable the persistence manager in Beta 2. There's no entry in the
server.xml file, and I couldn't see anything in the docs.

Thanks,

Kevin Jones
DevelopMentor
www.develop.com


Re: Session Persistence

Posted by Kief Morris <ki...@bitbull.com>.
Kevin Jones typed the following on 10:07 AM 3/31/2001 +0100
>How do I enable the persistence manager in Beta 2. There's no entry in the
>server.xml file, and I couldn't see anything in the docs.

It's currently an unofficial feature, so undocumented. Put the following
into your $CATALINA_HOME/conf/server.xml (not web.xml), in the 
<Context> section for your webapp: Catalina's xml parsing is strict,
so you need to put it in the right place in relation to other tags in
the Context, which is after <Ejb/> and before <Environment/>

     <Manager className="org.apache.catalina.session.PersistentManager"
          debug="0"
          saveOnRestart="true"
          maxActiveSessions="-1"
          minIdleSwap="-1"
          maxIdleSwap="-1"
          maxIdleBackup="-1">
              <Store className="org.apache.catalina.session.FileStore"/>
    </Manager>

Documentation:

        saveOnRestart: If true, all active sessions will be saved
                 to the Store when Catalina is shutdown properly, regardless of
                 other settings. All Sessions found in the Store will be
                 loaded on startup. Sessions past their expiration are
                 ignored in both cases.

        maxActiveSessions: If 0 or greater, having too many active
                 sessions will result in some being swapped out. minIdleSwap
                limits this. -1 means unlimited sessions are allowed.
                0 means sessions will almost always be swapped out after
                 use - this will be noticeably slow for your users.

        minIdleSwap: Sessions must be idle for at least this long
                (in seconds) before they will be swapped out due to
                 maxActiveSessions. This avoids thrashing when the site is
                 highly active. -1 or 0 means there is no minimum - sessions
                 can be swapped out at any time.

        maxIdleSwap: Sessions will be swapped out if idle for this
                 long (in seconds). If minIdleSwap is higher, then it will
                 override this. This isn't exact: it is checked periodically.
                 -1 means sessions won't be swapped out for this reason,
                 although they may be swapped out for maxActiveSessions.
                 If set to >= 0, guarantees that all sessions found in the
                 Store will be loaded on startup.

         maxIdleBackup: Sessions will be backed up (saved to the Store,
                 but left in active memory) if idle for this long (in seconds),
                 and all sessions found in the Store will be loaded on startup.
                 If set to -1 sessions will not be backed up, 0 means they
                 should be backed up shortly after being used. [Not implemented yet]

       To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
       and minIdleBackup all to -1, saveOnRestart to false, then restart
       Catalina.
 
ISSUES:
- The <Store/> tag doesn't currently work, FileStore is currently hard-coded
- Sessions which are restored after a restart, and have attributes changed,
  don't seem to be saved on the next shutdown: after a second restart, only 
  the attributes from the first restart are recovered.
- No test harness exists.
- Backup isn't implement.