-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththroughput.sh
executable file
·39 lines (33 loc) · 1.23 KB
/
throughput.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash -e
leader=http://192.168.111.18:2379
# assume three servers
servers=(http://192.168.111.180:2379 http://192.168.111.181:2379)
keysize=1024
numcl=4
reqsize=10
cf=1 # concurrency factor
for ((rr=0; rr<=100; rr+=10));
do
reqpercl=$((($numcl * $reqsize) / ($cf * ${#servers[@]})))
echo $rr read ratio
for ((j=1; j<=$reqpercl; j++)); do
coin=$(( ( RANDOM % 100 ) + 1 ))
for i in ${servers[@]}; do
if [ $coin -ge $rr ]; then
./boom -m PUT -n $cf -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c $cf -T application/x-www-form-urlencoded $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo "Write",$rr,$j &
else
./boom -n $cf -c $cf $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo "Read",$rr,$j &
fi
done
done
# wait for all booms to start running
sleep 3
# wait for all booms to finish
for pid in $(pgrep 'boom'); do
while kill -0 "$pid" 2> /dev/null; do
sleep 3
done
done
done
# Grep "Total:" and get the total time for n requests, add to the array and print the average throughput in the end
# Similarly, grep the latency histogram and construct an aggregate histogram.