6 Replies Latest reply on Jul 10, 2009 2:38 PM by Brian Stansberry

    sticky_session=0 + UseJk=false + HTTP Session Replication

    hellaenergy Newbie

      I have a setup with:

      Two hardware load balancers -> 2 Apache 2.2 instances running mod_jk
      1.2.28 LB w/ sticky_session=0 -> 2 JBossAS 4.2.3 Servers doing HTTP
      Session Replication via JBoss Clustering.

      * My hardware load balancers are not configured to do sticky sessions
      * My Apache 2.2 w/ mod_jk lb workers have sticky_session=0 set (No
      Sticky Sessions)

      Since I do not have sticky_session enabled do I still need to have
      UseJK=true and my jvmRoute value set for mod_jk LB and HTTP Session
      Replication to work?

      In deploy/jboss-web.deployer/META-INF/jboss-service.xml it reads:

      --- SNIP ---
      <!--
      Whether to use MOD_JK(2) for load balancing with sticky session
      combined with JvmRoute. If set to true, it will insert a JvmRouteFilter
      to intercept every request and replace the JvmRoute if it detects a
      failover. In addition, you will need to set the JvmRoute inside
      Tomcat, e.g.,
      Engine name="jboss.web" jmvRoute="Node1" defaultHost="localhost"
      in server.xml.

      For clustering purpose only.
      -->
      false
      --- SNIP ---

      This suggests to me that unless you are using sticky_session=1 in
      mod_jk you shouldn't need to set UseJK to true and/or the jvmRoute. Is this
      assumption correct?

      If UseJK is set to false does mod_jk LB still work with JBoss? Will
      other aspects of jboss clustering still function as they should i.e
      session replication?

        • 1. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
          Brian Stansberry Master

          1) Use sticky sessions. If you don't you are asking for trouble.

          2) If you disregard #1, there shouldn't be any harm in leaving UseJK=false. The purpose of the JvmRouteValve is to allow the session to stay stuck after failover.

          3) I've never tried to use mod_jk without configuring a jvmRoute. Quite possibly it will work fine. Suggest you just try it and see.

          Hmm, come to think of it just yesterday I by accident tried mod_jk w/ no jvmRoute configured (forgot to configure it on a test setup.) It seemed to work fine except the sessions didn't stick, which is to be expected.

          • 2. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
            hellaenergy Newbie

            The reason I've chosen not to use sticky sessions is because theoretically at any time a node in the HW LB cluster could go down. If it does and the user gets directed to a different Apache + mod_jk node in the cluster what good is the sticky session then? I figure as long as session replication is turned on within my JBoss cluster I should be taken care of regardless if the originating HW or Soft LB node goes down.

            With UseJK set to false it's been reported to me that JAAS replication wasn't happening as it should. I can neither confirm or deny that report because I have not seen the evidence to back it up. However, I am wondering if there is any possible way that could be true?

            Also, if UseJK is set to true and jvmRoute is defined and mod_jk is still configured with sticky_session=0 is that ever a valid configuration?

            • 3. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
              Brian Stansberry Master

              Mod_jk with sticky sessions routes requests based on the jvmRoute appended to the session id in the session cookie. The failure of one of your Apache nodes does not mean sticky sessions won't work, since such a failure doesn't affect the session cookies.

              For more on the sticky session recommendation see http://www.jboss.org/community/wiki/WebClusteringBestPractices.

              Not sure what you're referring to when you discuss JAAS replication. Perhaps https://jira.jboss.org/jira/browse/JBAS-1900 ?? That's another reason to use sticky sessions -- the web container's FORM authentication mechanism assumes the post of the login form will go to the server that issued the form.

              Re: UseJK=true and a jvmRoute when sticky session aren't used, it's valid in the sense that it doesn't break anything. The UseJK=true isn't doing anything for you; adds a bit of overhead. I'm not going to comment beyond what I already have on not setting the jvmRoute as it's not something I've really investigated.

              • 4. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
                hellaenergy Newbie

                I'd like to clarify that I have a hardware LB in front of two separate Apache + mod_jk (configured to load balance) nodes. Each Apache + mod_jk node lb's to the same two JBoss AS servers. If the HW LB cluster in front of the Apache nodes decides to send a request to a node other than the originating Apache + mod_jk sticky session initiating node (we'll call this ws node 1) during an active session then my assumption is the other Apache + mod_jk node (ws node 2) will have no knowledge or ability to handle the other Apache + mod_jk lb nodes activities/ sticky session? Thus my reason for skipping the sticky sessions. Follow me?

                The one thing they do have going for them is that they are both configured identically mod_jk wise. The workers are defined the same so therefore the jvmRoute entries theoretically could be identified by ws node 2 if ws node 1 wasn't available.

                I guess this brings me to another question. Does mod_jk keep track of sticky sessions it's initiated locally? How is that information stored/shared? If there are two separate web servers with mod_jk identically configured to LB w/ sticky_session=true and sharing the same workers, could one entire web server fail and the other take over seamlessly? How would JBossAS handle this. How would mod_jk handle this?

                • 5. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
                  hellaenergy Newbie

                   

                  "bstansberry@jboss.com" wrote:
                  Mod_jk with sticky sessions routes requests based on the jvmRoute appended to the session id in the session cookie. The failure of one of your Apache nodes does not mean sticky sessions won't work, since such a failure doesn't affect the session cookies.


                  My bad I missed that one some how. So theoretically two separate web servers with the same workers defined could handle each others sticky sessions without sending anything into a fit of confusion?



                  • 6. Re: sticky_session=0 + UseJk=false + HTTP Session Replicatio
                    Brian Stansberry Master

                    Right. Running more than one Apache node to avoid a single point of failure at that level is best practice.