Skip to content

Commit

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

* Docs: Monitoring

* K8s: v1apps.list_namespaced_deployment (new K8s version in cluster)

* K8s: Resultfolder as attribute of cluster object

* Masterscript: K8s store number of requested gpus

* Masterscript: K8s run shell scripts for loading data

* Masterscript: Allow list of jars per dbms

* Requirements: Allow current versions

* TPC-H: New specifics

* Masterscript: K8s monitoring as option

* Masterscript: K8s optional UPPER parameter of db and schema

* Masterscript: K8s DEPRECATED: we must know all jars upfront

* TPC-H: DDL for MariaDB Columnstore

* TPC-H: Bigint at MonetDB

* TPC-H: SQL Server precision and DB

* TPC-H: OmniSci sharding

* TPC-H: OmniSci template
  • Loading branch information
perdelt committed Jan 14, 2021
1 parent 2c4e56e commit c52d5bd
Show file tree
Hide file tree
Showing 14 changed files with 1,136 additions and 60 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This documentation
* OmniSci
* PostgreSQL
* illustrates the deployment in [Kubernetes](docs/Deployments.md)
* illustrates the usage of [Monitoring](docs/Monitoring.md)
* provides [more detailed examples](docs/Examples.md)
* [Example: TPC-H Benchmark for 3 DBMS on 1 Virtual Machine](docs/Examples.md#example-tpc-h-benchmark-for-3-dbms-on-1-virtual-machine)
* [Example: TPC-H Benchmark for 1 DBMS on 3 Virtual Machines](docs/Examples.md#example-tpc-h-benchmark-for-1-dbms-on-3-virtual-machines)
Expand Down
7 changes: 6 additions & 1 deletion bexhoma/masterAWS.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,12 @@ def runBenchmarks(self, connection=None, code=None, info='', resultfolder='', co
self.benchmark.connections.append(c)
self.benchmark.dbms[c['name']] = tools.dbms(c, False)
# we must know all jars upfront
tools.dbms.jars = [d['template']['JDBC']['jar'] for c,d in self.config['dockers'].items()]
tools.dbms.jars = []
for c,d in self.config['dockers'].items():
if isinstance(d['template']['JDBC']['jar'], list):
tools.dbms.jars.extend(d['template']['JDBC']['jar'])
else:
tools.dbms.jars.append(d['template']['JDBC']['jar'])
# write appended connection config
filename = self.benchmark.path+'/connections.config'
with open(filename, 'w') as f:
Expand Down
30 changes: 23 additions & 7 deletions bexhoma/masterK8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, clusterconfig='cluster.config', configfolder='experiments/',
configfile=f.read()
self.config = eval(configfile)
self.configfolder = configfolder
self.resultfolder = self.config['benchmarker']['resultfolder']
self.queryfile = queryfile
self.clusterconfig = clusterconfig
self.timeLoading = 0
Expand All @@ -59,6 +60,7 @@ def __init__(self, clusterconfig='cluster.config', configfolder='experiments/',
self.workload = {}
self.host = 'localhost'
self.port = self.config['credentials']['k8s']['port']
self.monitoring_active = True
# k8s:
self.namespace = self.config['credentials']['k8s']['namespace']
self.appname = self.config['credentials']['k8s']['appname']
Expand Down Expand Up @@ -255,6 +257,7 @@ def generateDeployment(self):
limit_cpu = cpu
req_mem = mem
limit_mem = mem
req_gpu = gpu
node_cpu = ''
node_gpu = node
# should be overwritten by resources dict?
Expand All @@ -276,6 +279,7 @@ def generateDeployment(self):
self.resources['requests'] = {}
self.resources['requests']['cpu'] = req_cpu
self.resources['requests']['memory'] = req_mem
self.resources['requests']['gpu'] = req_gpu
self.resources['limits'] = {}
self.resources['limits']['cpu'] = limit_cpu
self.resources['limits']['memory'] = limit_mem
Expand All @@ -299,7 +303,7 @@ def generateDeployment(self):
if not 'nodeSelector' in dep['spec']['template']['spec']:
dep['spec']['template']['spec']['nodeSelector'] = {}
dep['spec']['template']['spec']['nodeSelector']['gpu'] = node_gpu
dep['spec']['template']['spec']['containers'][0]['resources']['limits']['nvidia.com/gpu'] = int(gpu)
dep['spec']['template']['spec']['containers'][0]['resources']['limits']['nvidia.com/gpu'] = int(req_gpu)
# add resource cpu
#if node_cpu:
if not 'nodeSelector' in dep['spec']['template']['spec']:
Expand All @@ -326,7 +330,7 @@ def deleteDeployment(self, deployment):
self.kubectl('kubectl delete deployment '+deployment)
def getDeployments(self):
try:
api_response = self.v1beta.list_namespaced_deployment(self.namespace, label_selector='app='+self.appname)
api_response = self.v1apps.list_namespaced_deployment(self.namespace, label_selector='app='+self.appname)
#pprint(api_response)
if len(api_response.items) > 0:
return [p.metadata.name for p in api_response.items]
Expand Down Expand Up @@ -514,9 +518,14 @@ def loadData(self):
print("loadData")
self.timeLoadingStart = default_timer()
scriptfolder = '/data/{experiment}/{docker}/'.format(experiment=self.configfolder, docker=self.d)
shellcommand = 'sh {scriptname}'
commands = self.initscript
for c in commands:
self.executeCTL(self.docker['loadData'].format(scriptname=scriptfolder+c))
filename, file_extension = os.path.splitext(c)
if file_extension.lower() == '.sql':
self.executeCTL(self.docker['loadData'].format(scriptname=scriptfolder+c))
elif file_extension.lower() == '.sh':
self.executeCTL(shellcommand.format(scriptname=scriptfolder+c))
self.timeLoadingEnd = default_timer()
self.timeLoading = self.timeLoadingEnd - self.timeLoadingStart
def getMemory(self):
Expand Down Expand Up @@ -688,7 +697,7 @@ def runBenchmarks(self, connection=None, code=None, info=[], resultfolder='', co
c['connectionmanagement']['timeout'] = self.connectionmanagement['timeout']
c['connectionmanagement']['singleConnection'] = self.connectionmanagement['singleConnection'] if 'singleConnection' in self.connectionmanagement else False
c['monitoring'] = {}
if 'monitor' in self.config['credentials']['k8s']:
if self.monitoring_active and 'monitor' in self.config['credentials']['k8s']:
if 'grafanatoken' in self.config['credentials']['k8s']['monitor']:
c['monitoring']['grafanatoken'] = self.config['credentials']['k8s']['monitor']['grafanatoken']
if 'grafanaurl' in self.config['credentials']['k8s']['monitor']:
Expand All @@ -708,7 +717,7 @@ def runBenchmarks(self, connection=None, code=None, info=[], resultfolder='', co
for metricname, metricdata in self.config['credentials']['k8s']['monitor']['metrics'].items():
c['monitoring']['metrics'][metricname] = metricdata.copy()
c['monitoring']['metrics'][metricname]['query'] = c['monitoring']['metrics'][metricname]['query'].format(host=node, gpuid=gpuid)
c['JDBC']['url'] = c['JDBC']['url'].format(serverip='localhost', dbname=self.v)
c['JDBC']['url'] = c['JDBC']['url'].format(serverip='localhost', dbname=self.v, DBNAME=self.v.upper())
if code is not None:
resultfolder += '/'+str(code)
self.benchmark = benchmarker.benchmarker(
Expand All @@ -730,8 +739,15 @@ def runBenchmarks(self, connection=None, code=None, info=[], resultfolder='', co
else:
self.benchmark.connections.append(c)
self.benchmark.dbms[c['name']] = tools.dbms(c, False)
# we must know all jars upfront
tools.dbms.jars = [d['template']['JDBC']['jar'] for c,d in self.config['dockers'].items()]
# DEPRECATED: we must know all jars upfront
"""
tools.dbms.jars = []
for c,d in self.config['dockers'].items():
if isinstance(d['template']['JDBC']['jar'], list):
tools.dbms.jars.extend(d['template']['JDBC']['jar'])
else:
tools.dbms.jars.append(d['template']['JDBC']['jar'])
"""
# write appended connection config
filename = self.benchmark.path+'/connections.config'
with open(filename, 'w') as f:
Expand Down
137 changes: 137 additions & 0 deletions docs/Monitoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Monitoring

To include monitoring you will need
* a Prometheus server scraping a fixed IP / Port
* a Grafana server collecting metrics from the Prometheus server
* some [configuration](#configuration) what metrics to collect

This document contains information about the
* [Concept](#concept)
* [Installation](#installation)
* [Configuration](#configuration)

## Concept

<p align="center">
<img src="architecture.png" width="640">
</p>

There is
* an Experiment Host - this needs Prometheus exporters
* a Monitor - this needs a Prometheus server and a Grafana server scraping the Experiment Host
* a Manager - this needs a configuration (which metrics to collect and where from)

## Installation

To be documented

### Kubernetes

* Experiment Host: Exporters are part of the [deployments](Deployments.md)
* Monitor: Servers are deployed using Docker images, fixed on a separate monitoring instance
* Manager: See [configuration](#configuration)

### AWS

* Experiment Host: Exporters are deployed using Docker images, fixed on the benchmarked instance
* Monitor: Servers are deployed using Docker images, fixed on a separate monitoring instance
* Manager: See [configuration](#configuration)

## Configuration

We insert information about
* the Grafana server
* access token
* URL
* the collection
* extension of measure intervals
* time shift
* metrics definitions

into the cluster configuration.
This is handed over to the [DBMS configuration](https://github.com/Beuth-Erdelt/DBMS-Benchmarker/blob/master/docs/Options.md#connection-file) of the [benchmarker](https://github.com/Beuth-Erdelt/DBMS-Benchmarker/blob/master/docs/Concept.md#monitoring-hardware-metrics).

### Example

The details of the metrics correspond to the YAML configuration of the [deployments](Deployments.md):
* `job="monitor-node"`
* `container_name="dbms"`


```
'monitor': {
'grafanatoken': 'Bearer ABCDE==',
'grafanaurl': 'http://localhost:3000/api/datasources/proxy/1/api/v1/',
'grafanaextend': 20,
'grafanashift': 0,
'metrics': {
'total_cpu_memory': {
'query': 'container_memory_working_set_bytes{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}}',
'title': 'CPU Memory [MiB]'
},
'total_cpu_memory_cached': {
'query': 'container_memory_usage_bytes{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}}',
'title': 'CPU Memory Cached [MiB]'
},
'total_cpu_util': {
'query': 'sum(irate(container_cpu_usage_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}}[1m]))',
'title': 'CPU Util [%]'
},
'total_cpu_throttled': {
'query': 'sum(irate(container_cpu_cfs_throttled_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}}[1m]))',
'title': 'CPU Throttle [%]'
},
'total_cpu_util_others': {
'query': 'sum(irate(container_cpu_usage_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name!="dbms",id!="/"}}[1m]))',
'title': 'CPU Util Others [%]'
},
'total_cpu_util_s': {
'query': 'sum(container_cpu_usage_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}})',
'title': 'CPU Util [s]'
},
'total_cpu_throttled_s': {
'query': 'sum(container_cpu_cfs_throttled_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}})',
'title': 'CPU Throttle [s]'
},
'total_cpu_util_others_s': {
'query': 'sum(container_cpu_usage_seconds_total{{job="monitor-node", container_label_io_kubernetes_container_name!="dbms",id!="/"}})',
'title': 'CPU Util Others [s]'
},
'total_network_rx': {
'query': 'sum(container_network_receive_bytes_total{{container_label_app="dbmsbenchmarker", job="monitor-node"}})',
'title': 'Net Rx [b]'
},
'total_network_tx': {
'query': 'sum(container_network_transmit_bytes_total{{container_label_app="dbmsbenchmarker", job="monitor-node"}})',
'title': 'Net Tx [b]'
},
'total_fs_read': {
'query': 'sum(container_fs_reads_bytes_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}})',
'title': 'FS Read [b]'
},
'total_fs_write': {
'query': 'sum(container_fs_writes_bytes_total{{job="monitor-node", container_label_io_kubernetes_container_name="dbms"}})',
'title': 'FS Write [b]'
},
'total_gpu_util': {
'query': 'sum(DCGM_FI_DEV_GPU_UTIL{{UUID=~"{gpuid}"}})',
'title': 'GPU Util [%]'
},
'total_gpu_power': {
'query': 'sum(DCGM_FI_DEV_POWER_USAGE{{UUID=~"{gpuid}"}})',
'title': 'GPU Power Usage [W]'
},
'total_gpu_memory': {
'query': 'sum(DCGM_FI_DEV_FB_USED{{UUID=~"{gpuid}"}})',
'title': 'GPU Memory [MiB]'
},
}
}
```

#### Fine Tuning

If the Grafana server has metrics coming from general Prometheus server, that is it scrapes more exporters than just the bexhoma related, we will need to specify further which metrics we are interested in.

There is a placeholder `{gpuid}` that is substituted automatically by a list of GPUs present in the pod.

8 changes: 8 additions & 0 deletions experiments/tpch/MariaDBCS/initdata-tpch-SF1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cpimport tpch nation /data/tpch/SF1/nation.tbl
cpimport tpch region /data/tpch/SF1/region.tbl
cpimport tpch part /data/tpch/SF1/part.tbl
cpimport tpch supplier /data/tpch/SF1/supplier.tbl
cpimport tpch partsupp /data/tpch/SF1/partsupp.tbl
cpimport tpch customer /data/tpch/SF1/customer.tbl
cpimport tpch orders /data/tpch/SF1/orders.tbl
cpimport tpch lineitem /data/tpch/SF1/lineitem.tbl
74 changes: 74 additions & 0 deletions experiments/tpch/MariaDBCS/initschema-tpch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
CREATE DATABASE tpch;
CREATE USER 'benchmark'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'benchmark'@'%' WITH GRANT OPTION;

-- sccsid: @(#)dss.ddl 2.1.8.1
create table tpch.nation ( n_nationkey integer not null,
n_name char(25) not null,
n_regionkey integer not null,
n_comment varchar(152)) engine=columnstore;

create table tpch.region ( r_regionkey integer not null,
r_name char(25) not null,
r_comment varchar(152)) engine=columnstore;

create table tpch.part ( p_partkey integer not null,
p_name varchar(55) not null,
p_mfgr char(25) not null,
p_brand char(10) not null,
p_type varchar(25) not null,
p_size integer not null,
p_container char(10) not null,
p_retailprice decimal(15,2) not null,
p_comment varchar(23) not null ) engine=columnstore;

create table tpch.supplier ( s_suppkey integer not null,
s_name char(25) not null,
s_address varchar(40) not null,
s_nationkey integer not null,
s_phone char(15) not null,
s_acctbal decimal(15,2) not null,
s_comment varchar(101) not null) engine=columnstore;

create table tpch.partsupp ( ps_partkey integer not null,
ps_suppkey integer not null,
ps_availqty integer not null,
ps_supplycost decimal(15,2) not null,
ps_comment varchar(199) not null ) engine=columnstore;

create table tpch.customer ( c_custkey integer not null,
c_name varchar(25) not null,
c_address varchar(40) not null,
c_nationkey integer not null,
c_phone char(15) not null,
c_acctbal decimal(15,2) not null,
c_mktsegment char(10) not null,
c_comment varchar(117) not null) engine=columnstore;

create table tpch.orders ( o_orderkey integer not null,
o_custkey integer not null,
o_orderstatus char(1) not null,
o_totalprice decimal(15,2) not null,
o_orderdate date not null,
o_orderpriority char(15) not null,
o_clerk char(15) not null,
o_shippriority integer not null,
o_comment varchar(79) not null) engine=columnstore;

create table tpch.lineitem ( l_orderkey integer not null,
l_partkey integer not null,
l_suppkey integer not null,
l_linenumber integer not null,
l_quantity decimal(15,2) not null,
l_extendedprice decimal(15,2) not null,
l_discount decimal(15,2) not null,
l_tax decimal(15,2) not null,
l_returnflag char(1) not null,
l_linestatus char(1) not null,
l_shipdate date not null,
l_commitdate date not null,
l_receiptdate date not null,
l_shipinstruct char(25) not null,
l_shipmode char(10) not null,
l_comment varchar(44) not null) engine=columnstore;

0 comments on commit c52d5bd

Please sign in to comment.