bench: flush before shutting down (#8844)

while driving by:
- remove the extra tenant
- remove the extra timelines

implement this by turning the pg_compare to a yielding fixture.

evidence:
https://neon-github-public-dev.s3.amazonaws.com/reports/main/10571779162/index.html#suites/9681106e61a1222669b9d22ab136d07b/3bbe9f007b3ffae1/
This commit is contained in:
Joonas Koivunen
2024-08-28 12:20:43 +03:00
committed by GitHub
parent 992a951b5e
commit c0ba18a112
2 changed files with 16 additions and 19 deletions

View File

@@ -102,7 +102,6 @@ class NeonCompare(PgCompare):
zenbenchmark: NeonBenchmarker,
neon_simple_env: NeonEnv,
pg_bin: PgBin,
branch_name: str,
):
self.env = neon_simple_env
self._zenbenchmark = zenbenchmark
@@ -110,16 +109,11 @@ class NeonCompare(PgCompare):
self.pageserver_http_client = self.env.pageserver.http_client()
# note that neon_simple_env now uses LOCAL_FS remote storage
# Create tenant
tenant_conf: Dict[str, str] = {}
self.tenant, _ = self.env.neon_cli.create_tenant(conf=tenant_conf)
# Create timeline
self.timeline = self.env.neon_cli.create_timeline(branch_name, tenant_id=self.tenant)
self.tenant = self.env.initial_tenant
self.timeline = self.env.initial_timeline
# Start pg
self._pg = self.env.endpoints.create_start(branch_name, "main", self.tenant)
self._pg = self.env.endpoints.create_start("main", "main", self.tenant)
@property
def pg(self) -> PgProtocol:
@@ -297,13 +291,11 @@ class RemoteCompare(PgCompare):
@pytest.fixture(scope="function")
def neon_compare(
request: FixtureRequest,
zenbenchmark: NeonBenchmarker,
pg_bin: PgBin,
neon_simple_env: NeonEnv,
) -> NeonCompare:
branch_name = request.node.name
return NeonCompare(zenbenchmark, neon_simple_env, pg_bin, branch_name)
return NeonCompare(zenbenchmark, neon_simple_env, pg_bin)
@pytest.fixture(scope="function")

View File

@@ -2,14 +2,14 @@ import statistics
import threading
import time
import timeit
from typing import Any, Callable, List
from typing import Any, Callable, Generator, List
import pytest
from fixtures.benchmark_fixture import MetricReport, NeonBenchmarker
from fixtures.common_types import Lsn
from fixtures.compare_fixtures import NeonCompare, PgCompare, VanillaCompare
from fixtures.log_helper import log
from fixtures.neon_fixtures import DEFAULT_BRANCH_NAME, NeonEnvBuilder, PgBin
from fixtures.neon_fixtures import NeonEnvBuilder, PgBin, flush_ep_to_pageserver
from performance.test_perf_pgbench import get_durations_matrix, get_scales_matrix
@@ -20,7 +20,7 @@ from performance.test_perf_pgbench import get_durations_matrix, get_scales_matri
# For example, to build a `NeonCompare` interface, the corresponding fixture's param should have
# a format of `neon_{safekeepers_enable_fsync}`.
# Note that, here "_" is used to separate builder parameters.
def pg_compare(request) -> PgCompare:
def pg_compare(request) -> Generator[PgCompare, None, None]:
x = request.param.split("_")
if x[0] == "vanilla":
@@ -28,7 +28,7 @@ def pg_compare(request) -> PgCompare:
fixture = request.getfixturevalue("vanilla_compare")
assert isinstance(fixture, VanillaCompare)
return fixture
yield fixture
else:
assert (
len(x) == 2
@@ -47,10 +47,15 @@ def pg_compare(request) -> PgCompare:
neon_env_builder.safekeepers_enable_fsync = x[1] == "on"
env = neon_env_builder.init_start()
env.neon_cli.create_branch("empty", ancestor_branch_name=DEFAULT_BRANCH_NAME)
branch_name = request.node.name
return NeonCompare(zenbenchmark, env, pg_bin, branch_name)
cmp = NeonCompare(zenbenchmark, env, pg_bin)
yield cmp
flush_ep_to_pageserver(env, cmp._pg, cmp.tenant, cmp.timeline)
env.pageserver.http_client().timeline_checkpoint(
cmp.tenant, cmp.timeline, compact=False, wait_until_uploaded=True
)
def start_heavy_write_workload(env: PgCompare, n_tables: int, scale: int, num_iters: int):