netperf
Benchmark network performance
TLDR
Connect to server on a specific IP address via default port (12865)
Specify [p]ort
Specify the sampling [l]ength in seconds (default is 10)
Force IPv[4] or IPv[6]
SYNOPSIS
netperf options -H hostname_or_IP
netserver options (run on target host)
PARAMETERS
-H host
Specify the target hostname or IP address where the netserver daemon is running.
-l duration
Set the duration of the test in seconds. A value of 0 (default) runs indefinitely until interrupted.
-t testname
Select the type of test to perform. Common types include TCP_STREAM (bulk TCP transfer), UDP_STREAM (bulk UDP transfer), TCP_RR (TCP request/response), and UDP_RR (UDP request/response).
-p port
Specify the port number on which netserver is listening. Default is 12865.
-L local_host
Specify the local IP address to bind to for the test, useful on multi-homed systems.
-s size
Set the size of the socket send buffer for the netperf side (client).
-S size
Set the size of the socket receive buffer for the netperf side (client).
-f units
Specify the output units for throughput. E.g., 'm' for MBits/sec, 'M' for MBytes/sec, 'g' for GBits/sec, 'G' for GBytes/sec.
-P level
Control the display of test progress and results. Higher levels (e.g., 1 or 2) provide more detail during the test or at conclusion.
-c, -C
Enable CPU utilization measurements on the client (-c) and server (-C) respectively. This helps identify CPU bottlenecks.
-m size
Set the size of the data messages (request/response buffer size) used during the test, especially relevant for RR tests.
DESCRIPTION
netperf is a powerful command-line utility for measuring various aspects of network performance, including throughput (bandwidth) and transaction latency. It operates in a client-server model, requiring a netserver daemon to be running on the target machine. netperf supports a wide range of test types for TCP and UDP, including stream (bulk data transfer) and request/response (transactional) tests. It provides detailed statistics on data transfer rates, CPU utilization, and latency, making it valuable for network diagnostics, capacity planning, and benchmarking.
CAVEATS
netperf requires the netserver daemon to be running on the target remote host. Firewalls must be configured to allow traffic on the specified port (default 12865). Test results can be significantly influenced by operating system TCP/IP stack tuning (e.g., buffer sizes, congestion control algorithms). For accurate results, ensure minimal other network or CPU load on both client and server machines during testing.
CLIENT-SERVER ARCHITECTURE
netperf operates as a client program that initiates a connection to a netserver daemon running on the remote target machine. This client-server model allows for comprehensive performance measurement between any two points on a network, regardless of their physical location.
KEY TEST TYPES
netperf supports various test types to address different network performance metrics:
Stream Tests (TCP_STREAM, UDP_STREAM): Designed to measure maximum bulk data transfer throughput, indicating raw bandwidth.
Request/Response Tests (TCP_RR, UDP_RR): Focus on measuring transaction rate and latency by sending small requests and awaiting responses, ideal for assessing application-level responsiveness.
INTERPRETING RESULTS
The output of netperf typically includes key metrics such as transfer rates (in Mb/s, MB/s, Gb/s, or GB/s), transaction rates (transactions per second), and latency (in microseconds). Additionally, CPU utilization metrics for both the local client and remote server can be reported, which are crucial for identifying if network performance is being limited by CPU bottlenecks.
HISTORY
netperf was originally developed by Rick Jones at Hewlett-Packard, establishing itself as a foundational tool for network performance measurement in Unix and Linux environments. Its design predates many modern network benchmarking tools and has been widely used for benchmarking network interfaces, protocol stacks, and overall system network capabilities for decades.
SEE ALSO
iperf(1), ping(8), traceroute(8), ss(8), netstat(8)