Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate latency in stress as soon as success is returned #4527

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions crates/sui-benchmark/src/drivers/bench_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct Stats {

type RetryType = Box<(TransactionEnvelope<EmptySignInfo>, Box<dyn Payload>)>;
enum NextOp {
Response(Option<(Instant, Box<dyn Payload>)>),
Response(Option<(Duration, Box<dyn Payload>)>),
Retry(RetryType),
}

Expand Down Expand Up @@ -200,11 +200,11 @@ impl Driver<()> for BenchDriver {
debug!("Failed to update stat!");
}
num_success = 0;
num_error = 0;
num_no_gas = 0;
num_submitted = 0;
min_latency = Duration::MAX;
max_latency = Duration::ZERO;
num_error = 0;
num_no_gas = 0;
num_submitted = 0;
min_latency = Duration::MAX;
max_latency = Duration::ZERO;
}
_ = request_interval.tick() => {

Expand All @@ -215,6 +215,7 @@ impl Driver<()> for BenchDriver {
num_submitted += 1;
metrics_cloned.num_submitted.with_label_values(&[&b.1.get_workload_type().to_string()]).inc();
let metrics_cloned = metrics_cloned.clone();
let start = Instant::now();
let res = qd
.execute_transaction(ExecuteTransactionRequest {
transaction: b.0.clone(),
Expand All @@ -227,8 +228,12 @@ impl Driver<()> for BenchDriver {
let new_version = effects.effects.mutated.iter().find(|(object_ref, _)| {
object_ref.0 == b.1.get_object_id()
}).map(|x| x.0).unwrap();
let latency = start.elapsed();
metrics_cloned.latency_s.with_label_values(&[&b.1.get_workload_type().to_string()]).observe(latency.as_secs_f64());
metrics_cloned.num_success.with_label_values(&[&b.1.get_workload_type().to_string()]).inc();
metrics_cloned.num_in_flight.with_label_values(&[&b.1.get_workload_type().to_string()]).dec();
NextOp::Response(Some((
Instant::now(),
latency,
b.1.make_new_payload(new_version, effects.effects.gas_object.0),
),
))
Expand Down Expand Up @@ -273,8 +278,12 @@ impl Driver<()> for BenchDriver {
let new_version = effects.effects.mutated.iter().find(|(object_ref, _)| {
object_ref.0 == payload.get_object_id()
}).map(|x| x.0).unwrap();
let latency = start.elapsed();
metrics_cloned.latency_s.with_label_values(&[&payload.get_workload_type().to_string()]).observe(latency.as_secs_f64());
metrics_cloned.num_success.with_label_values(&[&payload.get_workload_type().to_string()]).inc();
metrics_cloned.num_in_flight.with_label_values(&[&payload.get_workload_type().to_string()]).dec();
NextOp::Response(Some((
start,
latency,
payload.make_new_payload(new_version, effects.effects.gas_object.0),
)))
}
Expand All @@ -298,14 +307,10 @@ impl Driver<()> for BenchDriver {
NextOp::Retry(b) => {
retry_queue.push_back(b);
}
NextOp::Response(Some((start, payload))) => {
let latency = start.elapsed();
NextOp::Response(Some((latency, new_payload))) => {
num_success += 1;
num_in_flight -= 1;
metrics_cloned.latency_s.with_label_values(&[&payload.get_workload_type().to_string()]).observe(latency.as_secs_f64());
metrics_cloned.num_success.with_label_values(&[&payload.get_workload_type().to_string()]).inc();
metrics_cloned.num_in_flight.with_label_values(&[&payload.get_workload_type().to_string()]).dec();
free_pool.push(payload);
free_pool.push(new_payload);
if latency > max_latency {
max_latency = latency;
}
Expand Down