[jbosscache-commits] JBoss Cache SVN: r6318 - in benchmarks/benchmark-fwk/trunk: conf and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Jul 17 09:57:14 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-07-17 09:57:13 -0400 (Thu, 17 Jul 2008)
New Revision: 6318

Modified:
   benchmarks/benchmark-fwk/trunk/conf/log4j.xml
   benchmarks/benchmark-fwk/trunk/generateChart.sh
   benchmarks/benchmark-fwk/trunk/runAllLocal.sh
   benchmarks/benchmark-fwk/trunk/runLocalNode.sh
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
Log:
Added the ability to perform multiple runs

Modified: benchmarks/benchmark-fwk/trunk/conf/log4j.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/log4j.xml	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/conf/log4j.xml	2008-07-17 13:57:13 UTC (rev 6318)
@@ -3,82 +3,87 @@
 <!-- The Log4j Configuration -->
 <!-- $Id: log4j.xml,v 1.10 2007/05/18 14:32:09 msurtani Exp $ -->
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-    <!-- The list of appenders -->
-    <!-- The rolling file appender -->
-    <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
-        <param name="File" value="cachebench.log"/>
-        <param name="Append" value="true"/>
-        <param name="Threshold" value="TRACE"/>
-        <param name="MaxFileSize" value="10480KB"/>
-        <param name="MaxBackupIndex" value="3"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <!-- The default pattern: Date Priority [Category] Message\n -->
-            <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
-            <!--param name="ConversionPattern" valye="%p %t %c - %m%n"/-->
-        </layout>
-    </appender>
+   <!-- The list of appenders -->
+   <!-- The rolling file appender -->
+   <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+      <param name="File" value="cachebench.log"/>
+      <param name="Append" value="true"/>
+      <param name="Threshold" value="TRACE"/>
+      <param name="MaxFileSize" value="10480KB"/>
+      <param name="MaxBackupIndex" value="3"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+         <!--param name="ConversionPattern" valye="%p %t %c - %m%n"/-->
+      </layout>
+   </appender>
 
-    <!-- The console appender -->
-    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-        <param name="Threshold" value="TRACE"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-        </layout>
-    </appender>
+   <!-- The console appender -->
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Threshold" value="TRACE"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
 
-    <!-- The list of Categories-->
-    <category name="ClusterConfigurationCheck" additivity="false">
-        <priority value="INFO"/>
-        <appender-ref ref="CONSOLE"/>
-    </category>
+   <!-- The list of Categories-->
+   <category name="ClusterConfigurationCheck" additivity="false">
+      <priority value="INFO"/>
+      <appender-ref ref="CONSOLE"/>
+   </category>
 
-    <category name="CacheException" additivity="false">
-        <priority value="ERROR"/>
-        <appender-ref ref="FILE"/>
-    </category>
+   <category name="CacheException" additivity="false">
+      <priority value="ERROR"/>
+      <appender-ref ref="FILE"/>
+   </category>
 
-    <category name="org.apache" additivity="false">
-        <priority value="ERROR"/>
-        <appender-ref ref="FILE"/>
-    </category>
+   <category name="org.apache" additivity="false">
+      <priority value="ERROR"/>
+      <appender-ref ref="FILE"/>
+   </category>
 
-    <category name="org.cachebench" additivity="false">
-        <priority value="TRACE"/>
-        <appender-ref ref="FILE"/>
-        <appender-ref ref="CONSOLE"/>
-    </category>
+   <category name="org.cachebench" additivity="false">
+      <priority value="INFO"/>
+      <appender-ref ref="FILE"/>
+      <appender-ref ref="CONSOLE"/>
+   </category>
 
-    <category name="net.sf.ehcache" additivity="false">
-        <priority value="WARN"/>
-        <appender-ref ref="FILE"/>
-    </category>
+   <category name="org.cachebench.reportgenerators" additivity="false">
+      <priority value="DEBUG"/>
+      <appender-ref ref="CONSOLE"/>
+   </category>
 
+   <category name="net.sf.ehcache" additivity="false">
+      <priority value="WARN"/>
+      <appender-ref ref="FILE"/>
+   </category>
+
    <category name="com.tc" additivity="false">
-        <priority value="WARN"/>
-        <appender-ref ref="FILE"/>
-    </category>
+      <priority value="WARN"/>
+      <appender-ref ref="FILE"/>
+   </category>
 
    <category name="org.tc" additivity="false">
-        <priority value="WARN"/>
-        <appender-ref ref="FILE"/>
-    </category>
+      <priority value="WARN"/>
+      <appender-ref ref="FILE"/>
+   </category>
 
    <category name="org.jboss" additivity="false">
