socket module rcvbuf and sndbuf

Ben Browitt ben.browitt@REDACTED
Wed Nov 6 14:54:39 CET 2019


Hi,

I'm writing a simple wrapper around the socket nif to test the performance
compared to gen_udp.
My questions are specific to UDP sockets.

How do the socket rcvbuf and the otp rcvbuf relate to each other?
The 'rcvbuf' with level = socket is the size of the OS level receive buffer.
The 'rcvbuf' with level = otp is the size of the buffer "we" read into when
we read data (with recv/recvfrom/recvmsg).
If UDP MTU is 1500 bytes, what happens if the socket rcvbuf=MTU or
rcvbuf=MTU*N?
Should the otp rcvbuf be equal to the socket rcvbuf or larger? What's the
difference?
What happen if the wrapper module doesn't read messages fast enough from
the socket nif?

Does sndbuf have any effect on UDP sockets?
Should the wrapper module queue packets if the sndbuf is full and resend
when possible or should it just drop packets?

What's the difference between recv, recvfrom, recvmsg and similarly send,
sendmsg, sendto?

Is it relatively safe to use the socket module in production?
What should I be careful about when implementing the udp wrapper module?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191106/821f8aa3/attachment.htm>


More information about the erlang-questions mailing list