背景:
在购买云服务器(阿里云)时, 其中有个内网带宽指标, 微服务架构或者搭建服务器集群时,这个指标就比较重要了。
那如何测试这个内网带宽指标值呢??
操作:
0. 在阿里云上购买了2台G5服务器内存型:CPU双核、内存16G;IP地址如下:
服务端:172.16.78.212
客户端:172.16.78.201
1. 在客服端/服务器端安装iperf软件:
yum -y install epel-release
yum -y install iperf
2. 服务器端开启服务
iperf -s 172.16.78.212
3. 客服端连接服务测试内网带宽
iperf -c 172.16.78.212
4. 测试结果如下:
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 172.16.78.212 port 5001 connected with 172.16.53.94 port 53812
[ 4] local 172.16.78.212 port 5001 connected with 172.16.53.94 port 53812
[ ID] Interval Transfer Bandwidth
[ 4] local 127.0.0.1 port 5001 connected with 127.0.0.1 port 36778
[ 4] 0.0-10.0 sec 61.7 GBytes 52.8 Gbits/sec
[ 4] local 172.16.78.212 port 5001 connected with 172.16.78.201 port 34260
[ 4] 0.0-10.1 sec 1.25 GBytes 1.06 Gbits/sec
[ 4] 0.0-10.0 sec 692 MBytes 578 Mbits/sec
5. 结论:
a). 本机内网带宽极高, 有52.8 Gbits/sec, 是相同局域网机器内网带宽的50倍, 这种情况下测试的是内存速度
b). 相同局域网下的两台机器内网带宽能达到阿里云给出的内网带宽指标值1Gbits/sec; 如: 172.16.78.201 > 172.16.78.212
c). 内网不同子网掩码下的两台机器内网带宽减半, 只有578 Mbits/sec; 如: 172.16.53.94 > 172.16.78.212