make the benchmarking script work again

This commit is contained in:
Christian Schwarz
2023-11-24 14:58:21 +00:00
parent bd06672cdd
commit a0909a2b80
2 changed files with 23 additions and 15 deletions

View File

@@ -724,8 +724,8 @@ class NeonEnv:
self.initial_tenant = config.initial_tenant
self.initial_timeline = config.initial_timeline
self.control_plane_api = None
self.attachment_service = None
self.control_plane_api: Optional[str] = None
self.attachment_service: Optional[NeonAttachmentService] = None
if config.enable_generations:
self.enable_generations()
@@ -820,11 +820,11 @@ class NeonEnv:
if not start:
# TODO: assert that we haven't `self.start()`ed yet
pass
assert self.control_plane_api == None
assert self.attachment_service == None
assert self.control_plane_api is None
assert self.attachment_service is None
attachment_service_port = self.port_distributor.get_port()
self.control_plane_api: Optional[str] = f"http://127.0.0.1:{attachment_service_port}"
self.attachment_service: Optional[NeonAttachmentService] = NeonAttachmentService(self)
self.control_plane_api = f"http://127.0.0.1:{attachment_service_port}"
self.attachment_service = NeonAttachmentService(self)
if start:
self.attachment_service.start()
@@ -1566,16 +1566,18 @@ class ComputeCtl(AbstractNeonCli):
COMMAND = "compute_ctl"
# class GetpageBenchLibpq(AbstractNeonCli):
# """
# A typed wrapper around the `getpage_bench_libpq` CLI.
# """
#
#
# COMMAND = "getpage_bench_libpq"
#
#
# def run(self):
# pass
class NeonAttachmentService:
def __init__(self, env: NeonEnv):
self.env = env

View File

@@ -1,14 +1,15 @@
import json
from pathlib import Path
import shutil
import subprocess
from fixtures.compare_fixtures import NeonCompare
from fixtures.remote_storage import LocalFsStorage, RemoteStorageKind
from pathlib import Path
from typing import List
from fixtures.benchmark_fixture import NeonBenchmarker
from fixtures.log_helper import log
from fixtures.neon_fixtures import NeonEnvBuilder, PgBin, last_flush_lsn_upload
from fixtures.pageserver.utils import wait_until_tenant_active
from fixtures.remote_storage import LocalFsStorage, RemoteStorageKind
from fixtures.types import TenantId
from fixtures.log_helper import log
from fixtures.benchmark_fixture import NeonBenchmarker
def test_getpage_throughput(
@@ -69,8 +70,10 @@ def test_getpage_throughput(
for file in tl.iterdir():
shutil.copy2(file, dst_tl_dir)
if "__" in file.name:
cmd = [
env.neon_binpath / "pagectl", # TODO: abstract this like the other binaries
cmd: List[str] = [
str(
env.neon_binpath / "pagectl"
), # TODO: abstract this like the other binaries
"layer",
"rewrite-summary",
str(dst_tl_dir / file.name),
@@ -110,9 +113,12 @@ def test_getpage_throughput(
"10000",
*[str(tenant) for tenant in tenants],
]
log.info(f"command: {' '.join(cmd)}")
basepath = pg_bin.run_capture(cmd)
results_path = Path(basepath + ".stdout")
log.info(f"Benchmark results at: {results_path}")
with open(results_path, "r") as f:
results = json.load(f)
log.info(f"Results:\n{json.dumps(results, sort_keys=True, indent=2)}")