Struct balter::RunStatistics
source · pub struct RunStatistics {
pub concurrency: usize,
pub goal_tps: u32,
pub actual_tps: f64,
pub latency_p50: Duration,
pub latency_p90: Duration,
pub latency_p95: Duration,
pub latency_p99: Duration,
pub error_rate: f64,
pub tps_limited: bool,
}Expand description
Run Statistics for a given Scenario
Fields§
§concurrency: usize§goal_tps: u32§actual_tps: f64§latency_p50: Duration§latency_p90: Duration§latency_p95: Duration§latency_p99: Duration§error_rate: f64§tps_limited: boolTrait Implementations§
source§impl Clone for RunStatistics
impl Clone for RunStatistics
source§fn clone(&self) -> RunStatistics
fn clone(&self) -> RunStatistics
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T, F> ConfigurableScenario<RunStatistics> for Scenario<T>
impl<T, F> ConfigurableScenario<RunStatistics> for Scenario<T>
source§fn error_rate(self, error_rate: f64) -> Self
fn error_rate(self, error_rate: f64) -> Self
Run the scenario increasing TPS until a custom error rate is reached.
§Example
use balter::prelude::*;
use std::time::Duration;
#[tokio::main]
async fn main() {
my_scenario()
// Scale scenario until 25% error rate
.error_rate(0.25)
.await;
}
#[scenario]
async fn my_scenario() {
}§Panics
This function will panic if the error_rate is not between 0 and 1.
source§fn latency(self, latency: Duration, quantile: f64) -> Self
fn latency(self, latency: Duration, quantile: f64) -> Self
Run the scenario up to the specified latency, given a quantile.
§Example
use balter::prelude::*;
use std::time::Duration;
use std::num::NonZeroU32;
#[tokio::main]
async fn main() {
my_scenario()
// Scale scenario until p95 latency is 200ms
.latency(Duration::from_millis(200), 0.95)
.await;
}
#[scenario]
async fn my_scenario() {
}§Panics
This function will panic if the quantile is not between 0 and 1.
source§fn duration(self, duration: Duration) -> Self
fn duration(self, duration: Duration) -> Self
Run the scenario for the given duration.
NOTE: This method doesn’t make much sense without one of the other
load-testing methods (tps()/error_rate()/latency())
§Example
use balter::prelude::*;
use std::time::Duration;
use std::num::NonZeroU32;
#[tokio::main]
async fn main() {
my_scenario()
.tps(10_000)
.duration(Duration::from_secs(120))
.await;
}
#[scenario]
async fn my_scenario() {
}source§fn hint(self, hint: Hint) -> Self
fn hint(self, hint: Hint) -> Self
Apply a hint for how to run the Scenario
By default Balter attempts to autoscale all parameters to find the optimal values for various scenarios. However, this process can be slow due to the control loop processes underneath (and the requirements to be adaptable to all sorts of timing characteristics).
This method allows providing hints to Balter to speed up finding optimal parameters. See Hint for more information.