Skip to content

Commit

Permalink
V0.5.14 (#92)
Browse files Browse the repository at this point in the history
* Prepare next release

* TPC-DS: Updated query files

* Evaluation: Enable toc in jupyter

* TPC-DS: Updated query files and title

* TPC-DS: Updated example

* TPC-H: Improved experiment management

* TPC-H: Improved experiment management - example file

* TPC-H: Improved experiment management

* TPC-H: Improved examples

* PVC for MonetDB
  • Loading branch information
perdelt committed Aug 27, 2021
1 parent 5d2f83b commit 1dc98c4
Show file tree
Hide file tree
Showing 13 changed files with 321 additions and 70 deletions.
46 changes: 24 additions & 22 deletions bexhoma/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def stop_monitoring(self):
def start_monitoring(self):
for config in self.configurations:
config.start_monitoring()
def start_sut(self):
def start_sut(self):#, configuration=None):
for config in self.configurations:
config.start_sut()
def stop_sut(self):
Expand All @@ -398,7 +398,7 @@ def load_data(self):
def add_benchmark_list(self, list_clients):
for config in self.configurations:
config.add_benchmark_list(list_clients)
def work_benchmark_list(self, intervals=30):
def work_benchmark_list(self, intervals=30, stop=True):
do = True
while do:
time.sleep(intervals)
Expand Down Expand Up @@ -473,25 +473,28 @@ def work_benchmark_list(self, intervals=30):
config.run_benchmarker_pod(connection=connection, configuration=config.configuration, client=client, parallelism=parallelism)
else:
# no list element left
print("{} can be stopped".format(config.configuration))
app = self.cluster.appname
component = 'sut'
pods = self.cluster.getPods(app, component, self.code, config.configuration)
if len(pods) > 0:
pod_sut = pods[0]
self.cluster.store_pod_log(pod_sut, 'dbms')
config.stop_sut()
config.numExperimentsDone = config.numExperimentsDone + 1
if config.numExperimentsDone < config.numExperiments:
print("{} starts again".format(config.configuration))
config.benchmark_list = config.benchmark_list_template.copy()
# wait for PV to be gone completely
self.wait(60)
config.reset_sut()
config.start_sut()
self.wait(10)
if stop:
print("{} can be stopped".format(config.configuration))
app = self.cluster.appname
component = 'sut'
pods = self.cluster.getPods(app, component, self.code, config.configuration)
if len(pods) > 0:
pod_sut = pods[0]
self.cluster.store_pod_log(pod_sut, 'dbms')
config.stop_sut()
config.numExperimentsDone = config.numExperimentsDone + 1
if config.numExperimentsDone < config.numExperiments:
print("{} starts again".format(config.configuration))
config.benchmark_list = config.benchmark_list_template.copy()
# wait for PV to be gone completely
self.wait(60)
config.reset_sut()
config.start_sut()
self.wait(10)
else:
config.experiment_done = True
else:
config.experiment_done = True
print("{} can be stopped, be we leave it running".format(config.configuration))
else:
print("{} is loading".format(config.configuration))
# all jobs of configuration - benchmarker
Expand Down Expand Up @@ -588,11 +591,10 @@ def benchmark_list(self, list_clients):
self.cluster.deleteJob(job)
if len(pods) == 0 and len(jobs) == 0:
break
def stop_benchmarker(self):
def stop_benchmarker(self, configuration=''):
# all jobs of configuration - benchmarker
app = self.appname
component = 'benchmarker'
configuration = ''
jobs = self.cluster.getJobs(app, component, self.code, configuration)
# status per job
for job in jobs:
Expand Down
4 changes: 1 addition & 3 deletions bexhoma/masterK8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -1613,12 +1613,10 @@ def stop_sut(self, app='', component='sut', experiment='', configuration=''):
self.deleteStatefulSet(stateful_set)
if component == 'sut':
self.stop_sut(app=app, component='worker', experiment=experiment, configuration=configuration)
def stop_benchmarker(self):
def stop_benchmarker(self, experiment='', configuration=''):
# all jobs of configuration - benchmarker
app = self.appname
component = 'benchmarker'
experiment = ''
configuration = ''
jobs = self.getJobs(app, component, experiment, configuration)
# status per job
for job in jobs:
Expand Down
11 changes: 7 additions & 4 deletions bexhoma/scripts/experimentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ def manage():
parser.add_argument('-cx', '--context', help='context of Kubernetes (for a multi cluster environment), default is current context', default=None)
clusterconfig = 'cluster.config'
args = parser.parse_args()
connection = args.connection
if args.mode == 'stop':
cluster = clusters.kubernetes(clusterconfig, context=args.context)
if args.experiment is None:
experiment = experiments.default(cluster=cluster, code=cluster.code)
cluster.stop_sut()
cluster.stop_monitoring()
cluster.stop_benchmarker()
if connection is None:
connection = ''
cluster.stop_sut(configuration=connection)
cluster.stop_monitoring(configuration=connection)
cluster.stop_benchmarker(configuration=connection)
else:
experiment = experiments.default(cluster=cluster, code=args.experiment)
experiment.stop_sut()
Expand All @@ -60,7 +63,7 @@ def manage():
cluster.connect_dashboard()
elif args.mode == 'master':
cluster = clusters.kubernetes(clusterconfig, context=args.context)
cluster.connect_master(experiment=args.experiment, configuration=args.connection)
cluster.connect_master(experiment=args.experiment, configuration=connection)
elif args.mode == 'status':
cluster = clusters.kubernetes(clusterconfig, context=args.context)
app = cluster.appname
Expand Down
8 changes: 4 additions & 4 deletions bexhoma/scripts/tpcds.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ def do_benchmark():
# we want all TPC-H queries
experiment.set_queries_full()
experiment.set_workload(
name = 'TPC-H Queries SF='+str(SF),
name = 'TPC-DS Queries SF='+str(SF),
info = 'This experiment compares run time and resource consumption of TPC-DS queries in different DBMS.'
)
else:
# we want to profile the import
experiment.set_queries_profiling()
experiment.set_workload(
name = 'TPC-H Data Profiling SF='+str(SF),
name = 'TPC-DS Data Profiling SF='+str(SF),
info = 'This experiment compares imported TPC-DS data sets in different DBMS.'
)
if monitoring:
Expand Down Expand Up @@ -158,7 +158,7 @@ def do_benchmark():
start_datetime = str(datetime.datetime.now())
print("Experiment starts at {} ({})".format(start_datetime, start))
# run workflow
experiment.work_benchmark_list()
experiment.work_benchmark_list(stop=False)
# total time of experiment
end = default_timer()
end_datetime = str(datetime.datetime.now())
Expand All @@ -175,7 +175,7 @@ def do_benchmark():
start_datetime = str(datetime.datetime.now())
print("Experiment starts at {} ({})".format(start_datetime, start))
# run workflow
experiment.work_benchmark_list()
experiment.work_benchmark_list(stop=True)
# total time of experiment
end = default_timer()
end_datetime = str(datetime.datetime.now())
Expand Down
9 changes: 8 additions & 1 deletion bexhoma/scripts/tpch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""
from bexhoma import *
from dbmsbenchmarker import *
#import experiments
import logging
import urllib3
import logging
Expand All @@ -34,6 +33,7 @@ def do_benchmark():
# argparse
parser = argparse.ArgumentParser(description=description)
parser.add_argument('mode', help='profile the import of TPC-H data, or run the TPC-H queries, or start DBMS and load data, or just start the DBMS', choices=['profiling', 'run', 'start', 'load'])
parser.add_argument('-c', '--connection', help='name of DBMS', default=None)
parser.add_argument('-cx', '--context', help='context of Kubernetes (for a multi cluster environment), default is current context', default=None)
parser.add_argument('-e', '--experiment', help='sets experiment code for continuing started experiment', default=None)
parser.add_argument('-d', '--detached', help='puts most of the experiment workflow inside the cluster', action='store_true')
Expand All @@ -57,6 +57,7 @@ def do_benchmark():
args = parser.parse_args()
# set parameter
monitoring = args.monitoring
connection = args.connection
mode = str(args.mode)
SF = str(args.scaling_factor)
timeout = int(args.timeout)
Expand Down Expand Up @@ -145,6 +146,12 @@ def do_benchmark():
#config = configurations.default(experiment=experiment, docker='Clickhouse', configuration='Clickhouse-{}'.format(cluster_name), alias='DBMS K')
#config = configurations.default(experiment=experiment, docker='SQLServer', configuration='SQLServer-{}'.format(cluster_name), alias='DBMS L')
#config = configurations.default(experiment=experiment, docker='OmniSci', configuration='OmniSci-{}'.format(cluster_name), alias='DBMS M')
if connection is not None:
for c in reversed(range(len(experiment.configurations))):
if experiment.configurations[c].docker != connection:
del experiment.configurations[c]
for c in experiment.configurations:
print("System to test:", c.configuration)
if args.mode == 'start':
experiment.start_sut()
elif args.mode == 'load':
Expand Down
6 changes: 3 additions & 3 deletions experiments/tpcds/queries-tpcds.config
Original file line number Diff line number Diff line change
Expand Up @@ -7762,7 +7762,7 @@
},
{
'title': "TPC-DS Q72",
'query': """ select i_item_desc
'query': """select i_item_desc
,w_warehouse_name
,d1.d_week_seq
,sum(case when p_promo_sk is null then 1 else 0 end) no_promo
Expand All @@ -7789,7 +7789,7 @@
order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq
limit 100""",
'DBMS': {
'MonetDB': """ select i_item_desc
'MonetDB': """select i_item_desc
,w_warehouse_name
,d1.d_week_seq
,sum(case when p_promo_sk is null then 1 else 0 end) no_promo
Expand All @@ -7808,7 +7808,7 @@
left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number)
where d1.d_week_seq = d2.d_week_seq
and inv_quantity_on_hand < cs_quantity
and d3.d_date > (cast(d1.d_date as date) + interval 5 days)
and d3.d_date > (cast(d1.d_date as date) + interval '5' day)
and hd_buy_potential = '{BP}'
and d1.d_year = {YEAR}
and cd_marital_status = '{MS}'
Expand Down
16 changes: 8 additions & 8 deletions experiments/tpch/MySQL/initdata-tpch-SF1.sql
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
LOAD DATA INFILE '/data/tpch/SF1/customer.tbl' IGNORE INTO TABLE tpch.customer
LOAD DATA INFILE '/tmp/tpch/SF1/customer.tbl' IGNORE INTO TABLE tpch.customer
FIELDS TERMINATED BY '|'
(@c_custkey, @c_name, @c_address, @c_nationkey, @c_phone, @c_acctbal, @c_mktsegment, @c_comment) SET c_custkey=NULLIF(@c_custkey,''), c_name=NULLIF(@c_name,''), c_address=NULLIF(@c_address,''), c_nationkey=NULLIF(@c_nationkey,''), c_phone=NULLIF(@c_phone,''), c_acctbal=NULLIF(@c_acctbal,''), c_mktsegment=NULLIF(@c_mktsegment,''), c_comment=NULLIF(@c_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/lineitem.tbl' IGNORE INTO TABLE tpch.lineitem
LOAD DATA INFILE '/tmp/tpch/SF1/lineitem.tbl' IGNORE INTO TABLE tpch.lineitem
FIELDS TERMINATED BY '|'
(@l_orderkey, @l_partkey, @l_suppkey, @l_linenumber, @l_quantity, @l_extendedprice, @l_discount, @l_tax, @l_returnflag, @l_linestatus, @l_shipdate, @l_commitdate, @l_receiptdate, @l_shipinstruct, @l_shipmode, @l_comment) SET l_orderkey=NULLIF(@l_orderkey,''), l_partkey=NULLIF(@l_partkey,''), l_suppkey=NULLIF(@l_suppkey,''), l_linenumber=NULLIF(@l_linenumber,''), l_quantity=NULLIF(@l_quantity,''), l_extendedprice=NULLIF(@l_extendedprice,''), l_discount=NULLIF(@l_discount,''), l_tax=NULLIF(@l_tax,''), l_returnflag=NULLIF(@l_returnflag,''), l_linestatus=NULLIF(@l_linestatus,''), l_shipdate=NULLIF(@l_shipdate,''), l_commitdate=NULLIF(@l_commitdate,''), l_receiptdate=NULLIF(@l_receiptdate,''), l_shipinstruct=NULLIF(@l_shipinstruct,''), l_shipmode=NULLIF(@l_shipmode,''), l_comment=NULLIF(@l_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/nation.tbl' IGNORE INTO TABLE tpch.nation
LOAD DATA INFILE '/tmp/tpch/SF1/nation.tbl' IGNORE INTO TABLE tpch.nation
FIELDS TERMINATED BY '|'
(@n_nationkey, @n_name, @n_regionkey, @n_comment) SET n_nationkey=NULLIF(@n_nationkey,''), n_name=NULLIF(@n_name,''), n_regionkey=NULLIF(@n_regionkey,''), n_comment=NULLIF(@n_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/orders.tbl' IGNORE INTO TABLE tpch.orders
LOAD DATA INFILE '/tmp/tpch/SF1/orders.tbl' IGNORE INTO TABLE tpch.orders
FIELDS TERMINATED BY '|'
(@o_orderkey, @o_custkey, @o_orderstatus, @o_totalprice, @o_orderdate, @o_orderpriority, @o_clerk, @o_shippriority, @o_comment) SET o_orderkey=NULLIF(@o_orderkey,''), o_custkey=NULLIF(@o_custkey,''), o_orderstatus=NULLIF(@o_orderstatus,''), o_totalprice=NULLIF(@o_totalprice,''), o_orderdate=NULLIF(@o_orderdate,''), o_orderpriority=NULLIF(@o_orderpriority,''), o_clerk=NULLIF(@o_clerk,''), o_shippriority=NULLIF(@o_shippriority,''), o_comment=NULLIF(@o_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/part.tbl' IGNORE INTO TABLE tpch.part
LOAD DATA INFILE '/tmp/tpch/SF1/part.tbl' IGNORE INTO TABLE tpch.part
FIELDS TERMINATED BY '|'
(@p_partkey, @p_name, @p_mfgr, @p_brand, @p_type, @p_size, @p_container, @p_retailprice, @p_comment) SET p_partkey=NULLIF(@p_partkey,''), p_name=NULLIF(@p_name,''), p_mfgr=NULLIF(@p_mfgr,''), p_brand=NULLIF(@p_brand,''), p_type=NULLIF(@p_type,''), p_size=NULLIF(@p_size,''), p_container=NULLIF(@p_container,''), p_retailprice=NULLIF(@p_retailprice,''), p_comment=NULLIF(@p_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/partsupp.tbl' IGNORE INTO TABLE tpch.partsupp
LOAD DATA INFILE '/tmp/tpch/SF1/partsupp.tbl' IGNORE INTO TABLE tpch.partsupp
FIELDS TERMINATED BY '|'
(@ps_partkey, @ps_suppkey, @ps_availqty, @ps_supplycost, @ps_comment) SET ps_partkey=NULLIF(@ps_partkey,''), ps_suppkey=NULLIF(@ps_suppkey,''), ps_availqty=NULLIF(@ps_availqty,''), ps_supplycost=NULLIF(@ps_supplycost,''), ps_comment=NULLIF(@ps_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/region.tbl' IGNORE INTO TABLE tpch.region
LOAD DATA INFILE '/tmp/tpch/SF1/region.tbl' IGNORE INTO TABLE tpch.region
FIELDS TERMINATED BY '|'
(@r_regionkey, @r_name, @r_comment) SET r_regionkey=NULLIF(@r_regionkey,''), r_name=NULLIF(@r_name,''), r_comment=NULLIF(@r_comment,'');

LOAD DATA INFILE '/data/tpch/SF1/supplier.tbl' IGNORE INTO TABLE tpch.supplier
LOAD DATA INFILE '/tmp/tpch/SF1/supplier.tbl' IGNORE INTO TABLE tpch.supplier
FIELDS TERMINATED BY '|'
(@s_suppkey, @s_name, @s_address, @s_nationkey, @s_phone, @s_acctbal, @s_comment) SET s_suppkey=NULLIF(@s_suppkey,''), s_name=NULLIF(@s_name,''), s_address=NULLIF(@s_address,''), s_nationkey=NULLIF(@s_nationkey,''), s_phone=NULLIF(@s_phone,''), s_acctbal=NULLIF(@s_acctbal,''), s_comment=NULLIF(@s_comment,'');

Expand Down
17 changes: 17 additions & 0 deletions experiments/tpch/MySQL/loadindexes-tpch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
SELECT COUNT(*) FROM tpch.customer FORCE INDEX(c_n);
SELECT COUNT(*) FROM tpch.nation FORCE INDEX(n_r);
SELECT COUNT(*) FROM tpch.supplier FORCE INDEX(s_n);
SELECT COUNT(*) FROM tpch.partsupp FORCE INDEX(ps_s);
SELECT COUNT(*) FROM tpch.partsupp FORCE INDEX(ps_p);
SELECT COUNT(*) FROM tpch.orders FORCE INDEX(o_c);
SELECT COUNT(*) FROM tpch.lineitem FORCE INDEX(l_o);
SELECT COUNT(*) FROM tpch.lineitem FORCE INDEX(l_ps);

SELECT COUNT(*) FROM tpch.customer;
SELECT COUNT(*) FROM tpch.lineitem;
SELECT COUNT(*) FROM tpch.nation;
SELECT COUNT(*) FROM tpch.supplier;
SELECT COUNT(*) FROM tpch.partsupp;
SELECT COUNT(*) FROM tpch.orders;
SELECT COUNT(*) FROM tpch.region;
SELECT COUNT(*) FROM tpch.part;
12 changes: 12 additions & 0 deletions experiments/tpch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ It also starts an evaluation dashboard.

Recommended settings: `tpch run -sf 1 -t 30 -dt`

For more detail about options.

## Tutorials

### Install Data

### Start a DBMS

### Start a DBMS and Load Data

### Start a DBMS and Load Data and Connect

## Options

```
Expand Down
8 changes: 8 additions & 0 deletions images/dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ RUN pip install dbmsbenchmarker

RUN pip install jupyter

RUN pip install jupyter_contrib_nbextensions

RUN jupyter contrib nbextension install --user

RUN jupyter nbextensions_configurator enable --user

RUN jupyter nbextension enable toc2/main

RUN git clone https://github.com/Beuth-Erdelt/DBMS-Benchmarker

WORKDIR /usr/src/app/DBMS-Benchmarker
Expand Down

0 comments on commit 1dc98c4

Please sign in to comment.