-        <priority value="ERROR"/>
-        <appender-ref ref="FILE"/>
-    </category>
+      <priority value="ERROR"/>
+      <appender-ref ref="FILE"/>
+   </category>
 
    <category name="org.jboss.cache" additivity="false">
-        <priority value="WARN"/>
-        <appender-ref ref="FILE"/>
-        <appender-ref ref="CONSOLE"/>
-    </category>
+      <priority value="WARN"/>
+      <appender-ref ref="FILE"/>
+      <appender-ref ref="CONSOLE"/>
+   </category>
 
-    <!-- Here goes the root -->
-    <root>
-        <priority value ="INFO" />
-        <!--<appender-ref ref="FILE" />-->
-        <appender-ref ref="CONSOLE" />
-    </root>
+   <!-- Here goes the root -->
+   <root>
+      <priority value="INFO"/>
+      <!--<appender-ref ref="FILE" />-->
+      <appender-ref ref="CONSOLE"/>
+   </root>
 
 </log4j:configuration>

Modified: benchmarks/benchmark-fwk/trunk/generateChart.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/generateChart.sh	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/generateChart.sh	2008-07-17 13:57:13 UTC (rev 6318)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-CP=.:classes/production/Framework
+CP=.:classes/production/Framework:./conf
 
 for i in lib/*.jar
 do

Modified: benchmarks/benchmark-fwk/trunk/runAllLocal.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runAllLocal.sh	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/runAllLocal.sh	2008-07-17 13:57:13 UTC (rev 6318)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 rm -rf ./output/*
-
+export JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.fwkCfgFile=cachebench-local.xml"
 ./runLocalNode.sh jbosscache-3.0.0 pess-local.xml
 ./runLocalNode.sh jbosscache-3.0.0 mvcc-local.xml
 ./runLocalNode.sh jbosscache-3.0.0 pess-local-NONE.xml

Modified: benchmarks/benchmark-fwk/trunk/runLocalNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runLocalNode.sh	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/runLocalNode.sh	2008-07-17 13:57:13 UTC (rev 6318)
@@ -45,7 +45,7 @@
 #. ./bindAddress.sh
 #echo bind address exit code is $?
 
-JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.cachePrioductName=${CACHE_PRODUCT} -DcacheBenchFwk.cacheConfigFile=${TEST_CFG} -Djava.net.preferIPv4Stack=${preferIPv4Stack} -DlocalOnly=true"
+JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.cacheProductName=${CACHE_PRODUCT} -DcacheBenchFwk.cacheConfigFile=${TEST_CFG} -Djava.net.preferIPv4Stack=${preferIPv4Stack} -DlocalOnly=true"
 TO_EXECUTE="java $JVM_OPTIONS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner"
 
 if [ "$DEBUG" = "debug" ]

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java	2008-07-17 13:57:13 UTC (rev 6318)
@@ -68,13 +68,15 @@
    /**
     * Initialise some params that may be passed in via JVM params
     */
