10G链接的netcat和iperf结果存在巨大差异 [英] Huge difference in netcat and iperf results for a 10G link

查看:299
本文介绍了10G链接的netcat和iperf结果存在巨大差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑看到netcat和iperf结果之间的巨大差异.我有10 G链接连接我的服务器和客户端.对于iperf,我的速度约为10Gb/s,对于netcat,速度仅为280 MB/s.可能是什么错误?

I am confused to see huge difference between netcat and iperf results. I am having 10 G link connecting my server and client. I am getting around 10Gb/s for iperf but only ~280 MB/s for netcat. What can be the error ?

对于Iperf

服务器

iperf -s

客户

iperf -c 172.79.56.27 -i1 -t 10

结果:

Client connecting to 172.79.56.27, TCP port 5001

TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 172.79.56.28 port 46058 connected with 172.79.56.27 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec  1.07 GBytes  9.23 Gbits/sec
[  3]  1.0- 2.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  2.0- 3.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  3.0- 4.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  4.0- 5.0 sec  1.09 GBytes  9.36 Gbits/sec
[  3]  5.0- 6.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  6.0- 7.0 sec  1.09 GBytes  9.36 Gbits/sec
[  3]  7.0- 8.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  8.0- 9.0 sec  1.09 GBytes  9.36 Gbits/sec
[  3]  9.0-10.0 sec  1.09 GBytes  9.35 Gbits/sec
[  3]  0.0-10.0 sec  10.9 GBytes  9.34 Gbits/sec

对于netcat,

服务器

nc -v -v -l -n 2222 >/dev/null

客户

time dd if=/dev/zero | nc -v -v -n 172.79.56.27 2222


Connection to 172.79.56.27 2222 port [tcp/*] succeeded!
^C6454690+0 records in
 6454690+0 records out
 3304801280 bytes (3.3 GB) copied, 11.4463 s, 289 MB/s


real    0m11.449s
user    0m6.868s
sys 0m15.372s

推荐答案

先生user1352179,

Mr user1352179,

再次运行netcat测试,然后在另一个窗口中查看htop.我敢打赌,您会看到这里的瓶颈是dd读/dev/zero的单线程.尝试再次与dd | netcat的'n'个实例并行运行测试,其中'n'=系统中的内核数.然后将所有并行运行的总带宽相加,以查看实际结果. (确保您在不同的端口上进行传输,并且使接收端也运行多个线程,并在多个端口上进行侦听).

Run your netcat test again and watch htop in another window. I bet you will see that the bottleneck here is the single thread of dd reading /dev/zero. Try running the test again in parallel with 'n' instances of dd|netcat where 'n' = the # of cores in your system. Then add the total bandwidth together from all parallel runs to see the real result. (Make sure you transmit on different ports & have your receiving end running multiple threads as well & listening on multiple ports).

这篇关于10G链接的netcat和iperf结果存在巨大差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