3 Replies Latest reply on Jun 3, 2007 10:08 PM by mjgreene550

    mod_jk 1.2 not distrubuting HTTP requests evenly

    mjgreene550

      I've successfully configured jboss 4.0.5 for clustering and I have to say it was pretty easy with all the documentation provided by JBoss. Fail over and farming work as advertised.

      I'm currently trying to configure HTTP Session Replication.

      My only concern is the mod_jk connector doesn't seem to be distributing the http requests evenly over the two nodes. The documentation that I've read suggests that mod_jk should alternate the requests over all of the nodes. In my case, it will alternate requests over all the nodes but not evenly. What ends up happening is Node 1 will handle say 9 requests, Node 2 will get 1 request, and then Node 1 gets a bunch more.

      I feel like I'm missing something simple here, can anyone point me in the right direction? Much obliged.

      My workers.properties file:

      # Define list of workers that will be used
      # for mapping requests
      worker.list=loadbalancer,status
      
      # Define Node1
      # modify the host as your host IP or DNS name.
      worker.node1.port=8009
      worker.node1.host=192.168.1.31
      worker.node1.type=ajp13
      worker.node1.lbfactor=1
      worker.node1.cachesize=10
      
      # Define Node2
      # modify the host as your host IP or DNS name.
      worker.node2.port=8009
      worker.node2.host=192.168.1.32
      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


      My mod-jk.conf file:
      # Load mod_jk module
      # Specify the filename of the mod_jk lib
      LoadModule jk_module modules/mod_jk.so
      
      # Where to find workers.properties
      JkWorkersFile conf/workers.properties
      
      # Where to put jk logs
      JkLogFile logs/mod_jk.log
      
      # Set the jk log level [debug/error/info]
      JkLogLevel info
      
      # Select the log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
      
      # JkOptions indicates to send SSK KEY SIZE
      JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
      
      # JkRequestLogFormat
      JkRequestLogFormat "%w %V %T"
      
      # Mount your applications
      JkMount /* loadbalancer
      
      # You can use external file for mount points.
      # It will be checked for updates each 60 seconds.
      # The format of the file is: /url=worker
      # /examples/*=loadbalancer
      #JkMountFile conf/uriworkermap.properties
      
      # Add shared memory.
      # This directive is present with 1.2.10 and
      # later versions of mod_jk, and is needed for
      # for load balancing to work properly
      JkShmFile logs/jk.shm
      
      # Add jkstatus for managing runtime data
      <Location /jkstatus/>
       JkMount status
       Order deny,allow
       Deny from all
       Allow from 127.0.0.1
      </Location>


        • 1. Re: mod_jk 1.2 not distrubuting HTTP requests evenly
          mjgreene550

          Ok sorry for the post. It seems like the requests don't get spread evenly over the nodes if the same URL is hit. In other words, if I try hitting the same page on my application the request goes to the same node. But if I actually click on different links bringing me to different pages, the requests alternate evenly.

          Out of curiosity, does anyone know why it mod_jk would send a request to the same node if the request was say just a refresh from the browser?

          Thanks!

          • 2. Re: mod_jk 1.2 not distrubuting HTTP requests evenly
            mjgreene550

            After further testing, I found that mod_jk distributes the requests evenly over the 2 nodes ONLY if I am using FF2 but not with IE7. When using IE7 a majority of the requests are directed to one node.

            Anyone else had similar issues?

            Thanks!

            • 3. Re: mod_jk 1.2 not distrubuting HTTP requests evenly
              mjgreene550

              UPDATE-----

              After many many hours of examining mod_jk's log output, it seems as if my declarations of various DWR (Direct Web Remoting) (for example: /dwr/interface/ValidationService.js) files was causing multiple requests to be generated. This in turn was throwing off the perceived even distribution of requests.

              I'm not quite sure how I am going to fix this issue in particular but at least it allows me to know that it's something to do with the way I have constructed the application. Hopefully that helps someone else.