Thanks Martin Grotzke for the answer.

"Its's not possible with PersistentManager. PersistentManagerBase
backups all sessions in batches (processMaxIdleSwaps(),
processMaxIdleBackups() are called by the background thread). You
might try to set maxIdleBackup and maxIdleSwap to 0. But even then
sessions are only stored by the background thread (running every 10
seconds by default IIRC) and not directly at the end of the request.
That was one of the reasons why PersistentManager was not an option
for me.
Therefore it's not suited for non-sticky sessions and as a failover
solution it's not reliable as sessions/session updates might get lost."



On 1/15/2011 8:52 PM, Reinwald Warapen wrote:
Any idea why the session does not get persisted to the database immediately (when setting maxIdleSwap='0'). Or is there any other possible way to "Always Load" and "Always Save Sessions" from the database in Tomcat 6

On 1/14/2011 9:07 PM, Reinwald Warapen wrote:
Thanks Mark for the quick response.

I just tried what you mentioned setting maxIdleSwap='0'. But for some reason the session does not get persisted to the database immediately. It takes around 30 sec for it to happen . Any other setting I need to add inorder that it saves immediately so that i can safely use it in a non-sticky session environment.
Ive added a snippet of the server.xml for your reference :
<Manager className="org.apache.catalina.session.PersistentManager" maxIdleSwap='0'>
<Store className="org.apache.catalina.session.JDBCStore"
connectionURL="jdbc:mysql://172.16.142.163:3306/session2?user=user&amp;password=password" driverName="com.mysql.jdbc.Driver" sessionAppCol="app_name" sessionDataCol="session_data" sessionIdCol="session_id" sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive" sessionTable="tomcat_sessions" sessionValidCol="valid_session" />

</Manager>

Thanks

 On 1/14/2011 8:31 PM, Mark Thomas wrote:
On 14/01/2011 14:56, Reinwald Warapen wrote:
Hey,
Im am migrating my webapp from Resin to Tomcat 6. In Resin there is an
option to "always save sessions" and "always load sessions" from the
persistent store (mysql db). Ive configured my tomcat instance to use
the JDBC for the persistence of sessions.
(http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html ). But the
sessions are stored only when Tomcat shutsdown/restarts or if the idle
time has exceeded. There is no mention of how to "always save" and
"always load sessions" from the db.

My requirement is such that I want to run two standalone instances of
Tomcat (not using clustering) and for every request it loads the session
from the database and saves it back.

Can you please tell me if this is possible in Tomcat . If yes, how.
> From looking at the source code, setting maxIdleSwap to zero should do
the trick.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to