netperf使用指南
2017-03-02 16:12
281 查看
netperf使用笔记
netperf 是一种非常常见的测量网络带宽的工具,其安装非常简单:1. 下载netperf包
2. 进入netperf目录,./configure
3. make
4. make install
netperf是一个C/S软件,进行test的时候画风是这样的:
netperf -H 172.18.11.203 -t TCP_STREAM -- -m 64B,64B
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 interval
using units as the initial guess for units per second
A negative value for time will make heavy use of the
system'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 passphrase
-d 在debug的时候还是很有用的。。。
不过netperf在测latency的时候不是很方便,在netperf 2.5.0之后,将一部分代码迁移到了`src/nettest_omni.c'中,能够选择统计包括latency在内的指标。
命令的画风是这样的:
netperf-H 172.18.28.10 -t omni -- -T tcp -d rr-r 64B,64B -O "THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY,MAX_LATENCY, MEAN_LATENCY, REQUEST_SIZE, RESPONSE_SIZE,STDDEV_LATENCY"
真是醉了。。。
输入选项是这样的:
-c This explicitly declares that the test is to include connection establishment and tear-down as in either a TCP CRR or TCP CC test.
-d <direction> This option sets the direction of the test relative to the netperf process. As of version 2.5.0 one can use the following in a case-insensitive manner:
send, stream, transmit, xmit or 2
Any of which will cause netperf to send to the netserver.
recv, receive, maerts or 4
Any of which will cause netserver to send to netperf.
rr or 6 Either of which will cause a request/response test.
Additionally, one can specify two directions separated by a '|' character and
they will be OR'ed together. In this way one can use the "Send|Recv" that will be emitted by the
Section 9.3.1 [Omni Output Selectors], page 51 Section 9.3
[Omni Output Selection], page 50 when used with a
request/response test.
-k [Section 9.3 [Omni Output Selection], This option sets the style of output to \keyval" where each line of output has the form:
key=value
For example:
$ netperf -t omni -- -d rr -k "THROUGHPUT,THROUGHPUT_UNITS"
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain (127.0.0.1)
THROUGHPUT=59092.65
THROUGHPUT_UNITS=Trans/s
Using the `-k' option will override any previous, test-speci c `-o' or `-O' option.
还有好多好多啊,此处省略一万字。。。
输出选项是这样的:
OUTPUT_NONE
This is essentially a null output. For `-k' output it will simply add a line that reads \OUTPUT NONE=" to the output. For `-o' it will cause an empty column" to be included. For `-O' output it will cause extra spaces to
separate
real" output.
SOCKET_TYPE
This will cause the socket type (eg SOCK STREAM, SOCK DGRAM) for the data connection to be output.
PROTOCOL This will cause the protocol used for the data connection to be displayed.
DIRECTION
This will display the data ow direction relative to the netperf process. Units: Send or Recv for a unidirectional bulk-transfer test, or Send|Recv for a request/response test.
ELAPSED_TIME
This will display the elapsed time in seconds for the test.
THROUGHPUT
This will display the throughput for the test. Units: As requested via the global `-f' option and displayed by the THROUGHPUT UNITS
output selector.
THROUGHPUT_UNITS
This will display the units for what is displayed by the THROUGHPUT output selector.
LSS_SIZE_REQ
This will display the local (netperf) send socket bu er size (aka SO SNDBUF) requested via the command line. Units:
Bytes.
还有一堆一堆又一堆。。。不写了,大家去看netperf文档吧!
有的时候,netperf会突然出现连接不上的bug:
establish control:are you sure there is a netserver listening on 172.18.11.203 at port 12865?
establish_control could not establish the control connection from 0.0.0.0 port0 address family AF_UNSPEC to 172.18.11.203 port 12865 address familyAF_INET
想了两个小时啊,我关闭了firewall.service,又尝试了其他端口,以及其他的地址,最后怀疑是不是端口被屏蔽了。。。尝试了一下:
sudo iptables -IINPUT 1 -p tcp --dport 12865 -j ACCEPT
好像真的是这样,晕!
那看来是iptables的锅。。。关闭iptables:
sudo serviceiptables stop
再次尝试,终于能连接上了!!!
我的启示是:以后一定要先把防火墙firewall.service和iptables先关掉!!!
最后再次致敬netperf文档!
相关文章推荐
- Eclipse快速上手指南之使用CVS
- Eclipse快速上手指南之使用基础
- Spread for ASP.NET 7新功能使用指南
- 【jquery】jquery.cookie.js 的使用指南
- MYSQL数据库初学者使用指南
- 负margin使用权威指南
- Log4Net使用指南
- GDI+ 使用指南(basic guiding of GDI plus )
- yacc / lex 在linux 下 使用指南
- MySQL数据库初学者的使用指南
- Android创建和使用数据库详细指南(1)
- IntelliJ使用指南—— 导入Eclipse的Web项目
- PL/SQL dev使用指南
- Thrift使用指南
- DataGridView使用指南[转载]
- ssh-agent 使用指南
- Git 使用指南
- MarkDown编辑使用指南
- JFreeChart-API使用指南(中文)
- vi 使用指南