Full UDP Receive Queue?
I have an application that receives heavy UDP traffic on port 12201 and I noticed that some of the UDP packets never make it to the application (only received by the kernel).
When I ran
netstat -c --udp -an | grep 12201
I see that Recv-Q is almost always 126408, rarely goes below, never goes above:
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
udp 126408 0 :::12201 :::*
Does this mean that the receive queue is full? Where does the number 126408 come from? How to increase it?
Sysctl config:
# sysctl -a | grep mem
vm.overcommit_memory = 0
vm.nr_hugepages_mempolicy = 0
vm.lowmem_reserve_ratio = 256 256 32
vm.meminfo_legacy_layout = 1
vm.memory_failure_early_kill = 0
vm.memory_failure_recovery = 1
net.core.wmem_max = 124928
net.core.rmem_max = 33554432
net.core.wmem_default = 124928
net.core.rmem_default = 124928
net.core.optmem_max = 20480
net.ipv4.igmp_max_memberships = 20
net.ipv4.tcp_mem = 365760 487680 731520
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.udp_mem = 262144 327680 393216
net.ipv4.udp_rmem_min = 4096
net.ipv4.udp_wmem_min = 4096
source to share
It looks like your application is using the default system receive buffer which is defined via sysctl
net.core.rmem_default = 124928
Hence, you see an upper limit in the Recv-Q
next to above. Try changing the SO_RCVBUF socket option in your application to higher values, probably up to the maximum limit. As defined in sysctl settingnet.core.rmem_max = 33554432
A decrease in the number of packets due to a full queue, can be seen through netstat -us
(search packet receive errors
)
source to share