From e9b7320d1ce0b21170741c1c7fc3143bf0d5b824 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Sun, 14 Jul 2024 11:38:29 -0400 Subject: [PATCH] Add preliminary web stress test script --- tools/stress_test.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/stress_test.sh diff --git a/tools/stress_test.sh b/tools/stress_test.sh new file mode 100644 index 000000000..c107f789a --- /dev/null +++ b/tools/stress_test.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Some web server stress tests +# +# Perform a large number of parallel requests, stress testing the web server +# TODO: some kind of performance metrics + + +TARGET=$1 + +JSON_TARGETS=('json/state' 'json/info' 'json/si', 'json/palettes' 'json/fxdata' 'settings/s.js?p=2') +FILE_TARGETS=('' 'iro.js' 'rangetouch.js' 'settings' 'settings/wifi') +CURL_ARGS="--compressed --parallel --parallel-immediate --parallel-max 2" + +# TODO: argument parsing + +# Test static file targets +TARGETS=(${JSON_TARGETS[@]}) +#TARGETS=(${FILE_TARGETS[@]}) + +# Expand target URLS to full arguments for curl +FULL_OPTIONS=$(printf "http://${TARGET}/%s -o /dev/null " "${TARGETS[@]}") + +#echo ${FULL_OPTIONS} +time curl ${CURL_ARGS} ${FULL_OPTIONS}