Enlarging Linux UDP buffer size
Posted on In QAOne of the most common causes of UDP data gram lost on Linux is an undersized receive buffer on the Linux socket. How to enlarge Linux UDP buffer size?
On Linux, you can change the UDP buffer size (e.g. to 26214400) by (as root):
sysctl -w net.core.rmem_max=26214400
The default buffer size on Linux is 131071
.
You can also make it permanent by adding this line to /etc/sysctl.conf
:
net.core.rmem_max=26214400
What is net.core.rmem_max
?
rmem_max
controls the maximum socket buffer size that can be allocated. The maximum sizes for socket buffers declared via the SO_SNDBUF
and SO_RCVBUF mechanisms are limited by the values in the /proc/sys/net/core/rmem_max
and /proc/sys/net/core/wmem_max
files.
“rmem_max the maximum receive socket buffer size in bytes” – ref.
Not that it can also affect TCP‘s performance beside of UDP’s.
Very nice article Eric.
Question: Is the UDP buffer the same thing as the network buffer?
rmem_max
controls the maximum socket buffer size that can be allocated.“rmem_max the maximum receive socket buffer size in bytes” – ref.
It can also affect TCP performance beside of UDP: https://www.systutorials.com/docs/linux/man/7-tcp/