From c15e4f48ebcba2cb08d88f16eb72468f14c83131 Mon Sep 17 00:00:00 2001 From: Thang Pham Date: Thu, 30 Jun 2022 12:34:58 -0400 Subject: [PATCH] init --- .../src/walreceiver/walreceiver_connection.rs | 2 +- .../performance/test_compare_pg_stats.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/pageserver/src/walreceiver/walreceiver_connection.rs b/pageserver/src/walreceiver/walreceiver_connection.rs index 98b36dfe48..136424be85 100644 --- a/pageserver/src/walreceiver/walreceiver_connection.rs +++ b/pageserver/src/walreceiver/walreceiver_connection.rs @@ -151,7 +151,7 @@ pub async fn handle_walreceiver_connection( waldecoder.feed_bytes(data); while let Some((lsn, recdata)) = waldecoder.poll_decode()? { - let _enter = info_span!("processing record", lsn = %lsn).entered(); + // let _enter = info_span!("processing record", lsn = %lsn).entered(); // It is important to deal with the aligned records as lsn in getPage@LSN is // aligned and can be several bytes bigger. Without this alignment we are diff --git a/test_runner/performance/test_compare_pg_stats.py b/test_runner/performance/test_compare_pg_stats.py index 798974eac2..869b8a9774 100644 --- a/test_runner/performance/test_compare_pg_stats.py +++ b/test_runner/performance/test_compare_pg_stats.py @@ -1,4 +1,6 @@ import os +import threading +import time from typing import List import pytest @@ -99,3 +101,34 @@ def test_compare_pg_stats_wal_with_pgbench_default(neon_with_baseline: PgCompare env.pg_bin.run_capture( ['pgbench', f'-T{duration}', f'--random-seed={seed}', '-Mprepared', env.pg.connstr()]) env.flush() + + +@pytest.mark.parametrize("n_tables", [1, 10]) +@pytest.mark.parametrize("duration", get_durations_matrix(10)) +def test_compare_pg_stats_wo_with_heavy_write(neon_with_baseline: PgCompare, + n_tables: int, + duration: int, + pg_stats_wo: List[PgStatTable]): + env = neon_with_baseline + with env.pg.connect().cursor() as cur: + for i in range(n_tables): + cur.execute( + f"CREATE TABLE t{i}(key serial primary key, t text default 'foooooooooooooooooooooooooooooooooooooooooooooooooooo')" + ) + + def start_single_table_workload(table_id: int): + start = time.time() + with env.pg.connect().cursor() as cur: + while time.time() - start < duration: + cur.execute(f"INSERT INTO t{table_id} SELECT FROM generate_series(1,1000)") + + with env.record_pg_stats(pg_stats_wo): + threads = [ + threading.Thread(target=start_single_table_workload, args=(i, )) + for i in range(n_tables) + ] + + for thread in threads: + thread.start() + for thread in threads: + thread.join()