外网直连家里软路由,下载速度只有 4Mbps ~ 8Mbps 左右,使用 smb 复制文件速度一致。发现 iperf3 单线程测速的确就是这样的结果:
~ iperf3 -c xxx -R -P 1
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 7.92 MBytes 66.4 Mbits/sec
[ 5] 1.00-2.00 sec 759 KBytes 6.22 Mbits/sec
[ 5] 2.00-3.00 sec 979 KBytes 8.02 Mbits/sec
[ 5] 3.00-4.00 sec 864 KBytes 7.06 Mbits/sec
[ 5] 4.00-5.00 sec 578 KBytes 4.73 Mbits/sec
[ 5] 5.00-6.00 sec 550 KBytes 4.51 Mbits/sec
[ 5] 6.00-7.00 sec 572 KBytes 4.68 Mbits/sec
[ 5] 7.00-8.00 sec 649 KBytes 5.32 Mbits/sec
[ 5] 8.00-9.00 sec 578 KBytes 4.73 Mbits/sec
[ 5] 9.00-10.00 sec 632 KBytes 5.18 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.01 sec 17.6 MBytes 14.8 Mbits/sec 1612 sender
[ 5] 0.00-10.00 sec 13.9 MBytes 11.7 Mbits/sec receiver
但神奇的是,只要改成多线程,除了宽带能跑满之外,每条线程的表现都要比单线程要好,比如 2 线程情况下,不仅能跑满 30M 的宽带,而且每条线程能到 15M 左右,比之前单线程表现要好得多:
~ iperf3 -c xxx -R -P 2
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 4.48 MBytes 37.6 Mbits/sec
[ 7] 0.00-1.00 sec 4.07 MBytes 34.2 Mbits/sec
[SUM] 0.00-1.00 sec 8.55 MBytes 71.7 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 1.00-2.00 sec 2.02 MBytes 17.0 Mbits/sec
[ 7] 1.00-2.00 sec 1.50 MBytes 12.6 Mbits/sec
[SUM] 1.00-2.00 sec 3.53 MBytes 29.6 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 2.00-3.00 sec 2.02 MBytes 17.0 Mbits/sec
[ 7] 2.00-3.00 sec 1.49 MBytes 12.5 Mbits/sec
[SUM] 2.00-3.00 sec 3.51 MBytes 29.5 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 3.00-4.00 sec 2.14 MBytes 17.9 Mbits/sec
[ 7] 3.00-4.00 sec 1.33 MBytes 11.2 Mbits/sec
[SUM] 3.00-4.00 sec 3.47 MBytes 29.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 4.00-5.00 sec 1.90 MBytes 16.0 Mbits/sec
[ 7] 4.00-5.00 sec 1.57 MBytes 13.1 Mbits/sec
[SUM] 4.00-5.00 sec 3.47 MBytes 29.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 5.00-6.00 sec 2.05 MBytes 17.2 Mbits/sec
[ 7] 5.00-6.00 sec 1.48 MBytes 12.4 Mbits/sec
[SUM] 5.00-6.00 sec 3.53 MBytes 29.6 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 6.00-7.00 sec 1.92 MBytes 16.1 Mbits/sec
[ 7] 6.00-7.00 sec 1.54 MBytes 12.9 Mbits/sec
[SUM] 6.00-7.00 sec 3.46 MBytes 29.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 7.00-8.00 sec 1.98 MBytes 16.6 Mbits/sec
[ 7] 7.00-8.00 sec 1.56 MBytes 13.1 Mbits/sec
[SUM] 7.00-8.00 sec 3.55 MBytes 29.8 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 8.00-9.00 sec 1.88 MBytes 15.8 Mbits/sec
[ 7] 8.00-9.00 sec 1.51 MBytes 12.6 Mbits/sec
[SUM] 8.00-9.00 sec 3.39 MBytes 28.4 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 9.00-10.00 sec 1.97 MBytes 16.5 Mbits/sec
[ 7] 9.00-10.00 sec 1.59 MBytes 13.3 Mbits/sec
[SUM] 9.00-10.00 sec 3.56 MBytes 29.9 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.01 sec 26.0 MBytes 21.8 Mbits/sec 9579 sender
[ 5] 0.00-10.00 sec 22.4 MBytes 18.8 Mbits/sec receiver
[ 7] 0.00-10.01 sec 21.1 MBytes 17.7 Mbits/sec 8230 sender
[ 7] 0.00-10.00 sec 17.6 MBytes 14.8 Mbits/sec receiver
[SUM] 0.00-10.01 sec 47.1 MBytes 39.5 Mbits/sec 17809 sender
[SUM] 0.00-10.00 sec 40.0 MBytes 33.6 Mbits/sec receiver
基于这个结论,尝试打开一个 SMB 文件复制的同时,开启 iperf3 单线程测试,此时 iperf3 也能跑到 15M 以上,同时 SMB 复制速度也提上去了
~ iperf3 -c xxx -R -P 1
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 6.47 MBytes 54.3 Mbits/sec
[ 5] 1.00-2.00 sec 1.87 MBytes 15.7 Mbits/sec
[ 5] 2.00-3.00 sec 1.73 MBytes 14.5 Mbits/sec
[ 5] 3.00-4.00 sec 1.69 MBytes 14.2 Mbits/sec
[ 5] 4.00-5.00 sec 1.82 MBytes 15.2 Mbits/sec
[ 5] 5.00-6.00 sec 1.97 MBytes 16.5 Mbits/sec
[ 5] 6.00-7.00 sec 1.92 MBytes 16.2 Mbits/sec
[ 5] 7.00-8.00 sec 1.67 MBytes 14.0 Mbits/sec
[ 5] 8.00-9.00 sec 1.56 MBytes 13.1 Mbits/sec
[ 5] 9.00-10.00 sec 1.58 MBytes 13.3 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.01 sec 25.8 MBytes 21.6 Mbits/sec 8644 sender
[ 5] 0.00-10.00 sec 22.3 MBytes 18.7 Mbits/sec receiver
所以有个骚操作,如果想提升 SMB 的复制速度,可以同时开一个 5 线程 1M 的 iperf3 测速,这样 SMB + iperf3 能把带宽打满,同时 iperf3 只占用 5M 左右带宽
~ iperf3 -c xxx -R -P 5 -b 1M
最后问题来了,为什么会出现这样的情况?软路由要调整什么配置才能恢复单线程性能? 另外补充一个信息,同网络下另外一台 PC 主机并没有出现这种情况,PC 的单线程也能把宽带跑满
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.