Skip to main content

Crate elara_loadtest

Crate elara_loadtest 

Source
Expand description

Load testing framework for the ELARA Protocol

This crate provides comprehensive load testing capabilities for validating ELARA Protocol performance under realistic deployment scenarios with multiple nodes.

§Features

  • Simulate multiple nodes in a single process
  • Generate realistic message patterns with ramp-up and sustained load
  • Measure end-to-end latency with accurate timestamps
  • Track message success/failure rates
  • Calculate latency percentiles (p50, p95, p99)
  • Generate comprehensive reports with statistical analysis
  • Predefined scenarios for small (10), medium (100), and large (1000) node deployments

§Example

use elara_loadtest::{LoadTestScenario, scenarios};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Use predefined medium deployment scenario
    let config = scenarios::medium_deployment();
    let mut scenario = LoadTestScenario::new(config);
     
    // Run the load test
    let result = scenario.run().await?;
     
    // Print results
    println!("Throughput: {:.2} msg/sec", result.throughput_msg_per_sec);
    println!("P95 Latency: {:.2}ms", result.p95_latency_ms);
     
    Ok(())
}

Modules§

scenarios
Predefined load test scenarios

Structs§

LoadTestConfig
Configuration for a load test scenario
LoadTestError
Error that can occur during load testing
LoadTestResult
Result of a load test execution
LoadTestScenario
A load test scenario with configuration and execution logic
TestNode
A simulated ELARA Protocol node for load testing