2 Replies Latest reply on Sep 4, 2003 9:42 PM by rgore

    sticky session configuration failing

    rgore

      On Redhat linux 7.3
      Using apache 2.0.47 with mod_jk2 and
      2 application servers using jboss 3.0.4 jetty bundle
      (I also have the exact same problem with jboss 3.2.2RC3 tomcat bundle)
      the load balancing of the workers between the two servers seems fine. I am having trouble getting sticky sessions to work.

      When I access my servlet through apache/mod_jk2 I do not get a jsessionid cookie at my browser.

      My servlet is getting a session:
      HttpSession session = req.getSession(true);
      But it gets a new session every time.

      If I just access a jsp page, I do get a jsessionid cookie properly.

      If I stop apache and just use the jetty webserver to access my servlet, my browser does get a jsessionid cookie and I do not get a new session every time.

      (In other words, if I do not use apache/mod_jk2 and the servlet session handling seems fine, but no way to load balance. If I put apache/mod_jk2 in front, my servlet always thinks it needs a new session.)

      I am assuming that the reason sticky sessions aren't working is because the jsessionid cookie is not getting set properly. But I don't know why.

      If anyone could please comment I would greatly appreciate it!

        • 1. Re: sticky session configuration failing
          rgore

          I am not exactly sure why any of this works like this. But this is what I have learned so far.

          I have included code from two workers2.properties files. One works with sticky sessions, the other does not. Using the second one my application is now working with sticky sessions!


          The following workers2.properties did not behave properly with sticky sessions:

          [logger]
          level=DEBUG

          [config:]
          file=${serverRoot}/conf/workers2.properties
          debug=0
          debugEnv=0

          [uriMap:]
          info=Maps the requests. Options: debug
          debug=0

          # Define the communication channel
          [channel.socket:www.testmachine1.tv:8009]
          info=Ajp13 forwarding over socket
          tomcatId=www.testmachine1.tv:8009
          lb_factor=1
          group=lb

          # Define the communication channel
          [channel.socket:www.testmachine1.tv:8009]
          info=Ajp13 forwarding over socket
          tomcatId=www.testmachine1.tv:8009
          lb_factor=1
          group=lb

          # Map the Tomcat examples webapp to the web server uri space
          [uri:/NetMovies/*]
          info=Map the whole webapp

          [shm:]
          info=Scoreboard. Required for reconfiguration and status with multiprocess servers
          file=${serverRoot}/logs/jk2.shm
          size=1000000
          debug=1
          disabled=0



          This is my workers2.properties file that does work correctly with sticky sessions:



          [shm:]
          file=${serverRoot}/logs/jk2.shm
          size=1048576

          [lb:lb_01]
          info=Default Load Balancer.
          debug=10

          # Define the worker
          [channel.socket:www.testmachine1.tv:8009]
          info=Ajp13 forwarding over socket
          tomcatId=worker1:8009
          lb_factor=100
          group=lb_01

          # Define the worker
          [channel.socket:www.testmachine2.tv:8009]
          info=Ajp13 forwarding over socket
          tomcatId=worker2:8009
          lb_factor=100
          group=lb_01

          # map /NetMovies
          [uri:/NetMovies/*]
          group=lb_01
          debug=10

          [logger]
          level=DEBUG

          [config:]
          file=${serverRoot}/conf/workers2.properties
          debug=10
          debugEnv=0




          • 2. Re: sticky session configuration failing
            rgore

            After many hours of toil, still seeing strange behavior with the sessions, I went back to Apache 1.3.28 and mod_jk and had the load balancing working in about an hour. I'm sure this must work on apache2/mod_jk2/jboss322, but I was never able to get it to work properly. It works with apache1/mod_jk/jboss3.0.4 wonderfully.