You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.2 KiB
93 lines
3.2 KiB
3 years ago
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
|
echo "*******************************"
|
||
|
echo "** rollout multiuser queries **"
|
||
|
echo "*******************************"
|
||
|
|
||
|
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||
|
parentPWD="$(dirname "$PWD")"
|
||
|
source $PWD/../functions.sh
|
||
|
|
||
|
GEN_DATA_SCALE=$1
|
||
|
EXPLAIN_ANALYZE=$2
|
||
|
RANDOM_DISTRIBUTION=$3
|
||
|
MULTI_USER_COUNT=$4
|
||
|
SINGLE_USER_ITERATIONS=$5
|
||
|
VERSION=$6
|
||
|
UTIL=$7
|
||
|
|
||
|
if [[ "$GEN_DATA_SCALE" == "" || "$EXPLAIN_ANALYZE" == "" || "$RANDOM_DISTRIBUTION" == "" || "$MULTI_USER_COUNT" == "" || "$SINGLE_USER_ITERATIONS" == "" ]]; then
|
||
|
echo "You must provide the scale as a parameter in terms of Gigabytes, true/false to run queries with EXPLAIN ANALYZE option, true/false to use random distribution, multi-user count, and the number of sql iterations."
|
||
|
echo "Example: ./rollout.sh 100 false false 5 1 exasol"
|
||
|
echo "This will create 100 GB of data for this test, not run EXPLAIN ANALYZE, not use random distribution and use 5 sessions for the multi-user test."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ "$MULTI_USER_COUNT" -eq "0" ]; then
|
||
|
echo "MULTI_USER_COUNT set at 0 so exiting..."
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
# Anlegen eines neuen ressource log files für jeden durchgeführten Lauf.
|
||
|
if [ -f $parentPWD/log/multi_run_log.01.1.txt ]; then
|
||
|
count=$(ls $parentPWD/log | grep 'multi_run_log' | wc -l)
|
||
|
count=$((count/2))
|
||
|
count=$((count+1))
|
||
|
if [ "${#count}" == 1 ]; then
|
||
|
multilog=$parentPWD/log/multi_run_log.0$count
|
||
|
touch $parentPWD/log/multi_run_ressource_log.0$count.txt
|
||
|
ressourcelogfile=$parentPWD/log/multi_run_ressource_log.0$count.txt
|
||
|
else
|
||
|
multilog=$parentPWD/log/multi_run_log.$count
|
||
|
touch $parentPWD/log/multi_run_ressource_log.$count.txt
|
||
|
ressourcelogfile=$parentPWD/log/multi_run_ressource_log.$count.txt
|
||
|
fi
|
||
|
else
|
||
|
multilog=$parentPWD/log/multi_run_log.01
|
||
|
touch $parentPWD/log/multi_run_ressource_log.01.txt
|
||
|
ressourcelogfile=$parentPWD/log/multi_run_ressource_log.01.txt
|
||
|
fi
|
||
|
|
||
|
# Logging der beanspruchten Ressourcen. Pid wird benutzt um später den Prozess beenden zu können. top -b -d 1
|
||
|
logging_pid=$(docker stats > $ressourcelogfile & echo $!)
|
||
|
|
||
|
# Erstellen der Queries für die multi user Durchläufe, wenn diese noch nicht erstellt wurden.
|
||
|
if [ ! -d $PWD/queries/qry1 ]; then
|
||
|
for i in $(seq 1 $MULTI_USER_COUNT); do
|
||
|
mkdir $PWD/queries/qry$i
|
||
|
|
||
|
cd $PWD/queries
|
||
|
for j in $(ls $PWD/*.sql | xargs -n 1 basename); do
|
||
|
q=$(echo $j | awk -F '.' '{print $1}')
|
||
|
id=$(printf %02d $q)
|
||
|
file_id="1""$id"
|
||
|
filename=$file_id.tpch.$id.sql
|
||
|
|
||
|
echo "./qgen $q >> $PWD/$i/$filename"
|
||
|
./qgen $q >> $PWD/qry$i/$filename
|
||
|
done
|
||
|
cd ..
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
sql_source_dir=$PWD/queries
|
||
|
# Für jeden Nutzer wird ein eigener Prozess zum Durchführen der Queries gestartet.
|
||
|
echo "Now executing queries. This may take a while."
|
||
|
touch $parentPWD/log/multi_user_runtime.txt
|
||
|
TOTAL_START=$(date +%s%N)
|
||
|
for i in $(seq 1 $MULTI_USER_COUNT); do
|
||
|
|
||
|
session_log=$PWD/../log/testing_session_$i.log
|
||
|
echo "$PWD/test.sh $i $sql_source_dir/qry$i $VERSION $UTIL $multilog.$i.txt"
|
||
|
$PWD/multi_user_query_run.sh $i $sql_source_dir/qry$i $VERSION $UTIL $multilog.$i.txt >> $session_log 2>&1 < $session_log &
|
||
|
|
||
|
done
|
||
|
wait
|
||
|
TOTAL_END=$(date +%s%N)
|
||
|
echo "It takes $((($TOTAL_END - $TOTAL_START)/1000000)) milliseconds to complete multi user run" >> $parentPWD/log/multi_user_runtime.txt
|
||
|
kill -9 $logging_pid
|
||
|
echo "queries complete"
|
||
|
echo ""
|
||
|
|