Skip to main content

Crate httpress

Crate httpress 

Source
Expand description

§httpress

A fast HTTP benchmarking library built in Rust.

httpress provides a simple yet powerful API for load testing HTTP services. It supports concurrent requests, rate limiting, custom request generation, and hooks for metrics collection.

§Quick Start

use httpress::{Benchmark, Result};
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<()> {
    let results = Benchmark::builder()
        .url("http://localhost:3000")
        .concurrency(50)
        .duration(Duration::from_secs(10))
        .build()?
        .run()
        .await?;

    results.print();
    Ok(())
}

§Features

  • Simple API: Builder pattern for easy configuration
  • Flexible Rate Control: Fixed rates or dynamic rate functions
  • Custom Request Generation: Generate requests dynamically per-worker
  • Hook System: Inject custom logic before/after requests
  • Detailed Metrics: Latency percentiles, throughput, status codes

Re-exports§

pub use benchmark::Benchmark;
pub use benchmark::BenchmarkBuilder;
pub use config::AfterRequestContext;
pub use config::AfterRequestHook;
pub use config::BeforeRequestContext;
pub use config::BeforeRequestHook;
pub use config::HookAction;
pub use config::HttpMethod;
pub use config::RateContext;
pub use config::RateFunction;
pub use config::RequestConfig;
pub use config::RequestContext;
pub use config::RequestGenerator;
pub use config::RequestSource;
pub use error::Error;
pub use error::Result;
pub use metrics::BenchmarkResults;

Modules§

benchmark
Benchmark runner and builder.
cli
client
config
Configuration types and contexts for benchmarks.
error
Error types for httpress.
executor
metrics
Benchmark results and metrics.