Update benchmark.sh

This commit is contained in:
Torma Kristóf 2019-04-17 14:09:03 +02:00 committed by GitHub
parent a19f99ab96
commit a27a6f434f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,25 +1,10 @@
#!/bin/bash #!/bin/bash
functions=(hello isprime) functions=(hello isprime)
connections=(2 5 10 20 50 100 200 400 500 1000) connections=(1000)
times=(1m) times=(1m)
data=(isprime) kuberhost="node1:32631"
kuberhost="node1:32764" maxthreads=40
maxthreads=160
array_contains () {
local array="$1[@]"
local seeking=$2
local in=1
for element in "${!array}"; do
if [[ $element == $seeking ]]; then
in=0
break
fi
done
return $in
}
WRK_INSTALLED=$(which wrk) WRK_INSTALLED=$(which wrk)
if [ "$WRK_INSTALLED" = "" ] if [ "$WRK_INSTALLED" = "" ]
@ -41,22 +26,13 @@ then
cp $HOME/go/bin/hey /usr/local/bin cp $HOME/go/bin/hey /usr/local/bin
fi fi
kubectl get pods --all-namespaces| grep Evicted | $(awk '{print "kubectl -n " $1 " delete pod "$2}')
kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml
echo -e "Benchmarking GET functions\n" echo -e "Benchmarking GET functions\n"
for function in "${functions[@]}" for function in "${functions[@]}"
do do
echo -e "Benchmarking $function\n" echo -e "Benchmarking $function\n"
echo -e "Output of $function is:\n" echo -e "Output of $function is:\n"
array_contains data function && perl -pi -e 'chomp if eof' $function.body perl -pi -e 'chomp if eof' $function.body
curl_additional_options=$(array_contains data function && "--data-binary \"@$function.body\"") curl --data-binary @$function.body --header "Host: $function.kubeless" --header "Content-Type:application/json" http://$kuberhost/$function
curl $curl_additional_options --header "Host: $function.kubeless" --header "Content-Type:application/json" http://$kuberhost/$function
echo -e "\n" echo -e "\n"
for connection in "${connections[@]}" for connection in "${connections[@]}"
do do
@ -70,8 +46,11 @@ do
for time in "${times[@]}" for time in "${times[@]}"
do do
echo -e "Time: $time\n" echo -e "Time: $time\n"
wrk -t$threads -c$connection -d$time $(array_contains data function && "-s$function.wrk") -H"Host: $function.kubeless" -H"Content-Type:application/json" --latency http://$kuberhost/$function > ./$function.$connection.$time.txt 2>&1 echo -e "wrk"
hey -c $connection -z $time -o csv -m POST -host "$function.kubeless" $(array_contains data function && "-D $function.body") -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.csv 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.wrk.txt 2>&1
echo -e "hey"
hey -c $connection -z $time -m POST -host "$function.kubeless" -D $function.body -T "application/json" http://$kuberhost/$function > ./$function.$connection.$time.hey.txt
date
done done
done done
done done