I am trying to build a glassfish3 cluster made of 6 nodes which has as a frontend 6 apache web servers balanced by Octopus lb. The load balancer allows me to send requests depending on load that is registered on every node.
My setup is as follows:
client-> octopus load balancer -> apache web server -> glassfish server.
Glassfish communicate with Apache via ajp.
The problem that i have is that "it seems" that the sessions are not replicated as they should over the entire cluster.
I have found some documentation about clustering with glassfish v2 and the said that if i have a cluster with 3 nodes, the node 1 will replicate his sessions to n2 and n2 to n3 and n3 to n1, so that one or two may fail but the session will still be there.
Is it the same for gf3?
What i thought when i started to build this cluster was the fact that each node will replicate his sessions to all other nodes from cluster.
If the session replication works as in version 2 i guess that my setup will never work, because i request may be server from n1, and the the second from n5 (n1 does not replicate directly sessions to n5), so then i will lose my session data.
Any advices ??
Ok, as nobody yet answer to my questions i came back with some conclusions regarding my questions.
So the session are replicated as i read, i mean every node backup his session to another node. Unlike glassfish v2 where this replication was performed in ring node1->node2->node3->node1 in version 3 every node replicate his sessions to other node based on a hash algorithm.
Also you need a sticky session load balancer, because if you get a session from node 1 and node 1 replicates it`s sessions on node3, and the second request is forwarded to node2 then you have a problem. A sticky session will fix that.
The setup that have implemented now is like this:
octopus lb(cannot make it work with sticky session) -> apache http (mod_jk loadbalancer with sticky session) -> glassfish node. So even if octopus sends me to a wrong node apache load balancer based on the session cookie will send me to correct glassfish node.
If you wonder why i use octopus lb asa a fist balancer si that because i have balanced other services and php applications.
hope this will help someone...