有没有办法获得目前txqueue利用如eth0或tun设备?

我在tun0接口上检测到了丢包。

他们似乎是由低txqueuelen设置造成的。 现在,当我增加了networking设备的txqueuelen值,并没有更多的下降 – 我想知道有什么办法来获得实际的networking设备缓冲区的当前使用情况?

对于TCP缓冲区,您可以使用

  netstat -nt 

并寻找第二和第三列的收发缓冲区(Recv-Q,Send-Q)

对于UDP

  netstat -nua 

同样的方式,你可以看看/ proc / net / {tcp,udp}并查找tx_queue&rx_queue

你可以使用同样的方式

  ethtool -S <nic card name> (driver need to support) NIC statistics: rx_packets: 445 tx_packets: 48 rx_bytes: 56015 tx_bytes: 5938 rx_broadcast: 336 tx_broadcast: 2 rx_multicast: 89 tx_multicast: 28 rx_errors: 0 tx_errors: 0 tx_dropped: 0 

也只是想添加一个networking参数“tcp_moderate_rcvbuf”默认启用,执行接收缓冲区自动调整。根据kernel-doc

  If set, TCP performs receive buffer auto-tuning, attempting to automatically size the buffer (no greater than tcp_rmem[2]) to match the size required by the path for full throughput