From 0559212df74b3c7225626ac3124a769e285577b7 Mon Sep 17 00:00:00 2001 From: carllin Date: Wed, 30 Oct 2019 19:51:44 -0700 Subject: [PATCH] log bench (#6643) --- bench-tps/src/bench.rs | 21 ++++++--- .../dashboards/testnet-monitor.json | 45 +++++++++++++++++-- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/bench-tps/src/bench.rs b/bench-tps/src/bench.rs index 785743308..66de7ea7f 100644 --- a/bench-tps/src/bench.rs +++ b/bench-tps/src/bench.rs @@ -18,7 +18,7 @@ use solana_sdk::{ pubkey::Pubkey, signature::{Keypair, KeypairUtil}, system_instruction, system_transaction, - timing::{duration_as_ms, duration_as_s, timestamp}, + timing::{duration_as_ms, duration_as_s, duration_as_us, timestamp}, transaction::Transaction, }; use std::{ @@ -158,12 +158,13 @@ where let mut reclaim_lamports_back_to_source_account = false; let mut i = keypair0_balance; let mut blockhash = Hash::default(); - let mut blockhash_time = Instant::now(); + let mut blockhash_time; while start.elapsed() < duration { // ping-pong between source and destination accounts for each loop iteration // this seems to be faster than trying to determine the balance of individual // accounts let len = tx_count as usize; + blockhash_time = Instant::now(); if let Ok((new_blockhash, _fee_calculator)) = client.get_new_blockhash(&blockhash) { blockhash = new_blockhash; } else { @@ -173,13 +174,19 @@ where sleep(Duration::from_millis(100)); continue; } - info!( - "Took {} ms for new blockhash", - duration_as_ms(&blockhash_time.elapsed()) + datapoint_debug!( + "bench-tps-get_blockhash", + ("duration", duration_as_us(&blockhash_time.elapsed()), i64) ); + blockhash_time = Instant::now(); let balance = client.get_balance(&id.pubkey()).unwrap_or(0); metrics_submit_lamport_balance(balance); + datapoint_debug!( + "bench-tps-get_balance", + ("duration", duration_as_us(&blockhash_time.elapsed()), i64) + ); + generate_txs( &shared_txs, &blockhash, @@ -367,7 +374,7 @@ fn generate_txs( ); datapoint_debug!( "bench-tps-generate_txs", - ("duration", duration_as_ms(&duration), i64) + ("duration", duration_as_us(&duration), i64) ); let sz = transactions.len() / threads; @@ -432,7 +439,7 @@ fn do_tx_transfers( ); datapoint_debug!( "bench-tps-do_tx_transfers", - ("duration", duration_as_ms(&transfer_start.elapsed()), i64), + ("duration", duration_as_us(&transfer_start.elapsed()), i64), ("count", tx_len, i64) ); } diff --git a/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json b/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json index 77f634c81..1e7012443 100644 --- a/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json +++ b/metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json @@ -4317,7 +4317,7 @@ "measurement": "cluster_info-vote-count", "orderByTime": "ASC", "policy": "autogen", - "query": "SELECT \"duration\" / 1000 as \"Generation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-generate_txs\" WHERE $timeFilter fill(null)\n\n\n\n\n", + "query": "SELECT mean(\"duration\") as \"Generation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-generate_txs\" WHERE $timeFilter GROUP BY time(1s)\n\n\n\n\n", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -4354,7 +4354,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT \"duration\" / 1000 as \"Transmit Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-do_tx_transfers\" WHERE $timeFilter fill(null)", + "query": "SELECT mean(\"duration\") as \"Transmit Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-do_tx_transfers\" WHERE $timeFilter GROUP BY time(1s)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -4391,7 +4391,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT \"duration\" / 1000 as \"Barrier Transaction Confirmation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-send_barrier_transaction\" WHERE $timeFilter fill(null)", + "query": "SELECT mean(\"duration\") as \"Get Blockhash\" FROM \"$testnet\".\"autogen\".\"bench-tps-get_blockhash\" WHERE $timeFilter GROUP BY time(1s)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -4410,6 +4410,43 @@ ] ], "tags": [] + }, + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT mean(\"duration\") as \"Get Balance\" FROM \"$testnet\".\"autogen\".\"bench-tps-get_balance\" WHERE $timeFilter GROUP BY time(1s)", + "rawQuery": true, + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] } ], "thresholds": [], @@ -4432,7 +4469,7 @@ }, "yaxes": [ { - "format": "short", + "format": "µs", "label": null, "logBase": 1, "max": null,