How to programmatically increase the buffer for each socket for UDP sockets on LInux?

I am trying to figure out the correct way to increase the socket buffer size for Linux for our streaming network application. The application receives data with a variable bit rate transmitted to it over several UDP sockets. The data volume is significantly higher at the beginning of the stream, and I used:

# sar -n UDP 1 200

to show that the UDP stack drops packets and

# ss -un -pa

to show that each Recv-Q socket length increases to the limit (124928. from sysctl net.core.rmem_default) before packets are dropped. This means that the application simply cannot keep up with the start of the flow. After dropping enough initial packets, the data transfer rate slows down, and the application is gaining momentum. Recv-Q tends to 0 and stays there for a while.

I can solve the packet loss problem by significantly increasing the rmem_default value, which increases the size of the socket buffer and gives the application time to recover from large initial bursts. I understand that this changes the default distribution for all sockets in the system. I would rather just increase the allocation for certain UDP sockets and not change the global default.

My initial strategy was to modify rmem_max and use setsockopt (SO_RCVBUF) for each individual socket. However, this question makes me worry about disabling Linux auto-tuning for all sockets, not just UDP.

udp (7) udp_mem, , rmem_default rmem_max. , , - " ", , UDP, UDP.

udp_rmem_min , ? , UDP .

UDP, , - ?

.

+3
1

. .

. ? TCP , ( TCP).

0

All Articles