You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vamsee Lakamsani <va...@yahoo.com.INVALID> on 2017/01/25 21:05:36 UTC

[users@httpd] mod_proxy_balancer not balancing equally

Hi,
We are using mod_proxy_balancer (mod_lbmethod_byrequests) with Apache httpd 2.4 on   Amazon Linux 4.4.41-35.53.amzn1.x86_64 (2016.09). We are using the docs from here:
mod_proxy_balancer - Apache HTTP Server Version 2.4

  
|  
|   |  
mod_proxy_balancer - Apache HTTP Server Version 2.4
   |  |

  |

 
Here is our balancer setup:
ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://mainBalancer">
  BalancerMember "http://api1:3000"  route=1  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api2:3000"  route=2  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api3:3000"  route=3  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api4:3000"  route=4  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api5:3000"  route=5  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api6:3000"  route=6  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api7:3000"  route=7  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api8:3000"  route=8  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api9:3000"  route=9  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api10:3000" route=10 loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  ProxySet lbmethod=byrequests stickysession=ROUTEID nofailover=Off
</Proxy>We are seeing (as measure by New Relic our monitoring service) that http request are not being distributed equally. The first server (api1) is getting more than the second one and so on with the last one getting the least amount of request. Attached is a screen shot that shows this. We would appreciate any feedback on what is causing this and how to fix.  A related question is on the health checks. Is there any way to avoid copy/pasting the health check info on all the member lines?
Vamsee Lakamsani


Re: [users@httpd] mod_proxy_balancer not balancing equally

Posted by Vamsee Lakamsani <va...@yahoo.com.INVALID>.
Hi,
We confirmed monitoring system is measuring correctly. Turning off sticky sessions did the trick and requests are being routed almost equally. We made our app work without sticky sessions. 
Vamsee 

    On Thursday, January 26, 2017 2:57 AM, Luca Toscano <to...@gmail.com> wrote:
 

 Hi,
2017-01-25 22:05 GMT+01:00 Vamsee Lakamsani <va...@yahoo.com.invalid>:


Hi,
We are using mod_proxy_balancer (mod_lbmethod_byrequests) with Apache httpd 2.4 on   Amazon Linux 4.4.41-35.53.amzn1.x86_ 64 (2016.09). We are using the docs from here:
mod_proxy_balancer - Apache HTTP Server Version 2.4

  
|  
|   |  
mod_proxy_balancer - Apache HTTP Server Version 2.4
   |  |

  |

 
Here is our balancer setup:
ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://mainBalancer">
  BalancerMember "http://api1:3000"  route=1  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api2:3000"  route=2  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api3:3000"  route=3  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api4:3000"  route=4  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api5:3000"  route=5  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api6:3000"  route=6  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api7:3000"  route=7  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api8:3000"  route=8  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api9:3000"  route=9  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  BalancerMember "http://api10:3000" route=10 loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
  ProxySet lbmethod=byrequests stickysession=ROUTEID nofailover=Off
</Proxy>We are seeing (as measure by New Relic our monitoring service) that http request are not being distributed equally. The first server (api1) is getting more than the second one and so on with the last one getting the least amount of request. Attached is a screen shot that shows this.

Quick sanity check: have you verified from the httpd access logs that the monitoring service is reporting correct metrics?  
We would appreciate any feedback on what is causing this and how to fix.  A related question is on the health checks. Is there any way to avoid copy/pasting the health check info on all the member lines?

https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html#stickyness

I would check what is the effect of the configured sticky session to the load balancer behavior (for example do some tests without it if possible).
Hope that helps!
Luca 

   

Re: [users@httpd] mod_proxy_balancer not balancing equally

Posted by Luca Toscano <to...@gmail.com>.
Hi,

2017-01-25 22:05 GMT+01:00 Vamsee Lakamsani <va...@yahoo.com.invalid>:

>
> Hi,
>
> We are using mod_proxy_balancer (mod_lbmethod_byrequests) with Apache
> httpd 2.4 on   Amazon Linux 4.4.41-35.53.amzn1.x86_64 (2016.09).
> We are using the docs from here:
>
> mod_proxy_balancer - Apache HTTP Server Version 2.4
> <https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html>
>
> mod_proxy_balancer - Apache HTTP Server Version 2.4
> <https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html>
>
> Here is our balancer setup:
>
> ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
> Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
> <Proxy "balancer://mainBalancer">
>   BalancerMember "http://api1:3000"  route=1  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api2:3000"  route=2  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api3:3000"  route=3  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api4:3000"  route=4  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api5:3000"  route=5  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api6:3000"  route=6  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api7:3000"  route=7  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api8:3000"  route=8  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api9:3000"  route=9  loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   BalancerMember "http://api10:3000" route=10 loadfactor=1 hcmethod=GET hcuri=/onkore/api/v1/time hcexpr=ok234 hcinterval=10 hcpasses=2 hcfails=3
>   ProxySet lbmethod=byrequests stickysession=ROUTEID nofailover=Off
> </Proxy>
>
> We are seeing (as measure by New Relic our monitoring service) that http request are not being distributed equally. The first server (api1) is getting more than the second one and so on with the last one getting the least amount of request. Attached is a screen shot that shows this.
>
>
Quick sanity check: have you verified from the httpd access logs that the
monitoring service is reporting correct metrics?


> We would appreciate any feedback on what is causing this and how to fix.  A related question is on the health checks. Is there any way to avoid copy/pasting the health check info on all the member lines?
>
>
https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html#stickyness

I would check what is the effect of the configured sticky session to the
load balancer behavior (for example do some tests without it if possible).

Hope that helps!

Luca