3 Replies Latest reply: Aug 22, 2012 1:33 PM by Wolf-Dieter Fink RSS

jboss cluster and sticky sessions question

kelly goedert Apprentice

I have a jsf2 app in a jboss 6.x server. From everything I have read here and searching in google, it is always recommended to use sticky sessions. From my understanding, this means that the same node will always be responsible for the requests of the same user. Is this right?

If it is, what is the point of using jboss on a cluster mode? Couldn't I just have two jboss instances and let the load balancer distribute the requests? Why do I need the cluster?

  • 1. Re: jboss cluster and sticky sessions question
    Wolf-Dieter Fink Master

    It depends on what you want and what you use.

     

    EJB's are loadbalanced if you use the JBoss ejb-client libraries automatic (more or less)

     

    If you use http there is no loadbalancing, this is normaly done by an apache (or HW) loadbalancer.

    The  session stickyness ensure that, after a session is created the LB route all requests to one node.

    If the same user create a new session (e.g. client crash) the LB may decide new and different.

     

    The cluster have also the failover perspective, so if you replicate the session and the current node crashes the LB will try a different node and the session might continue here.

  • 2. Re: jboss cluster and sticky sessions question
    kelly goedert Apprentice

    I understand what you said. But maybe I didn't make myself really clear. I have seen in a lot of posts that the best way is the web session to be sticky. I believe that if this is the case I won't be replicating the web session. Or am I wrong? My point is what is the real benefit of a jboss cluster if my web sessions are sticky? Clustering Ejbs? Clustering something else?

  • 3. Re: jboss cluster and sticky sessions question
    Wolf-Dieter Fink Master

    To avoid sync traffic the session should be sticky.

    The benefit is that you have a replication in case of failover and, depend on the loadbalancer, different session are spread over different JBoss instances.