From 754c20620340bda4402a88f04bb21367b31bf4d5 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov Date: Tue, 21 Jan 2020 21:15:25 +0300 Subject: [PATCH] [wip] performance comparison --- docker/test/performance-comparison/perf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/test/performance-comparison/perf.py b/docker/test/performance-comparison/perf.py index ae509e1bc78..4eeb6e76828 100755 --- a/docker/test/performance-comparison/perf.py +++ b/docker/test/performance-comparison/perf.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import os import sys import itertools import clickhouse_driver @@ -12,6 +13,9 @@ import traceback parser = argparse.ArgumentParser(description='Run performance test.') # Explicitly decode files as UTF-8 because sometimes we have Russian characters in queries, and LANG=C is set. parser.add_argument('file', metavar='FILE', type=argparse.FileType('r', encoding='utf-8'), nargs=1, help='test description file') +parser.add_argument('--host', nargs='*', default=['127.0.0.1', '127.0.0.1']) +parser.add_argument('--port', nargs='*', default=[9001, 9002]) +parser.add_argument('--runs', type=int, default=int(os.environ.get('CHPC_RUNS', 7))) args = parser.parse_args() tree = et.parse(args.file[0]) @@ -28,7 +32,7 @@ if infinite_sign is not None: raise Exception('Looks like the test is infinite (sign 1)') # Open connections -servers = [{'host': 'localhost', 'port': 9001, 'client_name': 'left'}, {'host': 'localhost', 'port': 9002, 'client_name': 'right'}] +servers = [{'host': host, 'port': port} for (host, port) in zip(args.host, args.port)] connections = [clickhouse_driver.Client(**server) for server in servers] # Check tables that should exist @@ -95,7 +99,7 @@ for q in test_queries: # excessive data. start_seconds = time.perf_counter() server_seconds = 0 - for run in range(0, 13): + for run in range(0, args.runs): for conn_index, c in enumerate(connections): res = c.execute(q) print('query\t' + tsv_escape(q) + '\t' + str(run) + '\t' + str(conn_index) + '\t' + str(c.last_query.elapsed))