Compare commits

...

29 commits

Author SHA1 Message Date
rand00
2ee733523c packaging/perftest/unipi/plot.sh: Added response-time and transactions/sec plots 2023-01-17 13:12:55 +01:00
rand00
3f8bfb9fa8 packaging/perftest/unipi/plot.sh: Title is now different from FS name + added informative y-label 2023-01-17 11:55:30 +01:00
rand00
2ffbf66053 packaging/perftest/unipi/plot.sh: Fixed ordering of build data 2023-01-17 11:45:25 +01:00
rand00
82622a9b46 packaging/perftest/unipi/run-test-remotely.sh: Fixed that cleanup + killing of daemons should always be done + checking if running 2023-01-17 11:20:41 +01:00
rand00
e27ca992bf packaging/perftest/unipi/plot.sh: Bettered plot output in several ways 2023-01-17 11:19:41 +01:00
rand00
0ae2602172 packaging/perftest_all.sh: Fixed some bugs and tried to fix that all builds are not gone through - but works by running again?? 2023-01-17 11:18:51 +01:00
rand00
0af832075f packaging/perftest.sh: Added force-parameter 2023-01-17 11:17:55 +01:00
rand00
68c0c74d37 packaging/perftest.sh: Fixed documentation + removed unused line 2023-01-16 14:45:58 +01:00
rand00
85a4a4784c packaging/perftest_all.sh: Added script to run performance-tests on all builds for a given job 2023-01-13 13:49:32 +01:00
rand00
20bc1785d0 Perftest: Fixed plot script semantics + made perftest.sh work with args given from builder-web ++ 2023-01-12 16:58:26 +01:00
rand00
932d10cbaf Perftest: shellcheck 2023-01-12 15:36:19 +01:00
rand00
74269e4ccd packaging/perftest.sh: Moved some variables up into new 'configure per system' section 2023-01-12 15:27:33 +01:00
rand00
7a0cdcbae5 Perftest: All scripts works now - tested by ssh'ing to same machine (need to configure some variables to fit other machines) 2023-01-11 18:48:34 +01:00
rand00
ee2d467678 Perftest: Changed scripts for new directory structure 2023-01-10 16:49:44 +01:00
rand00
bdb01be93b packaging/perftest/unipi/run-test-on-vm.sh: Fixed that ssh didn't run scripts from right dir 2023-01-03 17:20:59 +01:00
rand00
d2d1068d10 packaging/perftest.sh: Renaming of run-test.sh to not name-collide with unipi script + passing server-dir 2022-12-21 12:50:09 +01:00
rand00
3aea44f661 packaging/perftest/unipi/run-test-on-vm.sh: A script to manage and run the test on VM 2022-12-21 12:48:58 +01:00
rand00
49f9101e8b packaging/perftest.sh: Moved exit-logic for when test-results exist 2022-12-21 12:00:20 +01:00
rand00
8c776912f7 packaging/perftest/unipi/plot.sh: Removed now unneccesary 'echo' 2022-12-21 11:52:01 +01:00
rand00
8a45a3e522 packaging/perftest/unipi/plot.sh: Fixed plot title to 'throughput' 2022-12-20 21:28:06 +01:00
rand00
99f2788ec0 packaging/perftest/unipi/plot.sh: Skipping build if 'siege.csv' doesn't exist 2022-12-20 21:26:22 +01:00
rand00
f9375f0828 packaging/perftest/unipi/plot.sh: Plotting throughput column 2022-12-20 21:20:59 +01:00
rand00
34aa7a767a packaging/perftest/unipi/plot.sh: Prefixing build UUID to each row in DAT file 2022-12-20 21:18:56 +01:00
rand00
dd6f054a88 packaging/perftest/unipi/plot.sh: WIP: Added plotting script for unipi - missing a few things 2022-12-20 21:09:39 +01:00
rand00
f67c2f6fa9 packaging/perftest.sh: Checking DB and APP versions + passing more args to unipi/plot.sh 2022-12-20 21:08:16 +01:00
rand00
13612c59a5 packaging/perftest.sh: Passing dependencies to unipi perftest scripts 2022-12-20 15:14:31 +01:00
rand00
0176e8c5bb packaging/perftest.sh: Better printed message 2022-12-20 15:04:52 +01:00
rand00
cd26ddcd75 packaging/perftest.sh: Fixed documentation 2022-12-20 15:03:09 +01:00
rand00
db82447841 packaging/perftest.sh: Hook script for running performance tests on binary upload 2022-12-20 14:14:59 +01:00
4 changed files with 509 additions and 0 deletions

146
packaging/perftest.sh Executable file
View file

