diff options
author | Tomas Vondra | 2016-08-10 22:46:26 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-02-27 00:23:42 +0000 |
commit | fd2d80d799a550ebd08d61bde70d42b62ec70710 (patch) | |
tree | fd1c25c4c186e61b739950c319b62e95c7a2d029 | |
parent | e3f40ddd57b3f9751b511fbf3466ddb31e5083b4 (diff) |
Rework the perffarm client configuration.
Instead of configuration hardcoded into the perffrarm-client.py
script, move it into a separate settings.py file, and allow
override using settings_local.py (not required).
Also somewhat improve the benchmark configurations by allowing
specifying number of runs, durations etc. in the configuration
file (instead of using default parameter values).
-rw-r--r-- | client/.gitignore | 1 | ||||
-rw-r--r-- | client/benchmarks/pgbench.py | 18 | ||||
-rwxr-xr-x | client/perffarm-client.py | 26 | ||||
-rw-r--r-- | client/settings.py | 42 |
4 files changed, 58 insertions, 29 deletions
diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..fd2351e --- /dev/null +++ b/client/.gitignore @@ -0,0 +1 @@ +settings_local.py diff --git a/client/benchmarks/pgbench.py b/client/benchmarks/pgbench.py index da95064..eaa8402 100644 --- a/client/benchmarks/pgbench.py +++ b/client/benchmarks/pgbench.py @@ -14,15 +14,19 @@ class PgBench(object): # TODO allow running custom scripts, not just the default read-write/read-only tests # TODO allow running 'prepared' mode - def __init__(self, bin_path, dbname): + def __init__(self, bin_path, dbname, runs = 3, duration = 60): ''' bin_path - path to PostgreSQL binaries (dropdb, createdb, psql commands) dbname - name of the database to use + runs - number of runs (for each client count) + duration - duration of each execution ''' self._bin = bin_path self._dbname = dbname self._results = {} + self._duration = duration + self._runs = runs @staticmethod @@ -185,7 +189,7 @@ class PgBench(object): return r - def run_tests(self, duration=10, runs=3): + def run_tests(self): 'execute the whole benchmark, including initialization, warmup and benchmark runs' # derive configuration for the CPU count / RAM size @@ -196,20 +200,22 @@ class PgBench(object): # init for the dataset scale and warmup self._init(config['scale']) - warmup = self._run(duration, cpu_count(), cpu_count()) + warmup = self._run(self._duration, cpu_count(), cpu_count()) results = [] - for run in range(runs): + for run in range(self._runs): + + log("pgbench : run=%d" % (run,)) for clients in config['clients']: # read-only - r = self._run(duration, clients, clients, True) + r = self._run(self._duration, clients, clients, True) r.update({'run' : run}) results.append(r) # read-write - r = self._run(duration, clients, clients, False) + r = self._run(self._duration, clients, clients, False) r.update({'run' : run}) results.append(r) diff --git a/client/perffarm-client.py b/client/perffarm-client.py index 0d97677..1d75a10 100755 --- a/client/perffarm-client.py +++ b/client/perffarm-client.py @@ -14,28 +14,7 @@ from utils.git import GitRepository from utils.cluster import PgCluster from utils import logging -GIT_URL = '[email protected]:postgres/postgres.git' -REPOSITORY_PATH = '/home/user/tmp/git-postgres' -BUILD_PATH = '/home/user/tmp/bin-postgres' -BIN_PATH = os.path.join(BUILD_PATH, 'bin') -DATADIR_PATH = '/home/user/tmp/data-postgres' - -POSTGRES_CONFIG = {'shared_buffers' : '1GB', - 'work_mem' : '64MB', - 'maintenance_work_mem' : '128MB', - 'min_wal_size' : '2GB', - 'max_wal_size' : '4GB', - 'log_line_prefix' : '%n %t ', - 'log_checkpoints' : 'on', - 'log_autovacuum_min_duration' : '0', - 'log_temp_files' : '32', - 'checkpoint_timeout' : '15min', - 'checkpoint_completion_target' : '0.9'} - -DATABASE_NAME = 'perf' - -OUTPUT_DIR = '/home/user/perf-output' - +from settings import * if __name__ == '__main__': @@ -69,6 +48,7 @@ if __name__ == '__main__': runner.register_config('pgbench-basic', 'pgbench', dbname = DATABASE_NAME, bin_path = ('%s/bin' % (BUILD_PATH,)), - postgres_config = POSTGRES_CONFIG) + postgres_config = POSTGRES_CONFIG, + **PGBENCH_CONFIG) runner.run() diff --git a/client/settings.py b/client/settings.py new file mode 100644 index 0000000..4895f74 --- /dev/null +++ b/client/settings.py @@ -0,0 +1,42 @@ +import os +import sys + +# global configuration +GIT_URL = '[email protected]:postgres/postgres.git' +REPOSITORY_PATH = '/home/user/tmp/git-postgres' +BUILD_PATH = '/home/user/tmp/bin-postgres' +BIN_PATH = os.path.join(BUILD_PATH, 'bin') +DATADIR_PATH = '/home/user/tmp/data-postgres' + +POSTGRES_CONFIG = {'shared_buffers' : '1GB', + 'work_mem' : '64MB', + 'maintenance_work_mem' : '128MB', + 'min_wal_size' : '2GB', + 'max_wal_size' : '4GB', + 'log_line_prefix' : '%n %t ', + 'log_checkpoints' : 'on', + 'log_autovacuum_min_duration' : '0', + 'log_temp_files' : '32', + 'checkpoint_timeout' : '15min', + 'checkpoint_completion_target' : '0.9'} + +DATABASE_NAME = 'perf' + +OUTPUT_DIR = '/home/user/tmp/perf-output' + +# configuration for PgBench +# +# runs - number of repetitions (including test for all client counts) +# duration - duration (in seconds) of a single benchmark (per client count) +# +PGBENCH_CONFIG = { + 'runs' : 3, + 'duration' : 60 # duration of per-client-count benchmark +} + +# ignore missing file with local config +try: + from settings_local import * +except: + print >> sys.stderr, "ERROR: local configuration (settings_local.py) not found" + sys.exit(1) |