TCPBENCH(1)

NAME
tcpbench - TCP/UDP benchmarking and measurement tool

SYNOPSIS
tcpbench -l
tcpbench [-46DRUuv] [-B buf] [-b sourceaddr] [-k kvars] [-n connections] [-p port] [-r interval] [-S space] [-T toskeyword] [-t secs] [-V rtable] hostname
tcpbench -s [-46DUuv] [-B buf] [-k kvars] [-p port] [-r interval] [-S space] [-T toskeyword] [-V rtable] [hostname]

DESCRIPTION
tcpbench is a small tool that performs throughput benchmarking and concurrent sampling of kernel network variables.

tcpbench is run as a client/server pair. The server must be invoked with the -s flag, which will cause it to listen for incoming connections. The client must be invoked with the hostname of a listening server to connect to.

Once connected, the client will send TCP or UDP traffic as fast as possible to the server. Both the client and server will periodically compute and display throughput statistics. The server starts computing these for UDP on receipt of the first datagram, and stops for TCP when it has no connections. This display also includes any kernel variables the user has selected to sample (using the -k option, which is only available in TCP mode). A list of available kernel variables may be obtained using the -l option.

A summary over the periodic throughput statistics is displayed on exit. Its accuracy may be increased by decreasing the interval. The summary bytes and duration cover the interval from transfer start to process exit. The summary information can also be displayed while tcpbench is running by sending it a SIGINFO signal (see the status argument of stty(1) for more information).

The options are as follows:

-4  Force tcpbench to use IPv4 addresses only.

-6  Force tcpbench to use IPv6 addresses only.

-B buf
    Specify the size of the internal read/write buffer used by tcpbench. The default is 262144 bytes for TCP client/server and UDP server. In UDP client mode this may be used to specify the packet size on the test stream.

-b sourceaddr
    Specify the IP address to send the packets from, which is useful on machines with multiple interfaces.

-D  Enable debugging on the socket.

-k kvars
    Specify one or more kernel variables to monitor; multiple variables must be separated with commas. This option is only valid in TCP mode. The default is not to monitor any variables. Using this option requires read access to /dev/kmem, which may be restricted based upon the value of the kern.allowkmem sysctl(8).

-l  List the name of kernel variables available for monitoring and exit.

-n connections
    Use the given number of TCP connections (default: 1). UDP is connectionless so this option isn't valid.

-p port
    Specify the port used for the test stream (default: 12345).

-R  In client mode the write buffer size is randomized up to the size specified via -B.

-r interval
    Specify the statistics interval reporting rate in milliseconds (default: 1000). If set to 0, nothing is printed.

-S space
    Set the size of the socket buffer used for the test stream. On the client this option will resize the send buffer; on the server it will resize the receive buffer.

-s  Place tcpbench in server mode, where it will listen on all interfaces for incoming connections. It defaults to using TCP if -u is not specified.

-T toskeyword
    Change the IPv4 TOS or IPv6 TCLASS value. toskeyword may be one of critical, inetcontrol, lowdelay, netcontrol, throughput, reliability, or one of the DiffServ Code Points: ef, af11 ... af43, cs0 ... cs7; or a number in either hex or decimal.

-t secs
    Stop after secs seconds.

-U  Use AF_UNIX sockets instead of IPv4 or IPv6 sockets. In client and server mode hostname is used as the path to the AF_UNIX socket.

-u  Use UDP instead of TCP; this must be specified on both the client and the server. Transmitted packets per second (TX PPS) will be accounted on the client side, while received packets per second (RX PPS) will be accounted on the server side. UDP has no Protocol Control Block (PCB) so the -k flags don't apply.

-V rtable
    Set the routing table to be used.

-v  Display verbose output. If specified more than once, increase the detail of information displayed.

SEE ALSO
netstat(1), pstat(8)

HISTORY
The tcpbench program first appeared in OpenBSD 4.4.

AUTHORS
-nosplit The tcpbench program was written by Damien Miller <djm@openbsd.org>.

UDP mode and libevent port by Christiano F. Haesbaert <haesbaert@haesbaert.org>.