Update benchmark.sh

This commit is contained in:
Torma Kristóf 2019-04-26 16:13:03 +02:00 committed by GitHub
parent 0a7b4bd50d
commit f182eb162b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,10 @@
#!/bin/bash
functions=(isprime-scale)
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=(50)
times=(1m)
kuberhost="node1:30765"
maxthreads=40
maxthreads=160
wave_dir_up=true
wave_connection=40
@ -37,13 +37,14 @@ fi
echo -e "Benchmarking functions\n"
for function in "${functions[@]}"
do
function_friendly=$(echo $function | cut - -d'-' -t1)
echo -e "Benchmarking $function\n"
if [[ $* = *"--wave"* ]]
then
while [[ $wave_loop -lt $wave_loop_max ]]; 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"."$wave_connection"."$now".wave.csv
hey -c $wave_connection -z $wave_time -m POST -o csv -host "$function.kubeless" -D "$function_friendly".body -T "application/json" http://$kuberhost/"$function" > ./"$function"."$wave_connection"."$now".wave.csv
echo -e "Sleeping"
sleep $wave_time
if [[ $wave_dir_up ]]
@ -68,7 +69,7 @@ do
echo -e "Output of $function is:\n"
perl -pi -e 'chomp if eof' "$function".body
curl --data-binary @"$function".body --header "Host: $function.kubeless" --header "Content-Type:application/json" http://$kuberhost/"$function"
echo -e "\n"
echo -e "\n"
for connection in "${connections[@]}"
do
if [[ $connection -lt $((maxthreads + 1)) ]]
@ -79,15 +80,15 @@ do
fi
echo -e "Threads: $threads Connections $connection\n"
for time in "${times[@]}"
do
do
datetime=$(date '+%Y-%m-%d-%H-%M-%S')
echo -e "Time: $time\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_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"
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_firendly".body -T "application/json" http://$kuberhost/"$function" > ./"$function"."$connection"."$time"."$datetime".hey.txt
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_friendly".body -T "application/json" http://$kuberhost/"$function" > ./"$function"."$connection"."$time"."$datetime".csv
echo -e "$datetime"
done
done