Manage keepalive on haproxy

haproxy

I'm tuning a haproxy server (version 1.5-dev22).
Each url manage has today a backend with only one server (previously 2), so there no longer loadbalancing.
Each backend has the option "httpclose" setted up, it also in the defaults options.

I want to activate the keepalive on it, so I will delete the httpclose in the default option and backend, but i'm trying to look for the best : no httpclose at all, or http-server-close.
"http-server-close" will be better for loadbalancing only ?
It would better for me to only set "timeout http-keep-alive" to maintain connection from client to server ?

tks

Best Answer

Use option http-server-close.

This causes HAProxy to keep connections alive toward the client, while closing them toward the server after each request. The client round trip time is usually long and the server round trip time usually short, making this the most appropriate choice for many applications, since server connections tend to be more costly to maintain open, while idle client connections incur very little cost inside HAProxy itself.

You typically don't want idle clients tying up server connections, and that's what this option prevents.

Also, consider updating to HAProxy 1.5.15.

Related Topic