nginx-profile-setup/kaclient/run.sh
Ava Hahn 4acd439e8a get better profileo on worker process
Signed-off-by: Ava Hahn <a.hahn@f5.com>
2025-10-06 16:19:20 +00:00

36 lines
622 B
Bash
Executable file

#!/bin/bash
N=$(nproc --all)
function log_request_to () {
return_code=$(curl -Sikl -o /dev/null -w "%{http_code}" $1 2>/dev/null)
case ${return_code:0:1} in
"4" | "5")
echo "query of $1 returned $return_code"
return 1
;;
*)
return 0
;;
esac
}
function sigint_handler() {
jobs -p | xargs kill -9
exit
}
trap 'sigint_handler' INT
# TODO: make this a more elegant item
# maybe a while loop with curl
sleep 2
echo "[+] client making request loop"
for iter in {0..80}; do
((i=i%N)); ((i++==0)) && wait
echo "request to $iter"
log_request_to "https://kaproxy:8080/$iter" &
done
wait $(jobs -p)