mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-18 21:44:02 +03:00
Add bench.lua for KIND_TEXT and fix bench.sh
This commit is contained in:
parent
af661c06ac
commit
e51adb71b8
@ -1,41 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
set -Eeo pipefail
|
||||
|
||||
|
||||
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
SCRIPT_LOCATION=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
MDB_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../..)
|
||||
|
||||
BRANCH="$1"
|
||||
SCRIPT="$2"
|
||||
DATA="$3"
|
||||
TABLE="t1"
|
||||
export TABLE
|
||||
|
||||
cleanup() {
|
||||
trap - SIGINT SIGTERM ERR EXIT
|
||||
if [ -f $DATA ]
|
||||
then
|
||||
sudo rm $DATA
|
||||
fi
|
||||
if [ -f "${BRANCH}_bench.txt" ]
|
||||
then
|
||||
sudo rm "${BRANCH}_bench.txt"
|
||||
fi
|
||||
if [ -f "develop_bench.txt" ]
|
||||
then
|
||||
sudo rm "develop_bench.txt"
|
||||
fi
|
||||
sysbench $SCRIPT --mysql-socket=/run/mysqld/mysqld.sock \
|
||||
--db-driver=mysql \
|
||||
--mysql-db=test \
|
||||
cleanup > /dev/null
|
||||
unset TABLE
|
||||
}
|
||||
|
||||
|
||||
source $MDB_SOURCE_PATH/columnstore/columnstore/build/utils.sh
|
||||
|
||||
@ -44,15 +15,34 @@ if [ "$EUID" -ne 0 ]
|
||||
exit 1
|
||||
fi
|
||||
|
||||
message "Usage: $(basename "${BASH_SOURCE[0]}") branch lua_script data [-h] [-t t1]
|
||||
|
||||
A script to run benchmark(for now) to compare the pefromanceo of min/max
|
||||
calculation on develop and provided branch. Runs the provided .lua script using sysbench.
|
||||
message "A script to run benchmark(for now) to compare the pefromanceo of min/max
|
||||
calculation for two provided branches. Runs the provided .lua script using sysbench.
|
||||
"
|
||||
optparse.define short=t long=table desc="Name of the test table" variable=TABLE
|
||||
optparse.define short=a long=branch1 desc="Branch1 to compare" variable=BRANCH1 default="develop"
|
||||
optparse.define short=b long=branch2 desc="Branch2 to compare" variable=BRANCH2
|
||||
optparse.define short=s long=script-bench desc="Lua benchmark script" variable=SCRIPT
|
||||
optparse.define short=g long=gen desc="Data generator for the test table(to be used by cpimport)" variable=GEN
|
||||
optparse.define short=n long=name desc="Name of the test table" variable=TABLE default="t1"
|
||||
optparse.define short=t long=time desc="Time (in seconds) to run the benchmark" variable=TIME default=120
|
||||
|
||||
source $( optparse.build )
|
||||
|
||||
export TABLE
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
cleanup() {
|
||||
trap - SIGINT SIGTERM ERR EXIT
|
||||
sysbench $SCRIPT --mysql-socket=/run/mysqld/mysqld.sock \
|
||||
--db-driver=mysql \
|
||||
--mysql-db=test \
|
||||
cleanup > /dev/null
|
||||
if [ -f "$DATA" ] ; then
|
||||
sudo rm "$DATA"
|
||||
fi
|
||||
unset TABLE
|
||||
}
|
||||
|
||||
|
||||
die() {
|
||||
local msg=$1
|
||||
local code=${2-1} # default exit status 1
|
||||
@ -60,11 +50,15 @@ die() {
|
||||
exit "$code"
|
||||
}
|
||||
|
||||
|
||||
cd $MDB_SOURCE_PATH/columnstore/columnstore/benchmarks
|
||||
|
||||
git checkout $BRANCH
|
||||
DATA=$(sudo mktemp -p /var)
|
||||
eval ./$GEN > "$DATA"
|
||||
|
||||
git checkout $BRANCH1
|
||||
sudo $MDB_SOURCE_PATH/columnstore/columnstore/build/bootstrap_mcs.sh -t RelWithDebInfo
|
||||
echo "Build done; benchmarking $BRANCH now"
|
||||
echo "Build done; benchmarking $BRANCH1 now"
|
||||
git checkout with_benchmarks
|
||||
#Prepare should only create the table, we will fill it with cpimport
|
||||
sysbench $SCRIPT \
|
||||
@ -75,15 +69,15 @@ sysbench $SCRIPT \
|
||||
|
||||
sudo cpimport test "$TABLE" "$DATA"
|
||||
|
||||
sysbench $SCRIPT \
|
||||
BRANCH1_DATA=$(sysbench $SCRIPT \
|
||||
--mysql-socket=/run/mysqld/mysqld.sock \
|
||||
--db-driver=mysql \
|
||||
--mysql-db=test \
|
||||
--time=120 run | tail -n +12 > "${BRANCH}_bench.txt"
|
||||
--time=$TIME run | tail -n +12)
|
||||
|
||||
git checkout develop
|
||||
git checkout $BRANCH2
|
||||
sudo $MDB_SOURCE_PATH/columnstore/columnstore/build/bootstrap_mcs.sh -t RelWithDebInfo
|
||||
echo "Build done; benchmarking develop now"
|
||||
echo "Build done; benchmarking $BRANCH2 now"
|
||||
git checkout with_benchmarks
|
||||
sysbench $SCRIPT \
|
||||
--mysql-socket=/run/mysqld/mysqld.sock \
|
||||
@ -93,10 +87,10 @@ sysbench $SCRIPT \
|
||||
|
||||
sudo cpimport test "$TABLE" "$DATA"
|
||||
|
||||
sysbench $SCRIPT \
|
||||
BRANCH2_DATA=$(sysbench $SCRIPT \
|
||||
--mysql-socket=/run/mysqld/mysqld.sock \
|
||||
--db-driver=mysql \
|
||||
--mysql-db=test \
|
||||
--time=120 run | tail -n +12 > develop_bench.txt
|
||||
--time=$TIME run | tail -n +12)
|
||||
|
||||
python3 parse_bench.py "$BRANCH" "${BRANCH}_bench.txt" "develop_bench.txt"
|
||||
python3 parse_bench.py "$BRANCH2" "$BRANCH1" "$BRANCH2_DATA" "$BRANCH1_DATA" "$TIME"
|
||||
|
24
benchmarks/parse_bench.py
Normal file → Executable file
24
benchmarks/parse_bench.py
Normal file → Executable file
@ -3,31 +3,27 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
branch_name = sys.argv[1]
|
||||
data_branch = []
|
||||
data_develop = []
|
||||
time_spent = 30
|
||||
branch1_name = sys.argv[1]
|
||||
branch2_name = sys.argv[2]
|
||||
data_branch = json.loads(sys.argv[3])
|
||||
data_develop = json.loads(sys.argv[4])
|
||||
time_spent = 120
|
||||
|
||||
with open(sys.argv[2],'r') as jf1:
|
||||
data_branch = json.load(jf1)
|
||||
|
||||
with open(sys.argv[3],'r') as jf2:
|
||||
data_develop = json.load(jf2)
|
||||
|
||||
time = '''Time spent: {time}'''.format(time = time_spent)
|
||||
time = '''Time spent: {time}'''.format(time = sys.argv[5])
|
||||
|
||||
comparison = '''Queries made:
|
||||
for {name}
|
||||
for {name1}
|
||||
-- {reads1} reads ({reads1ps} per second)
|
||||
-- {writes1} writes ({writes1ps} per second)
|
||||
-- {other1} other ({other1ps} per second)
|
||||
-- {total1} in total ({total1ps} per second)
|
||||
for develop
|
||||
for {name2}
|
||||
-- {reads2} reads ({reads2ps} per second)
|
||||
-- {writes2} writes ({writes2ps} per second)
|
||||
-- {other2} other ({other2ps} per second)
|
||||
-- {total2} in total ({total2ps} per second)
|
||||
'''.format(name = branch_name,
|
||||
'''.format(name1 = branch1_name,
|
||||
name2 = branch2_name,
|
||||
reads1 = data_branch[0]["queries"]["reads"],
|
||||
writes1 = data_branch[0]["queries"]["writes"],
|
||||
other1 = data_branch[0]["queries"]["other"],
|
||||
|
29
benchmarks/select_text_bench.lua
Normal file
29
benchmarks/select_text_bench.lua
Normal file
@ -0,0 +1,29 @@
|
||||
require("bench_report")
|
||||
|
||||
function prepare ()
|
||||
local i
|
||||
print("creating table...")
|
||||
db_query("create table if not exists " .. os.getenv("TABLE") .. " (c1 varchar(3))engine=columnstore")
|
||||
end
|
||||
|
||||
function cleanup()
|
||||
db_query("drop table if exists " .. os.getenv("TABLE"))
|
||||
end
|
||||
|
||||
function help()
|
||||
print("sysbench Lua demo; no special command line options available")
|
||||
end
|
||||
|
||||
function thread_init(thread_id)
|
||||
end
|
||||
|
||||
function thread_done(thread_id)
|
||||
db_disconnect()
|
||||
end
|
||||
|
||||
function event(thread_id)
|
||||
db_query("select c1 from " .. os.getenv("TABLE") .. " where c1 = 'aaa' or c1 = 'ccc'")
|
||||
end
|
||||
|
||||
sysbench.hooks.report_intermediate = sysbench.report_json
|
||||
sysbench.hooks.report_cumulative = sysbench.report_json
|
Loading…
x
Reference in New Issue
Block a user