Hi!I have run some bench with stud + haproxy (1.5-dev7) and found that stud with "--write-proxy" parameter adds 40 ms of latency. stunnel has recently added (4.45) PROXY support too and enabling it does not add any latency. Therefore, I think the problem does not lie in HAProxy but maybe there is some bad interaction. I have modified stud to do a strcpy of a static proxy line:
strcpy(ring_pnt, "PROXY TCP4 1.1.1.1 172.31.10.15 56732 443\r\n");
written = 43;Still, 40 ms of latency. I have also modified stud to not send the proxy line until there is something else to send (by commenting out "ev_io_start" in "if (OPTIONS.WRITE_PROXY_LINE)" section of handle_connect(). No change. Since the code handling PROXY protocol is so small in stud, I have no other idea of what to do. See here for the relevant code:
https://github.com/bumptech/stud/blob/master/stud.c#L489 Any idea where the latency could lie? You can find some graph here: http://vincent.bernat.im/en/blog/2011-ssl-benchmark-round2.html I also attach a direct comparison with and without "--write-proxy".
stud with and without PROXY.pdf
Description: Adobe PDF document