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_max=300
climb_connection=30 climb_connection=30
kubeless=true kubeless=true
#Loadtest specific fonguration
loadtest_rps=1000
HEY_INSTALLED=$(command -v hey) HEY_INSTALLED=$(command -v hey)
if [[ $HEY_INSTALLED = "" ]] if [[ $HEY_INSTALLED = "" ]]
@ -29,6 +31,14 @@ then
cp "$HOME"/go/bin/hey /usr/local/bin cp "$HOME"/go/bin/hey /usr/local/bin
fi 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" echo -e "Benchmarking functions\n"
for function in "${functions[@]}" for function in "${functions[@]}"
do do
@ -95,16 +105,26 @@ 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"
if [[ $* = *"--hey"* ]] if [[ $* = *"--fire"* ]]
then then
echo -e "hey-summary $datetime\n" echo -e "hey-summary $datetime\n"
if $kubeless; if $kubeless;
then then
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 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
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 else
hey -c "$connection" -z "$time" -m POST -host "$function.default.example.com" http://$kuberhost/ > ./data/"$function"."$connection"."$time"."$datetime".txt hey -c "$connection" -z "$time" -m POST -host "$function.default.example.com" http://$kuberhost/ > ./data/"$function"."$connection"."$time"."$datetime".txt
fi fi
fi fi
fi
if [[ $* = *"--csv"* ]] if [[ $* = *"--csv"* ]]
then then
echo -e "hey-csv $datetime\n" echo -e "hey-csv $datetime\n"