1.\" $OpenBSD: tcpbench.1,v 1.18 2013/07/16 00:07:52 schwarze Exp $ 2.\" 3.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: July 16 2013 $ 18.Dt TCPBENCH 1 19.Os 20.Sh NAME 21.Nm tcpbench 22.Nd TCP/UDP benchmarking and measurement tool 23.Sh SYNOPSIS 24.Nm 25.Fl l 26.Nm 27.Op Fl uv 28.Op Fl B Ar buf 29.Op Fl b Ar addr 30.Op Fl k Ar kvars 31.Op Fl n Ar connections 32.Op Fl p Ar port 33.Op Fl r Ar interval 34.Op Fl S Ar space 35.Op Fl T Ar toskeyword 36.Op Fl t Ar secs 37.Op Fl V Ar rtable 38.Ar hostname 39.Nm 40.Bk -words 41.Fl s 42.Op Fl uv 43.Op Fl B Ar buf 44.Op Fl k Ar kvars 45.Op Fl p Ar port 46.Op Fl r Ar interval 47.Op Fl S Ar space 48.Op Fl T Ar toskeyword 49.Op Fl V Ar rtable 50.Ek 51.Sh DESCRIPTION 52.Nm 53is a small tool that performs throughput benchmarking and concurrent 54sampling of kernel network variables. 55.Pp 56.Nm 57is run as a client/server pair. 58The server must be invoked with the 59.Fl s 60flag, which will cause it to listen for incoming connections. 61The client must be invoked with the 62.Ar hostname 63of a listening server to connect to. 64.Pp 65Once connected, the client will send TCP or UDP traffic as fast as possible to 66the server. 67Both the client and server will periodically display throughput 68statistics along with any kernel variables the user has selected to 69sample (using the 70.Fl k 71option, which is only available in TCP mode). 72A list of available kernel variables may be obtained using the 73.Fl l 74option. 75.Pp 76The options are as follows: 77.Bl -tag -width Ds 78.It Fl B Ar buf 79Specify the size of the internal read/write buffer used by 80.Nm . 81The default is 262144 bytes for TCP client/server and UDP server. 82In UDP client mode this may be used to specify the packet size on the test 83stream. 84.It Fl b Ar addr 85Specifies the IP address of the interface which is used to send the packets. 86.It Fl k Ar kvars 87Specify one or more kernel variables to monitor; multiple variables must be 88separated with commas. 89This option is only valid in TCP mode. 90The default is not to monitor any variables. 91Using this option requires read access to 92.Pa /dev/kmem . 93.It Fl l 94List the name of kernel variables available for monitoring and exit. 95.It Fl n Ar connections 96Use the given number of TCP connections (default: 1). 97UDP is connectionless so this option isn't valid. 98.It Fl p Ar port 99Specify the port used for the test stream (default: 12345). 100.It Fl r Ar interval 101Specify the statistics interval reporting rate in milliseconds (default: 1000). 102.It Fl S Ar space 103Set the size of the socket buffer used for the test stream. 104On the client this option will resize the send buffer; 105on the server it will resize the receive buffer. 106.It Fl s 107Place 108.Nm 109in server mode, where it will listen on all interfaces for incoming 110connections. 111It defaults to using TCP if 112.Fl u 113is not specified. 114.It Fl T Ar toskeyword 115Change the IPv4 TOS or IPv6 TCLASS value. 116.Ar toskeyword 117may be one of 118.Ar critical , 119.Ar inetcontrol , 120.Ar lowdelay , 121.Ar netcontrol , 122.Ar throughput , 123.Ar reliability , 124or one of the DiffServ Code Points: 125.Ar ef , 126.Ar af11 ... af43 , 127.Ar cs0 ... cs7 ; 128or a number in either hex or decimal. 129.It Fl t Ar secs 130Stop after 131.Ar secs 132seconds. 133.It Fl u 134Use UDP instead of TCP; this must be specified on both the client 135and the server. 136Transmitted packets per second (TX PPS) will be accounted on the client 137side, while received packets per second (RX PPS) will be accounted on the 138server side. 139UDP has no Protocol Control Block (PCB) so the 140.Fl k 141flags don't apply. 142.It Fl V Ar rtable 143Set the routing table to be used. 144The default is 0. 145.It Fl v 146Display verbose output. 147If specified more than once, increase the detail of information displayed. 148.El 149.Sh SEE ALSO 150.Xr netstat 1 , 151.Xr pstat 8 152.Sh HISTORY 153The 154.Nm 155program first appeared in 156.Ox 4.4 . 157.Sh AUTHORS 158.An -nosplit 159The 160.Nm 161program was written by 162.An Damien Miller Aq Mt djm@openbsd.org . 163.Pp 164UDP mode and libevent port by 165.An Christiano F. Haesbaert Aq Mt haesbaert@haesbaert.org . 166