Author: manik.surtani(a)jboss.com
Date: 2008-01-24 08:10:34 -0500 (Thu, 24 Jan 2008)
New Revision: 5213
Added:
benchmarks/benchmark-fwk/trunk/killNode.sh
Removed:
benchmarks/benchmark-fwk/trunk/lib/smartfrog-3.12.014.jar
benchmarks/benchmark-fwk/trunk/smartfrog/
Modified:
benchmarks/benchmark-fwk/trunk/cluster.sh
benchmarks/benchmark-fwk/trunk/conf/cachebench.xml
benchmarks/benchmark-fwk/trunk/runNode.sh
benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
Log:
Updated scripts, which now take in the config to launch. Also created a killNode script.
Modified: benchmarks/benchmark-fwk/trunk/cluster.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/cluster.sh 2008-01-24 12:12:47 UTC (rev 5212)
+++ benchmarks/benchmark-fwk/trunk/cluster.sh 2008-01-24 13:10:34 UTC (rev 5213)
@@ -1,6 +1,6 @@
#!/bin/bash
-#####################################################
+##################################################################################
#
# This script allows you to start multiple cache bench instances across a cluster
#
@@ -12,7 +12,7 @@
#
# will work without prompting for passwords, or any user input.
#
-#####################################################
+##################################################################################
## Some user-cnfigurable variables:
@@ -22,8 +22,10 @@
# Cache instance you wish to run - taken from the command line.
CACHE_DIST=${2}
+CFG_FILE=${3}
+
# Number of servers to launch on - taken from the command line.
-NUM_SERVERS=${3}
+NUM_SERVERS=${4}
COMMAND=${1}
@@ -41,14 +43,23 @@
do
server="${HOSTNAMES[idx]}"
echo Starting CacheBenchmarkFramework on host ${server}
- ssh ${SSH_USER}(a)${server}.${DOMAIN} "cd ${CACHE_BENCHMARK_HOME}
&& ./runNode.sh &"
+ ssh ${SSH_USER}(a)${server}.${DOMAIN} "cd ${CACHE_BENCHMARK_HOME}
&& ./runNode.sh ${idx} ${CACHE_DIST} ${CFG_FILE} ${NUM_SERVERS}"
sleep 2
done
;;
stop)
- echo "stop not implemented yet"
+ for ((idx=0; idx < NUM_SERVERS ; idx++))
+ do
+ server="${HOSTNAMES[idx]}"
+ echo Starting CacheBenchmarkFramework on host ${server}
+ ssh ${SSH_USER}(a)${server}.${DOMAIN} "cd ${CACHE_BENCHMARK_HOME}
&& ./killNode.sh"
+ sleep 2
+ done
;;
*)
- echo "Usage: $0 [start | stop] [cache distribution to test] [number of
servers to launch on]"
+ echo "Usage: ${0} [start | stop] [cache distribution to test] [name of
configuration file to use] [number of servers to launch on]"
+ echo
+ echo "Example:"
+ echo " ${0} start jbosscache-2.0.0 repl_async.xml 6
;;
esac
Modified: benchmarks/benchmark-fwk/trunk/conf/cachebench.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/cachebench.xml 2008-01-24 12:12:47 UTC (rev 5212)
+++ benchmarks/benchmark-fwk/trunk/conf/cachebench.xml 2008-01-24 13:10:34 UTC (rev 5213)
@@ -8,7 +8,7 @@
emptyCacheBetweenTests - again, use if you're running out of mem.
numThreads - the number of executor threads to use to perform the required number of
operations.
-->
-<cachebench sampleSize="5500" gcBetweenTestsEnabled="true"
sleepBetweenTests="1000" emptyCacheBetweenTests="true"
numThreads="10">
+<cachebench sampleSize="10000" gcBetweenTestsEnabled="true"
sleepBetweenTests="1000" emptyCacheBetweenTests="true"
numThreads="10">
<!--
@@ -76,16 +76,9 @@
<test name="Custom Types With Associations"
testClass="org.cachebench.tests.simpletests.AssociationsTest"
weight="2.0" />
-->
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically
used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <param name="config" value="jbc210-br_tcp_mping.xml" />
- <!--<param name="config" value="pess-repl-async.xml"
/>-->
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml"
/>-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml"
/>-->
+ <!-- WARNING - Configuration file name is now DEPRECATED and will be ignored.
Please pass in your cache config
+ file name that you wish to use with the
-DcacheBenchFwk.cacheConfigFile JVM parameter. The runNode.sh
+ and cluster.sh scripts will also do this for you. -->
</testcase>
Added: benchmarks/benchmark-fwk/trunk/killNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/killNode.sh (rev 0)
+++ benchmarks/benchmark-fwk/trunk/killNode.sh 2008-01-24 13:10:34 UTC (rev 5213)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+##################################################################################
+#
+# This script allows you to kill benchmark runner instances started with runNode.sh
+#
+# Note that runNode.sh will create a PID.pid file in the current directory, which
+# this script will use to get the process id of the process to kill.
+#
+##################################################################################
+
+PIDFILE="PID.pid"
+
+if [ -e ${PIDFILE} ]
+then
+ pid=`cat ${PIDFILE}`
+ echo "Killing process ${pid}"
+ kill -9 ${pid}
+ rm ${PIDFILE}
+fi
+
+exit 0
\ No newline at end of file
Deleted: benchmarks/benchmark-fwk/trunk/lib/smartfrog-3.12.014.jar
===================================================================
(Binary files differ)
Modified: benchmarks/benchmark-fwk/trunk/runNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runNode.sh 2008-01-24 12:12:47 UTC (rev 5212)
+++ benchmarks/benchmark-fwk/trunk/runNode.sh 2008-01-24 13:10:34 UTC (rev 5213)
@@ -4,29 +4,41 @@
# those would make an automatic conversion from unix CLASSPATH to win classpath, needed
when executing java -cp
preferIPv4Stack=true
-export JVM_OPTIONS=" -DcurrentIndex=$1 -DclusterSize=$3 "
+CURRENT_INDEX=${1}
+CACHE_PRODUCT=${2}
+TEST_CFG=${3}
+CLUSTER_SIZE=${4}
+DEBUG=${5}
+PIDFILE="PID.pid"
+if [ -e ${PIDFILE} ]
+then
+ # first test if the process is still running. If not, clean up the PID file.
+ pid=`cat ${PIDFILE}`
+ if ps -C ${pid} > /dev/null
+ then
+ echo "A stale process already exists on this host! Run killNode.sh to kill it
first."
+ exit 3
+ else
+ ## This is a stale PID file. No such process is running.
+ rm ${PIDFILE}
+ fi
+fi
+
if [ -z $1 ]
then
- echo "Usage:"
+ echo Usage:
echo
- echo " ./runNode.sh <currentNodeIndex> <testConfig>
<clusterSize>"
- echo "param <currentNodeIndex> : the index of this node in the list of
nodes in the cluster(0..<clusterSize>-1)"
- echo "param <testConfig> : must be one of the directories names under
'./cache-products'"
- echo "param <clusterSize> : total number of nodes that will run tests.
"
- echo "Ex: './runNode.sh 0 jbosscache-2.0.0 3' will start the 1st node
running an instance of jbc2.0.0 on a cluster made out of 3 nodes."
+ echo ./runNode.sh [current node index] [cache product to test] [test config file]
[cluster size]
+ echo param [current node index] : the index of this node in the list of nodes in
the cluster [0 .. <cluster size> - 1]
+ echo param [cache product to test] : must be one of the directories names under
'./cache-products'
+ echo param [test config file] : configuration file to use with the cache product.
Typically resides in './cache-products/XXX/conf/'
+ echo param [cluster size] : total number of nodes that will run tests.
+ echo
+ echo Example: './runNode.sh 0 jbosscache-2.0.0 repl_async.xml 3' will start
the 1st node running an instance of jbc2.0.0 on a cluster made out of 3 nodes, using the
repl_async configuration.
exit 1
fi
-export SYS_PROPS="-DcurrentIndex=$1
-Djava.net.preferIPv4Stack=$preferIPv4Stack"
-
-#first kill all the exisiting processes as they might interfere with the new ones/ not
sure this works on cygwin
-ps -fe | grep "Cache*BenchmarkRunner" | cut -c 10-20 | xargs -r kill
-#for PID in `ps -fe | grep "Cache*BenchmarkRunner" | cut -c 10-20`
-#do
-# kill PID
-#done
-
#libraries needed by the fwk, add them to the classpath
for JAR in ./lib/*
do
@@ -35,21 +47,29 @@
export CLASSPATH=$CLASSPATH:./conf:./classes/production/Framework
-configFile=./cache-products/$2/config.sh
+configFile=./cache-products/${CACHE_PRODUCT}/config.sh
#first check whether the config file exists and load it
-if [ -f $configFile ]
+if [ -f ${configFile} ]
then
- . $configFile
- echo "Calling $configFile exit code is $?"
+ . ${configFile}
+ echo Calling ${configFile} exit code is $?
else
- echo could not find config file $configFile, exit!
+ echo could not find config file ${configFile}, aborting!
exit 2
fi
+JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.cacheConfigFile=${TEST_CFG}
-DcurrentIndex=${CURRENT_INDEX} -DclusterSize=${CLUSTER_SIZE}
-DcurrentIndex=${CURRENT_INDEX} -Djava.net.preferIPv4Stack=${preferIPv4Stack}"
TO_EXECUTE="java $JVM_OPTIONS -cp $CLASSPATH
org.cachebench.CacheBenchmarkRunner"
-echo executing:
-echo $TO_EXECUTE
-java $JVM_OPTIONS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner
+
+if [ "$DEBUG" = "debug" ]
+then
+ echo Executing:
+ echo ${TO_EXECUTE}
+ echo
+fi
+
+${TO_EXECUTE} &
+echo $!>${PIDFILE}
echo "Return code from benchmark runner is $?"
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-01-24
12:12:47 UTC (rev 5212)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-01-24
13:10:34 UTC (rev 5213)
@@ -16,6 +16,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
@@ -102,7 +103,12 @@
cache = getCacheWrapperInstance(test);
if (cache != null)
{
- cache.init(test.getParams());
+ Map<String,String> params = test.getParams();
+ // now add the config file, if any is passed in:
+ String configSystemProperty =
System.getProperty("cacheBenchFwk.cacheConfigFile");
+ if (configSystemProperty != null) params.put("config",
configSystemProperty);
+ logger.info("Initialising cache with params " + params);
+ cache.init(params);
barrier("BEFORE_WARMUP");
warmupCache(test, cache);
barrier("AFTER_WARMUP");
Show replies by date