点击"Python测试和开发"关注我

后台回复1024,解锁无限快乐!

安装

被测环境选择是某云的Ubuntu云主机,版本信息如下:

Ubuntu 18.04.1 LTS

执行安装:

apt install netperf
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:netperf
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 74 个软件包未被升级。
需要下载 550 kB 的归档。
解压缩后会消耗 1,155 kB 的额外空间。
获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse amd64 netperf amd64 2.6.0-2.1 [550 kB]
已下载 550 kB,耗时 1秒 (493 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
正在选中未选择的软件包 netperf。
(正在读取数据库 ... 系统当前共安装有 16082 个文件和目录。)
正准备解包 .../netperf_2.6.0-2.1_amd64.deb ...
正在解包 netperf (2.6.0-2.1) ...
正在设置 netperf (2.6.0-2.1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
➜ RemoteWorking

确认安装结果:

➜ RemoteWorking netperf -V
Netperf version 2.6.0

开始测试

因为我们当前只有一台测试机,所以我们就在同一台机器上启动服务端和客户端进行测试演示。

启动服务端:

➜ RemoteWorking netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC

启动客户端开始测试:

➜ RemoteWorking netperf -H localhost
MIGRATED TCP STREAM TEST from ::0 (::) port 0 AF_INET6 to localhost (::1) port 0 AF_INET6 : demo
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs. 10^6bits/sec  87380  16384  16384    10.00    37435.93

结果分析:

从上面的结果中我们可以看到:测试机的端口0的吞吐量为37435.93b/s。

转换成Mb结果为:4679.49Mb/s,约为4.57Gb/s。

更多

全部参数:

➜ RemoteWorking netperf --help
netperf: invalid option -- '-'Usage: netperf [global options] -- [test options] Global options:-a send,recv Set the local send,recv buffer alignment-A send,recv Set the remote send,recv buffer alignment-B brandstr Specify a string to be emitted with brief output-c [cpu_rate] Report local CPU usage-C [cpu_rate] Report remote CPU usage-d Increase debugging output-D time,[units] * Display interim results at least every time intervalusing units as the initial guess for units per secondA negative value for time will make heavy use of thesystem's timestamping functionality-f G|M|K|g|m|k Set the output units-F lfill[,rfill]* Pre-fill buffers with data from specified file-h Display this text-H name|ip,fam * Specify the target machine and/or local ip and family-i max,min Specify the max and min number of iterations (15,1)-I lvl[,intvl] Specify confidence level (95 or 99) (99) and confidence interval in percentage (10)-j Keep additional timing statistics-l testlen Specify test duration (>0 secs) (<0 bytes|trans)-L name|ip,fam * Specify the local ip|name and address family-o send,recv Set the local send,recv buffer offsets-O send,recv Set the remote send,recv buffer offset-n numcpu Set the number of processors for CPU util-N Establish no control connection, do 'send' side only-p port,lport* Specify netserver port number and/or local port-P 0|1 Don't/Do display test headers-r Allow confidence to be hit on result only-s seconds Wait seconds between test setup and test start-S Set SO_KEEPALIVE on the data connection-t testname Specify test to perform-T lcpu,rcpu Request netperf/netserver be bound to local/remote cpu-v verbosity Specify the verbosity level-W send,recv Set the number of send,recv buffers-v level          Set the verbosity level (default 1, min 0)-V Display the netperf version and exit-y local,remote Set the socket priority-Y local,remote Set the IP_TOS. Use hexadecimal.-Z passphrase Set and pass to netserver a passphraseFor those options taking two parms, at least one must be specified;
specifying one value without a comma will set both parms to that
value, specifying a value with a leading comma will set just the second
parm, a value with a trailing comma will set just the first. To set
each parm to unique values, specify both and separate them with a
comma.* For these options taking two parms, specifying one value with no comma
will only set the first parms and will leave the second at the default
value. To set the second value it must be preceded with a comma or be a
comma-separated pair. This is to retain previous netperf behaviour.

常用参数:

-H host:指定远端运行netserver的server IP地址

-l testlen:指定测试的时间长度(秒)

-t testname:指定进行的测试类型(包括TCP_STREAM,UDP_STREAM,TCP_RR,TCP_CRR,UDP_RR)

-s size:设置本地系统的socket发送与接收缓冲大小

-S size:设置远端系统的socket发送与接收缓冲大小

-m size:设置本地系统发送测试分组的大小,测试PPS时值为1。测试BPS时为1400。

-M size:设置远端系统接收测试分组的大小

-p port:设置测试连接Server端的端口

-D:对本地与远端系统的socket设置TCP_NODELAY选项

-r req,resp:设置request和reponse分组的大小

常用的组合命令:

TCP吞吐测试:

netperf -H 10.18.201.3 -l 60 -- -S 87380 -s 16384 -M 16384 -m 16384

UDP吞吐测试:

netperf -t UDP_STREAM -H 10.18.201.201 -l 60 -- -S 87380 -s 16384 -M 16384 -m 16384

数据库应用测试:

netperf -t TCP_RR -H 10.18.201.3 -l 60 -- -S 87380 -s 16384 -M 16384 -m 16384 -r 1024,32(发出去1024比特的包,收到32比特的包)

HTTP应用测试:

netperf -t TCP_CRR -H 10.18.201.3 -l 60 -- -S 87380 -s 16384 -M 16384 -m 16384 -r 1024,1024(发出去1024比特的包,收到1024比特的包)

往期推荐

使用FIO测试磁盘性能

Linux 超实用的工具分享!

使用sysbench测试CPU性能

点亮在看!

网络性能测试工具 | Netperf相关推荐

  1. 网络性能测试工具netperf

    源地址:网络性能测试工具netperf | 软件定义网络SDN 1 网络性能测试概述 在构建或管理一个网络系统时,我们更多的是关心网络的可用性,即网络是否连通,而对于其整体的性能往往考虑不多,或者即使 ...

  2. TCP/UDP网络性能测试工具 - Netperf (zz) ..网络测试工具

    在构建或管理一个网络系统时,我们更多的是关心网络的可用性,即网络是否连通,而对于其整体的性能往往考虑不多. 除了netperf以外.        还有很多其它的网络性能测试工具.        如d ...

  3. Linux之网络性能测试工具netperf实践

    一.netperf简介   Netperf是一种网络性能的测量工具,主要针对基于TCP或UDP的传输.Netperf根据应用的不同,可以进行不同模式的网络性能测试,即批量数据传输(bulk data ...

  4. 网络性能测试工具Iperf和netperf

    网络性能测试工具Iperf和netperf 一.iperf工具的使用 同主机网络传输速率吞吐率 网络响应时间 TCP/UDP吞吐率 跨主机网络传输速率吞吐率 网络响应时间 TCP/UDP吞吐率 1.测 ...

  5. 如何ping端口_复刻smartbits的国产网络性能测试工具minismb-如何配置Ping报文

    复刻smartbits的国产网络性能测试工具minismb,是一款专门用于测试智能路由器,网络交换机的性能和稳定性的软硬件相结合的工具.可以通过此以太网测试工具测试任何ip网络设备的端口吞吐率,带宽, ...

  6. tcp测试监听工具_linux 下两款网络性能测试工具介绍

    前言:最近生产上有点不稳定,开发说网络问题,于是需要测试一下网络环境,出一篇报告验证是否真是网络问题,所以今天正好为大家分享linux下两款网络性能测试工具iperf和netperf 一,iperf安 ...

  7. 网络性能测试工具iperf的使用与参数解析

    介绍   网络性能评估主要是监测网络带宽的使用率,将网络带宽利用最大化是保证网络性能的基础,但是由于网络设计不合理.网络存在安全漏洞等原因,都会导致网络带宽利用率不高.要找到网络带宽利用率不高的原因, ...

  8. Linux命令 iperf - 网络性能测试工具

    iperf 网络性能测试工具 下载地址: Google Code Archive - Long-term storage for Google Code Project Hosting.https:/ ...

  9. 网络性能测试工具Iperf上手指南

    Iperf是一个网络性能测试工具.可以测试TCP和UDP带宽质量,可以测量最大TCP带宽,具有多种参数和UDP特性,可以报告带宽,延迟抖动和数据包丢失.Iperf在linux和windows平台均有二 ...

最新文章

  1. TVM编译机器学习到 WASM 和 WebGPU
  2. RJ-45接口连接线、MDI/MDIX接口
  3. 单列表_使用Excel中的quot;记录单quot;功能快速录入数据
  4. 数据结构——树的理解路线(总)
  5. 求链表相交时的交点(C语言)
  6. mysql批量删除进程_小程序批量删除云数据库里的数据
  7. 投资平台服务器状态未知,投资者说20130606:503 service unavailable错误解决教程
  8. 微pe工具箱 系统安装教程_【微pe安装系统教程】微pe安装系统教程win7_微pe装系统教程...
  9. Java api监控_网站api监控、api监控教程详解
  10. 计算机类毕业设计选题推荐 springboot+vue宠物医院管理系统 java宠物预约挂号系统 微服务 宠物挂号系统 宠物医院预约挂号系统 springboot宠物诊所
  11. tp6 使用 redis
  12. 有关GUASS高斯数据库的语法汇总(获取字符串字节数等)
  13. EXIF App for Mac(EXIF查看器)
  14. 关闭QQ弹出的腾讯网迷你版
  15. 使用echarts中国地图上绘制散点图(自适应宽高)
  16. 数据解读 | 异地恋分手原因,它排第一
  17. Calander用例
  18. sql 语句 还原数据库
  19. matlab蒙特卡罗方法求体积_实验二-蒙特卡罗方法计算三维体积
  20. deepin驱动精灵_深度用户展望Deepin 15.11或Deepin 16版本应该有的新功能

热门文章

  1. PPT使用VBA导出pdf绘图
  2. PHP数组根据某个字段进行水平合并,横向合并
  3. 魔众网盘系统 v1.2.0 后台界面优化,系统常规升级
  4. 【独家方法纯分享】非教程非推广非广告
  5. Docker - 设置环境变量
  6. 享场地茶馆办公室v1.0.5 民宿 棋牌 共享茶室
  7. 2018 蓝桥杯省赛 B 组模拟赛(一)
  8. C# 状态机 Stateless 3.0
  9. HAWQ-V2:基于Hessian迹的混合比特量化策略
  10. Django 上传文件出现 OSError Permission denied的解决方法