Commit 53a687d3 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

option T pour la durée du test - suppression option r.

parent 21fc5b50
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -10,13 +10,13 @@

```
$ chmod u+x doit.sh
$ ./doit.sh -c <nb clients> -r <nb runs> -t <nb tests> -u <url dataset size> -endpoint <image url>
$ ./doit.sh -c <nb clients> -t <test_duration> -u <url dataset size> -endpoint <image url>
```

Example :
Example - 10 clients during 5 minutes fetching among 500 urls.

```
$ ./doit.sh -c 10 -r 20 -t 5 -u 500 -endpoint https://localhost/fcgi-bin/iipsrv.fcgi?IIIF=/img.tif/
$ ./doit.sh -c 10 -t 5M -u 500 -endpoint https://localhost/fcgi-bin/iipsrv.fcgi?IIIF=/img.tif/
```

Help :
+25 −30
Original line number Diff line number Diff line
@@ -3,9 +3,9 @@
DIRECTORY=$(cd `dirname $0` && pwd)
URLS_FILE=$DIRECTORY/urls.txt
N_CLIENTS=100
N_RUNS=10
#N_RUNS=10
N_URLS=2000
N_TESTS=1
TIME=1M

MAX_WIDTH=1920
MAX_HEIGHT=1080
@@ -17,13 +17,12 @@ display_usage(){
    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 "   -t : Specifies test duration. Default = 1 minute (1M)."
    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 "   ./doit.sh -c 10 -t 2M -u 500 -endpoint https://localhost/fcgi-bin/iipsrv.fcgi?IIIF=/img.tif/"
    echo ""
}

@@ -34,7 +33,7 @@ while [[ "$#" -gt 0 ]]; do
        -c) N_CLIENTS="$2"; shift ;;
        -r) N_RUNS="$2"; shift ;;
        -u) N_URLS="$2"; shift ;;
        -t) N_TESTS="$2"; shift ;;
        -t) TIME="$2"; shift ;;
        -endpoint) ENDPOINT="$2"; shift ;;
         *) echo "Unknown parameter passed: $1"; exit 1 ;;
    esac
@@ -49,31 +48,27 @@ then
  exit 1
fi

run(){

if [ -f  $URLS_FILE ]; then
      echo "removes existing urls file"
      rm *.txt
    echo "Removing existing urls file and previous CSV output."
    rm out.csv
    rm $URLS_FILE
fi

width=$(curl -s -k $ENDPOINT'info.json'|jq .width)
height=$(curl -s -k $ENDPOINT'info.json'|jq .height)

echo "Image dimensions = "$width" * "$height

for ((i=1;i<=$N_URLS;i++));
do
    w=$(( RANDOM %  $MAX_WIDTH ))
    h=$(( RANDOM %  $MAX_HEIGHT ))
  w=$(( (RANDOM %  $MAX_WIDTH) + 1 ))
  h=$(( (RANDOM %  $MAX_HEIGHT) + 1 ))
  x=$(( ( RANDOM %  ($width-$w)) ))
  y=$(( ( RANDOM %  ($height-$h)) ))
    tile_width=$(( (RANDOM %  ($w-1)) + 1 ))
  tile_width=$(( (RANDOM % $w) + 1 ))
  url=$ENDPOINT$x','$y','$w','$h'/'$tile_width',/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
siege -v -c$N_CLIENTS -f $URLS_FILE -t$TIME> out.csv