7 Replies Latest reply on Nov 17, 2010 7:48 AM by Tiago Souza

    Redirect URL in a cluster

    Tiago Souza Newbie

      We are  developing an application that has a module specific reports, which consumes a  lot of server processing.

      We currently  have 3 servers in the cluster, and we would like to stay a dedicated server for reporting.

      How to do it  using the cluster's own infrastructure?
        • 1. Re: Redirect URL in a cluster
          Wolf-Dieter Fink Master

          What kind of application WAR or EJB?

          • 2. Re: Redirect URL in a cluster
            Tiago Souza Newbie

            My application is EJB 3.


            To give some more clarifications, I implemented the LoadBalancePolicy, and I  have done the setup to use him in cluster-service.xml jboss, as follows:

            <attribute name="LoadBalancePolicy">my.package.loadbalance.SiopLoadBalancePolicy</attribute>


            In the ejb3-interceptors-aop.xml, I set the fallow rule:

            <domain name="Stateless Bean">
                 <annotation expr="class(@org.jboss.annotation.ejb.Clustered)">
                      @org.jboss.annotation.ejb.Clustered (loadBalancePolicy=my.package.loadbalance.SiopLoadBalancePolicy.class, partition="DefaultPartition")


            I add theanotation @Clustered in EJB would like it to be "clustered".

            @Stateless(mappedName = "RelatorioServico")


            When I start the JBoss server, I notice that my class LoadBalance is being  initiated, but it is just in no time the application "enters" the methods  chooseTarget.

            • 3. Re: Redirect URL in a cluster
              Wolf-Dieter Fink Master

              First of all, if you use stateless session beans, it makes no sense to be sticky to one server because after the method call of SLSB all states are lost (e.g. entities or resources).

              If you try to calculate with a second SLSB call all must be recalculated.

              • 4. Re: Redirect URL in a cluster
                Tiago Souza Newbie

                Hum... I got it.


                So, first should I change bean to Stateful?

                • 5. Re: Redirect URL in a cluster
                  Wolf-Dieter Fink Master

                  It depends to what you want ;-)


                  ok, better as example:

                  If you call more than one methods against one SessionBean, prepare something and then calculate according to what you have prepared.

                  It will be an idea to implement this as a stateful session bean, other is to transport the result to client and back or persist it in DB (or other).


                  For SFSB you need to know that it is not fail save in case of the note will crash. But I think it is not necessary in your case to replicate the session state, you can live with the failure in case of exact this node crash during the processing.


                  Also you do not need to implement your own load balancing, each call to the SFSB will reach the same server.

                  • 6. Re: Redirect URL in a cluster
                    Tiago Souza Newbie

                    Could make the redirection of URL's, but I use the mod_jk in Apache, to do load balancing among JBoss.


                    The configuration I did was to file worker.properties, and there arose a new  problem: "the user's session is lost."


                    My "worker.properties"

                    # Define list of workers that will be used for mapping requests
                    # TEMPLATE
                    # Define Node1
                    # Define Node2
                    # Load-balancing behaviour
                    # Status worker for managing load balancer
                    # Relatorio behaviour
                    • 7. Re: Redirect URL in a cluster
                      Tiago Souza Newbie

                      Just completing, redirection settings are on file mod_jk.conf.

                      Excerpt follows  below:



                      # Mount your applications
                      JkMount /sistema                    sistema
                      JkMount /sistema/*                  sistema
                      JkMount /sistema/GeraRelatorio      relatorio