5 Replies Latest reply on Jan 25, 2011 11:54 AM by zmb668

    Rebalance the request after a node restart

    zmb668

      Hi everybody!

       

      I have a jboss 6 cluster contains two nodes. In front of the cluster there is an apache http with mod_cluster, and session stickiness. I start load the httpd with 100 client. Each client has a unique session id. The load distributed uniformly between the nodes. When I stop the node1, the httpd send all the 100 client's request to the node2. When I start the node1 again, it doesn't get any request, because the sticky sessions, httpd sends continually requests to node2. Is there any way to the httpd somehow distribute the request all the nodes?

       

      Ps.: Sorry for the grammar mistakes.

        • 1. Rebalance the request after a node restart
          jfclere

          That is the purpose of sticky session!

          • 2. Rebalance the request after a node restart
            zmb668

            Okay, I reckon I asked in a wrong way. My prolem is when I restart one of the 2 nodes, because the sticky session, all of the request is routed to only one node, the another one is idle. Is there any way to ask mod_cluster to redistribute the requests accross the cluster in this case?

            • 3. Rebalance the request after a node restart
              jfclere

              Don't sticky session and cluster the 2 nodes.

              • 4. Rebalance the request after a node restart
                pferraro

                You can't redistribute sessions that are already stuck to a server - however, requests for new sessions will end up getting directed to your newly started node, until mod_cluster determines that the load is even.

                N.B. Like Jean-Frederic said, you can disable stick sessions, but if you do this, you should also switch to synchronous web session replication (the default mode is asynchronous).  Otherwise, if 2 sequential requests for the same session hit different nodes, the 2nd request could arrive before the replication from the 1st request completes.

                 

                There are a number of ways to switch to sync replication:

                 

                1. Override the cache-name in jboss-web.xml

                e.g.

                <jboss-web>

                   <replication-config>

                    <cache-name>web/sync</cache-name>

                  </replication-config>

                </jboss-web>

                 

                2. Override the cache-mode in jboss-web.xml

                e.g.

                <jboss-web>

                  <replication-config>

                    <replication-mode>SYNCHRONOUS</replication>

                  </replication-config>

                </jboss-web>

                 

                3. Change <async/> to <sync/> in the default cache config of the "web" cache container in infinispan-configs.xml itself.  N.B. this will change the default replication mode for all web applications!

                • 5. Rebalance the request after a node restart
                  zmb668

                  Okay, I got it now. Thanks to both of you for the help.