参考文章
http://ref.onixs.biz/lost-multicast-packets-troubleshooting.html
Operating system kernel network buffers tuning
操作系统内核网络缓冲区调优
Linux
Run the sysctl -A | grep net | grep ‘mem\|backlog‘ | grep ‘udp_mem\|rmem_max\|max_backlog‘
command to check the current settings of the system level buffers.
For example:
net.core.rmem_max | = | 131071 | ||
net.core.netdev_max_backlog | = | 1000 | ||
net.ipv4.udp_mem | = | 1501632 | 2002176 | 3003264 |
Increase the maximum socket receive buffer size to 32MB:
增加最大socket接收缓冲区大小为32MB:
sysctl -w net.core.rmem_max=33554432
Increase the maximum total buffer-space allocatable. This is measured in units of pages (4096 bytes):
增加最大可分配的缓冲区空间总量,数值以页面为单位,每个页面单位等于4096 bytes:sysctl -w net.ipv4.udp_mem="262144 327680 393216"
Note that net.ipv4.udp_mem
works in pages, so to calculate the size in bytes multiply values by PAGE_SIZE, where PAGE_SIZE = 4096 (4K). Then the max udp_mem size
in bytes is 385152 * 4096 = 1,577,582,592.
Increase the queue size for incoming packets:
增加接收数据包队列大小:sysctl -w net.core.netdev_max_backlog=2000
To apply the changes, run the sysctl -p
command.
Check the new settings by running the sysctl -A | grep net | grep ‘mem\|backlog‘ | grep ‘udp_mem\|rmem_max\|max_backlog‘
command again.