使用HAProxy对一些Web服务器进行负载平衡时,我遇到了一个奇怪的问题。 通过负载平衡的响应有时非常缓慢…
我的脚本:
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
当我取出负载均衡器并直接连接到Web服务器时,这个问题不会发生,但是我没有负载平衡/故障转移,所以这不是我想要的。
有没有人有迹象表明这里出了什么问题? 为什么有些请求会快速闪烁,其他请求会很慢(10-15秒)?
提前致谢!
我没有看到明显的错误。 你没有任何超时,这是不好的,但这是不相关的。 你应该启用日志logging,它会告诉你请求花费的时间。 为此,请使用“选项httplog”和“log 127.0.0.1 local0”,然后设置您的syslogd以便在UDP套接字上接收日志(例如:syslogd -r)。
嗯,是的,你的configuration有问题。 你每秒检查一次服务器100次,这对他们来说可能太多了。 将“inter 10”replace为“inter 10s”。
威利