本文在于解决在web压力测试中经常遇到的错误提示。
1. 硬件级别
1) 网卡丢包
使用命令 ifconfig –a 可以看到网卡dropped掉的包。
使用命令 ethtool –S eth* 可以看到丢包具体原因,如 ethtool–S eth0得到:
n rx_no_buffer_count: 2954164
If you see this error, most probably you have to increase "ring"size.
n rx_missed_errors: 3168887
对于 rx_missed_errors 这个参数,官方给出的解释是:This errorcan mean many things. Including not enough bus bandwidth,host is too busy (tryto enable flow-control), PBA buffer too small.简而言之,两种原因网卡缓冲太小和系统繁忙。
因此,减少网卡丢包方法之一可以增大网卡的环形缓冲区,但能否修改环形缓冲区得看网卡驱动是否支持。
使用如下命令可以修改环形缓冲区:
ethtool -G eth0 rx 2048
以上命令将网卡的读环形缓冲区设置为2048
如果该网卡驱动不支持修改&