2

I have a strange problem when using HAProxy to loadbalance some webservers. The response through the load balance gets very slow sometimes...

My script:

global
  daemon
  quiet
  maxconn          4096
  nbproc           2

listen XMLRPC 0.0.0.0:8888
  mode http
  balance roundrobin
  option httpclose
  option forwardfor
  server Srv1(10.199.100.111:8082) 10.199.100.111:8082 check inter 10
  server Srv2(10.199.100.112:8084) 10.199.100.112:8084 check inter 10

listen Custom1 0.0.0.0:60080
  mode http
  balance roundrobin
  option httpclose
  option forwardfor
  server Srv1(10.199.100.111:60081) 10.199.100.111:60081 check inter 10
  server Srv2(10.199.100.112:60083) 10.199.100.112:60083 check inter 10

listen Statistics 0.0.0.0:7000
  balance
  timeout connect 60000
  timeout client  60000
  timeout server  60000
  option httpclose
  mode http
  stats enable
  stats uri /
  stats hide-version
  stats auth admin:admin

When I take out the load balancers and connect to the webservers directly, this problem does not occur, but then I don't have load balancing/failover, so that's not what I want.

Does anyone have an indication on what is going wrong here? Why would some requests go lightning fast, and others really slow (10-15seconds)?

Thanks in advance!

1 Answers1

2

I see nothing obviously wrong. You don't have any timeout which is bad, but this is unrelated. You should enable logging, it will tell you where the request spent time. For this, please use "option httplog" and "log 127.0.0.1 local0" then setup your syslogd to receive logs on the UDP socket (eg: syslogd -r).

Hmmm yes there's something wrong in your config. You check the servers 100 times a second, which might be too much for them. Replace "inter 10" with "inter 10s".

Willy

Willy Tarreau
  • 3,894
  • 1
  • 19
  • 12