What's the maximum size of Linux UDP receive buffer? I thought it's limited only by available RAM, but when I set
5GB for rmem_max:
echo 5000000000 > /proc/sys/net/core/rmem_max
and 4GB for the actual socket buffer (in Erlang):
gen_udp:listen(Port, [{recbuf, 4000000000}])
When I measure the buffer utilization, it shows:
# netstat -u6anp | grep 5050
udp6 1409995136 0 :::5050 :::* 13483/beam.smp
I can't exceed this 1.4GB. For smaller buffer sizes, like e.g. 500MB, actual buffer size matched the configured value. My system is Debian 6.0, the machine has 50GB RAM available.
2^32-1 (2147483647, maximum 32bit signed integer)
Echoing into the
/proc
filesystem appears to overflow when attempting to set larger values.It seems that there is a limit in linux. I have tried setting rmem_max to 2^32-1 with success.
2^32 was too much:
Setting to 5000000000 yields:
I have tested in python that setting and getting socket receive buffer with
If 'bufferSize' is less then 1024^3 program prints doubled 'bufferSize', otherwise it falls back to 256.
The value 705032704*2 = 1410065408 is close to the 1409995136 obtained by netstat.