Update benchmark.sh

This commit is contained in:
Torma Kristóf 2019-04-25 13:46:53 +02:00 committed by GitHub
parent f3ab59a7f4
commit a4fbcf57e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,16 @@
#!/bin/bash #!/bin/bash
functions=(hello) functions=(isprime-scale)
connections=(50) connections=(50)
times=(1m) times=(1m)
kuberhost="node1:30765" kuberhost="node1:30765"
maxthreads=40 maxthreads=40
wave_connection=1
wave_time="1m"
WRK_INSTALLED=$(which wrk) WRK_INSTALLED=$(which wrk)
if [[ $WRK_INSTALLED -eq "" ]] if [[ $WRK_INSTALLED = "" ]]
then then
apt update apt update
apt install build-essential libssl-dev git -y apt install build-essential libssl-dev git -y
@ -18,7 +21,7 @@ then
fi fi
HEY_INSTALLED=$(which hey) HEY_INSTALLED=$(which hey)
if [[ $HEY_INSTALLED -eq "" ]] if [[ $HEY_INSTALLED = "" ]]
then then
apt update apt update
apt install -y golang apt install -y golang
@ -26,6 +29,17 @@ then
cp $HOME/go/bin/hey /usr/local/bin cp $HOME/go/bin/hey /usr/local/bin
fi fi
if [[ $@ = *"--wave"* ]]
then
while true; do
now=$(date '+%Y-%m-%d-%H-%M')
echo -e "Running"
hey -c $wave_connection -z $wave_time -m POST -o csv -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$now.wave.txt
echo -e "Sleeping"
sleep $time
wave_connection=wave_connection * 2
done
else
echo -e "Benchmarking functions\n" echo -e "Benchmarking functions\n"
for function in "${functions[@]}" for function in "${functions[@]}"
do do
@ -46,14 +60,6 @@ do
for time in "${times[@]}" for time in "${times[@]}"
do do
datetime=$(date '+%Y-%m-%d-%H-%M-%S') datetime=$(date '+%Y-%m-%d-%H-%M-%S')
if [[ $@ -eq "*--wave*" ]]
then
while true; do
$now=$(date '+%Y-%m-%d-%H-%M')
hey -c $connection -z $time -m POST -o csv -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.$now.heywave.txt
sleep $time
done
else
echo -e "Time: $time\n" echo -e "Time: $time\n"
echo -e "wrk\n" echo -e "wrk\n"
wrk -t$threads -c$connection -d$time -s$function.wrk -H"Host: $function.kubeless" -H"Content-Type:application/json" --latency http://$kuberhost/$function > ./$function.$connection.$time.$datetime.wrk.txt 2>&1 wrk -t$threads -c$connection -d$time -s$function.wrk -H"Host: $function.kubeless" -H"Content-Type:application/json" --latency http://$kuberhost/$function > ./$function.$connection.$time.$datetime.wrk.txt 2>&1
@ -61,8 +67,8 @@ do
hey -c $connection -z $time -m POST -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.$datetime.hey.txt hey -c $connection -z $time -m POST -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.$datetime.hey.txt
echo -e "hey-csv\n" echo -e "hey-csv\n"
hey -c $connection -z $time -m POST -o csv -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.$datetime.csv hey -c $connection -z $time -m POST -o csv -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.$datetime.csv
echo -e "$datetime" echo -e $datetime
fi
done done
done done
done done
fi