adding apachebench wrapper script and sample files
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Thu, 22 Sep 2011 23:09:58 +0000 (16:09 -0700)
committerJames Fournie <jfournie@sitka.bclibraries.ca>
Thu, 22 Sep 2011 23:10:52 +0000 (16:10 -0700)
Signed-off-by: James Fournie <jfournie@sitka.bclibraries.ca>
apachebench_eg/eg_ab.bash [new file with mode: 0755]
apachebench_eg/query-au-michener.txt [new file with mode: 0644]
apachebench_eg/query-kw-dogs.txt [new file with mode: 0644]
apachebench_eg/query-su-spain.txt [new file with mode: 0644]
apachebench_eg/query-ti-medieval.txt [new file with mode: 0644]

diff --git a/apachebench_eg/eg_ab.bash b/apachebench_eg/eg_ab.bash
new file mode 100755 (executable)
index 0000000..e529d19
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+# content-type header
+MYCONTENTTYPE="Content-type: text/plain"
+
+TESTNAMES=`ls *.txt`
+TESTFOLDER=`pwd`
+
+TIMEOUT=9999
+NUM_TRIES=20
+NUM_CONCURRENT=2
+
+usage()
+{
+cat << EOF
+usage: $0 options
+
+This script run the test1 or test2 over a machine.
+
+OPTIONS:
+   -h      show this message
+   -s      server hostname *REQUIRED
+   -o      output folder name *REQUIRED
+   -t      data containing POST data as txt files [default is pwd]
+   -n      number of requests [50]
+   -c      number concurrent requests [2]
+   -g      include gnuplot output
+   -e      include CSV output
+EOF
+}
+
+
+
+while getopts "hs:n:c:o:ge" opt; do
+  case $opt in
+    h) usage; exit 1;;
+    s) GATEWAY="http://$OPTARG/osrf-gateway-v1";;
+    t) TESTFOLDER=$OPTARG; TESTNAMES=`ls $TESTFOLDER *.txt`;;
+    s) GATEWAY="http://$OPTARG/osrf-gateway-v1";;
+    n) NUM_TRIES=$OPTARG;;
+    c) NUM_CONCURRENT=$OPTARG;;
+    o) OUTPUTFOLDER=$OPTARG;;
+    g) GNUPLOT_OUTPUT=1;;
+    e) CSV_OUTPUT=1;;
+  esac
+done
+
+if [ -z $GATEWAY ] || [ -z $OUTPUTFOLDER ]
+then
+     usage
+     exit 1
+fi
+
+
+mkdir -p $OUTPUTFOLDER
+pushd $OUTPUTFOLDER
+
+for MYTEST in $TESTNAMES
+do
+    echo "Running test $MYTEST"
+    if [ ! -z $GNUPLOT_OUTPUT ]
+    then
+        GNUPLOT="-g $MYTEST-gnuplot.tsv"
+    fi
+    if [ ! -z $CSV_OUTPUT ]
+    then
+        CSVOUT="-e $MYTEST.csv"
+    fi
+    ab -t $TIMEOUT -n $NUM_TRIES -c $NUM_CONCURRENT -p $TESTFOLDER/$MYTEST $GNUPLOT $CSVOUT -T "$MYCONTENTTYPE" "$GATEWAY" > $MYTEST-report.txt
+done
+popd
diff --git a/apachebench_eg/query-au-michener.txt b/apachebench_eg/query-au-michener.txt
new file mode 100644 (file)
index 0000000..5554a40
--- /dev/null
@@ -0,0 +1 @@
+service=open-ils.search&method=open-ils.search.biblio.multiclass.query&locale=en-CA&param={"org_unit":1,"depth":0,"limit":10,"offset":0,"visibility_limit":3000,"default_class":"author"}&param="michener"&param=0
diff --git a/apachebench_eg/query-kw-dogs.txt b/apachebench_eg/query-kw-dogs.txt
new file mode 100644 (file)
index 0000000..7066750
--- /dev/null
@@ -0,0 +1 @@
+service=open-ils.search&method=open-ils.search.biblio.multiclass.query&locale=en-CA&param={"org_unit":1,"depth":0,"limit":10,"offset":0,"visibility_limit":3000,"default_class":"keyword"}&param="dogs"&param=0
diff --git a/apachebench_eg/query-su-spain.txt b/apachebench_eg/query-su-spain.txt
new file mode 100644 (file)
index 0000000..0e12ec2
--- /dev/null
@@ -0,0 +1 @@
+service=open-ils.search&method=open-ils.search.biblio.multiclass.query&locale=en-CA&param={"org_unit":1,"depth":0,"limit":10,"offset":0,"visibility_limit":3000,"default_class":"subject"}&param="spain"&param=0
diff --git a/apachebench_eg/query-ti-medieval.txt b/apachebench_eg/query-ti-medieval.txt
new file mode 100644 (file)
index 0000000..c7d8481
--- /dev/null
@@ -0,0 +1 @@
+service=open-ils.search&method=open-ils.search.biblio.multiclass.query&locale=en-CA&param={"org_unit":1,"depth":0,"limit":10,"offset":0,"visibility_limit":3000,"default_class":"title"}&param="medieval"&param=0