Performance tests - bash based
authorAdam Dickmeiss <adam@indexdata.dk>
Sun, 21 Feb 2010 11:02:58 +0000 (12:02 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Sun, 21 Feb 2010 11:02:58 +0000 (12:02 +0100)
perf/bash/.gitignore [new file with mode: 0644]
perf/bash/README [new file with mode: 0644]
perf/bash/client.sh [new file with mode: 0755]
perf/bash/get_session.xsl [new file with mode: 0644]
perf/bash/par.sh [new file with mode: 0755]

diff --git a/perf/bash/.gitignore b/perf/bash/.gitignore
new file mode 100644 (file)
index 0000000..0da406c
--- /dev/null
@@ -0,0 +1,2 @@
+*.log
+*.xml
diff --git a/perf/bash/README b/perf/bash/README
new file mode 100644 (file)
index 0000000..7433b58
--- /dev/null
@@ -0,0 +1,17 @@
+# Script to test performance for local ztest's.
+
+client.sh - single session dong init, search, show
+par.sh - parallel invocation of client.sh
+get_session.xsl - get session from response
+
+Start in one session pazpar2:
+cd etc
+../src/pazpar2 -f perf.xml -X
+
+Start in one session yaz-ztest:
+yaz-ztest
+
+Start the par.sh:
+./par.sh
+
+
diff --git a/perf/bash/client.sh b/perf/bash/client.sh
new file mode 100755 (executable)
index 0000000..6f9e076
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+O=$1
+if test -z "$O"; then
+       O=1
+fi
+H='http://localhost:9004/search.pz2'
+wget -q -O $O.init.xml "$H/?command=init"
+S=`xsltproc get_session.xsl $O.init.xml`
+wget -q -O $O.search.xml "$H?command=search&query=utah&session=$S"
+sleep 0.5
+wget -q -O $O.show.xml "$H?command=show&session=$S"
diff --git a/perf/bash/get_session.xsl b/perf/bash/get_session.xsl
new file mode 100644 (file)
index 0000000..e26eb76
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+  xmlns:marc="http://www.loc.gov/MARC21/slim"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  >
+  <xsl:output method="text"/>
+  <xsl:strip-space elements="*"/>
+  <xsl:template match="session">
+     <xsl:value-of select="."/>
+  </xsl:template> 
+  <xsl:template match="text()"/>
+</xsl:stylesheet>
diff --git a/perf/bash/par.sh b/perf/bash/par.sh
new file mode 100755 (executable)
index 0000000..d85b598
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+DELAY=0.1
+NUMBER=10
+let i=0
+while test $i -lt $NUMBER; do
+       ./client.sh $i >$i.log 2>&1 &
+       sleep $DELAY
+       let i=$i+1
+done