Expand description
A universal load testing library for Rust, with real-time tui support.
This crate provides a simple way to create load test tools in Rust. It is designed to be a universal load test framework, which means you can use rlt for various services, such as Http, gRPC, Thrift, Database, or other customized services.
§Features
- Flexible: Customize the work load with your own logic.
- Easy to use: Little boilerplate code, just focus on testing.
- Rich Statistics: Collect and display rich statistics.
- High performance: Optimized for performance and resource usage.
- Real-time TUI: Monitor testing progress with a powerful real-time TUI.
§Example
A simple example of a stateless bench suite:
use anyhow::Result;
use async_trait::async_trait;
use clap::Parser;
use rlt::{cli::BenchCli, IterInfo, IterReport, StatelessBenchSuite, Status};
use tokio::time::Instant;
#[derive(Clone)]
struct SimpleBench;
#[async_trait]
impl StatelessBenchSuite for SimpleBench {
async fn bench(&mut self, _: &IterInfo) -> Result<IterReport> {
let t = Instant::now();
// do the work here
let duration = t.elapsed();
let report = IterReport {
duration,
status: Status::success(0),
bytes: 42, // bytes processed in current iteration
items: 5, // items processed in current iteration
};
Ok(report)
}
}
#[tokio::main]
async fn main() -> Result<()> {
rlt::cli::run(BenchCli::parse(), SimpleBench).await
}
Stateful bench is also supported, see the examples/http_reqwest.
Modules§
- This module provides a CLI interface for the benchmark tool.
- This module defines a trait for collecting iteration results.
- This module defines a trait for printing benchmark reports.
Structs§
- The final benchmark report.
- Information about the current iteration.
- The iteration report.
- The iteration status.
Enums§
- Represents the kind of status.
Traits§
- A trait for benchmark suites.
- A trait for stateless benchmark suites.