| Crates.io | rperf3-rs |
| lib.rs | rperf3-rs |
| version | 0.6.1 |
| created_at | 2025-12-03 06:04:06.673877+00 |
| updated_at | 2025-12-19 20:28:07.372497+00 |
| description | High-performance network throughput measurement tool, inspired by iperf3. |
| homepage | |
| repository | https://github.com/arunkumar-mourougappane/rperf3-rs |
| max_upload_size | |
| id | 1963426 |
| size | 486,269 |
A high-performance network throughput measurement tool written in Rust, inspired by iperf3. Provides accurate bandwidth testing for TCP and UDP protocols with memory safety, async I/O, and comprehensive metrics.
rperf3-rs is a modern network performance measurement tool that allows you to measure the maximum achievable bandwidth between two network endpoints. Whether you're diagnosing network performance issues, validating infrastructure upgrades, or benchmarking network equipment, rperf3-rs provides detailed, real-time statistics about your network's capabilities.
Built from the ground up in Rust, rperf3-rs leverages modern async I/O (via Tokio) to achieve high throughput while maintaining memory safety guarantees. Unlike traditional C-based tools, rperf3-rs eliminates entire classes of bugs (buffer overflows, use-after-free, data races) through Rust's compile-time checks.
Memory Safety: Rust's ownership system eliminates memory safety bugs at compile time, making rperf3-rs more reliable than C-based alternatives. No buffer overflows, no use-after-free, no data races.
High Performance: Built on Tokio's async runtime with optimized buffer management, rperf3-rs achieves 25-30 Gbps throughput on localhost tests, matching or exceeding traditional tools.
Developer-Friendly: Clean API design with builder patterns, comprehensive error handling, and extensive documentation make integration straightforward. Use it as a CLI tool or embed it as a library.
Modern Architecture: Async/await syntax, modular design, and thread-safe statistics collection provide a solid foundation for building network testing applications.
Full-Featured: Supports TCP and UDP testing, bidirectional tests, bandwidth limiting, packet loss and jitter measurement, real-time callbacks, and JSON output for automation.
From crates.io (when published):
cargo install rperf3-rs
From source:
git clone https://github.com/arunkumar-mourougappane/rperf3-rs.git
cd rperf3-rs
cargo build --release
Binary available at target/release/rperf3.
rperf3-rs delivers excellent performance across different network scenarios:
# Terminal 1 - Start server
./target/release/rperf3 server
# Terminal 2 - Run client test
./target/release/rperf3 client 127.0.0.1
# Basic TCP test (10 seconds)
rperf3 client 192.168.1.100
# 30-second test with custom interval
rperf3 client 192.168.1.100 -t 30 -i 2
# Reverse mode (server sends data)
rperf3 client 192.168.1.100 -R
# Reverse mode with bandwidth limiting
rperf3 client 192.168.1.100 -R -b 200M
# Parallel streams
rperf3 client 192.168.1.100 -P 4
# UDP test with 100 Mbps target
rperf3 client 192.168.1.100 -u -b 100M
# UDP reverse mode with bandwidth limit
rperf3 client 192.168.1.100 -u -R -b 50M
# UDP with custom buffer size
rperf3 client 192.168.1.100 -u -b 1G -l 8192
# Default server (port 5201)
rperf3 server
# Custom port
rperf3 server -p 8080
# Bind to specific address
rperf3 server -b 192.168.1.100
# JSON output with custom interval
rperf3 server -J -i 2
# UDP mode with interval reporting
rperf3 server -u -i 1
Add to your Cargo.toml:
[dependencies]
# From crates.io (when published)
rperf3 = "0.5"
# Or from git
# rperf3 = { git = "https://github.com/arunkumar-mourougappane/rperf3-rs" }
tokio = { version = "1", features = ["full"] }
use rperf3::{Client, Config, Protocol};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::client("192.168.1.100".to_string(), 5201)
.with_protocol(Protocol::Tcp)
.with_duration(Duration::from_secs(10));
let client = Client::new(config)?;
client.run().await?;
let measurements = client.get_measurements();
println!("Bandwidth: {:.2} Mbps",
measurements.total_bits_per_second() / 1_000_000.0);
Ok(())
}
use rperf3::{Client, Config, Protocol};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::client("192.168.1.100".to_string(), 5201)
.with_protocol(Protocol::Udp)
.with_bandwidth(100_000_000) // 100 Mbps
.with_duration(Duration::from_secs(10));
let client = Client::new(config)?;
client.run().await?;
let measurements = client.get_measurements();
println!("Bandwidth: {:.2} Mbps",
measurements.total_bits_per_second() / 1_000_000.0);
println!("Packets: {}, Loss: {} ({:.2}%), Jitter: {:.3} ms",
measurements.total_packets,
measurements.lost_packets,
(measurements.lost_packets as f64 / measurements.total_packets as f64) * 100.0,
measurements.jitter_ms);
Ok(())
}
use rperf3::{Client, Config, ProgressEvent};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::client("192.168.1.100".to_string(), 5201)
.with_duration(Duration::from_secs(10));
let client = Client::new(config)?
.with_callback(|event: ProgressEvent| {
match event {
ProgressEvent::TestStarted => {
println!("Test started");
}
ProgressEvent::IntervalUpdate { bits_per_second, .. } => {
println!("Current: {:.2} Mbps", bits_per_second / 1_000_000.0);
}
ProgressEvent::TestCompleted { bits_per_second, .. } => {
println!("Average: {:.2} Mbps", bits_per_second / 1_000_000.0);
}
ProgressEvent::Error(msg) => {
eprintln!("Error: {}", msg);
}
}
});
client.run().await?;
Ok(())
}
use rperf3::{Server, Config};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Server with JSON output and custom interval
let config = Config::server(5201)
.with_json(true)
.with_interval(Duration::from_secs(2));
let server = Server::new(config);
println!("Server listening on port 5201");
server.run().await?;
Ok(())
}
| Option | Short | Description | Default |
|---|---|---|---|
--port <PORT> |
-p |
Port to listen on | 5201 |
--bind <ADDRESS> |
-b |
Bind to specific address | 0.0.0.0 |
--udp |
-u |
UDP mode | TCP |
--json |
-J |
JSON output | false |
| Option | Short | Description | Default |
|---|---|---|---|
<SERVER> |
Server address (required) | - | |
--port <PORT> |
-p |
Server port | 5201 |
--udp |
-u |
UDP mode | TCP |
--time <SECONDS> |
-t |
Test duration | 10 |
--bandwidth <RATE> |
-b |
Target bandwidth (K/M/G suffix) | unlimited (TCP), 1M (UDP) |
--length <BYTES> |
-l |
Buffer/packet size | 131072 (TCP), 1460 (UDP) |
--parallel <NUM> |
-P |
Number of parallel streams | 1 |
--reverse |
-R |
Reverse mode (server sends) | false |
--json |
-J |
JSON output | false |
--interval <SECONDS> |
-i |
Report interval | 1 |
Use K/M/G suffixes for bandwidth values:
100K = 100,000 bits/second100M = 100,000,000 bits/second1G = 1,000,000,000 bits/secondTypical performance on modern hardware:
rperf3-rs includes several performance optimizations:
record_udp_packet() for high packet rates (issue #18)Built on Tokio's async runtime with optimized buffer management for maximum throughput.
Use --json flag for machine-readable output compatible with automation:
rperf3 client 192.168.1.100 -u -b 100M --json
Output includes:
┌─────────────────────────────────────┐
│ rperf3-rs Application │
├─────────────────────────────────────┤
│ CLI (main.rs) │ Library API │
├─────────────────────────────────────┤
│ Client Module │ Server Module │
│ - TCP/UDP Send │ - TCP/UDP Recv │
│ - Statistics │ - Statistics │
├─────────────────────────────────────┤
│ Buffer Pool │ Measurements │
│ - Reusable │ - Metrics │
│ - Thread-safe │ - Calculations │
├─────────────────────────────────────┤
│ Protocol │ UDP Packet │
│ - Messages │ - Sequence #s │
│ - Serialization│ - Timestamps │
├─────────────────────────────────────┤
│ Tokio Async Runtime │
└─────────────────────────────────────┘
buffer_pool: Thread-safe buffer pooling for efficient memory reuseclient: Client-side test execution with progress callbacksserver: Server-side test handling for concurrent clientsmeasurements: Thread-safe statistics collection and calculationsprotocol: Message serialization for client-server communicationudp_packet: UDP packet format with sequence numbers and timestampsconfig: Configuration builder with validationSee PERFORMANCE_IMPROVEMENTS.md for detailed performance roadmap.
| Feature | iperf3 | rperf3-rs |
|---|---|---|
| TCP Testing | ✅ | ✅ |
| UDP Testing | ✅ | ✅ |
| Bandwidth Limiting | ✅ | ✅ |
| Reverse Mode | ✅ | ✅ |
| JSON Output | ✅ | ✅ |
| Parallel Streams | ✅ | ✅ |
| UDP Loss/Jitter | ✅ | ✅ |
| Library API | Limited | Full |
| Language | C | Rust |
| Memory Safety | Manual | Guaranteed |
| Async I/O | No | Yes |
| Progress Callbacks | No | Yes |
Contributions welcome! Please ensure:
cargo fmt and cargo clippycargo test# Development workflow
git clone https://github.com/arunkumar-mourougappane/rperf3-rs.git
cd rperf3-rs
cargo build
cargo test
cargo clippy
cargo fmt
Licensed under either of:
at your option.
Inspired by iperf3 - the industry-standard network testing tool.
Author: Arunkumar Mourougappane
Repository: https://github.com/arunkumar-mourougappane/rperf3-rs