@ -0,0 +1,146 @@
#!/bin/sh
set -e
#set -x
#> Note: this script lies within <conf-dir>/upload_hooks
CONF_DIR="$(dirname "${0}")"/..
prog_NAME=$(basename "${0}")
warn()
{
echo "${prog_NAME}: WARN: $*"
}
info()
{
echo "${prog_NAME}: INFO: $*"
}
err()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
}
die()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
exit 1
}
usage()
{
cat <<EOM 1>&2
usage: ${prog_NAME} [ OPTIONS ] <main_binary_localpath>
Starts up a performance-test if job is supported and the binary has not been tested before.
In the end a new histogram-plot is generated containing all the results over time.
Options:
--uuid=STRING
UUID of build.
--job=STRING
The job name of the build.
--sha256=STRING
The SHA256 hash of the main binary.
--data-dir=STRING
Path to the data directory.
--cache-dir=STRING
Path to the cache directory.
EOM
exit 1
}
UUID=
JOB=
BIN_SHA256=
CACHE_DIR=
DATA_DIR=
FORCE="false"
while [ $# -gt 1 ]; do
OPT="$1"
case "${OPT}" in
--uuid=*)
UUID="${OPT##*=}"
;;
--job=*)
JOB="${OPT##*=}"
;;
--sha256=*)
BIN_SHA256="${OPT##*=}"
;;
--cache-dir=*)
CACHE_DIR="${OPT##*=}"
;;
--data-dir=*)
DATA_DIR="${OPT##*=}"
;;
--force)
FORCE="true"
;;
*)
warn "Ignoring unknown option: '${OPT}' (Note that this script reads DB)"
;;
esac
shift
done
[ -z "${UUID}" ] && die "The --uuid option must be specified"
[ -z "${JOB}" ] && die "The --job option must be specified"
[ -z "${BIN_SHA256}" ] && die "The --sha256 option must be specified"
[ -z "${CACHE_DIR}" ] && die "The --cache-dir option must be specified"
[ -z "${DATA_DIR}" ] && die "The --data-dir option must be specified"
BIN="$1"
[ -z "${BIN}" ] && \
die "The main binarys localpath must be given as the first positional argument"
BIN_EXT=$(echo "$BIN" | sed 's/.*\.\(.*\)/\1/')
# >>> CONFIGURE PER SYSTEM
SERVER="starand"
SERVER_DIR="0tmp/robur_perftest"
# <<< --------------------
info "processing UUID '$UUID'"
DB="${DATA_DIR}/builder.sqlite3"
[ ! -e "$DB" ] && die "The database doesn't exist: '$DB'"
DB_VERSION="$(sqlite3 "$DB" "PRAGMA user_version;")"
[ -z "$DB_VERSION" ] && die "Couldn't read database version from '$DB'"
[ "$DB_VERSION" -lt 16 ] && die "The database version should be >= 16. It is '$DB_VERSION'"
APP_ID="$(sqlite3 "$DB" "PRAGMA application_id;")"
[ -z "$APP_ID" ] && die "Couldn't read application-id from '$DB'"
[ "$APP_ID" -ne 1234839235 ] && die "The application-id should be = 1234839235. It is '$APP_ID'"
PERFJOB_DIR="$DATA_DIR/_perftest/$JOB"
PERFSCRIPT_DIR="$CONF_DIR/perftest/$JOB"
PERFDATA_DIR="$PERFJOB_DIR/$BIN_SHA256"
if [ -d "$PERFDATA_DIR" -o "$FORCE" = "true" ]; then
info "$PERFDATA_DIR already exists, exiting"
exit 0
fi
case "${JOB},${BIN_EXT}" in
unipi,hvt)
"$PERFSCRIPT_DIR"/run-test-remotely.sh "$PERFSCRIPT_DIR"/remote "$PERFDATA_DIR" "$BIN" "$SERVER" "$SERVER_DIR"
"$PERFSCRIPT_DIR"/plot.sh "$PERFJOB_DIR" "$CACHE_DIR" "$DB" "$JOB" "$UUID"
;;
*)
info "Job '${JOB}' compiled to the '${BIN_EXT}'-target doesn't support performance-testing"
;;
esac
info done

160
packaging/perftest/unipi/plot.sh Executable file
View file

