From 192bbd6c5422bc7c5b2fa3d794be6d0406140133 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 3 Nov 2023 11:59:51 +0000 Subject: [PATCH] pq bench: configurable connection string --- pageserver/src/bin/getpage_bench_libpq.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pageserver/src/bin/getpage_bench_libpq.rs b/pageserver/src/bin/getpage_bench_libpq.rs index 4a8900054a..a26e81c91b 100644 --- a/pageserver/src/bin/getpage_bench_libpq.rs +++ b/pageserver/src/bin/getpage_bench_libpq.rs @@ -56,6 +56,8 @@ struct RelTagBlockNo { struct Args { #[clap(long, default_value = "http://localhost:9898")] ps_endpoint: String, + #[clap(long, default_value = "postgres://postgres@localhost:64000")] + pq_client_connstring: String, // tenant_id: String, // timeline_id: String, num_tasks: usize, @@ -246,10 +248,13 @@ fn timeline( let task = tokio::spawn({ let stats = Arc::clone(&stats); async move { - let mut client = - getpage_client::Client::new(tenant_id.clone(), timeline_id.clone()) - .await - .unwrap(); + let mut client = getpage_client::Client::new( + args.pq_client_connstring.clone(), + tenant_id.clone(), + timeline_id.clone(), + ) + .await + .unwrap(); for i in 0..args.num_requests { match args.mode { Mode::GetPage => { @@ -319,12 +324,13 @@ mod getpage_client { impl Client { pub fn new( + connstring: String, tenant_id: String, timeline_id: String, ) -> impl std::future::Future> + Send { async move { let (client, connection) = - tokio_postgres::connect("host=localhost port=64000", postgres::NoTls).await?; + tokio_postgres::connect(&connstring, postgres::NoTls).await?; let conn_task_cancel = CancellationToken::new(); let conn_task = tokio::spawn({