⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 在Linux/Unix环境下发包测试性能的工具
💻 HTML
📖 第 1 页 / 共 3 页
字号:
        <I>host</I> specified. Does not work well for UDP.</TD></TR>  <TR vAlign=top>    <TD><A name=sparallel></A><TT>-P, --parallel <I>#</I></TT></TD>    <TD><TT>$IPERF_PARALLEL</TT></TD>    <TD>The number of connections to handle by the server before      closing. Default is 0 (which means to accept connections forever).</TD></TR>  <TR>    <TH bgColor=#cccccc colSpan=3>Client specific options</TH></TR>  <TR vAlign=top>    <TD><A name=bandwidth></A><TT>-b, --bandwidth <I>#[KM]</I></TT></TD>    <TD><TT>$IPERF_BANDWIDTH</TT></TD>    <TD>The UDP bandwidth to send at, in bits/sec. This implies the -u option.       Default is 1 Mbit/sec.</TD></TR>  <TR vAlign=top>    <TD><A name=client></A><TT>-c, --client <I>host</I></TT></TD>    <TD><TT>$IPERF_CLIENT</TT></TD>    <TD>Run Iperf in client mode, connecting to an Iperf server running on       <I>host</I>.</TD></TR>  <TR vAlign=top>    <TD><A name=dualtest></A><TT>-d, --dualtest </TT></TD>    <TD><TT>$IPERF_DUALTEST</TT></TD>    <TD>Run Iperf in dual testing mode. This will cause the server to connect        back to the client on the port specified in the        <A href="#listenport">-L</A> option (or defaults        to the port the client connected to the server on). This is done immediately        therefore running the tests simultaneously. If you want an alternating        test try <A href="#tradeoff">-r.</A></TD></TR>  <TR vAlign=top>    <TD><A name=num></A><TT>-n, --num <I>#[KM]</I></TT></TD>    <TD><TT>$IPERF_NUM</TT></TD>    <TD>The number of buffers to transmit. Normally, Iperf sends for 10       seconds. The -n option overrides this and sends an array of <I>len</I>       bytes <I>num</I> times, no matter how long that takes. See also the <A       href="#len">-l</A>       and <A       href="#time">-t</A>       options.</TD></TR>  <TR vAlign=top>    <TD><A name=tradeoff></A><TT>-r, --tradeoff </TT></TD>    <TD><TT>$IPERF_TRADEOFF</TT></TD>    <TD>Run Iperf in tradeoff testing mode. This will cause the server to connect        back to the client on the port specified in the        <A href="#listenport">-L</A> option (or defaults        to the port the client connected to the server on). This is done following        the client connection termination, therefore running the tests        alternating. If you want an simultaneous test try        <A href="#dualtest">-d.</A></TD></TR>  <TR vAlign=top>    <TD><A name=time></A><TT>-t, --time <I>#</I></TT></TD>    <TD><TT>$IPERF_TIME</TT></TD>    <TD>The time in seconds to transmit for. Iperf normally works by       repeatedly sending an array of <I>len</I> bytes for <I>time</I> seconds.       Default is 10 seconds. See also the <A       href="#len">-l</A>       and <A       href="#num">-n</A>       options.</TD></TR>  <TR vAlign=top>    <TD><A name=listenport></A><TT>-L, --listenport <I>#</I></TT></TD>    <TD><TT>$IPERF_LISTENPORT</TT></TD>    <TD>This specifies the port that the server will connect back to the        client on. It defaults to the port used to connect to the server        from the client.</TD></TR>  <TR vAlign=top>    <TD><A name=parallel></A><TT>-P, --parallel <I>#</I></TT></TD>    <TD><TT>$IPERF_PARALLEL</TT></TD>    <TD>The number of simultaneous connections to make to the server. Default       is 1. Requires thread support on both the client and server.</TD></TR>  <TR vAlign=top>    <TD><A name=tos></A><TT>-S, --tos <I>#</I></TT></TD>    <TD><TT>$IPERF_TOS</TT></TD>    <TD>The type-of-service for outgoing packets. (Many routers ignore the TOS       field.) You may specify the value in hex with a '0x' prefix, in octal with       a '0' prefix, or in decimal. For example, '0x10' hex = '020' octal = '16'       decimal. The TOS numbers specified in RFC 1349 are:&nbsp; 	<PRE>&nbsp;&nbsp;&nbsp; IPTOS_LOWDELAY&nbsp;&nbsp;&nbsp;&nbsp; minimize delay&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x10&nbsp;&nbsp;&nbsp; IPTOS_THROUGHPUT&nbsp;&nbsp; maximize throughput&nbsp;&nbsp; 0x08&nbsp;&nbsp;&nbsp; IPTOS_RELIABILITY&nbsp; maximize reliability&nbsp; 0x04&nbsp;&nbsp;&nbsp; IPTOS_LOWCOST&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; minimize cost&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x02&nbsp;&nbsp;&nbsp;&nbsp;	</PRE>	</TD></TR>  <TR vAlign=top>    <TD><A name=ttl></A><TT>-T, --ttl <I>#</I></TT></TD>    <TD><TT>$IPERF_TTL</TT></TD>    <TD>The time-to-live for outgoing multicast packets. This is essentially       the number of router hops to go through, and is also used for scoping.       Default is 1, link-local.</TD></TR>  <TR>    <TD><TT>-F</TT> (from v1.2 or higher)</TD>    <TD>.</TD>    <TD>Use a representative stream to measure bandwidth, e.g. :-&nbsp; <BR>$       iperf -c &lt;server address&gt; -F &lt;file-name&gt;</TD></TR>  <TR>    <TD><TT>-I </TT>(from v1.2 or higher)</TD>    <TD>.</TD>    <TD>Same as -F, input from stdin.</TD></TR> <!-- <TR>    <TD><TT>-W </TT>(from v1.2 or higher)</TD>    <TD>.</TD>    <TD>Adaptive Window Sizes.	  <BR>Use Iperf to suggest the best Window size for a connection. Iperf will start from a default window size and try to perform a search for the optimal window size</TD></TR>-->  <TR>    <TH bgColor=#cccccc colSpan=3>Miscellaneous options</TH></TR>  <TR vAlign=top>    <TD><A name=help></A><TT>-h, --help</TT></TD>    <TD>&nbsp;</TD>    <TD>Print out a summary of commands and quit.</TD></TR>  <TR vAlign=top>    <TD><A name=version></A><TT>-v, --version</TT></TD>    <TD>&nbsp;</TD>    <TD>Print version information and quit. Prints 'pthreads' if compiled with       POSIX threads, 'win32 threads' if compiled with Microsoft Win32 threads,       or 'single threaded' if compiled without threads.</TD></TR></TBODY></TABLE><P><HR><!-- ----- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --><H2><A name=tuningtcp></A>Tuning a TCP connection</H2>The primary goal of Iperf is to help in tuning TCP connections over a particular path. The most fundamental tuning issue for TCP is the TCP window size, which controls how much data can be in the network at any one point. If it is too small, the sender will be idle at times and get poor performance. The theoretical value to use for the TCP window size is the <I>bandwidth delay product</I>, <BLOCKQUOTE>bottleneck bandwidth * round trip time</BLOCKQUOTE>In the below modi4/cyclops example, the bottleneck link is a 45 Mbit/sec DS3 link and the round trip time measured with ping is 42 ms. The bandwidth delay product is <BLOCKQUOTE>45 Mbit/sec * 42 ms <BR>= (45e6) * (42e-3) <BR>= 1890000 bits   <BR>= 230 KByte</BLOCKQUOTE>That is a starting point for figuring the best window size; setting it higher or lower may produce better results. In our example, buffer sizes over 130K did not improve the performance, despite the bandwidth delay product of 230K. <P>Note that many OSes and hosts have upper limits on the TCP window size. These may be as low as 64 KB, or as high as several MB. Iperf tries to detect when these occur and give a warning that the actual and requested window sizes are not equal (as below, though that is due to rounding in IRIX). PSC has a <A href="http://www.psc.edu/networking/perf_tune.html">list detailing</A> how to change the default and maximum window sizes for various OSes. For more information on TCP window sizes, see the <A href="http://dast.nlanr.net/Guides/GettingStarted/TCP_window_size.html">User's Guide to TCP Windows.</A> <P>Here is an example session, between node1 in Illinois and node2 in North Carolina. These are connected via the vBNS backbone and a 45 Mbit/sec DS3 link. Notice we improve bandwidth performance by a factor of 3 using proper TCP window sizes. Use the adaptive window sizes feature on platforms which allow setting window sizes in the granularity of bytes. <BLOCKQUOTE><PRE><B>node2&gt;</B> iperf -s------------------------------------------------------------Server listening on TCP port 5001TCP window size: 60.0 KByte (default)------------------------------------------------------------[&nbsp; 4] local &lt;IP Addr node2&gt; port 5001 connected with &lt;IP Addr node1&gt; port 2357[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 4]&nbsp; 0.0-10.1 sec&nbsp;&nbsp; 6.5 MBytes&nbsp;&nbsp; <B><FONT color=#ff0000>5.2 Mbits/sec</FONT>node1&gt;</B> iperf -c node2------------------------------------------------------------Client connecting to node1, TCP port 5001TCP window size: 59.9 KByte (default)------------------------------------------------------------[&nbsp; 3] local &lt;IP Addr node1&gt; port 2357 connected with &lt;IP Addr node2&gt; port 5001[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 3]&nbsp; 0.0-10.0 sec&nbsp;&nbsp; 6.5 MBytes&nbsp;&nbsp; 5.2 Mbits/sec</PRE>  <HR><PRE><B>node2&gt;</B> iperf -s -w 130k------------------------------------------------------------Server listening on TCP port 5001TCP window size:&nbsp; 130 KByte------------------------------------------------------------[&nbsp; 4] local &lt;IP Addr node 2&gt; port 5001 connected with &lt;IP Addr node 1&gt; port 2530[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 4]&nbsp; 0.0-10.1 sec&nbsp; 19.7 MBytes&nbsp; <B><FONT color=#ff0000>15.7 Mbits/sec</FONT>node1&gt;</B> iperf -c node2 -w 130k------------------------------------------------------------Client connecting to node2, TCP port 5001TCP window size:&nbsp; 129 KByte (WARNING: requested&nbsp; 130 KByte)------------------------------------------------------------[&nbsp; 3] local &lt;IP Addr node1&gt; port 2530 connected with &lt;IP Addr node2&gt; port 5001[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 3]&nbsp; 0.0-10.0 sec&nbsp; 19.7 MBytes&nbsp; 15.8 Mbits/sec</PRE></BLOCKQUOTE>Another test to do is run parallel TCP streams. If the total aggregate bandwidth is more than what an individual stream gets, something is wrong. Either the TCP window size is too small, or the OS's TCP implementation has bugs, or the network itself has deficiencies. See above for TCP window sizes; otherwise diagnosing which is somewhat difficult. If Iperf is compiled with pthreads, a single client and server can test this, otherwise setup multiple clients and servers on different ports. Here's an example where a single stream gets 16.5 Mbit/sec, but two parallel streams together get 16.7 + 9.4 = 26.1 Mbit/sec, even when using large TCP window sizes: <BLOCKQUOTE><PRE><B>node2&gt;</B> iperf -s -w 300k------------------------------------------------------------Server listening on TCP port 5001TCP window size:&nbsp; 300 KByte------------------------------------------------------------[&nbsp; 4] local &lt;IP Addr node2&gt; port 5001 connected with &lt;IP Addr node1&gt; port 6902[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 4]&nbsp; 0.0-10.2 sec&nbsp; 20.9 MBytes&nbsp; <B><FONT color=#ff0000>16.5 Mbits/sec</FONT></B>[&nbsp; 4] local &lt;IP Addr node2&gt; port 5001 connected with &lt;IP Addr node1&gt; port 6911[&nbsp; 5] local &lt;IP Addr node2&gt; port 5001 connected with &lt;IP Addr node2&gt; port 6912[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 5]&nbsp; 0.0-10.1 sec&nbsp; 21.0 MBytes&nbsp; <B><FONT color=#ff0000>16.7 Mbits/sec</FONT></B>[&nbsp; 4]&nbsp; 0.0-10.3 sec&nbsp; 12.0 MBytes&nbsp;&nbsp;<B><FONT color=#ff0000> 9.4 Mbits/sec</FONT>node1&gt;</B> ./iperf -c node2 -w 300k------------------------------------------------------------Client connecting to node2, TCP port 5001TCP window size:&nbsp; 299 KByte (WARNING: requested&nbsp; 300 KByte)------------------------------------------------------------[&nbsp; 3] local &lt;IP Addr node2&gt; port 6902 connected with &lt;IP Addr node1&gt; port 5001[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 3]&nbsp; 0.0-10.2 sec&nbsp; 20.9 MBytes&nbsp; 16.4 Mbits/sec<B>node1&gt;</B> iperf -c node2 -w 300k -P 2------------------------------------------------------------Client connecting to node2, TCP port 5001TCP window size:&nbsp; 299 KByte (WARNING: requested&nbsp; 300 KByte)------------------------------------------------------------[&nbsp; 4] local &lt;IP Addr node2&gt; port 6912 connected with &lt;IP Addr node1&gt; port 5001[&nbsp; 3] local &lt;IP Addr node2&gt; port 6911 connected with &lt;IP Addr node1&gt; port 5001[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 4]&nbsp; 0.0-10.1 sec&nbsp; 21.0 MBytes&nbsp; 16.6 Mbits/sec[&nbsp; 3]&nbsp; 0.0-10.2 sec&nbsp; 12.0 MBytes&nbsp;&nbsp; 9.4 Mbits/sec</PRE></BLOCKQUOTE>A secondary tuning issue for TCP is the maximum transmission unit (MTU). To be most effective, both hosts should support Path MTU Discovery. PSC has a <A href="http://www.psc.edu/networking/perf_tune.html">list detailing</A> what OSes support Path MTU Discovery. Hosts without Path MTU Discovery often use 536 as the MSS, which wastes bandwidth and processing time. Use the -m option to display what MSS is being used, and see if this matches what you expect. Often it is around 1460 bytes for ethernet. <BLOCKQUOTE><PRE><B>node3&gt;</B> iperf -s -m------------------------------------------------------------Server listening on TCP port 5001TCP window size: 60.0 KByte (default)------------------------------------------------------------[&nbsp; 4] local &lt;IP Addr node3&gt; port 5001 connected with &lt;IP Addr node4&gt; port 1096[ ID] Interval&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transfer&nbsp;&nbsp;&nbsp;&nbsp; Bandwidth[&nbsp; 4]&nbsp; 0.0- 2.0 sec&nbsp;&nbsp; 1.8 MBytes&nbsp;&nbsp; 6.9 Mbits/sec[&nbsp; 4] <B><FONT color=#ff0000>MSS size 1448 bytes (MTU 1500 bytes, ethernet)</FONT></B>[&nbsp; 4] Read lengths occurring in more than 5% of reads:[&nbsp; 4]&nbsp;&nbsp; 952 bytes read&nbsp;&nbsp; 219 times (16.2%)[&nbsp; 4]&nbsp; 1448 bytes read&nbsp; 1128 times (83.6%)</PRE></BLOCKQUOTE>Here is a host that doesn't support Path MTU Discovery. It will only send and receive small 576 byte packets. <BLOCKQUOTE><PRE><B>node4&gt;</B> iperf -s -m------------------------------------------------------------Server listening on TCP port 5001TCP window size: 32.0 KByte (default)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -