A universal load testing framework for Rust, with real-time tui support.

Overview

rlt

A Rust Load Testing framework with real-time tui support.

Crates.io Documentation Dependency status License

Screenshot

rlt 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.

Quick Start

Run cargo add rlt to add rlt as a dependency to your Cargo.toml:

[dependencies]
rlt = "0.1.1"

Then create your bench suite by implementing the BenchSuite trait. flatten attribute can be used to embed the predefined BenchCli into your own.

#[derive(Parser, Clone)]
pub struct HttpBench {
    /// Target URL.
    pub url: Url,

    /// Embed BenchCli into this Opts.
    #[command(flatten)]
    pub bench_opts: BenchCli,
}

#[async_trait]
impl BenchSuite for HttpBench {
    type WorkerState = Client;

    async fn state(&self, _: u32) -> Result<Self::WorkerState> {
        Ok(Client::new())
    }

    async fn bench(&mut self, client: &mut Self::WorkerState, _: &IterInfo) -> Result<IterReport> {
        let t = Instant::now();
        let resp = client.get(self.url.clone()).send().await?;
        let status = resp.status().into();
        let bytes = resp.bytes().await?.len() as u64;
        let duration = t.elapsed();
        Ok(IterReport { duration, status, bytes, items: 1 })
    }
}

You can also create a separate struct to hold the cli options for more flexibility. There is an example in examples/http_hyper.rs.

Finally, create the main function to run the load test:

#[tokio::main]
async fn main() -> Result<()> {
    let bs = HttpBench::parse();
    rlt::cli::run(bs.bench_opts, bs).await
}

More examples can be found in the examples directory.

Credits

The TUI layout in rlt is inspired by oha.

License

rlt is distributed under the terms of both the MIT License and the Apache License 2.0.

See the LICENSE-APACHE and LICENSE-MIT files for license details.

You might also like...
Another TUI based system monitor, this time in Rust!
Another TUI based system monitor, this time in Rust!

Another TUI based system monitor, this time in Rust!

Display ZFS datasets' I/O in real time
Display ZFS datasets' I/O in real time

ztop Display ZFS datasets' I/O in real time Overview ztop is like top, but for ZFS datasets. It displays the real-time activity for datasets. The buil

Minimal and blazing-fast file server. For real, this time.

Zy Minimal and blazing-fast file server. For real, this time. Features Single Page Application support Partial responses (Range support) Cross-Origin

🛡️ Terminal-based, real-time traffic monitoring and statistics for your AdGuard Home instance
🛡️ Terminal-based, real-time traffic monitoring and statistics for your AdGuard Home instance

AdGuardian-Term Terminal-based, real-time traffic monitoring and statistics for your AdGuard Home instance About AdGuardian Terminal Eddition - Keep a

Revolutionize handheld gaming with adaptive game settings. Optimize graphics and gameplay experience based on real-time system metrics. Open-source project empowering developers to enhance games on portable devices
Revolutionize handheld gaming with adaptive game settings. Optimize graphics and gameplay experience based on real-time system metrics. Open-source project empowering developers to enhance games on portable devices

Welcome to the server-side application for the HarmonyLink project. This innovative software is developed with the Rust programming language and is ai

Display near-real-time satellite imagery on your desktop.
Display near-real-time satellite imagery on your desktop.

Satpaper Display near-real-time satellite imagery on your desktop. (Click to see full-size version) Satpaper generates live wallpapers for your deskto

Kiomet.com real-time strategy game
Kiomet.com real-time strategy game

Kiomet.com Kiomet.com is an online multiplayer real-time strategy game. Command your forces wisely and prepare for intense battles! Build Instructions

Wikit - A universal dictionary

Wikit - A universal dictionary What is it? To be short, Wikit is a tool which can (fully, may be in future) render and create dictionary file in MDX/M

Universal Windows library for discovering common render engines functions. Supports DirectX9 (D3D9), DirectX10 (D3D10), DirectX11 (D3D11), DirectX12 (D3D12).
Universal Windows library for discovering common render engines functions. Supports DirectX9 (D3D9), DirectX10 (D3D10), DirectX11 (D3D11), DirectX12 (D3D12).

