inet buffer size for TCP

Lukas Larsson lukas@REDACTED
Fri Dec 13 09:27:54 CET 2019


On Thu, Dec 12, 2019 at 7:43 PM Frank Muller <frank.muller.erl@REDACTED>
wrote:

> Hi all
>
> The inet (
> http://erlang.org/doc/man/inet.html
> ) documentation states :
>
> {buffer, Size}
>
>     The size of the user-level buffer used by the driver. Not to be
> confused with options sndbuf and recbuf, which correspond to the Kernel
> socket buffers. For TCP it is recommended to have val(buffer) >=
> val(recbuf) to avoid performance issues because of unnecessary copying. For
> UDP [...]
>
>
> Question: which is best here:
>
> val(buffer) = val(recbuf)
>
> val(buffer) = val(recbuf) + (1/4 *val(recbuf))
>
> val(buffer) = val(recbuf) + (2/4 *val(recbuf))
>
> val(buffer) = val(recbuf) + (3/4 *val(recbuf))
>
> val(buffer) = 2 * val(recbuf)
>
> Is there any optimal value?
>

Not a general optimal value. It will depend on what data you are sending
and which packet mode you are using. If not using any packet mode (aka
raw), then I would say that "val(buffer) = val(recbuf)" should be the best
option.


>
> /Frank
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191213/55ff3fb5/attachment.htm>


More information about the erlang-questions mailing list