Iperf使用crontab以超级用户身份运行时会产生较慢的结果

我们在安装了iperf的客户端上安装了一个linux框(Raspberry Pi),我们将其作为客户端运行。

我们还在云端运行Ubuntu 16.04的xxxx虚拟机箱

当我们运行以下命令时:

iperf -c <xxxx> 

我们得到以下内容:

 ------------------------------------------------------------ Client connecting to <xxxx>, TCP port 5001 TCP window size: 43.8 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.30.11 port 34893 connected with <xxxx> port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 63.9 MBytes 53.5 Mbits/sec 

几乎每次我们手动运行50Mbits / sec的数量时,我们都能够获得类似的结果。 由于该网站运行在五千万线上,这是在期望之内。

但是,当我们运行以下命令时:

 */5 * * * * iperf -c <xxxx> | grep Mbits/sec >> speed.txt 

我们已经插入到crontab中,我们实现了以下function:

 sudo cat /root/speed.txt [ 3] 0.0-10.1 sec 22.4 MBytes 18.6 Mbits/sec [ 3] 0.0-10.1 sec 21.5 MBytes 17.8 Mbits/sec [ 3] 0.0-10.1 sec 22.5 MBytes 18.6 Mbits/sec [ 3] 0.0-10.1 sec 20.5 MBytes 17.0 Mbits/sec [ 3] 0.0-10.1 sec 21.4 MBytes 17.7 Mbits/sec [ 3] 0.0-10.1 sec 19.5 MBytes 16.1 Mbits/sec [ 3] 0.0-10.1 sec 19.8 MBytes 16.4 Mbits/sec [ 3] 0.0-10.1 sec 19.2 MBytes 15.9 Mbits/sec [ 3] 0.0-10.1 sec 20.9 MBytes 17.3 Mbits/sec [ 3] 0.0-10.1 sec 21.4 MBytes 17.7 Mbits/sec [ 3] 0.0-10.1 sec 19.6 MBytes 16.2 Mbits/sec [ 3] 0.0-10.1 sec 19.9 MBytes 16.4 Mbits/sec [ 3] 0.0-10.1 sec 21.4 MBytes 17.8 Mbits/sec [ 3] 0.0-10.2 sec 19.8 MBytes 16.3 Mbits/sec [ 3] 0.0-10.1 sec 20.9 MBytes 17.3 Mbits/sec [ 3] 0.0-10.2 sec 21.9 MBytes 18.1 Mbits/sec 

我的问题是,为什么这些结果运行在crontab显然会显示一个不同的更慢的结果?