-   private void initJVMParams()
+   private void initJVMParams(String defaultCfgFile)
    {
+      String overallCfg = System.getProperty("cacheBenchFwk.fwkCfgFile", defaultCfgFile);
       String configuraton = System.getProperty("cacheBenchFwk.cacheConfigFile");
-      String cacheProductName = System.getProperty("cacheBenchFwk.cachePrioductName");
+      String cacheProductName = System.getProperty("cacheBenchFwk.cacheProductName");
       String clusterSize = System.getProperty("clusterSize");
       localOnly = Boolean.getBoolean("localOnly");
 
+      systemParams.put("fwk.config", overallCfg);
       if (configuraton != null) systemParams.put("config", configuraton);
       if (cacheProductName != null) systemParams.put("cacheProductName", cacheProductName);
       if (clusterSize != null) systemParams.put("clusterSize", clusterSize);
@@ -88,12 +90,13 @@
 
    private CacheBenchmarkRunner(String s)
    {
-      initJVMParams();
+      initJVMParams(s);
       // first, try and find the configuration on the filesystem.
+      s = systemParams.get("fwk.config");
       URL confFile = ConfigBuilder.findConfigFile(s);
       if (confFile == null)
       {
-         log.warn("Unable to locate a configuration file; Application terminated");
+         log.warn("Unable to locate a configuration file " + s + "; Application terminated");
       }
       else
       {
@@ -233,8 +236,8 @@
       catch (Exception e)
       {
          // The Empty barrier of the cache failed. Add a foot note for the TestResult here.
-         testResult.setFootNote("The Cache Empty barrier failed after test case: " + testResult.getTestName() + " : " + testResult.getTestType());
-         errorLogger.error("The Cache Empty barrier failed after test case : " + testResult.getTestName() + ", " + testResult.getTestType(), e);
+//         testResult.setFootNote("The Cache Empty barrier failed after test case: " + testResult.getTestName() + " : " + testResult.getTestType());
+//         errorLogger.error("The Cache Empty barrier failed after test case : " + testResult.getTestName() + ", " + testResult.getTestType(), e);
       }
 
       return testResult;

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/AbstractChartGen.java	2008-07-17 13:57:13 UTC (rev 6318)
@@ -4,6 +4,7 @@
 {
    protected String reportDirectory;
    protected String filenamePrefix;
+   protected static final String MU = "\u00B5";//((char) 0xC2B5) + ""; 
 
    public void setReportDirectory(String reportDirectory)
    {

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java	2008-07-17 13:57:13 UTC (rev 6318)
@@ -6,7 +6,6 @@
 import org.cachebench.tests.results.TestResult;
 
 import java.io.BufferedWriter;
-import java.io.FileWriter;
 import java.io.IOException;
 
 
@@ -48,9 +47,9 @@
          buf.append(",");
          buf.append(stResults.getNumThreads());
          buf.append(",");
-         buf.append(putData.getSum()/1000);
+         buf.append(putData.getSum() / 1000);
          buf.append(",");
-         buf.append(getData.getSum()/1000);
+         buf.append(getData.getSum() / 1000);
          buf.append(",");
          buf.append(putData.getMean());
          buf.append(",");
@@ -76,6 +75,10 @@
          buf.append(stResults.getThroughputTransactionsPerSecond());
          buf.append(",");
          buf.append(stResults.getThroughputBytesPerSecond());
+         buf.append(",");
+         buf.append(putData.getN());
+         buf.append(",");
+         buf.append(getData.getN());
       }
       else
       {
@@ -97,9 +100,9 @@
    protected void writeHeaderLine(BufferedWriter writer) throws IOException
    {
       log.debug("Write the Report Header");
-      writer.write("TEST NAME, TEST DATE, TEST TYPE, NUM MEMBERS, NUM THREADS, TOTAL PUT TIME (secs), TOTAL GET TIME (secs), MEAN PUT TIME, MEAN GET TIME, MEDIAN PUT TIME, MEDIAN GET TIME, STANDARD DEVIATION PUT TIME, STANDARD DEVIATION GET TIME, MAX PUT TIME, MAX GET TIME, MIN PUT TIME, MIN GET TIME, THROUGHPUT TRANSACTIONS PER SEC, THROUGHPUT BYTES PER SEC");
+      writer.write("TEST NAME, TEST DATE, TEST TYPE, NUM MEMBERS, NUM THREADS, TOTAL PUT TIME (secs), TOTAL GET TIME (secs), MEAN PUT TIME, MEAN GET TIME, MEDIAN PUT TIME, MEDIAN GET TIME, STANDARD DEVIATION PUT TIME, STANDARD DEVIATION GET TIME, MAX PUT TIME, MAX GET TIME, MIN PUT TIME, MIN GET TIME, THROUGHPUT TRANSACTIONS PER SEC, THROUGHPUT BYTES PER SEC, NUM_PUTS, NUM_GETS");
       writer.newLine();
-      log.debug("Complted the Report Header");
+      log.debug("Completed the Report Header");
    }
 
 

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java	2008-07-17 11:51:15 UTC (rev 6317)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java	2008-07-17 13:57:13 UTC (rev 6318)
@@ -1,5 +1,7 @@
 package org.cachebench.reportgenerators;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jfree.chart.ChartFactory;
 import org.jfree.chart.ChartUtilities;
 import org.jfree.chart.JFreeChart;
@@ -30,6 +32,9 @@
    private DefaultCategoryDataset putData, getData;
    private String chartExtension = ".png";
    private String putChartName = "PutChart", getChartName = "GetChart";
+   private Log log = LogFactory.getLog(PutGetChartGenerator.class);
+   private int nPuts = 0, nGets = 0;
+   private int numFilesScanned = 0;
 
    public void generateChart() throws IOException
    {
@@ -43,7 +48,7 @@
          chartFile = new File(putChartNameToUse + chartExtension);
       }
 
-      ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache PUT (WRITE) performance", putData), 800, 800);
+      ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache PUT (WRITE) performance", putData, nPuts / numFilesScanned), 800, 800);
 
       String getChartNameToUse = filenamePrefix == null ? getChartName : filenamePrefix + "-" + getChartName;
       chartFile = new File(getChartNameToUse + chartExtension);
@@ -53,14 +58,14 @@
          chartFile = new File(getChartNameToUse + chartExtension);
       }
 
-      ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache GET (READ) performance", getData), 800, 800);
+      ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache GET (READ) performance", getData, nGets / numFilesScanned), 800, 800);
 
       System.out.println("Charts saved as " + putChartNameToUse + " and " + getChartNameToUse);
    }
 
-   private JFreeChart createChart(String title, DefaultCategoryDataset data)
+   private JFreeChart createChart(String title, DefaultCategoryDataset data, int numOperations)
    {
-      JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operation", "Average time (µ-seconds)", data, PlotOrientation.VERTICAL, true, false, false);
+      JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operations performed (approx): " + NumberFormat.getIntegerInstance().format(numOperations), "Average time (" + MU + "-seconds)", data, PlotOrientation.VERTICAL, true, false, false);
       BarRenderer3D renderer = (BarRenderer3D) chart.getCategoryPlot().getRenderer();
       renderer.setBaseItemLabelsVisible(true);
 
@@ -86,7 +91,7 @@
             String retval;
             try
             {
-               retval = fmt.format(categoryDataset.getValue(product, operation)) + " µs";
+               retval = fmt.format(categoryDataset.getValue(product, operation)) + " " + MU + "s";
             }
             catch (Exception e)
             {
@@ -98,6 +103,7 @@
       });
 
       chart.addSubtitle(new TextTitle("Generated on " + new Date() + " by The CacheBenchFwk"));
+
       chart.setBorderVisible(true);
       chart.setAntiAlias(true);
       chart.setTextAntiAlias(true);
@@ -132,6 +138,7 @@
 
    private void readData(File f) throws IOException
    {
+      log.debug("Processing file " + f);
       String productName = f.getName();
       if (productName.startsWith("data_"))
       {
@@ -148,25 +155,33 @@
       String line = null;
       BufferedReader br = new BufferedReader(new FileReader(f));
       double avgPut = -1, avgGet = -1;
+      Stats s = null;
 
-      while ((line = br.readLine()) != null && avgPut == -1 && avgGet == -1)
+      while ((line = br.readLine()) != null && s == null)
       {
-         double[] tmp = getAveragePutAndGet(line);
-         avgPut = tmp[0];
-         avgGet = tmp[1];
+         s = getAveragePutAndGet(line);
+         log.debug("Read stats " + s);
+         if (s != null)
+         {
+            avgPut = s.avgPut;
+            avgGet = s.avgGet;
+            nGets += s.numGets;
+            nPuts += s.numPuts;
+         }
       }
 
       br.close();
 
       putData.addValue(avgPut, productName, "PUT");
       getData.addValue(avgGet, productName, "GET");
+      numFilesScanned++;
    }
 
-   private double[] getAveragePutAndGet(String line)
+   private Stats getAveragePutAndGet(String line)
    {
       // To be a valid line, the line should be comma delimited
       StringTokenizer strTokenizer = new StringTokenizer(line, ",");
-      if (strTokenizer.countTokens() < 7) return new double[]{-1, -1};
+      if (strTokenizer.countTokens() < 7) return null;
 
       // 8th token is avg put
       // 9th token is avg get
@@ -175,17 +190,44 @@
       String putStr = strTokenizer.nextToken();
       String getStr = strTokenizer.nextToken();
 
-      double[] results = new double[2];
+      // 20 and 21st tokens are the num puts and num gets performed.
+
+      for (int i = 0; i < 10; i++) strTokenizer.nextToken();
+
+      String nPutStr = strTokenizer.nextToken();
+      String nGetStr = strTokenizer.nextToken();
+
+      Stats s = new Stats();
       try
       {
-         results[0] = Double.parseDouble(putStr) / 1000;
-         results[1] = Double.parseDouble(getStr) / 1000;
-         return results;
+         s.avgPut = Double.parseDouble(putStr) / 1000;
+         s.avgGet = Double.parseDouble(getStr) / 1000;
+         s.numPuts = Integer.parseInt(nPutStr);
+         s.numGets = Integer.parseInt(nGetStr);
       }
       catch (NumberFormatException nfe)
       {
-         return new double[]{-1, -1};
+//         log.error("Unable to parse file properly!", nfe);
+         return null;
       }
+      return s;
    }
 
+   private static class Stats
+   {
+      double avgPut, avgGet;
+      int numPuts, numGets;
+
+
+      public String toString()
+      {
+         return "Stats{" +
+               "avgPut=" + avgPut +
+               ", avgGet=" + avgGet +
+               ", numPuts=" + numPuts +
+               ", numGets=" + numGets +
+               '}';
+      }
+   }
+
 }




More information about the jbosscache-commits mailing list