Uploaded image for project: 'JBoss Core Services'
  1. JBoss Core Services
  2. JBCS-1224

mod_proxy_balancer lbmethod=bybusyness (and also lbmethod=bytraffic) does not work correctly because worker stats are reset at every new child process creation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • httpd 2.4.58 GA
    • httpd 2.4.29 SP4 RHEL GA, httpd 2.4.37 SP8 GA
    • httpd
    • None
    • False
    • False
    • +
    • Hide
      • Example configuration that enables mod_proxy_balancer with mod_lbmethod_bybusyness
      # Enable mod_proxy and mod_proxy_balancer
      LoadModule proxy_module modules/mod_proxy.so
      LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
      LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
      LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
      LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
      LoadModule proxy_http_module modules/mod_proxy_http.so
      LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
      
      # Make sure to disable mod_cluster when mod_cluster is used
      # LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
      # LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
      # LoadModule manager_module modules/mod_manager.so
      # LoadModule advertise_module modules/mod_advertise.so
      
      ProxyPass /test/ balancer://mycluster/test/
      ProxyPassReverse /test/ balancer://mycluster/test/
      <Proxy balancer://mycluster>
         BalancerMember http://node1:8080 route=node1
         BalancerMember http://node2:8080 route=node2
         ProxySet stickysession=JSESSIONID|jsessionid
         # ProxySet lbmethod=byrequests # <- OK
         ProxySet lbmethod=bybusyness # <- not work as expected
         # ProxySet lbmethod=bytraffic # <-not work as expected
      </Proxy>
      
      <Location "/balancer-manager">
          SetHandler balancer-manager
      </Location>
      
      • Start two back-end JBoss EAP servers (node1 and node2) with a test application that contains a simple JSP page that sleeps for a while (30 seconds):
        <%
        out.println("request starting: " + System.currentTimeMillis());
        out.println("<br>");
        out.println("jboss.node.name: " + System.getProperty());
        out.println("<br>");
        try {
            long ms = 30000L
            System.out.println("sleeping " + ms + " ms");
            Thread.sleep(ms);
            System.out.println("sleep done");
        } catch (Exception ignore) { }
        out.println("request completed: " + System.currentTimeMillis());
        out.println("<br>");
        %>
        
      • Send several requests to the above JSP:
        curl -v http://localhost/test/example.jsp
        
      • Check the busyness of each backend worker from the "busy" value inside the "balancer-manager" page (http://localhost/balancer-manager). Even if the above JSP is still running, you will see the statistics including "busy" becomes 0 after a new child httpd process is created. So, a new request mainly goes to node1 in such cases.
      Show
      Example configuration that enables mod_proxy_balancer with mod_lbmethod_bybusyness # Enable mod_proxy and mod_proxy_balancer LoadModule proxy_module modules/mod_proxy.so LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so # Make sure to disable mod_cluster when mod_cluster is used # LoadModule proxy_cluster_module modules/mod_proxy_cluster.so # LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so # LoadModule manager_module modules/mod_manager.so # LoadModule advertise_module modules/mod_advertise.so ProxyPass /test/ balancer: //mycluster/test/ ProxyPassReverse /test/ balancer: //mycluster/test/ <Proxy balancer: //mycluster> BalancerMember http: //node1:8080 route=node1 BalancerMember http: //node2:8080 route=node2 ProxySet stickysession=JSESSIONID|jsessionid # ProxySet lbmethod=byrequests # <- OK ProxySet lbmethod=bybusyness # <- not work as expected # ProxySet lbmethod=bytraffic # <-not work as expected </Proxy> <Location "/balancer-manager" > SetHandler balancer-manager </Location> Start two back-end JBoss EAP servers (node1 and node2) with a test application that contains a simple JSP page that sleeps for a while (30 seconds): <% out.println( "request starting: " + System .currentTimeMillis()); out.println( "<br>" ); out.println( "jboss.node.name: " + System .getProperty()); out.println( "<br>" ); try { long ms = 30000L System .out.println( "sleeping " + ms + " ms" ); Thread .sleep(ms); System .out.println( "sleep done" ); } catch (Exception ignore) { } out.println( "request completed: " + System .currentTimeMillis()); out.println( "<br>" ); %> Send several requests to the above JSP: curl -v http: //localhost/test/example.jsp Check the busyness of each backend worker from the "busy" value inside the "balancer-manager" page ( http://localhost/balancer-manager ). Even if the above JSP is still running, you will see the statistics including "busy" becomes 0 after a new child httpd process is created. So, a new request mainly goes to node1 in such cases.

    Description

      mod_proxy_balacner lbmethod=bybusyness setting determines the distribution of load based on the worker's busyness (number of requests that the worker is currently handling). However, the distribution of the load does not work as expected because the busyness statistic is reset by mod_lbmethod_bybusyness's reset() method which is invoked every time at the initialization phase of a new child process creation.

      Also, the same issue happens when using lbmethod=bytraffic as load balancer scheduler algorithm of mod_proxy_balancer, because the worker statistics are also reset by mod_lbmethod_bytraffic's reset() method.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-jclere Jean-Frederic Clere
              rhn-support-mmiura Masafumi Miura
              Paul Lodge Paul Lodge
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: