pub struct ReWrkBenchmark<P, C>{ /* private fields */ }
Expand description
The core benchmarker runtime.
Once a benchmarker is created you can run the benchmark
several times using the run
method which returns a future
that will complete once the benchmark is over.
By default this system will use n - 1
worker threads where n
is the number of logical CPU cores available, this can be
overriden using the ReWrkBenchmark::set_num_workers method.
Implementations§
Source§impl<P, C> ReWrkBenchmark<P, C>
impl<P, C> ReWrkBenchmark<P, C>
Sourcepub async fn create(
base_uri: Uri,
concurrency: usize,
protocol: HttpProtocol,
producer: P,
collector: C,
) -> Result<Self, Error>
pub async fn create( base_uri: Uri, concurrency: usize, protocol: HttpProtocol, producer: P, collector: C, ) -> Result<Self, Error>
Creates a new ReWrkBenchmark.
This sets up the connector and collector actor.
Once created benchmarks can be started by calling the run
method.
Sourcepub fn run(&self) -> impl Future<Output = ()>
pub fn run(&self) -> impl Future<Output = ()>
Run a benchmark.
This returns a future which will complete once all workers for the benchmark have completed.
Sourcepub async fn consume_collector(self) -> C
pub async fn consume_collector(self) -> C
Shuts the benchmarker down and returns the collector once complete.
Sourcepub fn set_connection_retry_max(&mut self, max: usize)
pub fn set_connection_retry_max(&mut self, max: usize)
Sets the maximum number of times the connector will attempt to connect to the server before error.
Sourcepub fn set_validator(&mut self, validator: impl ResponseValidator)
pub fn set_validator(&mut self, validator: impl ResponseValidator)
Sets the benchmark validator.
Sourcepub fn set_num_workers(&mut self, n: usize)
pub fn set_num_workers(&mut self, n: usize)
Set the number of workers to spawn.
Sourcepub fn set_sample_window(&mut self, dur: Duration)
pub fn set_sample_window(&mut self, dur: Duration)
Set the duration which should elapse before a sample is submitted to be processed in the collector.
Sourcepub fn set_producer_wait_warning_threshold(&mut self, pct: f32)
pub fn set_producer_wait_warning_threshold(&mut self, pct: f32)
Set the percentage threshold that the system must be waiting on the producer in order for a warning to be raised.
This is useful in situations where you know the producer will take more time than normal and want to silence the warning.