mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-15 12:10:37 +00:00
* Add --id argument to safekeeper setting its unique u64 id. In preparation for storage node messaging. IDs are supposed to be monotonically assigned by the console. In tests it is issued by ZenithEnv; at the zenith cli level and fixtures, string name is completely replaced by integer id. Example TOML configs are adjusted accordingly. Sequential ids are chosen over Zid mainly because they are compact and easy to type/remember. * add node id to pageserver This adds node id parameter to pageserver configuration. Also I use a simple builder to construct pageserver config struct to avoid setting node id to some temporary invalid value. Some of the changes in test fixtures are needed to split init and start operations for envrionment. Co-authored-by: Arseny Sher <sher-ars@yandex.ru>
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
import timeit
|
|
from fixtures.benchmark_fixture import MetricReport
|
|
import pytest
|
|
|
|
from fixtures.zenith_fixtures import ZenithEnvBuilder
|
|
|
|
# Run bulk tenant creation test.
|
|
#
|
|
# Collects metrics:
|
|
#
|
|
# 1. Time to create {1,10,50} tenants
|
|
# 2. Average creation time per tenant
|
|
|
|
|
|
@pytest.mark.parametrize('tenants_count', [1, 5, 10])
|
|
@pytest.mark.parametrize('use_wal_acceptors', ['with_wa', 'without_wa'])
|
|
def test_bulk_tenant_create(
|
|
zenith_env_builder: ZenithEnvBuilder,
|
|
use_wal_acceptors: str,
|
|
tenants_count: int,
|
|
zenbenchmark,
|
|
):
|
|
"""Measure tenant creation time (with and without wal acceptors)"""
|
|
if use_wal_acceptors == 'with_wa':
|
|
zenith_env_builder.num_safekeepers = 3
|
|
env = zenith_env_builder.init_start()
|
|
|
|
time_slices = []
|
|
|
|
for i in range(tenants_count):
|
|
start = timeit.default_timer()
|
|
|
|
tenant = env.create_tenant()
|
|
env.zenith_cli.create_branch(
|
|
f"test_bulk_tenant_create_{tenants_count}_{i}_{use_wal_acceptors}",
|
|
"main",
|
|
tenant_id=tenant)
|
|
|
|
# FIXME: We used to start new safekeepers here. Did that make sense? Should we do it now?
|
|
#if use_wal_acceptors == 'with_wa':
|
|
# wa_factory.start_n_new(3)
|
|
|
|
pg_tenant = env.postgres.create_start(
|
|
f"test_bulk_tenant_create_{tenants_count}_{i}_{use_wal_acceptors}",
|
|
None, # branch name, None means same as node name
|
|
tenant,
|
|
)
|
|
|
|
end = timeit.default_timer()
|
|
time_slices.append(end - start)
|
|
|
|
pg_tenant.stop()
|
|
|
|
zenbenchmark.record('tenant_creation_time',
|
|
sum(time_slices) / len(time_slices),
|
|
's',
|
|
report=MetricReport.LOWER_IS_BETTER)
|