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

Track which validators are contributing towards tx and effects cert the most #4535

Merged
merged 1 commit into from
Sep 19, 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
28 changes: 26 additions & 2 deletions crates/sui-benchmark/src/drivers/bench_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub struct BenchMetrics {
pub num_submitted: IntCounterVec,
pub num_in_flight: GaugeVec,
pub latency_s: HistogramVec,
pub validators_in_tx_cert: IntCounterVec,
pub validators_in_effects_cert: IntCounterVec,
}

const LATENCY_SEC_BUCKETS: &[f64] = &[
Expand Down Expand Up @@ -91,6 +93,20 @@ impl BenchMetrics {
registry,
)
.unwrap(),
validators_in_tx_cert: register_int_counter_vec_with_registry!(
"validators_in_tx_cert",
"Number of times a validator was included in tx cert",
&["validator"],
registry,
)
.unwrap(),
validators_in_effects_cert: register_int_counter_vec_with_registry!(
"validators_in_effects_cert",
"Number of times a validator was included in effects cert",
&["validator"],
registry,
)
.unwrap(),
}
}
}
Expand Down Expand Up @@ -196,6 +212,7 @@ impl Driver<BenchmarkStats> for BenchDriver {
show_progress: bool,
run_duration: Interval,
) -> Result<BenchmarkStats, anyhow::Error> {
let committee = Arc::new(aggregator.committee.clone());
let mut tasks = Vec::new();
let (tx, mut rx) = tokio::sync::mpsc::channel(100);
let mut bench_workers = vec![];
Expand Down Expand Up @@ -224,6 +241,7 @@ impl Driver<BenchmarkStats> for BenchDriver {
),
});
for (i, worker) in bench_workers.into_iter().enumerate() {
let committee = committee.clone();
let request_delay_micros = 1_000_000 / worker.target_qps;
let mut free_pool = worker.payload;
let progress = progress.clone();
Expand Down Expand Up @@ -291,6 +309,7 @@ impl Driver<BenchmarkStats> 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 committee_cloned = committee.clone();
let start = Instant::now();
let res = qd
.execute_transaction(ExecuteTransactionRequest {
Expand All @@ -300,14 +319,16 @@ impl Driver<BenchmarkStats> for BenchDriver {
.map(move |res| {
match res {
Ok(ExecuteTransactionResponse::EffectsCert(result)) => {
let (_, effects) = *result;
let (cert, effects) = *result;
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();
cert.auth_sign_info.authorities(&committee_cloned).for_each(|name| metrics_cloned.validators_in_tx_cert.with_label_values(&[&name.unwrap().to_string()]).inc());
effects.auth_signature.authorities(&committee_cloned).for_each(|name| metrics_cloned.validators_in_effects_cert.with_label_values(&[&name.unwrap().to_string()]).inc());
NextOp::Response(Some((
latency,
b.1.make_new_payload(new_version, effects.effects.gas_object.0),
Expand Down Expand Up @@ -342,6 +363,7 @@ impl Driver<BenchmarkStats> for BenchDriver {
let tx = payload.make_transaction();
let start = Instant::now();
let metrics_cloned = metrics_cloned.clone();
let committee_cloned = committee.clone();
let res = qd
.execute_transaction(ExecuteTransactionRequest {
transaction: tx.clone(),
Expand All @@ -350,14 +372,16 @@ impl Driver<BenchmarkStats> for BenchDriver {
.map(move |res| {
match res {
Ok(ExecuteTransactionResponse::EffectsCert(result)) => {
let (_, effects) = *result;
let (cert, effects) = *result;
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();
cert.auth_sign_info.authorities(&committee_cloned).for_each(|name| metrics_cloned.validators_in_tx_cert.with_label_values(&[&name.unwrap().to_string()]).inc());
effects.auth_signature.authorities(&committee_cloned).for_each(|name| metrics_cloned.validators_in_effects_cert.with_label_values(&[&name.unwrap().to_string()]).inc());
NextOp::Response(Some((
latency,
payload.make_new_payload(new_version, effects.effects.gas_object.0),
Expand Down