1.\" $OpenBSD: tcpbench.1,v 1.20 2014/08/19 03:28:53 dlg 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: August 19 2014 $ 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 46uv 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 46uv 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 4 79Forces 80.Nm 81to use IPv4 addresses only. 82.It Fl 6 83Forces 84.Nm 85to use IPv6 addresses only. 86.It Fl B Ar buf 87Specify the size of the internal read/write buffer used by 88.Nm . 89The default is 262144 bytes for TCP client/server and UDP server. 90In UDP client mode this may be used to specify the packet size on the test 91stream. 92.It Fl b Ar addr 93Specifies the IP address of the interface which is used to send the packets. 94.It Fl k Ar kvars 95Specify one or more kernel variables to monitor; multiple variables must be 96separated with commas. 97This option is only valid in TCP mode. 98The default is not to monitor any variables. 99Using this option requires read access to 100.Pa /dev/kmem . 101.It Fl l 102List the name of kernel variables available for monitoring and exit. 103.It Fl n Ar connections 104Use the given number of TCP connections (default: 1). 105UDP is connectionless so this option isn't valid. 106.It Fl p Ar port 107Specify the port used for the test stream (default: 12345). 108.It Fl r Ar interval 109Specify the statistics interval reporting rate in milliseconds (default: 1000). 110.It Fl S Ar space 111Set the size of the socket buffer used for the test stream. 112On the client this option will resize the send buffer; 113on the server it will resize the receive buffer. 114.It Fl s 115Place 116.Nm 117in server mode, where it will listen on all interfaces for incoming 118connections. 119It defaults to using TCP if 120.Fl u 121is not specified. 122.It Fl T Ar toskeyword 123Change the IPv4 TOS or IPv6 TCLASS value. 124.Ar toskeyword 125may be one of 126.Ar critical , 127.Ar inetcontrol , 128.Ar lowdelay , 129.Ar netcontrol , 130.Ar throughput , 131.Ar reliability , 132or one of the DiffServ Code Points: 133.Ar ef , 134.Ar af11 ... af43 , 135.Ar cs0 ... cs7 ; 136or a number in either hex or decimal. 137.It Fl t Ar secs 138Stop after 139.Ar secs 140seconds. 141.It Fl u 142Use UDP instead of TCP; this must be specified on both the client 143and the server. 144Transmitted packets per second (TX PPS) will be accounted on the client 145side, while received packets per second (RX PPS) will be accounted on the 146server side. 147UDP has no Protocol Control Block (PCB) so the 148.Fl k 149flags don't apply. 150.It Fl V Ar rtable 151Set the routing table to be used. 152.It Fl v 153Display verbose output. 154If specified more than once, increase the detail of information displayed. 155.El 156.Sh SEE ALSO 157.Xr netstat 1 , 158.Xr pstat 8 159.Sh HISTORY 160The 161.Nm 162program first appeared in 163.Ox 4.4 . 164.Sh AUTHORS 165.An -nosplit 166The 167.Nm 168program was written by 169.An Damien Miller Aq Mt djm@openbsd.org . 170.Pp 171UDP mode and libevent port by 172.An Christiano F. Haesbaert Aq Mt haesbaert@haesbaert.org . 173