pub struct HyperGenerator<S: Scenario> {
pub scenario: S,
pub request: HttpConfig,
pub max_open_connections: usize,
/* private fields */
}
Expand description
A hyper based generator. This generator use’s HTTP multiplexing, and requires that the target server supports
HTTP2. Much like the reqwest generator, HyperGenerator
is very sensitive to
latency. For good proformance, it is recommended to test servers running on the same LAN as your
machine. This Generator will reuse TCP connections for requests, and all request will be sent from the same IP.
Fields§
§scenario: S
§request: HttpConfig
§max_open_connections: usize
This is the maximum amount of TCP file descriptors being used at any one time. The actual number of open connections will be higher, because it takes time to purge old fd’s.
Implementations§
Source§impl<S: Scenario> HyperGenerator<S>
impl<S: Scenario> HyperGenerator<S>
Sourcepub fn new(
scenario: S,
request: HttpConfig,
max_open_connections: usize,
worker_count: usize,
warmup: bool,
) -> Self
pub fn new( scenario: S, request: HttpConfig, max_open_connections: usize, worker_count: usize, warmup: bool, ) -> Self
Constructs a new HyperGenerator
Trait Implementations§
Source§impl<T: Scenario> TrafficGenerator<T> for HyperGenerator<T>
impl<T: Scenario> TrafficGenerator<T> for HyperGenerator<T>
Source§fn run_scenario(&mut self)
fn run_scenario(&mut self)
Runs the current scenario
Source§fn set_scenario(&mut self, schem: T)
fn set_scenario(&mut self, schem: T)
Sets a
Scenario
for the generator to try and replicate.Source§fn get_scenario(&self) -> &T
fn get_scenario(&self) -> &T
Gets the current
Scenario
Source§fn send_packet(&mut self)
fn send_packet(&mut self)
Send a single packet per call, used for debuging and low traffic testing.
Source§fn get_data_rate_channel(&self) -> Receiver<(f32, f32)>
fn get_data_rate_channel(&self) -> Receiver<(f32, f32)>
Give a bounded channel that sends time series data on the send rate of
a generator. The data is encoded as
(Miliseconds since start of scenario, counts/sec)
.Source§fn get_sent_packets_channel(&self) -> Receiver<usize>
fn get_sent_packets_channel(&self) -> Receiver<usize>
Give a bounded channel that sends the total amount of packets/requests sent
Auto Trait Implementations§
impl<S> Freeze for HyperGenerator<S>where
S: Freeze,
impl<S> RefUnwindSafe for HyperGenerator<S>where
S: RefUnwindSafe,
impl<S> Send for HyperGenerator<S>
impl<S> Sync for HyperGenerator<S>
impl<S> Unpin for HyperGenerator<S>where
S: Unpin,
impl<S> UnwindSafe for HyperGenerator<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more