Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 1 | #!/bin/bash |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 2 | set -e |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 3 | |
Yulia Portnova | 886a256 | 2015-04-07 11:16:13 +0300 | [diff] [blame] | 4 | while [[ $# > 1 ]] |
| 5 | do |
| 6 | key="$1" |
| 7 | |
| 8 | case $key in |
| 9 | num_clients) |
| 10 | CLIENTS="$2" |
| 11 | shift |
| 12 | ;; |
| 13 | transactions_per_client) |
| 14 | TRANSACTINOS_PER_CLIENT="$2" |
| 15 | shift |
| 16 | ;; |
| 17 | *) |
| 18 | echo "Unknown option $key" |
| 19 | exit 1 |
| 20 | ;; |
| 21 | esac |
| 22 | shift |
| 23 | done |
| 24 | |
| 25 | CLIENTS=$(echo $CLIENTS | tr ',' '\n') |
| 26 | TRANSACTINOS_PER_CLIENT=$(echo $TRANSACTINOS_PER_CLIENT | tr ',' '\n') |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 27 | |
| 28 | |
Yulia Portnova | 886a256 | 2015-04-07 11:16:13 +0300 | [diff] [blame] | 29 | sudo -u postgres createdb -O postgres pgbench &> /dev/null |
| 30 | sudo -u postgres pgbench -i -U postgres pgbench &> /dev/null |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 31 | |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 32 | |
| 33 | for num_clients in $CLIENTS; do |
| 34 | for trans_per_cl in $TRANSACTINOS_PER_CLIENT; do |
| 35 | tps_all='' |
| 36 | for i in 1 2 3 4 5 6 7 8 9 10; do |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 37 | echo -n "$num_clients $trans_per_cl:" |
| 38 | sudo -u postgres pgbench -c $num_clients -n -t $trans_per_cl -j 4 -r -U postgres pgbench | |
| 39 | grep "(excluding connections establishing)" | awk {'print $3'} |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 40 | done |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 41 | done |
| 42 | done |
| 43 | |
Yulia Portnova | 886a256 | 2015-04-07 11:16:13 +0300 | [diff] [blame] | 44 | sudo -u postgres dropdb pgbench &> /dev/null |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 45 | |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 46 | exit 0 |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 47 | |