diff options
author | MS <ms@taler.net> | 2023-07-27 16:56:23 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2023-07-27 16:56:23 +0200 |
commit | 144930b146b3e926f92d10bd558414113d9ea362 (patch) | |
tree | 060d289cec60b9f924ca1b166a345b6657f5200c | |
parent | 4b2f0f326b839c7af7d9579d922adc3ea3a13e3f (diff) | |
download | deployment-144930b146b3e926f92d10bd558414113d9ea362.tar.gz deployment-144930b146b3e926f92d10bd558414113d9ea362.tar.bz2 deployment-144930b146b3e926f92d10bd558414113d9ea362.zip |
NLnet task 5.
Completing the benchmark container.
-rw-r--r-- | nlnet/task5/performance/.start.sh.swp | bin | 12288 -> 0 bytes | |||
-rwxr-xr-x | nlnet/task5/performance/start.sh | 33 |
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 differdeleted file mode 100644 index 78df566..0000000 --- a/nlnet/task5/performance/.start.sh.swp +++ /dev/null diff --git a/nlnet/task5/performance/start.sh b/nlnet/task5/performance/start.sh index 9ae2ada..2cc9175 100755 --- 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" |