Session migration / replication to tomcat

I have N application server numbers behind a hardware load balancer. Now I want these app server sessions to know?

If I create a session on one application server, the other application server won't know about it. After googling I found 2 approaches 1) Generate a random string. Inject this randomString into cookies and store them in Db table with creation time. The time when the query is checked against this db table. But this work is hard 2) Use tomcat session migration? Now I'm pretty sure this is working correctly. Is this work right?

I am using TOMCAT as my webserver (cannot use the other)

How do I configure tomcat for session migration / replication? Any tutorial?


source to share

2 answers

Session replication is a fairly broad topic. Have you tried Tomcat built-in replication yet?

If that's not enough for you, you can look for commercial tools like Terracotta Web Sessions. Or you can create your own session cache like memcached.



I am not aware of session proximity while working behind a hardware load balancer. However, for the scenario you mentioned according to the google search results for the first part, you can use Memcache instead of a cookie + database to reduce the response time to the operation. An easier approach when using Memcache is to use the "memcached-session-manager" . Setting up and configuring is straightforward as stated at .



All Articles