元はこれ
https://github.com/yugabyte/sysbench/blob/master/run_sysbench.sh
Created
September 5, 2023 15:23
-
-
Save WinLinux1028/ef0f36f776a6a6b991e98e777bbeac37 to your computer and use it in GitHub Desktop.
Yugabyteのrun_sysbench.shをPostgreSQLでも動くようにしてみた
This file contains hidden or 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/bash | |
# Get the IP, numtables and the tablesize from the user. The default value for the | |
# numtables is 10, tablesize is 100k and for the ip is '127.0.0.1'. | |
# | |
# Run the script as './run_sysbench.sh --ip 192.168.1.2 --numtables 10 --tablesize 1000' | |
tablesize=${tablesize:-100000} | |
numtables=${numtables:-10} | |
ip=${ip:-127.0.0.1} | |
while [ $# -gt 0 ]; do | |
if [[ $1 == *"--"* ]]; then | |
param="${1/--/}" | |
declare $param="$2" | |
fi | |
shift | |
done | |
port=5432 | |
user=postgres | |
pass=postgres | |
db=bench | |
run_threads=64 | |
time=120 | |
warmuptime=120 | |
delete_tables() { | |
# Make sure that ysqlsh is present in the 'PATH'. | |
export PGPASSWORD=$pass | |
for i in `seq $numtables`; do psql -h $ip -U $user $db -c "drop table sbtest$i;"; done | |
} | |
run_workload() { | |
echo "RUNNING $1" | |
echo Writing output to $1-load.dat and $1-run.dat | |
time sysbench $1 --tables=$numtables --table-size=$tablesize --db-driver=pgsql --pgsql-host=$ip --pgsql-port=$port --pgsql-user=$user --pgsql-password=$pass --pgsql-db=$db prepare > $1-load.dat | |
time sysbench $1 --tables=$numtables --table-size=$tablesize --db-driver=pgsql --pgsql-host=$ip --pgsql-port=$port --pgsql-user=$user --pgsql-password=$pass --pgsql-db=$db --threads=$run_threads --time=$time run > $1-run.dat | |
delete_tables | |
echo "DONE $1" | |
} | |
run_workload oltp_insert | |
run_workload oltp_point_select | |
run_workload oltp_write_only | |
run_workload oltp_read_only | |
run_workload oltp_read_write | |
run_workload oltp_update_index | |
run_workload oltp_update_non_index | |
run_workload oltp_delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment