7 Replies Latest reply on Apr 11, 2013 2:39 AM by Michal Rakoczy

    mod_jk redirect for worker

    Michal Rakoczy Newbie

      I would like to ask what is the proper configuration for loadbalancing worker and non-balanced worker referring to retries parameter.

       

       

      My current configuration :

       

       

      worker.list=loadbalancer,node3,node4

      worker.loadbalancer.type=lb

      worker.loadbalancer.balance_workers=node3,node4

      worker.loadbalancer.sticky_session=1

      worker.loadbalancer.method=R

       

       

      worker.template.type=ajp13

      worker.template.socket_connect_timeout=5000

      worker.template.socket_keepalive=true

      worker.template.ping_mode=A

      worker.template.ping_timeout=10000

      worker.template.connection_pool_minsize=0

      worker.template.connection_pool_timeout=60

      worker.template.reply_timeout=300000

      worker.template.recovery_options=3

       

       

      worker.node3.reference=worker.template

      worker.node3.port=8309

      worker.node3.host=127.0.0.1

      worker.node3.type=ajp13

      worker.node3.lbfactor=1

      worker.node3.redirect=node4

       

       

      worker.node4.reference=worker.template

      worker.node4.port=8409

      worker.node4.host=127.0.0.1

      worker.node4.type=ajp13

      worker.node4.lbfactor=1

      worker.node4.redirect=node3

       

       

      Before balancing node3 and node4 i used retries parameter for both workers, to avoid double requests to tomcat --> http://www.itpile.com/r2089/apache-mod-jk-repeats-request-to-tomcat-why :

       

       

      worker.node3.port=8309

      worker.node3.host=127.0.0.1

      worker.node3.type=ajp13

      worker.node3.lbfactor=1

      worker.node3.retries=1  

      worker.node3.connect_timeout=15000

      worker.node3.socket_timeout=60

      worker.node3.connection_pool_timeout=60

      worker.node3.socket_keepalive=True

       

       

      worker.node4.port=8409

      worker.node4.host=127.0.0.1

      worker.node4.type=ajp13

      worker.node4.lbfactor=1

      worker.node4.retries=1

      worker.node4.connect_timeout=15000

      worker.node4.socket_timeout=60

      worker.node4.connection_pool_timeout=60

      worker.node4.socket_keepalive=True

       

       

       

      I had skipped retries parameter between non-balanced and balanced configuration as i'm confused where to set it up - on loadbalancer or directly on node, i would like to also avoid infinite loops (is it possible ?) because of misconfiguration.

       

       

      The doubts are :

       

       

      - if retries parameter for loadbalancer is set up to 0 is it equal to node parameter equal 1 ?

       

      - how the request is handled when retries is set up on loadbalancer and balanced worker simultaneously - which of them has higher "priority" ?

        • 1. Re: mod_jk redirect for worker
          Mladen Turk Newbie

          Hi,

           

          You should not mix load balancer and standard workers.

          I suppose you are trying to have failover worker or something like that. Am I right?

          In that case those workers should be part of the same load balancer.

          • 2. Re: mod_jk redirect for worker
            Mladen Turk Newbie

            ... and also, the more important thing:

            members of load balancer must not appear in worker.list directive

            • 3. Re: mod_jk redirect for worker
              Michal Rakoczy Newbie

              Thank you Mleden for you answer. Could you explain it more as in my configuration i MUST mix balanced and non-balanced workers.

               

              I have few applications running on each JBoss intance, some of them are replicated on balanced workers (application is prepared for that) some of them work on the one instance only. That's why i need to mix both types of workers, and also this is why it's appear in worker.list directive.

               

              Apache configuration :

               

              <VirtualHost>

               

              JkMount /App3 node3

              JkMount /App4 node4

              JkMount /App5 loadbalancer

               

              </VirtualHost>


              As you may see App3 and App5 is deployed on node3 and App4 and App5 is deployed on node4. It means that only App5 is balanced - in case of node failure only requests to /App5 are redirected to spare node. It's also the reason why i node3 and node4 appear in worker.list - as i need to redirect requests to App3 and App4 directly to proper node, not to loadbalancer.

               

              You also asked :  I suppose you are trying to have failover worker or something like that. Am I right? - No, i'm not trying, i have failover workers but only for App5 (at least this is how it works for me) - correct me if i'm wrong please.

              • 4. Re: mod_jk redirect for worker
                Mladen Turk Newbie

                You should create two additional workers for non load balancer nodes.

                That way you will have 3 workers in worker.list eg loadbalancer,app3worker,app4worker

                 

                They can point to the same appserver instance (even have the same ip:port) as  loadbalancer members.

                However they will be separated inside internal mod_jk shared memory making them separate.

                • 5. Re: mod_jk redirect for worker
                  Michal Rakoczy Newbie

                  So if i understand it properly i should ammend the configuration to :

                   

                  worker.list=loadbalancer,node3worker,node4worker

                  worker.loadbalancer.type=lb

                  worker.loadbalancer.balance_workers=node3,node4

                  worker.loadbalancer.sticky_session=1

                  worker.loadbalancer.method=R

                   

                   

                  worker.template.type=ajp13

                  worker.template.socket_connect_timeout=5000

                  worker.template.socket_keepalive=true

                  worker.template.ping_mode=A

                  worker.template.ping_timeout=10000

                  worker.template.connection_pool_minsize=0

                  worker.template.connection_pool_timeout=60

                  worker.template.reply_timeout=300000

                  worker.template.recovery_options=3

                   

                   

                  worker.node3.reference=worker.template

                  worker.node3.port=8309

                  worker.node3.host=127.0.0.1

                  worker.node3.type=ajp13

                  worker.node3.lbfactor=1

                  worker.node3.redirect=node4

                   

                  worker.node3worker.reference=worker.template

                  worker.node3worker.port=8309

                  worker.node3worker.host=127.0.0.1

                  worker.node3worker.type=ajp13

                   

                  worker.node4.reference=worker.template

                  worker.node4.port=8409

                  worker.node4.host=127.0.0.1

                  worker.node4.type=ajp13

                  worker.node4.lbfactor=1

                  worker.node4.redirect=node3

                   

                  worker.node4worker.reference=worker.template

                  worker.node4worker.port=8409

                  worker.node4worker.host=127.0.0.1

                  worker.node4worker.type=ajp13

                   

                  and

                   

                  <VirtualHost>

                   

                  JkMount /App3 node3worker

                  JkMount /App4 node4worker

                  JkMount /App5 loadbalancer

                   

                  </VirtualHost>

                   

                  Is that correct ?

                  • 6. Re: mod_jk redirect for worker
                    Mladen Turk Newbie

                    Yes.

                     

                    Just note that the potential number of connections between httpd and AS will double. Same as having two httpd's in front.

                    So perhaps you can choose to have two vhosts on AS and two connectors on different ports. But that's optional.

                    • 7. Re: mod_jk redirect for worker
                      Michal Rakoczy Newbie

                      What about retries parameter ?

                        The doubts are :

                       

                       

                      - if retries parameter for loadbalancer is set up to 0 is it equal to node parameter equal 1 ?

                       

                      - how the request is handled when retries is set up on loadbalancer and balanced worker simultaneously - which of them has higher "priority" ?