commit 144930b146b3e926f92d10bd558414113d9ea362
parent 4b2f0f326b839c7af7d9579d922adc3ea3a13e3f
Author: MS <ms@taler.net>
Date: Thu, 27 Jul 2023 16:56:23 +0200
NLnet task 5.
Completing the benchmark container.
Diffstat:
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/nlnet/task5/performance/.start.sh.swp b/nlnet/task5/performance/.start.sh.swp
Binary files differ.
diff --git a/nlnet/task5/performance/start.sh b/nlnet/task5/performance/start.sh
@@ -8,13 +8,15 @@
# and closes many PostgreSQL connections, as it is required
# by milestone #3.
-set -eux
+set -eu
-# trap -- 'echo nullified signal' SIGINT SIGTERM SIGTSTP
+export HOW_MANY_WITHDRAWALS=100
service postgresql start
sudo -u postgres createuser -s root
-createdb libeufincheck
+
+# Activating the disconnection logs.
+sudo -u postgres psql -q -c "ALTER SYSTEM SET log_disconnections = 'on'" -c "SELECT pg_reload_conf()" > /dev/null
# Converts AA:BB:CC.DDD to milliseconds.
convert_pg_time_to_ms () {
@@ -53,8 +55,8 @@ prepare_and_run () {
-c /exchange/src/benchmark/benchmark-cs.conf.edited \
-u exchange-account-2 \
-L WARNING \
- -n1 \
- -r100
+ -n 1 \
+ -r $HOW_MANY_WITHDRAWALS
}
export -f prepare_and_run
@@ -77,30 +79,29 @@ fi
# it compatible with the format as GREPped through Postgres logs.
BENCHMARK_TOT_MS=$(awk -F. '{t=($1 * 1000 + $2 * 10)} END {print t}' /benchmark-wall-clock-time.txt)
-NEXUS_LONGEST_DB_SESSION=$(grep disconnection < /var/log/postgresql/postgresql-14-main.log \
- | grep $NEXUS_PID | convert_pg_time_to_ms | sort | tail -1)
+NEXUS_LONGEST_DB_SESSION_MS=$(grep disconnection < /var/log/postgresql/postgresql-15-main.log | grep $NEXUS_PID | grep -o "session time:.*$" | grep -o [0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9] | convert_pg_time_to_ms | sort -n | tail -n 1)
-SANDBOX_LONGEST_DB_SESSION=$(grep disconnection < /var/log/postgresql/postgresql-14-main.log \
- | grep $SANDBOX_PID | convert_pg_time_to_ms | sort | tail -1)
+SANDBOX_LONGEST_DB_SESSION_MS=$(grep disconnection < /var/log/postgresql/postgresql-15-main.log | grep $SANDBOX_PID | grep -o "session time:.*$" | grep -o [0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9] | convert_pg_time_to_ms | sort -n | tail -n 1)
-if test $NEXUS_LONGEST_DB_SESSION -gt $BENCHMARK_TOT_MS; then
+if test $NEXUS_LONGEST_DB_SESSION_MS -gt $BENCHMARK_TOT_MS; then
echo Nexus had a DB session longer than the benchmark itself, failing.
exit 1
fi
-if test $SANDBOX_LONGEST_DB_SESSION -gt $BENCHMARK_TOT_MS; then
+if test $SANDBOX_LONGEST_DB_SESSION_MS -gt $BENCHMARK_TOT_MS; then
echo Sandbox had a DB session longer than the benchmark itself, failing.
exit 1
fi
-NEXUS_TIME_FRACTION=$(echo "$BENCHMARK_TOT_MS / $NEXUS_LONGEST_DB_SESSION" | bc -lq)
-SANDBOX_TIME_FRACTION=$(echo "$BENCHMARK_TOT_MS / $SANDBOX_LONGEST_DB_SESSION" | bc -lq)
+NEXUS_TIME_PORTION=$(echo "($NEXUS_LONGEST_DB_SESSION_MS / $BENCHMARK_TOT_MS) * 100" | bc -lq | sed 's/^\./0./')
+SANDBOX_TIME_PORTION=$(echo "($SANDBOX_LONGEST_DB_SESSION_MS / $BENCHMARK_TOT_MS) * 100" | bc -lq | sed 's/^\./0./')
# Here: the further from 1 the better.
-echo Nexus longest DB session is $NEXUS_TIME_FRACTION of the total benchmark time.
-echo Sandbox longest DB session is $SANDBOX_TIME_FRACTION of the total benchmark time.
+echo Nexus longest DB session is $NEXUS_TIME_PORTION percent of the total benchmark time.
+echo Sandbox longest DB session is $SANDBOX_TIME_PORTION percent of the total benchmark time.
# Now show the total space occupied by the database.
# Although that's a _total_ estimate, it'll anyhow show
# that _also_ libeufin has reasonable data usage.
-echo "SELECT pg_size_pretty(pg_database_size('libeufincheck'))" | psql -d libeufincheck
+TOTAL_DB_SPACE=$(echo "SELECT pg_size_pretty(pg_database_size('talercheck'))" | psql -d talercheck | grep "^ [0-9]" | tr -d "[:blank:]")
+echo "The total space occupied by the database for $HOW_MANY_WITHDRAWALS withdrawals is $TOTAL_DB_SPACE"