@ -0,0 +1,160 @@
#! /bin/bash
set -e
prog_NAME=$(basename "${0}")
warn()
{
echo "${prog_NAME}: WARN: $*"
}
info()
{
echo "${prog_NAME}: INFO: $*"
}
err()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
}
die()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
exit 1
}
PERFJOB_DIR="$1"
CACHE_DIR="$2"
DB="$3"
JOB="$4"
LATEST_UUID="$5"
DIMS=1920,1080
COLS=5,6,7,8 #resp-time, transaction-rate, throughput, concurrent
#< Note: gnuplot can select the final columns
DAT="${PERFJOB_DIR}/tmp.dat"
#> Note: ordering desc for plot ordering left->right
get_jobs_build-uuids () {
sqlite3 "$DB" "select b.uuid from build as b \
join job as j on j.id = b.job\
where j.name = '$JOB' \
order by b.start_d asc, b.start_ps asc"
}
get_bin_hash () {
UUID="$1"
sqlite3 "$DB" "SELECT lower(hex(ba.sha256)) FROM build AS b
JOIN build_artifact AS ba ON ba.id = b.main_binary
WHERE uuid = '$UUID'"
}
N=0
while read -r UUID; do
BIN_SHA256=$(get_bin_hash "$UUID")
CSV="${PERFJOB_DIR}/${BIN_SHA256}/siege_test01.csv"
if [ ! -f "$CSV" ]; then
info "Skipping build with uuid '$UUID'. Test-data doesn't exist: '$CSV'"
continue
fi
if [ $N = 0 ]; then
echo -n "# Build UUID - " > "$DAT"
cat "$CSV" | head -n1 | cut -d, -f"$COLS" \
| sed 's/,//g' \
| sed 's/ \+//' \
| sed 's/\( \+\)/ -\1/g' \
>> "$DAT"
fi
#goto validate csv file, and on invalid: append error-data instead
info appending line from "$CSV" of uuid "$UUID"
UUID_CUT=$(echo "$UUID" | cut -d- -f1)
echo -n "$UUID_CUT " >> "$DAT"
cat "$CSV" | tail +2 | cut -d, -f"$COLS" \
| sed 's/,//g' \
| sed 's/ \+//' \
>> "$DAT"
N=$(($N + 1))
done < <(get_jobs_build-uuids)
PLOT_VERSION=1
PLOT_NAME="throughput"
PLOT_TITLE="Throughput for 30 concurrent threads"
OUT_DIR="${CACHE_DIR}/perftest/${JOB}/${PLOT_NAME}_${PLOT_VERSION}"
if [ ! -e "$OUT_DIR" ]; then
mkdir -p "$OUT_DIR"
fi
OUT_IMG="${OUT_DIR}/${LATEST_UUID}.png"
info generating plot: "$OUT_IMG"
gnuplot >"$OUT_IMG" <<EOF
set terminal png size $DIMS background rgb "gray40"
set output '$OUT_IMG'
set title '$PLOT_TITLE'
set style data histograms
set style histogram clustered gap 2
set style fill solid 1.0 border lt -1
set xlabel "build UUID"
set ylabel "Avg. bytes/sec"
plot '$DAT' using 4:xtic(1)
EOF
PLOT_VERSION=1
PLOT_NAME="transaction_rate"
PLOT_TITLE="Transaction rate for 30 concurrent threads"
OUT_DIR="${CACHE_DIR}/perftest/${JOB}/${PLOT_NAME}_${PLOT_VERSION}"
if [ ! -e "$OUT_DIR" ]; then
mkdir -p "$OUT_DIR"
fi
OUT_IMG="${OUT_DIR}/${LATEST_UUID}.png"
info generating plot: "$OUT_IMG"
gnuplot >"$OUT_IMG" <<EOF
set terminal png size $DIMS background rgb "gray40"
set output '$OUT_IMG'
set title '$PLOT_TITLE'
set style data histograms
set style histogram clustered gap 2
set style fill solid 1.0 border lt -1
set xlabel "build UUID"
set ylabel "Avg. transactions/sec"
plot '$DAT' using 3:xtic(1)
EOF
PLOT_VERSION=1
PLOT_NAME="response_time"
PLOT_TITLE="Response time for 30 concurrent threads"
OUT_DIR="${CACHE_DIR}/perftest/${JOB}/${PLOT_NAME}_${PLOT_VERSION}"
if [ ! -e "$OUT_DIR" ]; then
mkdir -p "$OUT_DIR"
fi
OUT_IMG="${OUT_DIR}/${LATEST_UUID}.png"
info generating plot: "$OUT_IMG"
gnuplot >"$OUT_IMG" <<EOF
set terminal png size $DIMS background rgb "gray40"
set output '$OUT_IMG'
set title '$PLOT_TITLE'
set style data histograms
set style histogram clustered gap 2
set style fill solid 1.0 border lt -1
set xlabel "build UUID"
set ylabel "Avg. response-time/req in ms"
plot '$DAT' using 2:xtic(1)
EOF
#rm "$DAT"
info done

View file

