xref: /openbsd-src/usr.bin/tcpbench/tcpbench.1 (revision e24b4d49c58de8662d35ee80b5f8d37c5c8b3328)
1*e24b4d49Sjmc.\" $OpenBSD: tcpbench.1,v 1.32 2024/11/06 06:40:16 jmc Exp $
2438193baSdjm.\"
3438193baSdjm.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org>
4438193baSdjm.\"
5438193baSdjm.\" Permission to use, copy, modify, and distribute this software for any
6438193baSdjm.\" purpose with or without fee is hereby granted, provided that the above
7438193baSdjm.\" copyright notice and this permission notice appear in all copies.
8438193baSdjm.\"
9438193baSdjm.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10438193baSdjm.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11438193baSdjm.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12438193baSdjm.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13438193baSdjm.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14438193baSdjm.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15438193baSdjm.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16438193baSdjm.\"
17*e24b4d49Sjmc.Dd $Mdocdate: November 6 2024 $
18438193baSdjm.Dt TCPBENCH 1
19beb47433Sjmc.Os
20438193baSdjm.Sh NAME
21438193baSdjm.Nm tcpbench
22fb3b63e9Sjmc.Nd TCP/UDP benchmarking and measurement tool
23438193baSdjm.Sh SYNOPSIS
24438193baSdjm.Nm
25438193baSdjm.Fl l
26438193baSdjm.Nm
2767fb5732Sjan.Op Fl 46cDRUuv
28d7522fb0Sjmc.Op Fl B Ar buf
2965e34726Sschwarze.Op Fl b Ar sourceaddr
30438193baSdjm.Op Fl k Ar kvars
3198487596Shenning.Op Fl n Ar connections
32438193baSdjm.Op Fl p Ar port
33654afd03Sclaudio.Op Fl r Ar interval
34438193baSdjm.Op Fl S Ar space
3567fb5732Sjan.Op Fl T Ar keyword
36eaf1d82aShenning.Op Fl t Ar secs
378bb39f08Sguenther.Op Fl V Ar rtable
38438193baSdjm.Ar hostname
39438193baSdjm.Nm
409ae9de48Sjmc.Bk -words
41438193baSdjm.Fl s
4267fb5732Sjan.Op Fl 46cDUuv
43d7522fb0Sjmc.Op Fl B Ar buf
4467fb5732Sjan.Op Fl C Ar certfile Fl K Ar keyfile
45438193baSdjm.Op Fl k Ar kvars
46438193baSdjm.Op Fl p Ar port
47654afd03Sclaudio.Op Fl r Ar interval
48438193baSdjm.Op Fl S Ar space
4967fb5732Sjan.Op Fl T Ar keyword
508bb39f08Sguenther.Op Fl V Ar rtable
5133ed67eeSclaudio.Op Ar hostname
529ae9de48Sjmc.Ek
53438193baSdjm.Sh DESCRIPTION
54438193baSdjm.Nm
55438193baSdjmis a small tool that performs throughput benchmarking and concurrent
56438193baSdjmsampling of kernel network variables.
57438193baSdjm.Pp
58438193baSdjm.Nm
59438193baSdjmis run as a client/server pair.
60438193baSdjmThe server must be invoked with the
61438193baSdjm.Fl s
62438193baSdjmflag, which will cause it to listen for incoming connections.
63438193baSdjmThe client must be invoked with the
64438193baSdjm.Ar hostname
65438193baSdjmof a listening server to connect to.
66438193baSdjm.Pp
67654afd03SclaudioOnce connected, the client will send TCP or UDP traffic as fast as possible to
68438193baSdjmthe server.
696fb15185SprocterBoth the client and server will periodically compute and display throughput
706fb15185Sprocterstatistics.
716fb15185SprocterThe server starts computing these for UDP on receipt of the first datagram,
726fb15185Sprocterand stops for TCP when it has no connections.
736fb15185SprocterThis display also includes any kernel variables the user has selected to
74438193baSdjmsample (using the
75438193baSdjm.Fl k
76654afd03Sclaudiooption, which is only available in TCP mode).
77438193baSdjmA list of available kernel variables may be obtained using the
78438193baSdjm.Fl l
79438193baSdjmoption.
80438193baSdjm.Pp
816fb15185SprocterA summary over the periodic throughput statistics is displayed on exit.
826fb15185SprocterIts accuracy may be increased by decreasing the
836fb15185Sprocter.Ar interval .
846fb15185SprocterThe summary bytes and duration cover the interval from transfer start
856fb15185Sprocterto process exit.
865ca842b4SsthenThe summary information can also be displayed while
875ca842b4Ssthen.Nm
885ca842b4Ssthenis running by sending it a
895ca842b4Ssthen.Dv SIGINFO
905ca842b4Ssthensignal (see the
915ca842b4Ssthen.Cm status
925ca842b4Ssthenargument of
935ca842b4Ssthen.Xr stty 1
945ca842b4Ssthenfor more information).
956fb15185Sprocter.Pp
96438193baSdjmThe options are as follows:
97438193baSdjm.Bl -tag -width Ds
989f39e938Sdlg.It Fl 4
99b868dff9SjmcForce
1009f39e938Sdlg.Nm
1019f39e938Sdlgto use IPv4 addresses only.
1029f39e938Sdlg.It Fl 6
103b868dff9SjmcForce
1049f39e938Sdlg.Nm
1059f39e938Sdlgto use IPv6 addresses only.
106d7522fb0Sjmc.It Fl B Ar buf
1075a6aa24dSjmcSpecify the size of the internal read/write buffer used by
108438193baSdjm.Nm .
109654afd03SclaudioThe default is 262144 bytes for TCP client/server and UDP server.
110fb3b63e9SjmcIn UDP client mode this may be used to specify the packet size on the test
111654afd03Sclaudiostream.
11265e34726Sschwarze.It Fl b Ar sourceaddr
11365e34726SschwarzeSpecify the IP address to send the packets from,
11465e34726Sschwarzewhich is useful on machines with multiple interfaces.
11567fb5732Sjan.It Fl C Ar certfile
11667fb5732SjanLoad the public key part of the TLS peer certificate from
11767fb5732Sjan.Ar certfile ,
11867fb5732Sjanin PEM format.
11967fb5732SjanRequires
12067fb5732Sjan.Fl s
12167fb5732Sjanand
12267fb5732Sjan.Fl c .
123*e24b4d49Sjmc.It Fl c
124*e24b4d49SjmcUse TLS to connect or listen.
1256b0ee4efSbluhm.It Fl D
1266b0ee4efSbluhmEnable debugging on the socket.
12767fb5732Sjan.It Fl K Ar keyfile
12867fb5732SjanLoad the TLS private key from
12967fb5732Sjan.Ar keyfile ,
13067fb5732Sjanin PEM format.
13167fb5732SjanRequires
13267fb5732Sjan.Fl s
13367fb5732Sjanand
13467fb5732Sjan.Fl c .
135*e24b4d49Sjmc.It Fl k Ar kvars
136*e24b4d49SjmcSpecify one or more kernel variables to monitor; multiple variables must be
137*e24b4d49Sjmcseparated with commas.
138*e24b4d49SjmcThis option is only valid in TCP mode.
139*e24b4d49SjmcThe default is not to monitor any variables.
140d7522fb0Sjmc.It Fl l
141d7522fb0SjmcList the name of kernel variables available for monitoring and exit.
14298487596Shenning.It Fl n Ar connections
143fb3b63e9SjmcUse the given number of TCP connections (default: 1).
144fb3b63e9SjmcUDP is connectionless so this option isn't valid.
145438193baSdjm.It Fl p Ar port
146fb3b63e9SjmcSpecify the port used for the test stream (default: 12345).
14733ed67eeSclaudio.It Fl R
14833ed67eeSclaudioIn client mode the write buffer size is randomized up to the size specified via
14933ed67eeSclaudio.Fl B .
150654afd03Sclaudio.It Fl r Ar interval
151654afd03SclaudioSpecify the statistics interval reporting rate in milliseconds (default: 1000).
15271134256SbluhmIf set to 0, nothing is printed.
153d7522fb0Sjmc.It Fl S Ar space
154fb3b63e9SjmcSet the size of the socket buffer used for the test stream.
155d7522fb0SjmcOn the client this option will resize the send buffer;
156d7522fb0Sjmcon the server it will resize the receive buffer.
157438193baSdjm.It Fl s
158438193baSdjmPlace
159438193baSdjm.Nm
160438193baSdjmin server mode, where it will listen on all interfaces for incoming
161fb3b63e9Sjmcconnections.
162fb3b63e9SjmcIt defaults to using TCP if
163654afd03Sclaudio.Fl u
164fb3b63e9Sjmcis not specified.
16567fb5732Sjan.It Fl T Ar keyword
16620e2e75bShaesbaertChange the IPv4 TOS or IPv6 TCLASS value.
16767fb5732Sjan.Ar keyword
16820e2e75bShaesbaertmay be one of
16920e2e75bShaesbaert.Ar critical ,
17020e2e75bShaesbaert.Ar inetcontrol ,
17120e2e75bShaesbaert.Ar lowdelay ,
17220e2e75bShaesbaert.Ar netcontrol ,
17320e2e75bShaesbaert.Ar throughput ,
17420e2e75bShaesbaert.Ar reliability ,
17520e2e75bShaesbaertor one of the DiffServ Code Points:
17620e2e75bShaesbaert.Ar ef ,
17720e2e75bShaesbaert.Ar af11 ... af43 ,
17820e2e75bShaesbaert.Ar cs0 ... cs7 ;
17920e2e75bShaesbaertor a number in either hex or decimal.
18067fb5732Sjan.Pp
18167fb5732SjanFor TLS options,
18267fb5732Sjan.Ar keyword
18367fb5732Sjanspecifies a value in the form of a
18467fb5732Sjan.Ar key Ns = Ns Ar value
18567fb5732Sjanpair:
18667fb5732Sjan.Cm ciphers ,
18767fb5732Sjanwhich allows the supported TLS ciphers to be specified (see
18867fb5732Sjan.Xr tls_config_set_ciphers 3
18967fb5732Sjanfor further details) or
19067fb5732Sjan.Cm protocols ,
19167fb5732Sjanwhich allows the supported TLS protocols to be specified (see
19267fb5732Sjan.Xr tls_config_parse_protocols 3
19367fb5732Sjanfor further details).
19467fb5732SjanSpecifying TLS options requires
19567fb5732Sjan.Fl c .
196eaf1d82aShenning.It Fl t Ar secs
197eaf1d82aShenningStop after
198eaf1d82aShenning.Ar secs
199eaf1d82aShenningseconds.
20033ed67eeSclaudio.It Fl U
20133ed67eeSclaudioUse AF_UNIX sockets instead of IPv4 or IPv6 sockets.
20233ed67eeSclaudioIn client and server mode
20333ed67eeSclaudio.Ar hostname
20433ed67eeSclaudiois used as the path to the AF_UNIX socket.
205654afd03Sclaudio.It Fl u
206fb3b63e9SjmcUse UDP instead of TCP; this must be specified on both the client
207fb3b63e9Sjmcand the server.
208fb3b63e9SjmcTransmitted packets per second (TX PPS) will be accounted on the client
209938b67baShaesbaertside, while received packets per second (RX PPS) will be accounted on the
210fb3b63e9Sjmcserver side.
211fb3b63e9SjmcUDP has no Protocol Control Block (PCB) so the
212654afd03Sclaudio.Fl k
213654afd03Sclaudioflags don't apply.
2148bb39f08Sguenther.It Fl V Ar rtable
2158bb39f08SguentherSet the routing table to be used.
216438193baSdjm.It Fl v
217438193baSdjmDisplay verbose output.
218438193baSdjmIf specified more than once, increase the detail of information displayed.
219438193baSdjm.El
220438193baSdjm.Sh SEE ALSO
221d7522fb0Sjmc.Xr netstat 1 ,
222438193baSdjm.Xr pstat 8
22376d2944dSfkr.Sh HISTORY
22476d2944dSfkrThe
22576d2944dSfkr.Nm
22676d2944dSfkrprogram first appeared in
22776d2944dSfkr.Ox 4.4 .
22876d2944dSfkr.Sh AUTHORS
229fb3b63e9Sjmc.An -nosplit
23076d2944dSfkrThe
23176d2944dSfkr.Nm
23276d2944dSfkrprogram was written by
23376c04420Sschwarze.An Damien Miller Aq Mt djm@openbsd.org .
234fb3b63e9Sjmc.Pp
235654afd03SclaudioUDP mode and libevent port by
23676c04420Sschwarze.An Christiano F. Haesbaert Aq Mt haesbaert@haesbaert.org .
237