wire up confirmation_rate + bench1
This commit is contained in:
parent
4a6a594873
commit
8aca443d56
|
@ -14,14 +14,14 @@ use solana_sdk::signature::{read_keypair_file, Keypair, Signature, Signer};
|
|||
|
||||
#[derive(Clone, Copy, Debug, Default, serde::Serialize)]
|
||||
pub struct Metric {
|
||||
tx_sent: u64,
|
||||
tx_confirmed: u64,
|
||||
pub txs_sent: u64,
|
||||
pub txs_confirmed: u64,
|
||||
// in ms
|
||||
average_confirmation_time: f32,
|
||||
pub average_confirmation_time: f32,
|
||||
// in slots
|
||||
average_slot_confirmation_time: f32,
|
||||
tx_send_errors: u64,
|
||||
tx_unconfirmed: u64,
|
||||
pub average_slot_confirmation_time: f32,
|
||||
pub txs_send_errors: u64,
|
||||
pub txs_un_confirmed: u64,
|
||||
}
|
||||
|
||||
/// TC2 send multiple runs of num_txs, measure the confirmation rate
|
||||
|
@ -149,10 +149,10 @@ pub async fn send_bulk_txs_and_wait(
|
|||
};
|
||||
|
||||
Ok(Metric {
|
||||
tx_sent,
|
||||
tx_send_errors,
|
||||
tx_confirmed,
|
||||
tx_unconfirmed,
|
||||
txs_sent: tx_sent,
|
||||
txs_send_errors: tx_send_errors,
|
||||
txs_confirmed: tx_confirmed,
|
||||
txs_un_confirmed: tx_unconfirmed,
|
||||
average_confirmation_time: average_confirmation_time_ms,
|
||||
average_slot_confirmation_time,
|
||||
})
|
||||
|
@ -162,27 +162,27 @@ fn calc_stats_avg(stats: &[Metric]) -> Metric {
|
|||
let len = stats.len();
|
||||
|
||||
let mut avg = Metric {
|
||||
tx_sent: 0,
|
||||
tx_send_errors: 0,
|
||||
tx_confirmed: 0,
|
||||
tx_unconfirmed: 0,
|
||||
txs_sent: 0,
|
||||
txs_send_errors: 0,
|
||||
txs_confirmed: 0,
|
||||
txs_un_confirmed: 0,
|
||||
average_confirmation_time: 0.0,
|
||||
average_slot_confirmation_time: 0.0,
|
||||
};
|
||||
|
||||
for stat in stats {
|
||||
avg.tx_sent += stat.tx_sent;
|
||||
avg.tx_send_errors += stat.tx_send_errors;
|
||||
avg.tx_confirmed += stat.tx_confirmed;
|
||||
avg.tx_unconfirmed += stat.tx_unconfirmed;
|
||||
avg.txs_sent += stat.txs_sent;
|
||||
avg.txs_send_errors += stat.txs_send_errors;
|
||||
avg.txs_confirmed += stat.txs_confirmed;
|
||||
avg.txs_un_confirmed += stat.txs_un_confirmed;
|
||||
avg.average_confirmation_time += stat.average_confirmation_time;
|
||||
avg.average_slot_confirmation_time += stat.average_slot_confirmation_time;
|
||||
}
|
||||
|
||||
avg.tx_sent /= len as u64;
|
||||
avg.tx_send_errors /= len as u64;
|
||||
avg.tx_confirmed /= len as u64;
|
||||
avg.tx_unconfirmed /= len as u64;
|
||||
avg.txs_sent /= len as u64;
|
||||
avg.txs_send_errors /= len as u64;
|
||||
avg.txs_confirmed /= len as u64;
|
||||
avg.txs_un_confirmed /= len as u64;
|
||||
avg.average_confirmation_time /= len as f32;
|
||||
avg.average_slot_confirmation_time /= len as f32;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ pub async fn benchnew_confirmation_rate_servicerunner(
|
|||
cu_price_micro_lamports: bench_config.cu_price_micro_lamports,
|
||||
};
|
||||
let max_timeout = Duration::from_secs(60);
|
||||
let result = send_bulk_txs_and_wait(&rpc, &funded_payer, 1, &tx_params, max_timeout).await;
|
||||
let result = send_bulk_txs_and_wait(&rpc, &funded_payer, bench_config.tx_count, &tx_params, max_timeout).await;
|
||||
result.unwrap_or_else(|err| {
|
||||
error!("Failed to send bulk txs and wait: {}", err);
|
||||
confirmation_rate::Metric::default()
|
||||
|
|
|
@ -99,13 +99,13 @@ async fn main() {
|
|||
|
||||
let benchrun_at = SystemTime::now();
|
||||
|
||||
let permutation = factorize(run_count, &[bench_configs.len(), NUM_BENCH_IMPLS]);
|
||||
let permutation = factorize(run_count, &[NUM_BENCH_IMPLS, bench_configs.len()]);
|
||||
|
||||
let bench_config = bench_configs[permutation[0]].clone();
|
||||
let bench_config = bench_configs[permutation[1]].clone();
|
||||
|
||||
let bench_impl: Box<dyn BenchTrait> = match permutation[1] {
|
||||
let bench_impl: Box<dyn BenchTrait> = match permutation[0] {
|
||||
0 => {
|
||||
Box::new(BenchRunnerBench1Impl {
|
||||
Box::new(BenchRunnerConfirmationRateImpl {
|
||||
benchrun_at,
|
||||
tenant_config: tenant_config.clone(),
|
||||
bench_config: bench_config.clone(),
|
||||
|
@ -115,7 +115,7 @@ async fn main() {
|
|||
})
|
||||
}
|
||||
1 => {
|
||||
Box::new(BenchRunnerConfirmationRateImpl {
|
||||
Box::new(BenchRunnerBench1Impl {
|
||||
benchrun_at,
|
||||
tenant_config: tenant_config.clone(),
|
||||
bench_config: bench_config.clone(),
|
||||
|
@ -238,6 +238,7 @@ impl BenchRunner for BenchRunnerBench1Impl {
|
|||
self.size_tx,
|
||||
)
|
||||
.await;
|
||||
self.metric.set(metric).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ impl BenchMetricsPostgresSaver for BenchRunnerBench1Impl {
|
|||
.execute(
|
||||
r#"
|
||||
INSERT INTO
|
||||
benchrunner.bench_metrics (
|
||||
benchrunner.bench_metrics_bench1 (
|
||||
tenant,
|
||||
ts,
|
||||
prio_fees,
|
||||
|
@ -107,7 +107,44 @@ impl BenchMetricsPostgresSaver for BenchRunnerBench1Impl {
|
|||
#[async_trait]
|
||||
impl BenchMetricsPostgresSaver for BenchRunnerConfirmationRateImpl {
|
||||
async fn try_save_results_postgres(&self, postgres_session: &PostgresSessionCache) -> anyhow::Result<()> {
|
||||
todo!();
|
||||
let metric = self.metric.get().expect("metric not set");
|
||||
let metricjson = serde_json::to_value(metric).unwrap();
|
||||
let values: &[&(dyn ToSql + Sync)] = &[
|
||||
&self.tenant_config.tenant_id,
|
||||
&self.benchrun_at,
|
||||
&(self.bench_config.cu_price_micro_lamports as i64),
|
||||
&(metric.txs_sent as i64),
|
||||
&(metric.txs_confirmed as i64),
|
||||
&(metric.txs_un_confirmed as i64),
|
||||
&(metric.average_confirmation_time as f32),
|
||||
&(metric.average_slot_confirmation_time as f32),
|
||||
&metricjson,
|
||||
];
|
||||
postgres_session
|
||||
.get_session()
|
||||
.await?
|
||||
.execute(
|
||||
r#"
|
||||
INSERT INTO
|
||||
benchrunner.bench_metrics_confirmation_rate (
|
||||
tenant,
|
||||
ts,
|
||||
prio_fees,
|
||||
txs_sent,
|
||||
txs_confirmed,
|
||||
txs_un_confirmed,
|
||||
average_confirmation_time_ms,
|
||||
average_slot_confirmation_time_ms,
|
||||
metric_json
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
"#,
|
||||
values,
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
|
||||
CREATE SCHEMA benchrunner;
|
||||
|
||||
CREATE TABLE benchrunner.bench_metrics (
|
||||
|
||||
CREATE TABLE benchrunner.bench_runs (
|
||||
tenant text NOT NULL,
|
||||
ts timestamp NOT NULL,
|
||||
status text NOT NULL,
|
||||
PRIMARY KEY (tenant, ts)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE benchrunner.bench_metrics_bench1 (
|
||||
tenant text NOT NULL,
|
||||
ts timestamp NOT NULL,
|
||||
prio_fees int8 NOT NULL,
|
||||
|
@ -13,14 +22,28 @@ CREATE TABLE benchrunner.bench_metrics (
|
|||
PRIMARY KEY (tenant, ts)
|
||||
);
|
||||
|
||||
CREATE TABLE benchrunner.bench_runs (
|
||||
tenant text NOT NULL,
|
||||
ts timestamp NOT NULL,
|
||||
status text NOT NULL,
|
||||
PRIMARY KEY (tenant, ts)
|
||||
|
||||
CREATE TABLE benchrunner.bench_metrics_confirmation_rate (
|
||||
tenant text NOT NULL,
|
||||
ts timestamp NOT NULL,
|
||||
prio_fees int8 NOT NULL,
|
||||
txs_sent int8 NOT NULL,
|
||||
txs_confirmed int8 NOT NULL,
|
||||
txs_un_confirmed int8 NOT NULL,
|
||||
average_confirmation_time_ms real NOT NULL,
|
||||
average_slot_confirmation_time_ms real NOT NULL,
|
||||
metric_json jsonb NOT NULL,
|
||||
PRIMARY KEY (tenant, ts)
|
||||
);
|
||||
|
||||
|
||||
GRANT USAGE ON SCHEMA benchrunner TO r_benchrunner;
|
||||
GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA benchrunner TO r_benchrunner;
|
||||
GRANT USAGE ON SCHEMA benchrunner TO ro_benchrunner;
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA benchrunner TO r_benchrunner;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA benchrunner GRANT SELECT, INSERT, UPDATE ON TABLES TO r_benchrunner;
|
||||
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA benchrunner TO ro_benchrunner;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA benchrunner GRANT SELECT ON TABLES TO ro_benchrunner;
|
||||
|
||||
ALTER TABLE benchrunner.bench_metrics RENAME TO bench_metrics_bench1;
|
||||
|
|
Loading…
Reference in New Issue