Following the documentation of
http://blogs.sun.com/Prashanth/entry/setting_up_load_balancing_in and
http://developers.sun.com/appserver/reference/techart/glassfishcluster/ , i installed 2 GlassfishV2 on 2 linux machines(CentOS 5) with clustering and loading balancing with Sun Web Server 7.0 Update 1 version. And using the in-memory replication for session failover. The system works, but i found session fail over not work sometimes. Following are the structure:
Machine 1: node_agent_1, instance1, instance3
Machine 2: node_agent_2, instance2, instance4
Machine 1 served as DAS, and machine 2 served as the HTTP load balancer
The scenario is following:
1. After startup the cluster, i use 2 different browsers (Firefox and Opera) to access the clusterjsp application.(just to ensure getting different session id)
2. Both brower is served by the same instance(e.g. instance1) with different session id.
3. Input any data to Name/Value fields of 'Session Attribute' and press "ADD SESSION DATA" button.
4. The input data is shown under "Data retrieved from the HttpSession:".
5. Stop the instance1, and instance2 from the Web admin console.
6. Go back to the 2 previous browsers, input any data again to Name/Value fields of 'Session Attribute' and press "ADD SESSION DATA" button.
7. Both browser's request has now gone to instance3. However, only one browser's session data is failed over to the instance3. The other browser fail to keep the session data.
Another scenario:
1. Browser1 served by instance1, Browser2 served by instance2
2. Input data to Name/Value fields of 'Session Attribute' and press "ADD SESSION DATA" button.
3. Stop the instance1, and instance2 from the Web admin console.
4. Back to the 2 browsers and input data to Name/Value fields of 'Session Attribute' and press "ADD SESSION DATA" button.
5. Now, browser1 served by instance4 but session fail over not work. data is not replicated.
But, broswer2 served by instance3 but session fail over is work, data is replicated.
I tested many times to input data, then stop the instances, found out that the session fail over sometimes work, sometimes won't.
And found out, if the replica parnter(e.g. instance2 is instance1's replica parnter) still alive, the session fail over must work.
Do anyone have idea on this? Thanks a lot.
[Message sent by forum member 'onejason' (onejason)]
http://forums.java.net/jive/thread.jspa?messageID=244447