Shroud Universal library for discovering common render engines functions. Supports DirectX9 (D3D9), DirectX10 (D3D10), DirectX11 (D3D11), DirectX12 (D

Comments
  • Add debug derive to BenchCli

    Add debug derive to BenchCli

    Resolves #3

    Motivation

    I want to be able to debug print BenchCLI values.

    Modifications

    • Add Debug derive to BenchCli
    • Add Debug derive to Collector
    • Add Debug derive to ReportFormat
    opened by mattremmel 1
  • feat: implement logical clock

    feat: implement logical clock

    Previously, the benchmark runner uses physical time to track the benchmark progress. This is not ideal because the physical time keeps moving forward even when the benchmark is paused. Also the throughput calculation is not accurate when there are pauses. This commit introduces a logical clock that can be paused and resumed to improve the pause functionality.

    enhancement 
    opened by wfxr 0
Releases(v0.1.1)
  • v0.1.1(Apr 14, 2024)

    🚀 Features

    🐛 Bug Fixes

    • Fix panic when the receiver is dropped(#2) - (08f0bcd)

    ⚙️ Miscellaneous Tasks

    • Fix changelog workflow - (d53bc17)
    • Release rlt version 0.1.1 - (75cfb89)
    • Fix release branch - (be59e79)
    • Improve release process (#10) - (967f711)
    • Polish changelog (#9) - (5c3b1a1)
    • Release rlt version 0.1.1-rc.1 - (d67a49c)
    • Use git-cliff to generate changlog (#8) - (13d806c)
    • Remove spaces in tui title - (722842e)
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1-rc.1(Apr 14, 2024)

    What's Changed

    • feat: add log framework by @wfxr in https://github.com/wfxr/rlt/pull/4
    • fix: fix panic when the receiver is dropped #2 by @wfxr in https://github.com/wfxr/rlt/pull/5
    • Add debug derive to BenchCli by @mattremmel in https://github.com/wfxr/rlt/pull/7
    • feat: implement logical clock by @wfxr in https://github.com/wfxr/rlt/pull/6
    • ci: use git-cliff to generate changlog by @wfxr in https://github.com/wfxr/rlt/pull/8

    New Contributors

    • @mattremmel made their first contribution in https://github.com/wfxr/rlt/pull/7

    Full Changelog: https://github.com/wfxr/rlt/commits/v0.1.1-rc.1

    Source code(tar.gz)
    Source code(zip)
Owner
Wenxuan
Rustacean, Linuxer | 0xE9791F3E2CC6AA5C
Wenxuan
A template for bootstrapping a Rust TUI application with tui-rs & crossterm

rust-tui-template A template for bootstrapping a Rust TUI application with tui-rs & crossterm. tui-rs The library is based on the principle of immedia

Orhun Parmaksız 72 Dec 31, 2022
Api testing tool made with rust to use for api developement (Kind of Tui)

Api testing tool made with rust to use for api developement (Kind of Tui) This Rust project provides a simple yet powerful tool for making HTTP reques

Kythonlk 3 Feb 14, 2024
A WIP property-based testing library in Rust, built with generalized targeted-property testing in mind.

Crabcheck A WIP property-based testing library in Rust, built with generalized targeted-property testing in mind. What is property-based testing? TODO

Alperen Keleş 9 Mar 27, 2024
A TUI for your todos built in Rust with full CLI support.

todui TUI Features This app allows for almost anythig you would need when dealing with todos: Create, edit, and delete tasks Add links to tasks Add du

Daniel Melchor 14 Apr 1, 2023
Real-time CLI level meter built in Rust.

Meter This is a very simple command line utility written in Rust for measuring the gain of a microphone. It displays the values in dBFS. This is usefu

Chris Burgess 16 Sep 8, 2022
An experimental real-time operating system (RTOS) written in Rust

An experimental real-time operating system (RTOS) written in Rust

null 0 Nov 14, 2022
Real-time stock tickers from the command-line. Written in Rust.

ticker-rs Real-time stock tickers from the command-line written in Rust. CLI tool using the Yahoo Finance API as a data source. It features colored ou

Patrick Stadler 4 Nov 17, 2022
Blaze is a Rust script that continuously monitors server resource usage and sends real-time summaries and alerts to a Discord channel via Webhook.

Blaze Blaze is a Rust script designed to run 24/7 on a server, providing a summary of resource usage every 30 minutes (configurable) to a Discord chan

ShadowArcanist 18 Sep 23, 2024
a universal meta-transliterator that can decipher arbitrary encoding schemas, built in pure Rust

transliterati a universal meta-transliterator that can decipher arbitrary encoding schemas, built in pure Rust what does it do? You give it this: Барл

Catherine Koshka 7 Dec 21, 2022
Truly universal encoding detector in pure Rust - port of Python version

Charset Normalizer A library that helps you read text from an unknown charset encoding. Motivated by original Python version of charset-normalizer, I'

Nikolay Yarovoy 29 Oct 9, 2023