Created
November 7, 2017 09:47
-
-
Save simonmellor/8c49dbd77772f74d8d83155893971f39 to your computer and use it in GitHub Desktop.
pgbench script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
: "${PGHOST?Need to set PGHOST}" | |
: "${PGPORT?Need to set PGPORT}" | |
: "${PGDATABASE?Need to set PGDATABASE}" | |
: "${PGUSER?Need to set PGUSER}" | |
: "${PGPASSWORD?Need to set PGPASSWORD}" | |
REPORT_NAME="/tmp/$PGHOST$PGPORT.txt" | |
touch "${REPORT_NAME}" | |
echo "$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$PGDATABASE" >> "$REPORT_NAME" | |
seed () { | |
echo "Seed" >> "$REPORT_NAME" | |
pgbench -i -s 30 "$PGDATABASE" >> "$REPORT_NAME" 2>&1 | |
} | |
seed | |
echo "Single-Threaded" >> "$REPORT_NAME" | |
pgbench -c 1 -T 600 "$PGDATABASE" >> "$REPORT_NAME" 2>&1 | |
seed | |
echo "Normal Load" >> "$REPORT_NAME" | |
pgbench -c 8 -j 2 -T 600 "$PGDATABASE" >> "$REPORT_NAME" 2>&1 | |
seed | |
echo "Heavy Contention" >> "$REPORT_NAME" | |
pgbench -c 64 -j 4 -T 600 "$PGDATABASE" >> "$REPORT_NAME" 2>&1 | |
seed | |
echo "Heavy Connections without Contention" >> "$REPORT_NAME" | |
pgbench -c 64 -j 4 -T 600 -N "$PGDATABASE" >> "$REPORT_NAME" 2>&1 | |
seed | |
echo "Heavy Re-connection (simulates no connection pooling)" >> "$REPORT_NAME" | |
pgbench -c 8 -j 2 -T 600 -C "$PGDATABASE" >> "$REPORT_NAME" 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment