8 Replies Latest reply on Dec 9, 2005 11:05 AM by Brian Stansberry

    Shared session not working always

    Baiju Varugese Newbie

      Hi all,

      I am using JBoss AS 4.0 for my Application, recently we need to scale the application, so we added another JBoss AS 4.0 in cluster. It is working fine with sticky session.

      But we need to share the session state so we made the changes in JBoss service .xml and the Appache for shared session, as described in the Jboss administration documentation, but the session shareing is not working always, some time it is working, suddenly the session in the clustered server gone out,

      please advice me what if i am missing, i cannot figure out

      thanks in advance

        • 1. Re: Shared session not working always
          Manik Surtani Master

          Hi,

          You will need to post a lot more information than that! :-)

          - your cluster config
          - are all your nodes on the same machine?
          - have you tried the JGroups tests - http://www.jgroups.org/javagroupsnew/docs/newuser/node13.html
          - anything in your error logs

          • 2. Re: Shared session not working always
            Baiju Varugese Newbie

            Hi,
            Thanks.

            are all your nodes on the same machine?

            No. I am running it in different machine

            My cluster config file
            here i am adding the lines which i changed

            1. server.xml



            2. jboss-service.xml

            false
            false
            true

            4. worker.properties in appache/conf

            worker.list=loadbalancer,status

            # Define Node1
            # modify the host as your host IP or DNS name.
            worker.node1.port=8009
            worker.node1.host=server1
            worker.node1.type=ajp13
            worker.node1.lbfactor=1
            worker.node1.cachesize=10

            worker.node2.port=8009
            worker.node2.host=server2
            worker.node2.type=ajp13
            worker.node2.lbfactor=1
            worker.node2.cachesize=10


            # Load-balancing behaviour
            worker.loadbalancer.type=lb
            worker.loadbalancer.balance_workers=node1,node2
            worker.loadbalancer.sticky_session=0
            #worker.list=loadbalancer


            # Status worker for managing load balancer
            worker.status.type=status


            These are the changes i have done, there is no error in the log, simply in the application we are verfiying for the user session if the session is not there we are redirecting to login page.

            Everthing working fine with sticky session

            thanks

            Baiju

            • 3. Re: Shared session not working always
              Baiju Varugese Newbie

              xml tags are missing

              server.xml

              Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1"

              jboss-service.xml

              attribute name="UseJBossWebLoader" = false
              attribute name="UseLocalCache = false
              attribute name="UseJK" = true

              • 4. Re: Shared session not working always
                Baiju Varugese Newbie

                Hi Manik,

                Session replication is working when we change the worker.properties

                worker.loadbalancer.sticky_session=0 to 1

                when the first server fails, the user is redirected to the second server and the session of the user is available in the second one can you please explain me how it is working

                thanks

                baiju

                • 5. Re: Shared session not working always
                  Manik Surtani Master

                  Hi there. This is the typical characteristic of sticky sessions, where all requests for a given session are directed to a single server until that server fails.

                  • 6. Re: Shared session not working always
                    Shvetha Prabhu Newbie

                    I have a related problem regarding loadbalancing and session sharing.

                    I have worker.loadbalancer.sticky_session=1 in my worker.properties file on Apache. ( Let me know if I should send the complete worker.properties). Yet, the loadbalancer seems to be trying to send requests to both the servers. The first page goes to the first server and when I try submitting the page, the request goes to the second server.
                    And it seems like the session information has not been shared between the 2 servers yet. Because the response page has most elements missing. Only static logos and links show up. None of the real application elements are showing up.
                    I have set the JVMRoute='nodename' in server.xml on both servers.

                    An interesting thing I noticed was the when I tried to set the UseJK attribute to true in jboss-service.xml, the server would not start up and would give an error in JVMRouteFilter. So have run the server without this. But clustering works. Am using JBoss 4.0.0.

                    Suprisingly, failover works fine. When a server goes down, the other server picks it up instantly. I can see that the 2 servers have recognised each other and formed a cluster. Tried the jgroups Draw test recommended here too. works fine.

                    • 7. Re: Shared session not working always
                      Baiju Varugese Newbie

                      hi,

                      i think in JBoss 4.0.0 we dont need to add the attribute useJK, now we are using jBoss 4.0.2RC1 everything works fine in jboss ... but some time apache showing service not available ... if i refresh the page the page get loaded....

                      baiju

                      • 8. Re: Shared session not working always
                        Brian Stansberry Master

                        You should set the useJK flag in 4.0.2. There was a problem with the JVMRouteFilter in 4.0.0 (see issue 1037726 on Sourceforge), but that was fixed in 4.0.1.