wal-lock-test.sh
application/x-shellscript
Filename: wal-lock-test.sh
Type: application/x-shellscript
Part: 0
Message:
Re: Get rid of WALBufMappingLock
#!/usr/bin/env bash
LABEL=$1
OUTDIR=$(date +%Y%m%d-%H%M)-$LABEL
DURATION=15
mkdir -p $OUTDIR
# write 64GB of data to WAL
for r in $(seq 1 65536); do
psql test -c "SELECT pg_logical_emit_message(true, 'test', repeat('0', 1048576))" > /dev/null 2>&1
done
for r in $(seq 1 3); do
for s in 8 64 1024; do
size=$((s*1024))
sed "s/SIZE/$size/" test.template > test.sql
for c in 1 4 8 16 32 48 64 96 128 160 196; do
mkdir -p $OUTDIR/$r/$s/$c
psql test -c checkpoint
psql test -c "select pg_switch_wal()"
pgbench -n -M prepared -c $c -j $c -f test.sql -P 1 -T $DURATION test > $OUTDIR/$r/$s/$c/pgbench.log 2>&1
tps=$(grep 'tps = ' $OUTDIR/$r/$s/$c/pgbench.log | awk '{print $3}')
echo $r $s $c $tps >> $OUTDIR/results.csv
done
done
done