Reputation: 275
I made a load balancer using HAProxy. My connections can takes up to 1-4 minutes, so I increased the default timeout values in HAProxy to 300s as follows:
global
daemon
log 127.0.0.1 local0 notice
maxconn 2000
defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
timeout connect 300s
timeout client 300s
timeout server 300s
option http-keep-alive
frontend LOAD_BALANCER_TIER
bind *:80
default_backend WEB_SERVER_TIER
backend WEB_SERVER_TIER
balance leastconn
mode tcp
server segmentingApi01 some_private_ip:7331 check tcp-ut 300000
server segmentingApi02 some_private_ip:7331 check tcp-ut 300000
server segmentingApi03 some_private_ip:7331 check tcp-ut 300000
As you can see I even increased the TCP connection in server
options. Yet, my request to the load balancer timeout after exactly 120s. Please note that I believe the issue is from the load balancer as when I send a request to the servers directly (some_private_ip:7331
) it does not timeout.
I was wondering if somebody could help me with this.
Upvotes: 1
Views: 5406
Reputation: 46
First, I don't think "redispatch" and "http-keep-alive" work in tcp mode - as haproxy does not deal with application (http) information in tcp mode.
Maybe you should give "option tcpka" a try. This does TCP keep alive, so the OS won't cancel the connection when no data is exchanged - which I guess is happening here.
You should not set connection timeout to such a high value, because this timeout is for making the initial connection to the server.
Upvotes: 2