@ -0,0 +1,82 @@
#! /bin/bash
set -e
prog_NAME=$(basename "${0}")
warn()
{
echo "${prog_NAME}: WARN: $*"
}
info()
{
echo "${prog_NAME}: INFO: $*"
}
err()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
}
die()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
exit 1
}
PERFSCRIPT_DIR="$1"
PERFDATA_DIR="$2"
BIN="$3"
SERVER="$4"
SERVER_DIR="$5"
SERVER_W_DIR="$SERVER:$SERVER_DIR"
SSH="ssh $SERVER"
scp "$BIN" "$SERVER_W_DIR"
scp -r "$PERFSCRIPT_DIR"/* "$SERVER_W_DIR"
cleanup () {
info killing unikernel
$SSH "cd $SERVER_DIR; kill "'$(cat run-unikernel.sh.PID)' || info .. unikernel not running
info killing git daemon
$SSH "cd $SERVER_DIR; kill "'$(cat init.sh.PID)' || info .. git daemon not running
info running cleanup.sh
$SSH "cd $SERVER_DIR; ./cleanup.sh"
}
trap cleanup EXIT
info initializing context for unikernel
$SSH "cd $SERVER_DIR; ./init.sh" &
info sleeping before starting unipi
sleep 5
info checking if git daemon is still running
$SSH "cd $SERVER_DIR; kill -0 "'$(cat init.sh.PID)'
info running unikernel in background
$SSH "cd $SERVER_DIR; ./run-unikernel.sh" &
info sleeping a bit before test
sleep 5
info checking if unikernel is still running
$SSH "cd $SERVER_DIR; kill -0 "'$(cat run-unikernel.sh.PID)'
info running test
$SSH "cd $SERVER_DIR; ./run-test.sh"
info copying results to "$PERFDATA_DIR"
if [ ! -e "$PERFDATA_DIR" ]; then
mkdir -p "$PERFDATA_DIR"
fi
scp "${SERVER_W_DIR}/output/*" "$PERFDATA_DIR"/
info successfully run test

121
packaging/perftest_all.sh Executable file
View file

@ -0,0 +1,121 @@
#!/bin/bash
set -e
prog_NAME=$(basename "${0}")
warn()
{
echo "${prog_NAME}: WARN: $*"
}
info()
{
echo "${prog_NAME}: INFO: $*"
}
err()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
}
die()
{
echo "${prog_NAME}: ERROR: $*" 1>&2
exit 1
}
usage()
{
cat <<EOM 1>&2
usage: ${prog_NAME} [ OPTIONS ]
Starts up a performance-test if job is supported and the binary has not been tested before.
In the end a new histogram-plot is generated containing all the results over time.
Options:
--job=STRING
The job name of the build.
--data-dir=STRING
Path to the data directory.
--cache-dir=STRING
Path to the cache directory.
--conf-dir=STRING
Path to the configuration directory.
EOM
exit 1
}
JOB=
DATA_DIR=
CACHE_DIR=
CONF_DIR=
while [ $# -gt 0 ]; do
OPT="$1"
case "${OPT}" in
--job=*)
JOB="${OPT##*=}"
;;
--data-dir=*)
DATA_DIR="${OPT##*=}"
;;
--cache-dir=*)
CACHE_DIR="${OPT##*=}"
;;
--conf-dir=*)
CONF_DIR="${OPT##*=}"
;;
*)
warn "Ignoring unknown option: '${OPT}' (Note that this script reads DB)"
;;
esac
shift
done
[ -z "${JOB}" ] && die "The --job option must be specified"
[ -z "${CACHE_DIR}" ] && die "The --cache-dir option must be specified"
[ -z "${DATA_DIR}" ] && die "The --data-dir option must be specified"
[ -z "${CONF_DIR}" ] && die "The --conf-dir option must be specified"
DB="${DATA_DIR}/builder.sqlite3"
[ ! -e "$DB" ] && die "The database doesn't exist: '$DB'"
get_jobs_build-uuids () {
sqlite3 "$DB" "select b.uuid from build as b \
join job as j on j.id = b.job\
where j.name = '$JOB' \
order by b.id desc"
}
get_bin_hash () {
UUID="$1"
sqlite3 "$DB" "SELECT lower(hex(ba.sha256)) FROM build AS b
JOIN build_artifact AS ba ON ba.id = b.main_binary
WHERE uuid = '$UUID'"
}
get_bin_localpath () {
UUID="$1"
sqlite3 "$DB" "SELECT ba.localpath FROM build AS b
JOIN build_artifact AS ba ON ba.id = b.main_binary
WHERE uuid = '$UUID'"
}
TMP_UUIDS=/tmp/perftest_uuids.txt
get_jobs_build-uuids > "$TMP_UUIDS"
while read -r UUID; do
BIN="$DATA_DIR"/$(get_bin_localpath "$UUID")
BIN_SHA256=$(get_bin_hash "$UUID")
"$CONF_DIR"/upload-hooks/perftest.sh \
--uuid="$UUID" \
--job="$JOB" \
--sha256="$BIN_SHA256" \
--data-dir="$DATA_DIR" \
--cache-dir="$CACHE_DIR" \
"$BIN"
done < "$TMP_UUIDS"
info done