--- /dev/null
+settings_local.py
# 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
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
# 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)
from utils.cluster import PgCluster
from utils import logging
-GIT_URL = 'git@github.com: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__':
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()
--- /dev/null
+import os
+import sys
+
+# global configuration
+GIT_URL = 'git@github.com: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)