mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 21:42:56 +00:00
we want to run some specific pagebench test cases on dedicated hardware to get reproducible results run1: 1 client per tenant => characterize throughput with n tenants. - 500 tenants - scale 13 (200 MB database) - 1 hour duration - ca 380 GB layer snapshot files run2.singleclient: 1 client per tenant => characterize latencies run2.manyclient: N clients per tenant => characterize throughput scalability within one tenant. - 1 tenant with 1 client for latencies - 1 tenant with 64 clients because typically for a high number of connections we recommend the connection pooler which by default uses 64 connections (for scalability) - scale 136 (2048 MB database) - 20 minutes each
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""
|
|
Utilities used by all code in this sub-directory
|
|
"""
|
|
|
|
from typing import Any, Callable, Dict, Optional, Tuple
|
|
|
|
import fixtures.pageserver.many_tenants as many_tenants
|
|
from fixtures.common_types import TenantId, TimelineId
|
|
from fixtures.log_helper import log
|
|
from fixtures.neon_fixtures import (
|
|
NeonEnv,
|
|
NeonEnvBuilder,
|
|
)
|
|
from fixtures.pageserver.utils import wait_until_all_tenants_state
|
|
|
|
|
|
def ensure_pageserver_ready_for_benchmarking(env: NeonEnv, n_tenants: int):
|
|
"""
|
|
Helper function.
|
|
"""
|
|
ps_http = env.pageserver.http_client()
|
|
|
|
log.info("wait for all tenants to become active")
|
|
wait_until_all_tenants_state(
|
|
ps_http, "Active", iterations=10 + n_tenants, period=1, http_error_ok=False
|
|
)
|
|
|
|
# ensure all layers are resident for predictiable performance
|
|
tenants = [info["id"] for info in ps_http.tenant_list()]
|
|
for tenant in tenants:
|
|
for timeline in ps_http.tenant_status(tenant)["timelines"]:
|
|
info = ps_http.layer_map_info(tenant, timeline)
|
|
for layer in info.historic_layers:
|
|
assert not layer.remote
|
|
|
|
log.info("ready")
|
|
|
|
|
|
def setup_pageserver_with_tenants(
|
|
neon_env_builder: NeonEnvBuilder,
|
|
name: str,
|
|
n_tenants: int,
|
|
setup: Callable[[NeonEnv], Tuple[TenantId, TimelineId, Dict[str, Any]]],
|
|
timeout_in_seconds: Optional[int] = None,
|
|
) -> NeonEnv:
|
|
"""
|
|
Utility function to set up a pageserver with a given number of identical tenants.
|
|
"""
|
|
|
|
def doit(neon_env_builder: NeonEnvBuilder) -> NeonEnv:
|
|
return many_tenants.single_timeline(neon_env_builder, setup, n_tenants)
|
|
|
|
env = neon_env_builder.build_and_use_snapshot(name, doit)
|
|
env.start(timeout_in_seconds=timeout_in_seconds)
|
|
ensure_pageserver_ready_for_benchmarking(env, n_tenants)
|
|
return env
|