“qperf“, is one of the many tools used to measure bandwidth and latency between two nodes. qperf works over many transports including TCP/IP, RDMA, UDP, and SCTP. qperf measures throughput on different sockets in the IP stack.
Installation:
To install qperf on a RedHat Based systems, use the below command.
# yum install qperf
To lists available tests, use the below command:
# qperf --help tests# qperf --help tests
Miscellaneous
conf Show configuration
quit Cause the server to quit
Socket Based
rds_bw RDS streaming one way bandwidth
rds_lat RDS one way latency
sctp_bw SCTP streaming one way bandwidth
sctp_lat SCTP one way latency
tcp_bw TCP streaming one way bandwidth
tcp_lat TCP one way latency
udp_bw UDP streaming one way bandwidth
udp_lat UDP one way latency
RDMA Send/Receive
rc_bi_bw RC streaming two way bandwidth
rc_bw RC streaming one way bandwidth
rc_lat RC one way latency
uc_bi_bw UC streaming two way bandwidth
uc_bw UC streaming one way bandwidth
uc_lat UC one way latency
...
Basic Syntax
qperf has the notion of a “client” and “server” for testing network throughput between two systems. To use qperf, configure 2 machines:
- On the listener, run qperf without options.
- On the other machine, run “qperf [hostname] [options to test]“.
Few of the most commonly used qperf options are :
- tcp_bw
- tcp_lat
- udp_bw
See the man page of qperf for more options.
Open firewall ports for qperf
The qperf server listens on TCP Port 19765 by default. This can be changed with the –listen_port option. This port will need to be allowed in any firewall present.
On iptables:
# iptables -I INPUT -m tcp --dport 19765 -j ACCEPT
On firewalld:
firewall-cmd --add-port=19765/tcp
If you are not on production systems or do not need iptables or firewald to be enabled, you can go ahead and simply disable them.
Measuring Bandwidth with qperf
Server
To measure the network bandwidth between 2 servers, we have to configure one of them to server as the listener as shown below.
# qperf
Client
Now we can have the other system connect to the listener as a client machine. Use the command below to do so.
# qperf 192.168.104.112 tcp_bw tcp_bw: bw = 314 MB/sec
Here,
192.168.104.112 – is the lister machine (Server) IP address.
As with any performance test, you should not rely on 1 iteration of the test. Try the above command 3 or more times to find an average value.
Measuring Latency with qperf
Server
As with the above example, we need to start the listener on one of the machines.
# qperf
Client
Use the below command on the client-server in order to measure the latency between 2 servers.
# qperf -vvs 192.168.104.112 tcp_lat
tcp_lat:
latency = 311 us
msg_rate = 3.22 K/sec
loc_send_bytes = 3.22 KB
loc_recv_bytes = 3.22 KB
loc_send_msgs = 3,218
loc_recv_msgs = 3,217
rem_send_bytes = 3.22 KB
rem_recv_bytes = 3.22 KB
rem_send_msgs = 3,217
rem_recv_msgs = 3,217
As shown in the output above, latency value is 311 Microseconds and then there are few other details as well. loc_xx shows details from the local system perspective and rem_xx shows the same from the remote system perspective. Refer man page of qperf for more options/verbosity.
Other Tests
There are Other tests available with qperf, including UDP bandwidth and latency, SCTP bandwidth and latency, and other protocols which run on RDMA. See the TESTS section of man qperf for more details.
