tcpbench — TCP/UDP
benchmarking and measurement tool
tcpbench is a small tool that performs
throughput benchmarking and concurrent sampling of kernel network
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
Once connected, the client will send TCP or UDP traffic as fast as
possible to the server. Both the client and server will periodically display
throughput statistics along with 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
The options are as follows:
tcpbench to use IPv4 addresses only.
tcpbench to use IPv6 addresses only.
- 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.
- Specifies the IP address of the interface which is used to send the
- 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
- List the name of kernel variables available for monitoring and exit.
- Use the given number of TCP connections (default: 1). UDP is
connectionless so this option isn't valid.
- Specify the port used for the test stream (default: 12345).
- In client mode the write buffer size is randomized up to the size
- Specify the statistics interval reporting rate in milliseconds (default:
- 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
tcpbench in server mode, where it will
listen on all interfaces for incoming connections. It defaults to using
-u is not specified.
- Change the IPv4 TOS or IPv6 TCLASS value. toskeyword
may be one of critical,
reliability, or one of the DiffServ Code Points:
ef, af11 ... af43,
cs0 ... cs7; or a number in either hex or
- Stop after secs seconds.
- 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
- 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.
- Set the routing table to be used.
- Display verbose output. If specified more than once, increase the detail
of information displayed.
tcpbench program first appeared in