loadtest benchmark

This commit is contained in:
Torma Kristóf 2019-10-29 12:21:03 +01:00
parent 9b3d4cfd8b
commit a3f99d0983
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -19,6 +19,8 @@ wave_loop_max=2
climb_max=300
climb_connection=30
kubeless=true
#Loadtest specific fonguration
loadtest_rps=1000
HEY_INSTALLED=$(command -v hey)
if [[ $HEY_INSTALLED = "" ]]
@ -29,6 +31,14 @@ then
cp "$HOME"/go/bin/hey /usr/local/bin
fi
LOADTEST_INSTALLED=$(command -v loadtest)
if [[ LOADTEST_INSTALLED = "" ]]
then
apt update
apt install -y nodejs npm
npm i -g loadtest
fi
echo -e "Benchmarking functions\n"
for function in "${functions[@]}"
do
@ -95,14 +105,24 @@ do
do
datetime=$(date '+%Y-%m-%d-%H-%M-%S')
echo -e "Time: $time\n"
if [[ $* = *"--hey"* ]]
if [[ $* = *"--fire"* ]]
then
echo -e "hey-summary $datetime\n"
if $kubeless;
then
hey -c "$connection" -z "$time" -m POST -host "$function.kubeless" -D "$function_firendly".body -T "application/json" http://$kuberhost/"$function" > ./data/"$function"."$connection"."$time"."$datetime".txt
if [[ $* = *"--loadtest"* ]]
then
loadtest -H Host: $function.kubeless --rps $leadtest_rps -c $connection -t $time -p "$function_firendly".body http://$kuberhost/"$function" > ./data/"$function"."$connection"."$time"."$datetime".txt
else
hey -c "$connection" -z "$time" -m POST -host "$function.kubeless" -D "$function_firendly".body -T "application/json" http://$kuberhost/"$function" > ./data/"$function"."$connection"."$time"."$datetime".txt
fi
else
hey -c "$connection" -z "$time" -m POST -host "$function.default.example.com" http://$kuberhost/ > ./data/"$function"."$connection"."$time"."$datetime".txt
if [[ $* = *"--loadtest"* ]]
then
loadtest -H Host: $function.default.example.com --rps $leadtest_rps -c $connection -t $time http://$kuberhost/ > ./data/"$function"."$connection"."$time"."$datetime".txt
else
hey -c "$connection" -z "$time" -m POST -host "$function.default.example.com" http://$kuberhost/ > ./data/"$function"."$connection"."$time"."$datetime".txt
fi
fi
fi
if [[ $* = *"--csv"* ]]