You may have heard of Netperf, which is a benchmark tool that is used to measure the performance of many different types of networking. But normally what we care are the throughput and latency. As the throughput may affected by different factors like the package size, you may have to run many tests by Netperf which is not that convenient.
Qperf is much handy for such tests. Qperf is part of official release along with RHEL-5 and above versions. A detailed manual page of qperf can be referred to die.net, and a brief introduction from its release note:
qperf measures bandwidth and latency between two nodes. It can work over TCP/IP as well as the RDMA transports. On one of the nodes, qperf is typically run with no arguments designating it the server node. One may then run qperf on a client node to obtain measurements such as bandwidth, latency and cpu utilization.
In its most basic form, qperf is run on one node in server mode by invoking it with no arguments. On the other node, it is run with two arguments: the name of the server node followed by the name of the test. A list of tests can be found in the section, TESTS. A variety of options may also be specified.
How to perform a netowrking performance test with qper?
qperf runs in C/S mode, the same as netperf. we just need to run “qperf” without argument to start the server side, and then we can run below command on client side to run benchmarks.
Example-1. Check TCP throughput and latency
$ qperf 192.168.2.64 tcp_bw tcp_lat conf tcp_bw: bw = 118 MB/sec tcp_lat: latency = 1.1 ms conf: loc_node = 63.sqa.cm4 loc_cpu = 16 Cores: Intel Xeon L5630 @ 2.13GHz loc_os = Linux 2.6.32-131.21.el6.x86_64 loc_qperf = 0.4.6 rem_node = 64.sqa.cm4 rem_cpu = 16 Cores: Intel Xeon L5630 @ 2.13GHz rem_os = Linux 2.6.32-131.21.el6.x86_64 rem_qperf = 0.4.6
Example-2: Track the status of network throughput and latency by different packets size
$ qperf -oo msg_size:1:64K:*2 192.168.2.64 tcp_bw tcp_lat tcp_bw: bw = 2.43 MB/sec tcp_bw: bw = 4.69 MB/sec tcp_bw: bw = 9.12 MB/sec tcp_bw: bw = 18.5 MB/sec tcp_bw: bw = 33.1 MB/sec tcp_bw: bw = 61.4 MB/sec tcp_bw: bw = 114 MB/sec tcp_bw: bw = 118 MB/sec tcp_bw: bw = 113 MB/sec ...(omited) tcp_lat: latency = 1.0 ms tcp_lat: latency = 1.1 ms tcp_lat: latency = 1.1 ms tcp_lat: latency = 1.4 ms tcp_lat: latency = 0.8 ms ...(omited) latency = 4.1 ms tcp_lat: latency = 9.6 ms tcp_lat: latency = 8.0 ms ...
From the above testing result, we can see that when package size exceeds 64 bytes, our network throughput reaches its peak value, and when package size exceeds 1KB, the network latency change a lot.