Latency added when backend emits response every few seconds

I’ve set up a simple haproxy to do load balancing between my servers. Here’s part of the haproxy.conf:

listen my_app
    mode http
    bind :9010
    balance roundrobin
    option forwardfor
    log global
    option httplog
    option httpchk GET /crowdtest/health
    timeout check 10s
    cookie BEC insert indirect nocache maxlife 120s
    maxconn 20480
    timeout server 30s
    timeout client 30s
    server my_backend 10.17.11.219:80 cookie 4D49D4F check inter 10s rise 3 fall 3 weight
 100 port 80

Everything works fine when my_backend sends files with static content length. However when my_backend sends 2 chunks of data using chunked transfer-encoding (the first chunk sent, 5s later send the second), haproxy adds about 500ms latency. Is haproxy waiting for my_backend to send the whole response so that it will begin to forward response?

Exactly what haproxy release are you running? Can you provide the output of haproxy -vv?

If you want to sacrifice performance for latency, you can set option http-no-delay:
http://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-option%20http-no-delay

Thanks a lot! I’m using haproxy 1.5.3. I looked up http-no-delay in the documentation and I think that’s the cause.

It could also be a bug though.

Upgrade to a current stable release to make sure.