Skip to content
Snippets Groups Projects
Commit 46eee660 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
*.txt
doit.sh 0 → 100755
#!/bin/bash
DIRECTORY=$(cd `dirname $0` && pwd)
URLS_FILE=$DIRECTORY/urls.txt
N_CLIENTS=100
N_RUNS=10
N_URLS=2000
N_TESTS=1
display_usage(){
echo ""
echo " IIPserver benchtest"
echo ""
echo " ./doit.sh [options] -endpoint [endpoint url]"
echo " -h : Displays help."
echo " -c : Specifies number of Siege clients / concurrent users. Default = 100."
echo " -r : Specifies number of Siege runs. Default = 10."
echo " -t : Specifies number of tests. A new urls dataset is generated for each test. Default = 1."
echo " -u : Specifies number of generated URLS (urls.txt). Default = 2000."
echo " -endpoint : Specifies IIIF image URL to query. Required."
echo ""
echo " Example : "
echo " ./doit.sh -c 10 -r 20 -t 5 -u 500 -endpoint https://localhost/fcgi-bin/iipsrv.fcgi?IIIF=/img.tif/"
echo ""
}
while [[ "$#" -gt 0 ]]; do
case $1 in
-h) display_usage
exit 0;;
-c) N_CLIENTS="$2"; shift ;;
-r) N_RUNS="$2"; shift ;;
-u) N_URLS="$2"; shift ;;
-t) N_TESTS="$2"; shift ;;
-endpoint) ENDPOINT="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
if [ -z $ENDPOINT ]
then
echo ""
echo "[ ERROR ] endpoint is required"
display_usage
exit 1
fi
run(){
if [ -f $URLS_FILE ]; then
echo "removes existing urls file"
rm $URLS_FILE
fi
for ((i=1;i<=$N_URLS;i++));
do
x=$(( ( RANDOM % 45000) ))
y=$(( ( RANDOM % 5550) ))
w=$(( ( RANDOM % 3000) ))
h=$(( ( RANDOM % 1000) ))
url=$ENDPOINT$x','$y','$w','$h'/256,/0/default.jpg'
echo $url >>$URLS_FILE
done
siege -v -c$N_CLIENTS -r$N_RUNS -f $URLS_FILE > out-$1.txt
}
for ((nrun=1;nrun<=$N_TESTS;nrun++));
do
echo "====================="
echo "RUNNING TEST "$nrun
echo "---------------------"
run $nrun
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment