Update benchmark.sh

This commit is contained in:
Torma Kristóf 2019-04-26 16:39:50 +02:00 committed by GitHub
parent 6bf71c87b5
commit 5565baea22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
#Requirements:
#<function name without dashes>.wrk descriptor file for wrk
#<function name without dashes>.body (even if you don't need it)
#Configuration variables
functions=(isprime-scale isprime-scale-py isprime-scale-js hello-scale hello-scale-py hello-scale-js hello hello-js hello-py isprime isprime-js isprime-py) functions=(isprime-scale isprime-scale-py isprime-scale-js hello-scale hello-scale-py hello-scale-js hello hello-js hello-py isprime isprime-js isprime-py)
connections=(1000) connections=(1000)
times=(1m) times=(1m)
kuberhost="node1:30765" kuberhost="node1:30765"
maxthreads=40 maxthreads=40
#Wave mode configuration
wave_dir_up=true
wave_connection=40 wave_connection=40
wave_max_conn=160 wave_max_conn=160
wave_min_conn=40 wave_min_conn=40
wave_time="1m" wave_time="1m"
wave_loop=1
wave_loop_max=2 wave_loop_max=2
WRK_INSTALLED=$(command -v wrk) WRK_INSTALLED=$(command -v wrk)
@ -45,6 +47,8 @@ do
echo -e "\n" echo -e "\n"
if [[ $* = *"--wave"* ]] if [[ $* = *"--wave"* ]]
then then
wave_loop=1
wave_dir_up=true
while [[ $wave_loop -lt $wave_loop_max ]]; do while [[ $wave_loop -lt $wave_loop_max ]]; do
now=$(date '+%Y-%m-%d-%H-%M') now=$(date '+%Y-%m-%d-%H-%M')
echo -e "Connections: $wave_connection" echo -e "Connections: $wave_connection"
@ -54,14 +58,14 @@ do
sleep $wave_time sleep $wave_time
if [[ $wave_dir_up ]] if [[ $wave_dir_up ]]
then then
if [[ $wave_connection -lt $wave_max_conn ]] if [[ $wave_connection -le $wave_max_conn ]]
then then
wave_connection=$((wave_connection * 2)) wave_connection=$((wave_connection * 2))
else else
wave_dir_up=false wave_dir_up=false
fi fi
else else
if [[ $wave_connection -gt $wave_min_conn ]] if [[ $wave_connection -ge $wave_min_conn ]]
then then
wave_connection=$((wave_connection / 2)) wave_connection=$((wave_connection / 2))
else else
@ -84,13 +88,22 @@ do
do do
datetime=$(date '+%Y-%m-%d-%H-%M-%S') datetime=$(date '+%Y-%m-%d-%H-%M-%S')
echo -e "Time: $time\n" echo -e "Time: $time\n"
echo -e "wrk\n" if [[ $* = *"--wrk"* ]]
then
echo -e "wrk $datetime\n"
wrk -t$threads -c"$connection" -d"$time" -s"$function_friendly".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_friendly".wrk -H"Host: $function.kubeless" -H"Content-Type:application/json" --latency http://$kuberhost/"$function" > ./"$function"."$connection"."$time"."$datetime".wrk.txt 2>&1
echo -e "hey-summary\n" fi
if [[ $* = *"--hey"* ]]
then
echo -e "hey-summary $datetime\n"
hey -c "$connection" -z "$time" -m POST -host "$function.kubeless" -D "$function_firendly".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_firendly".body -T "application/json" http://$kuberhost/"$function" > ./"$function"."$connection"."$time"."$datetime".hey.txt
echo -e "hey-csv\n" fi
if [[ $* = *"--csv"* ]]
then
echo -e "hey-csv $datetime\n"
hey -c "$connection" -z "$time" -m POST -o csv -host "$function.kubeless" -D "$function_friendly".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_friendly".body -T "application/json" http://$kuberhost/"$function" > ./"$function"."$connection"."$time"."$datetime".csv
echo -e "$datetime" fi
echo -e "Finished at $datetime"
done done
done done
fi fi