2 Replies Latest reply on Oct 20, 2010 1:43 AM by sudheerk84

    Mod cluster with stciky session in tomcat

    sudheerk84

      I have a use case where i am using tomcat.  I need the sample to work with sticky sessions.

       

      But if teh tomcat server dies , i want the request to be handled by another server.

       

      My SetUP has 3 machines

       

      1 apache(httpd) and  2 tomcats.

       

      Now i try a sample example with one servlet  - and it hits apache1 and then followed by tomcat1.

       

      Now without closing the browser , i kell the tomcat1 , expecting my next request to hit tomcat2.

       

      But i get service down exception [If i close teh browser and open again it goes to tomcat 2] .

       

      But with sticky session , if server(tomcat) is down i want the request to hit another server.

       

       

       

      I tried tehvalue sgiven  in t eh documentation

       

      stickySessionRemovefalse

      Indicates whether the httpd proxy should remove session  stickiness in the event that the balancer is unable to route a request  to the node to which it is stuck. This property is ignored if stickySession is false.

      stickySessionForcetrue

      Indicates whether the httpd proxy should return an  error in the event that the balancer is unable to route a request to the  node to which it is stuck. This property is ignored if stickySession is false.

       

       

      I made  stickySessionRemove = true and also  tried with stickySessionForce=false [Actually i did not understand why we require both properties , isnt one sufficent ?]

       

       

      Any help is really appreciated.

       

       

      Tahnks is Advance

        • 1. Re: Mod cluster with stciky session in tomcat
          pferraro

          Is your web application using distributed sessions (i.e. does you web.xml specify <distributable/>)?  Without this, all session information will be lost in the case of a failover.  That said, try the following:

          stickySession="true"

          stickySessionForce="false"

          stickySessionRemove="false"

           

              <property name="stickySession">true</property>
              <property name="stickySessionForce">false</property>
              <property name="stickySessionRemove">false</property>

          • 2. Re: Mod cluster with stciky session in tomcat
            sudheerk84

            I do not use distributed sessions.

             

            i have tried the options you have given , but still could not get it working.

             

            As explained above when i shutdown tomcat1 and fire teh request from teh same browser I get a error , and teh request does not go to tomcat2.