it profiles

Signed-off-by: Ava Hahn <a.hahn@f5.com>
This commit is contained in:
Ava Hahn 2025-08-25 23:04:54 +00:00
parent 8924f2ef22
commit d07bf56cd7
7 changed files with 112 additions and 33 deletions

View file

@ -1,6 +1,11 @@
FROM archlinux:latest
RUN pacman -Sy curl --noconfirm
RUN pacman -Sy git base-devel curl luajit unzip --noconfirm
RUN git clone https://github.com/wg/wrk
WORKDIR /wrk
RUN make
WORKDIR /
COPY run.sh /
CMD ["/run.sh"]

View file

@ -1,28 +1,42 @@
#!/bin/bash
log_request () {
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
}
while :
do
log_request "https://kaproxy:8080/0"
log_request "https://kaproxy:8080/1"
log_request "https://kaproxy:8080/2"
log_request "https://kaproxy:8080/3"
log_request "https://kaproxy:8080/4"
log_request "https://kaproxy:8080/5"
log_request "https://kaproxy:8080/6"
log_request "https://kaproxy:8080/7"
log_request "https://kaproxy:8080/8"
log_request "https://kaproxy:8080/9"
done
function do_wrk_on () {
/wrk/wrk -t1 -c10 $1 &
}
# TODO: use wrk2 or something to stress test endpoints I dunno
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 0.5
do_wrk_on "https://kaproxy:8080/0"
do_wrk_on "https://kaproxy:8080/1"
do_wrk_on "https://kaproxy:8080/2"
do_wrk_on "https://kaproxy:8080/3"
do_wrk_on "https://kaproxy:8080/4"
do_wrk_on "https://kaproxy:8080/5"
do_wrk_on "https://kaproxy:8080/6"
do_wrk_on "https://kaproxy:8080/7"
do_wrk_on "https://kaproxy:8080/8"
do_wrk_on "https://kaproxy:8080/9"
wait $(jobs -p)