mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-28 10:30:40 +00:00
test_pageserver: report duration
This commit is contained in:
@@ -410,34 +410,42 @@ class NeonBenchmarker:
|
|||||||
report=MetricReport.LOWER_IS_BETTER,
|
report=MetricReport.LOWER_IS_BETTER,
|
||||||
)
|
)
|
||||||
|
|
||||||
def record_pagebench_results(self, name: str, results: Dict[str, Any]):
|
def record_pagebench_results(self, name: str, results: Dict[str, Any], duration: str):
|
||||||
total = results["total"]
|
total = results["total"]
|
||||||
|
|
||||||
metric = "request_count"
|
metric = "request_count"
|
||||||
self.record(
|
self.record(
|
||||||
f"{name}.{metric}",
|
metric_name=f"{name}.{metric}",
|
||||||
total[metric],
|
metric_value=total[metric],
|
||||||
"",
|
unit="",
|
||||||
report=MetricReport.HIGHER_IS_BETTER,
|
report=MetricReport.HIGHER_IS_BETTER,
|
||||||
)
|
)
|
||||||
|
|
||||||
metric = "latency_mean"
|
metric = "latency_mean"
|
||||||
self.record(
|
self.record(
|
||||||
f"{name}.{metric}",
|
metric_name=f"{name}.{metric}",
|
||||||
humantime_to_ms(total[metric]),
|
metric_value=humantime_to_ms(total[metric]),
|
||||||
"ms",
|
unit="ms",
|
||||||
report=MetricReport.LOWER_IS_BETTER,
|
report=MetricReport.LOWER_IS_BETTER,
|
||||||
)
|
)
|
||||||
|
|
||||||
metric = "latency_percentiles"
|
metric = "latency_percentiles"
|
||||||
for k, v in total[metric].items():
|
for k, v in total[metric].items():
|
||||||
self.record(
|
self.record(
|
||||||
f"{name}.{metric}.{k}",
|
metric_name=f"{name}.{metric}.{k}",
|
||||||
humantime_to_ms(v),
|
metric_value=humantime_to_ms(v),
|
||||||
"ms",
|
unit="ms",
|
||||||
report=MetricReport.LOWER_IS_BETTER,
|
report=MetricReport.LOWER_IS_BETTER,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
metric = "duration"
|
||||||
|
self.record(
|
||||||
|
metric_name=f"{name}.{metric}",
|
||||||
|
metric_value=humantime_to_ms(duration) / 1000,
|
||||||
|
unit="s",
|
||||||
|
report=MetricReport.LOWER_IS_BETTER,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def zenbenchmark(record_property: Callable[[str, object], None]) -> Iterator[NeonBenchmarker]:
|
def zenbenchmark(record_property: Callable[[str, object], None]) -> Iterator[NeonBenchmarker]:
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ def test_getpage_throughput(
|
|||||||
ps_http = env.pageserver.http_client()
|
ps_http = env.pageserver.http_client()
|
||||||
|
|
||||||
# run the benchmark with one client per timeline, each doing 10k requests to random keys.
|
# run the benchmark with one client per timeline, each doing 10k requests to random keys.
|
||||||
|
duration = "10s"
|
||||||
cmd = [
|
cmd = [
|
||||||
str(env.neon_binpath / "pagebench"),
|
str(env.neon_binpath / "pagebench"),
|
||||||
"get-page-latest-lsn",
|
"get-page-latest-lsn",
|
||||||
@@ -160,7 +161,7 @@ def test_getpage_throughput(
|
|||||||
"--page-service-connstring",
|
"--page-service-connstring",
|
||||||
env.pageserver.connstr(password=None),
|
env.pageserver.connstr(password=None),
|
||||||
"--runtime",
|
"--runtime",
|
||||||
"10s",
|
duration,
|
||||||
*[f"{tenant}/{template_timeline}" for tenant in tenants],
|
*[f"{tenant}/{template_timeline}" for tenant in tenants],
|
||||||
]
|
]
|
||||||
log.info(f"command: {' '.join(cmd)}")
|
log.info(f"command: {' '.join(cmd)}")
|
||||||
@@ -173,4 +174,4 @@ def test_getpage_throughput(
|
|||||||
|
|
||||||
log.info(f"Results:\n{json.dumps(results, sort_keys=True, indent=2)}")
|
log.info(f"Results:\n{json.dumps(results, sort_keys=True, indent=2)}")
|
||||||
|
|
||||||
zenbenchmark.record_pagebench_results("get-page-latest-lsn", results)
|
zenbenchmark.record_pagebench_results("get-page-latest-lsn", results, duration)
|
||||||
|
|||||||
Reference in New Issue
Block a user