Compare commits
29 commits
main
...
20221220_p
Author | SHA1 | Date | |
---|---|---|---|
|
2ee733523c | ||
|
3f8bfb9fa8 | ||
|
2ffbf66053 | ||
|
82622a9b46 | ||
|
e27ca992bf | ||
|
0ae2602172 | ||
|
0af832075f | ||
|
68c0c74d37 | ||
|
85a4a4784c | ||
|
20bc1785d0 | ||
|
932d10cbaf | ||
|
74269e4ccd | ||
|
7a0cdcbae5 | ||
|
ee2d467678 | ||
|
bdb01be93b | ||
|
d2d1068d10 | ||
|
3aea44f661 | ||
|
49f9101e8b | ||
|
8c776912f7 | ||
|
8a45a3e522 | ||
|
99f2788ec0 | ||
|
f9375f0828 | ||
|
34aa7a767a | ||
|
dd6f054a88 | ||
|
f67c2f6fa9 | ||
|
13612c59a5 | ||
|
0176e8c5bb | ||
|
cd26ddcd75 | ||
|
db82447841 |
4 changed files with 509 additions and 0 deletions
146
packaging/perftest.sh
Executable file
146
packaging/perftest.sh
Executable 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
160
packaging/perftest/unipi/plot.sh
Executable 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
|
82
packaging/perftest/unipi/run-test-remotely.sh
Executable file
82
packaging/perftest/unipi/run-test-remotely.sh
Executable 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
121
packaging/perftest_all.sh
Executable 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
|
||||
|
Loading…
Reference in a new issue