NTTTCP

NTTTCP

NTTTCP是微软推出的一款网络吞吐量基准测试工具,使用它可以测试网络带宽和吞吐量性能。 NTTTCP 以网络为目标进行测试,可最大程度地减少可能影响性能的其他资源的使用。

安装NTTTCP

使用NTTTCP测试网络吞吐量

测试同一主机

以下为使用ntttcp测试本地网络吞吐量的实例,即发送和接收为同一主机。

先使用ntttcp -r启动接收端,然后再使用ntttcp -s启动发送端,测试一段时间后Ctrl+c结束测试,随后输出测试结果。

ntttcp测试本地网络吞吐量的实例

发送端测试结果说明如下,接收端类同。

 1NTTTCP for Linux 1.4.0                                   
 2---------------------------------------------------------  
 323:52:54 INFO: 64 threads created                          
 423:52:54 INFO: 64 connections created in 21933 microseconds
 523:52:54 INFO: Network activity progressing...             
 6^C23:53:08 INFO: Interrupted by Ctrl+C                    
 723:53:08 INFO: Test run completed.                       
 823:53:08 INFO: Test cycle finished.                       
 923:53:08 INFO: receiver exited from current test          
1023:53:09 INFO: 64 connections tested                     
1123:53:09 INFO: #####  Totals:  #####                    
1223:53:09 INFO: test duration    :14.44 seconds          ## 测试时长       
1323:53:09 INFO: total bytes      :12770607104                ## 总字节数
1423:53:09 INFO:   throughput     :7.08Gbps                  ## 吞吐量
1523:53:09 INFO:   retrans segs   :28570                     
1623:53:09 INFO: cpu cores        :1                        
1723:53:09 INFO:   cpu speed      :2599.998MHz               
1823:53:09 INFO:   user           :6.23%                    
1923:53:09 INFO:   system         :76.45%                 
2023:53:09 INFO:   idle           :0.00%                     
2123:53:09 INFO:   iowait         :0.00%                     
2223:53:09 INFO:   softirq        :17.31%                    
2323:53:09 INFO:   cycles/byte    :2.94                     
2423:53:09 INFO: cpu busy (all)   :57.87%                    ## CPU使用率
25---------------------------------------------------------                                      

测试不同主机

在发送方和接收方上运行 NTTTCP 测试 300 秒(5 分钟)。 发送方和接收方必须为 -t 参数指定相同的测试持续时间。 如未指定则测试时间默认为 60 秒。

注意:其中接收端和发送端设置的IP都是接收端IP(198.181.22.33)。

 1➜  ~ ntttcp -r 198.181.22.33
 2NTTTCP for Linux 1.4.0
 3---------------------------------------------------------
 401:23:55 INFO: 17 threads created
 501:25:27 INFO: Network activity progressing...
 601:26:27 INFO: Test run completed.
 701:26:27 INFO: Test cycle finished.
 801:26:27 INFO: #####  Totals:  #####
 901:26:27 INFO: test duration    :60.00 seconds
1001:26:27 INFO: total bytes      :25073568
1101:26:27 INFO:   throughput     :3.34Mbps
1201:26:27 INFO:   retrans segs   :0
1301:26:27 INFO: cpu cores        :1
1401:26:27 INFO:   cpu speed      :2599.998MHz
1501:26:27 INFO:   user           :0.65%
1601:26:27 INFO:   system         :1.74%
1701:26:27 INFO:   idle           :97.23%
1801:26:27 INFO:   iowait         :0.00%
1901:26:27 INFO:   softirq        :0.39%
2001:26:27 INFO:   cycles/byte    :172.64
2101:26:27 INFO: cpu busy (all)   :5.12%
22---------------------------------------------------------
 1root@aly:~# ntttcp -s 198.181.22.33
 2NTTTCP for Linux 1.4.0
 3---------------------------------------------------------
 416:25:26 INFO: 64 threads created
 516:25:27 INFO: 64 connections created in 167014 microseconds
 616:25:27 INFO: Network activity progressing...
 716:26:27 INFO: Test run completed.
 816:26:27 INFO: Test cycle finished.
 916:26:33 INFO: 64 connections tested
1016:26:33 INFO: #####  Totals:  #####
1116:26:33 INFO: test duration    :60.00 seconds
1216:26:33 INFO: total bytes      :28704768
1316:26:33 INFO:   throughput     :3.83Mbps
1416:26:33 INFO:   retrans segs   :11091
1516:26:33 INFO: cpu cores        :2
1616:26:33 INFO:   cpu speed      :2499.998MHz
1716:26:33 INFO:   user           :0.46%
1816:26:33 INFO:   system         :0.20%
1916:26:33 INFO:   idle           :99.25%
2016:26:33 INFO:   iowait         :0.01%
2116:26:33 INFO:   softirq        :0.08%
2216:26:33 INFO:   cycles/byte    :78.25
2316:26:33 INFO: cpu busy (all)   :1.96%
24---------------------------------------------------------

Windows测试实例

以上实例均为Linux中测试结果,Windows实例如下:

1ntttcp -r -m [<number of CPU cores> x 2],*,<receiver IP address> -t <seconds>
 1D:\dsk2>ntttcp -r -m 4,*,127.0.0.1 -t 120
 2Copyright Version 5.40
 3Network activity progressing...
 4
 5Thread  Time(s) Throughput(KB/s) Avg B / Compl
 6======  ======= ================ =============
 7     0    0.000            0.000     65535.615
 8     1    0.000            0.000     65535.615
 9     2    0.000            0.000     65535.563
10     3    0.000            0.000     65535.759
11
12
13#####  Totals:  #####
14
15
16   Bytes(MEG)    realtime(s) Avg Frame Size Throughput(MB/s)
17================ =========== ============== ================
18   339669.812500     120.009      21830.785         2830.370
19
20
21Throughput(Buffers/s) Cycles/Byte       Buffers
22===================== =========== =============
23            45285.912       4.170   5434717.000
24
25
26DPCs(count/s) Pkts(num/DPC)   Intr(count/s) Pkts(num/intr)
27============= ============= =============== ==============
28     3331.150        40.811       52187.336          2.605
29
30
31Packets Sent Packets Received Retransmits Errors Avg. CPU %
32============ ================ =========== ====== ==========
33    16315022         16315016          23      5     99.944
 1D:\dsk2>ntttcp -s -m 4,*,127.0.0.1 -t 120
 2Copyright Version 5.40
 3Network activity progressing...
 4
 5
 6Thread  Time(s) Throughput(KB/s) Avg B / Compl
 7======  ======= ================ =============
 8     0    0.000            0.000     65536.000
 9     1    0.000            0.000     65536.000
10     2    0.000            0.000     65536.000
11     3    0.000            0.000     65536.000
12
13
14#####  Totals:  #####
15
16
17   Bytes(MEG)    realtime(s) Avg Frame Size Throughput(MB/s)
18================ =========== ============== ================
19   339669.687500     120.009      21830.763         2830.368
20
21
22Throughput(Buffers/s) Cycles/Byte       Buffers
23===================== =========== =============
24            45285.886       4.170   5434715.000
25
26
27DPCs(count/s) Pkts(num/DPC)   Intr(count/s) Pkts(num/intr)
28============= ============= =============== ==============
29     3331.166        40.811       52187.392          2.605
30
31
32Packets Sent Packets Received Retransmits Errors Avg. CPU %
33============ ================ =========== ====== ==========
34    16315027         16315022          23      5     99.944

如果在Linux和Windows之间进行吞吐量测试,命令格式参考Windows实例中的使用方法。