Skip to content

Instantly share code, notes, and snippets.

@mziyabo
Last active October 3, 2017 07:10
Show Gist options
  • Save mziyabo/794e4cc3f3f1307402d806cca18caa8f to your computer and use it in GitHub Desktop.
Save mziyabo/794e4cc3f3f1307402d806cca18caa8f to your computer and use it in GitHub Desktop.
run OltpBench, progressively scaling warehouses on VOLTDB and/ MONETDB
#!/bin/bash
# Script to Load and Execute the tpcc benchmark to a database
echo Enter DatabaseType:
echo [0]. MONETDB
echo [1]. VOLTDB
echo -n DatabaseType:
read DatabaseType
if [ ! $DatabaseType ]
then
DatabaseType=MONETDB
fi
Benchmark=tpcc
OltpBenchPath=/home/researcher/oltpbench
ConfigDir=$OltpBenchPath'/config/'
ConfigFile=
ServerIP=
cd $OltpBenchPath
case $DatabaseType in
MONETDB)
ConfigFile=$(echo $ConfigDir'monetdb_tpch1.xml')
ServerIP=10.1.0.5
ProcessName=mserver5
;;
VOLTDB)
ConfigFile=$(echo $ConfigDir'voltdb_tpcc.xml')
ServerIP=10.1.0.7
ProcessName=java
;;
*)
ConfigFile=$ConfigDir'monetdb_tpch1.xml'
ServerIP=10.1.0.5
ProcessName=mserver5
;;
esac
function main()
{
if [ -f $ConfigFile ]
then
for warehouses in $(seq 2 2 20); do
create-schema
sed -ie s/\<scalefactor\>[0-9]*/\<scalefactor\>$warehouses/g $ConfigFile
load-data
get-osstatistics $warehouses
get-databasestatistics $warehouses
execute-benchmark $warehouses $DatabaseType "scalefactor"
done
else
echo Invalid Configuration File: $ConfigFile
exit 1
fi
}
function bench-terminal()
{
if [ -f $ConfigFile ]
then
create-schema
load-data
for terminal in $(seq 5 5 50); do
sed -ie s/\<terminals\>[0-9]*/\<terminals\>$terminals/g $ConfigFile
task=$(ssh $ServerIP -l researcher ./monitor-bench $DatabaseType terminals $terminal) &
execute-benchmark $terminal $DatabaseType "terminals"
# Destroy Job
kill -9 $(jobs -p $task)
ssh $ServerIP -l researcher kill -9 $(pgrep monitor-bench)
done
else
echo Invalid Configuration File: $ConfigFile
exit 1
fi
}
function create-schema() {
./oltpbenchmark -b $Benchmark -c $ConfigFile --create=true -v
}
function load-data() {
./oltpbenchmark -b $Benchmark -c $ConfigFile --load=true -v
}
function execute-benchmark() {
./oltpbenchmark -b $Benchmark -c $ConfigFile --execute=true -o $2'-tpcc-'$3'-'$1 -v
}
function get-osstatistics()
{
if [ $ DatabaseType ]
then
statistics=(rss,trs,sz,vsz,size,pmem,maj_flt,min_flt)
pid=$(ps -eo pid,fname|grep $ProcessName|cut -f2 -d ' ')
ssh $ServerIP -l researcher ps -p $pid -o $statistics > $DatabaseType'-osstatistics-scalingfactor-'$1
fi
}
function get-databasestatistics()
{
case $DatabaseType in
MONETDB)
ssh $ServerIP mclient -d tpcc -s "SELECT table,column,location,heapsize,columnsize,typewidth from sys.storage where table in ('customer','district','history','item','new_order','oorder','order_line','stock','warehouse');" > $DatabaseType'-storagestatistics-scalingfactor-'$1
;;
VOLTDB)
ssh $ServerIP ~/get-databasestatistics.sh > $DatabaseType'-memorystatistics-scalingfactor-'$1
;;
esac
}
# Run Benchmark-Monitoring
bench-terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment