On Sun, Sep 30, 2018 at 12:12 PM Willy Tarreau <[email protected]> wrote:
> > If so then by not setting it the kernel should choose the default
> > value, which according to:
> > ~~~~
> > > sysctl net.ipv4.tcp_wmem
> > net.ipv4.tcp_wmem = 4096 16384 4194304
> > ~~~~
> > , should be 16384.
>
> No, it *starts* at 16384 then grows up to the configured limit depending
> on the ability to do so without losses and the available memory.
OK. The Linux man-page eludes this part... Good to know. :)
> > Anyway, why am I trying to configure the sending buffer size: if I
> > have large downloads and I have (some) slow clients, and as a
> > consequence HAProxy times out waiting for the kernel buffer to clear.
>
> Thus you might have very short timeouts! Usually it's not supposed to
> be an issue.
I wouldn't say they are "small":
~~~~
timeout server 60s
timeout server-fin 6s
timeout client 30s
timeout client-fin 6s
timeout tunnel 180s
timeout connect 6s
timeout queue 30s
timeout check 6s
timeout tarpit 30s
~~~~
As seen the timeout which I believe is the culprit is the `timeout
client 30s` which I guess is quite enough.
> > However if I configure the buffer size small enough it seems HAProxy
> > is "kept bussy" and nothing breaks.
>
> I see but then maybe you should simply lower the tcp_wmem max value a
> little bit, or increase your timeout ?
I'll try to experiment with `tcp_wmem max` as you've suggested.
> > Thus, is there a way to have both OK bandwidth for normal clients, and
> > not timeout for slow clients?
>
> That's exactly the role of the TCP stack. It measures RTT and losses and
> adjusts the send window accordingly. You must definitely let the TCP
> stack play its role there, you'll have much less problems. Even if you
> keep 4 MB as the max send window, for a 1 Mbps client that's rougly 40
> seconds of transfer. You can deal with this using much larger timeouts
> (1 or 2 minutes), and configure the tcp-ut value on the bind line to
> get rid of clients which do not ACK the data they're being sent at the
> TCP level.
I initially let the TCP "do its thing", but it got me into trouble
with poor wireless clients...
I'll also give `tcp-ut` as suggested.
Thanks,
Ciprian.