JBoss Cache SVN: r5034 - in cache-bench-fwk/trunk: smartfrog and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-07 09:10:02 -0500 (Mon, 07 Jan 2008)
New Revision: 5034
Added:
cache-bench-fwk/trunk/smartfrog/main_dev.sf
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
cache-bench-fwk/trunk/src/org/cachebench/tests/results/
cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java
cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java
cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java
Removed:
cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf
cache-bench-fwk/trunk/smartfrog/conf.sf
cache-bench-fwk/trunk/src/org/cachebench/TestResult.java
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java
Modified:
cache-bench-fwk/trunk/conf/cachebench.xml
cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java
cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java
cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
Log:
added session simulator test + refactoring
Modified: cache-bench-fwk/trunk/conf/cachebench.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench.xml 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/conf/cachebench.xml 2008-01-07 14:10:02 UTC (rev 5034)
@@ -47,7 +47,7 @@
org.cachebench.warmup.NoCacheWarmup
-->
<warmup warmupClass="org.cachebench.warmup.PutGetCacheWarmup">
- <param name="operationCount" value="100"/>
+ <param name="operationCount" value="10000"/>
</warmup>
<!--
@@ -63,15 +63,22 @@
* You can write your own custom testClass.
* weight is currently unused.
-->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
+ <!--<test name="Strings" testClass="org.cachebench.tests.simpletests.StringTest" weight="2.0" />-->
+
+ <test name="Strings" testClass="org.cachebench.tests.SessionSimulatorTest" weight="2.0" >
+ <param name="numberOfRequest" value="1000000"/>
+ <param name="numberOfAttributes" value="100"/>
+ <param name="writePercentage" value="20"/>
+ <param name="sizeOfAnAttribute" value="1000"/>
+ </test>
<!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
+ <test name="Primitive Wrappers" testClass="org.cachebench.tests.simpletests.PrimitiveTest" weight="1.0" />
+ <test name="Custom Class Types" testClass="org.cachebench.tests.simpletests.CustomClassTest" weight="1.0" />
+ <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.simpletests.SubclassTest" weight="1.5" />
+ <test name="Custom Types With Transients" testClass="org.cachebench.tests.simpletests.TransientTest" weight="1.0" />
+ <test name="Custom Types With Statics" testClass="org.cachebench.tests.simpletests.StaticsTest" weight="1.5" />
+ <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. -->
@@ -93,7 +100,7 @@
own report generators such as XML generators, graphic generators, etc
-->
<!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs. If 'outputFile is set to
- '-generic-' then the name would be generated as follows: 'performance-<clusterSize>.csv' -->
+ '-generic-' then the name would be generated as follows: 'performance-<nodeIndeInCluster>.csv' -->
<report outputFile="-generic-" generator="org.cachebench.reportgenerators.ClusterReportGenerator"/>
</cachebench>
Deleted: cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/smartfrog/cacheBenchComponent.sf 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,20 +0,0 @@
-#include "org/smartfrog/components.sf"
-
-BaseCacheBenchPrim extends Prim {
- sfClass "org.cachebench.smartfrog.CacheBenchmarkPrim";
-
- scriptToExec "./runNode.sh"
-
- //FQN of the directory where the framework was checked out (noramally is th eparent of the dir that contains this file)
- //this should be edited
- cacheBenchmarkHome "c:/projects/jboss/cache/benchmark/cache-bench-fwk";
-
- //should be the name of a subdirectory of 'cache-products' directory.
- cacheDistribution "jbosscache-2.0.0";
-
- //defines on how many nodes the benchmark will run
- clusterSize 1;
-
- //might take a value from 0..max_nr_of_nodes, representing the index of the current node in the cluster
- nodeIndex TBD;
-}
\ No newline at end of file
Deleted: cache-bench-fwk/trunk/smartfrog/conf.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/conf.sf 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/smartfrog/conf.sf 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,33 +0,0 @@
-//Most sf files start with this line. Compound is a sf component that can have children components.
-sfConfig extends Compound
-{
-
- //The CacheBenchController starts up the slaves, runs the master, then collects the results.
- controller extends CacheBenchController
- {
- //List of cluster sizes to test. In this case the first cluster would be a single master. Second cluster would be one master and one slave.
- clusterConfigs [1,2];
-
- //Pool of hosts to deploy the slaves onto.
- slaves [ "cluster02", "cluster03", "cluster04", "cluster05", "cluster06", "cluster07", "cluster08" ];
-
- //Template used for slave components. Each slave will be a copy of this component, with the sfHost attribute replaced by one of the hostnames above.
- slaveTemplate extends LAZY CacheBenchSlave
- {
- plugin "jbosscache-1.4.1";
- //bindAddress "10.1.5.2";
- homeDir "/home/pthurmond/sandbox/cachebench/CacheBenchFwk";
- }
-
- //Master component.
- master extends LAZY CacheBenchMaster
- {
- sfHost "localhost";
- autoStart true;
- //Which cache provider? This is based on the directory structure in the CacheBenchFwk cvs. Sort of fragile imo. Maybe the classpath could be simplified some?
- plugin "jbosscache-1.4.1";
- homeDir "/home/pthurmond/sandbox/cachebench/CacheBenchFwk";
- //bindAddress "10.1.5.1";
- }
- }
-}
\ No newline at end of file
Added: cache-bench-fwk/trunk/smartfrog/main_dev.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/main_dev.sf (rev 0)
+++ cache-bench-fwk/trunk/smartfrog/main_dev.sf 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,434 @@
+#include "org/smartfrog/components.sf"
+
+
+BaseCacheBenchPrim extends Prim {
+ sfClass "org.cachebench.smartfrog.CacheBenchmarkPrim";
+
+ scriptToExec "./runNode.sh"
+
+ //FQN of the directory where the framework was checked out (noramally is th eparent of the dir that contains this file)
+ //this should be edited
+ cacheBenchmarkHome "/projects/jboss/cache/benchmark/cache-bench-fwk";
+
+ //should be the name of a subdirectory of 'cache-products' directory.
+ cacheDistribution "jbosscache-2.0.0";
+
+ //might take a value from 0..max_nr_of_nodes, representing the index of the current node in the cluster
+ nodeIndex TBD;
+
+ //defines on how many nodes the benchmark will run
+ clusterSize TBD;
+ minClusterSize TBD;
+ maxClusterSize TBD;
+
+}
+
+sfConfig extends Compound {
+
+ minimumClusterSize 3;
+ maximumClusterSize 5;
+
+ oneClusterSize extends Compound {
+
+ c1FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize 1;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ twoClusterSize extends Compound {
+
+ sizeOfTheCluster 2;
+
+ c2FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c2SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ threeClusterSize extends Compound {
+
+ sizeOfTheCluster 3;
+
+ c3FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c3SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c3ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ fourClusterSize extends Compound {
+
+ sizeOfTheCluster 4;
+
+ c4FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c4SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c4ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c4ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ fiveClusterSize extends Compound {
+
+ sizeOfTheCluster 5;
+
+ c5FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c5SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c5ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c5ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c5FifthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 4;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ sixClusterSize extends Compound {
+
+ sizeOfTheCluster 6;
+
+ c6FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c6SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c6ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c6ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c6FifthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 4;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c6SixthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 5;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ sevenClusterSize extends Compound {
+
+ sizeOfTheCluster 7;
+
+ c7FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7FifthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 4;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7SixthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 5;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c7SeventhMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 6;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ eightClusterSize extends Compound {
+
+ sizeOfTheCluster 8;
+
+ c8FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8FifthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 4;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8SixthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 5;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8SeventhMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 6;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c8EighthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 7;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+ nineClusterSize extends Compound {
+
+ sizeOfTheCluster 9;
+
+ c9FirstMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 0;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9SecondMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 1;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9ThirdMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 2;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9ForthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 3;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9FifthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 4;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9SixthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 5;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9SeventhMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 6;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9EighthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 7;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+
+ c9NinthMember extends BaseCacheBenchPrim {
+ sfProcessHost "localhost";
+ nodeIndex 7;
+ clusterSize ATTRIB sizeOfTheCluster;
+ minClusterSize ATTRIB minimumClusterSize;
+ maxClusterSize ATTRIB maximumClusterSize;
+ }
+ }
+
+}
Modified: cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/CacheBenchmarkRunner.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -3,14 +3,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.cachebench.cluster.ClusterBarrier;
import org.cachebench.config.*;
import org.cachebench.reportgenerators.ReportGenerator;
import org.cachebench.tests.CacheTest;
-import org.cachebench.cluster.ClusterBarrier;
+import org.cachebench.tests.results.BaseTestResult;
+import org.cachebench.tests.results.TestResult;
import org.cachebench.utils.Instantiator;
import org.cachebench.warmup.CacheWarmup;
-import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
@@ -200,7 +201,7 @@
catch (Exception e)
{
// The test failed. We should add a test result object with a error message and indicate that it failed.
- result = new TestResult();
+ result = new BaseTestResult();
result.setTestName(testCaseName);
result.setTestTime(new Date());
result.setTestType(testName);
Deleted: cache-bench-fwk/trunk/src/org/cachebench/TestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/TestResult.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/TestResult.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,188 +0,0 @@
-package org.cachebench;
-
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-
-import java.io.Serializable;
-import java.util.Date;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * @version $Id: TestResult.java,v 1.4 2007/04/18 19:09:30 msurtani Exp $
- */
-public class TestResult implements Serializable
-{
- private String testName;
- private String testType;
- private Date testTime;
- private DescriptiveStatistics putData, getData;
- private boolean testPassed; // This is to indicate whether the test is passed/failed.
- private String errorMsg = ""; // This holds the error message if any error had occured in the test.
- private String footNote = ""; // This is utilized if special notes need to be captured for this test.
- private int throughputTransactionsPerSecond;
- private int throughputBytesPerSecond;
- private int numMembers;
- private int numThreads;
- private boolean skipReport;
-
- public DescriptiveStatistics getGetData()
- {
- return getData;
- }
-
- public void setGetData(DescriptiveStatistics getData)
- {
- this.getData = getData;
- }
-
- public DescriptiveStatistics getPutData()
- {
- return putData;
- }
-
- public void setPutData(DescriptiveStatistics putData)
- {
- this.putData = putData;
- }
-
- public String getTestName()
- {
- return testName;
- }
-
- public void setTestName(String testName)
- {
- this.testName = testName;
- }
-
- public String getTestType()
- {
- return testType;
- }
-
- public void setTestType(String testType)
- {
- this.testType = testType;
- }
-
- public Date getTestTime()
- {
- return testTime;
- }
-
- public void setTestTime(Date testTime)
- {
- this.testTime = testTime;
- }
-
- public boolean isTestPassed()
- {
- return testPassed;
- }
-
- public void setTestPassed(boolean testPassed)
- {
- this.testPassed = testPassed;
- }
-
- public String getErrorMsg()
- {
- return errorMsg;
- }
-
- public void setErrorMsg(String errorMsg)
- {
- this.errorMsg = errorMsg;
- }
-
- public String getFootNote()
- {
- return footNote;
- }
-
- public void setFootNote(String footNote)
- {
- this.footNote = footNote;
- }
-
- /**
- * This is only measured on put() operations as it has little meaning for get()s.
- */
- public int getThroughputTransactionsPerSecond()
- {
- return throughputTransactionsPerSecond;
- }
-
- public void setThroughputTransactionsPerSecond(int throughputTransactionsPerSecond)
- {
- this.throughputTransactionsPerSecond = throughputTransactionsPerSecond;
- }
-
- /**
- * This is only measured on put() operations as it has little meaning for get()s. Note that the serialized size of objects
- * are used to calculate this, not the ACTUAL bytes transmitted, as some cache impls (JBoss Cache >= 1.4) has internal
- * marshallers that reduce object sizes to smaller than what they would be if serialized. For the sake of comparing though,
- * one must still consider that an object of, say, 200 bytes when serialized was transmitted, even if the cache compresses
- * this to 100 bytes.
- */
- public int getThroughputBytesPerSecond()
- {
- return throughputBytesPerSecond;
- }
-
- public void setThroughputBytesPerSecond(int throughputBytesPerSecond)
- {
- this.throughputBytesPerSecond = throughputBytesPerSecond;
- }
-
- public int getNumMembers()
- {
- return numMembers;
- }
-
- public void setNumMembers(int numMembers)
- {
- this.numMembers = numMembers;
- }
-
- public int getNumThreads()
- {
- return numThreads;
- }
-
- public void setNumThreads(int numThreads)
- {
- this.numThreads = numThreads;
- }
-
- public String toString()
- {
- return "TestResult{" +
- "testName='" + testName + '\'' +
- ", testType='" + testType + '\'' +
- ", testTime=" + testTime +
- ", putData=" + putData +
- ", getData=" + getData +
- ", testPassed=" + testPassed +
- ", errorMsg='" + errorMsg + '\'' +
- ", footNote='" + footNote + '\'' +
- ", throughputTransactionsPerSecond=" + throughputTransactionsPerSecond +
- ", throughputBytesPerSecond=" + throughputBytesPerSecond +
- ", numMembers=" + numMembers +
- ", numThreads=" + numThreads +
- '}';
- }
-
- /**
- * If set to true, no reports will be generated from this test result.
- */
- public boolean isSkipReport()
- {
- return skipReport;
- }
-
- public void setSkipReport(boolean skipReport)
- {
- this.skipReport = skipReport;
- }
-}
Modified: cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -31,4 +31,9 @@
{
return configParams.get(name);
}
+
+ public int getIntValue(String name)
+ {
+ return Integer.parseInt(configParams.get(name));
+ }
}
Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/AbstractReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,10 +1,11 @@
package org.cachebench.reportgenerators;
import org.apache.commons.logging.Log;
-import org.cachebench.TestResult;
import org.cachebench.config.ClusterConfig;
+import org.cachebench.tests.results.TestResult;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -34,7 +35,8 @@
public void setResults(List<TestResult> results)
{
- this.results = results;
+
+ this.results = new ArrayList(results);
}
public void setClusterConfig(ClusterConfig clusterConfig)
Deleted: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CSVReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,197 +0,0 @@
-package org.cachebench.reportgenerators;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-import org.cachebench.TestResult;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * @version $Id: CSVReportGenerator.java,v 1.5 2007/04/18 19:09:31 msurtani Exp $
- */
-public class CSVReportGenerator extends AbstractReportGenerator
-{
- private ArrayList footNotes;
-
-
- public CSVReportGenerator()
- {
- log = LogFactory.getLog(this.getClass());
- }
-
- public void generate() throws Exception
- {
- try
- {
- BufferedWriter writer = null;
- log.debug("Opening output file [" + output + "]");
- String fileName = output.getAbsolutePath() + ".old." + System.currentTimeMillis();
- prepareReportFile(fileName);
- writer = new BufferedWriter(new FileWriter(output));
- writeHeaderLine(writer); // Write the Header of the Report
- // Write the results
- for (TestResult result : results)
- {
- writeTestResult(result, writer);
- }
- // Write the Footnotes (if available)
- if (footNotes != null)
- {
- writeFoodNotes(writer);
- }
-
- writer.close();
- log.debug("Report complete");
- if (output.exists())
- {
- log.warn("Expected report file:'" + output.getAbsoluteFile() + "'does not exist!");
- }
- } catch (IOException e)
- {
- log.error("Error appeared while generatin report:", e);
- }
- }
-
- private void prepareReportFile(String fileName)
- throws IOException
- {
- if (output.exists())
- {
- log.info("A file named: '" + output.getAbsolutePath() + "' already exist. Renaming to '" + fileName + "'");
- if (output.renameTo(new File(fileName))) {
- log.warn("Could not rename!!!");
- }
- } else
- {
- if (output.createNewFile()) {
- log.info("Successfully created report file:" + output.getAbsolutePath());
- } else {
- log.warn("Failed to create the report file!");
- }
- }
- }
-
- /**
- * Writes out the report.
- * The method checkes whether the result is passed or failed. And based on the status would generate the report with
- * appropriate content. The method also checks whether the report has any foot notes attached to the test case. If
- * any foot note is found, then its added to the <code>footNotes</code> ArrayList for later processing.
- */
- private void writeTestResult(TestResult result, BufferedWriter writer) throws IOException
- {
- log.debug("Writing the Result to the Report");
- StringBuffer buf = new StringBuffer();
- if (result.isTestPassed())
- {
- // This test has pased. Lets add this test results to the report.
- DescriptiveStatistics putData = result.getPutData();
- DescriptiveStatistics getData = result.getGetData();
-
- buf.append(result.getTestName());
- buf.append(",");
- buf.append(result.getTestTime());
- buf.append(",");
- buf.append(result.getTestType());
- buf.append(",");
- buf.append(result.getNumMembers());
- buf.append(",");
- buf.append(result.getNumThreads());
- buf.append(",");
- buf.append(putData.getSum()/1000);
- buf.append(",");
- buf.append(getData.getSum()/1000);
- buf.append(",");
- buf.append(putData.getMean());
- buf.append(",");
- buf.append(getData.getMean());
- buf.append(",");
- // medians are the 50th percentile...
- buf.append(putData.getPercentile(50));
- buf.append(",");
- buf.append(getData.getPercentile(50));
- buf.append(",");
- buf.append(putData.getStandardDeviation());
- buf.append(",");
- buf.append(getData.getStandardDeviation());
- buf.append(",");
- buf.append(putData.getMax());
- buf.append(",");
- buf.append(getData.getMax());
- buf.append(",");
- buf.append(putData.getMin());
- buf.append(",");
- buf.append(getData.getMin());
- buf.append(",");
- buf.append(result.getThroughputTransactionsPerSecond());
- buf.append(",");
- buf.append(result.getThroughputBytesPerSecond());
- }
- else
- {
- // This test has failed. Need to add this to the report.
- buf.append(result.getTestName());
- buf.append(",");
- buf.append(result.getTestTime());
- buf.append(",");
- buf.append(result.getTestType());
- buf.append(",");
- buf.append(result.getErrorMsg());
- }
-
- // write details of this test to file.
- writer.write(buf.toString());
- writer.newLine();
-
- // Now check if we have foot notes for this error
- if (!"".equals(result.getFootNote()))
- {
- // We hae footnotes
- if (footNotes == null)
- {
- footNotes = new ArrayList();
- }
- footNotes.add(result.getFootNote());
- }
- log.debug("Completed writing test result");
- }
-
- private 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.newLine();
- log.debug("Complted the Report Header");
- }
-
- private void writeFoodNotes(BufferedWriter writer) throws IOException
- {
- log.debug("Writing the Footnotes");
- writer.newLine();
- writer.newLine();
- writer.newLine();
- writer.newLine();
- writer.write("Report FootNotes");
- writer.newLine();
- int footNoteSize = footNotes.size();
- for (int i = 0; i < footNoteSize; i++)
- {
- writer.write((String) footNotes.get(i));
- writer.newLine();
- }
- log.debug("Complted the Footnotes");
- }
-
- public void setConfigParams(Map configParams)
- {
- //we are not intereseted in any params, yet (e.g. may be we want to change separator from comma to tab)
- }
-}
Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ClusterReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -2,8 +2,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.cachebench.TestResult;
import org.cachebench.cluster.ClusterBarrier;
+import org.cachebench.tests.results.TestResult;
import java.net.SocketAddress;
import java.util.ArrayList;
@@ -20,10 +20,12 @@
public class ClusterReportGenerator extends AbstractReportGenerator
{
private static Log log = LogFactory.getLog(ClusterReportGenerator.class);
+ private String reportGeneratorClassName;
public void setConfigParams(Map<String, String> configParams)
{
log.trace("Received config params: " + configParams);
+ reportGeneratorClassName = configParams.get("generatorClassName");
}
public void generate() throws Exception
@@ -41,10 +43,11 @@
log.trace("Received following results: " + results);
generateReport(barrier.getReceivedMessages());
}
- barrierUntilReportIsGenerated();
} catch (Exception e)
{
log.error("Error while generating report!", e);
+ } finally {
+ barrierUntilReportIsGenerated();
}
}
@@ -73,12 +76,32 @@
private void generateReportFile(List<TestResult> mergedResults) throws Exception
{
- CSVReportGenerator generator = new CSVReportGenerator();
+ if (mergedResults.isEmpty())
+ {
+ log.warn("Result list is emty, not generating any report");
+ return;
+ }
+ String genClassName = mergedResults.get(0).getReportGeneratorClassName();
+ AbstractReportGenerator generator = instantiateReportGenerator(genClassName);
generator.setResults(mergedResults);
+ log.debug("Generating reports to file: " + output);
generator.output = output;
generator.generate();
}
+ private AbstractReportGenerator instantiateReportGenerator(String genClassName)
+ {
+ try
+ {
+ log.debug("Using generator class: " + genClassName);
+ return (AbstractReportGenerator) Class.forName(genClassName).newInstance();
+ } catch (Exception e)
+ {
+ log.error("Could not instantiate report generators", e);
+ throw new IllegalStateException(e);
+ }
+ }
+
private List<TestResult> mergerTestResultsAndGenerateReport(List<List<TestResult>> results)
{
List<TestResult> mergedResults = new ArrayList<TestResult>();
Added: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvBaseReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,120 @@
+package org.cachebench.reportgenerators;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.tests.results.TestResult;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public abstract class CsvBaseReportGenerator extends AbstractReportGenerator
+{
+ protected static Log log = LogFactory.getLog(CsvBaseReportGenerator.class);
+
+ protected Map<String,String> configParams;
+ private ArrayList footNotes;
+
+ public void setConfigParams(Map<String, String> configParams)
+ {
+ this.configParams = configParams;
+ }
+
+ public void generate() throws Exception
+ {
+ try
+ {
+ BufferedWriter writer = null;
+
+ log.debug("Opening output file [" + output + "]");
+ prepareReportFile();
+ writer = new BufferedWriter(new FileWriter(output));
+ writeHeaderLine(writer);
+
+ for (TestResult result : results)
+ {
+ writeTestResult(result, writer);
+ checkForFootnotes(result);
+ }
+ // Write the Footnotes (if available)
+ if (footNotes != null)
+ {
+ writeFoodNotes(writer);
+ }
+ writer.close();
+ log.debug("Report complete");
+ if (output.exists())
+ {
+ log.warn("Expected report file:'" + output.getAbsoluteFile() + "'does not exist!");
+ }
+ } catch (IOException e)
+ {
+ log.error("Error appeared while generatin report:", e);
+ }
+ }
+
+ private void checkForFootnotes(TestResult result)
+ {
+ // Now check if we have foot notes for this error
+ if (!"".equals(result.getFootNote()))
+ {
+ // We hae footnotes
+ if (footNotes == null)
+ {
+ footNotes = new ArrayList();
+ }
+ footNotes.add(result.getFootNote());
+ log.debug("Foot node found, added " + result.getFootNote());
+ }
+ }
+
+ protected abstract void writeTestResult(TestResult result, BufferedWriter writer) throws IOException;
+
+ protected abstract void writeHeaderLine(BufferedWriter writer) throws IOException;
+
+ private void prepareReportFile() throws IOException
+ {
+ String fileName = output.getAbsolutePath() + ".old." + System.currentTimeMillis();
+ if (output.exists())
+ {
+ log.info("A file named: '" + output.getAbsolutePath() + "' already exist. Renaming to '" + fileName + "'");
+ if (output.renameTo(new File(fileName))) {
+ log.warn("Could not rename!!!");
+ }
+ } else
+ {
+ if (output.createNewFile()) {
+ log.info("Successfully created report file:" + output.getAbsolutePath());
+ } else {
+ log.warn("Failed to create the report file!");
+ }
+ }
+ }
+
+ private void writeFoodNotes(BufferedWriter writer) throws IOException
+ {
+ log.debug("Writing the Footnotes");
+ writer.newLine();
+ writer.newLine();
+ writer.newLine();
+ writer.newLine();
+ writer.write("Report FootNotes");
+ writer.newLine();
+ int footNoteSize = footNotes.size();
+ for (int i = 0; i < footNoteSize; i++)
+ {
+ writer.write((String) footNotes.get(i));
+ writer.newLine();
+ }
+ log.debug("Complted the Footnotes");
+ }
+
+
+}
Added: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,65 @@
+package org.cachebench.reportgenerators;
+
+import org.cachebench.tests.SessionSimulatorTestResult;
+import org.cachebench.tests.results.TestResult;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class CsvSessionSimlatorReportGenerator extends CsvBaseReportGenerator
+{
+ protected void writeTestResult(TestResult result, BufferedWriter writer) throws IOException
+ {
+ SessionSimulatorTestResult ssResult = (SessionSimulatorTestResult) result;
+ log.debug("Writing the Result to the Report");
+ StringBuffer buf = new StringBuffer();
+ if (ssResult.isTestPassed())
+ {
+ buf.append(ssResult.getTestName());
+ buf.append(",");
+ buf.append(ssResult.getTestTime());
+ buf.append(",");
+ buf.append(ssResult.getNoRequestPerSec());
+ buf.append(",");
+ buf.append(ssResult.getBytesRead());
+ buf.append(",");
+ buf.append(ssResult.getBytesWritten());
+ buf.append(",");
+ buf.append(ssResult.getDurration());
+ buf.append(",");
+ buf.append(ssResult.getTotalOperationCount());
+ buf.append(",");
+ buf.append(ssResult.getReadCount());
+ buf.append(",");
+ buf.append(ssResult.getWriteCount());
+ }
+ else
+ {
+ // This test has failed. Need to add this to the report.
+ buf.append(ssResult.getTestName());
+ buf.append(",");
+ buf.append(ssResult.getTestTime());
+ buf.append(",");
+ buf.append(ssResult.getTestType());
+ buf.append(",");
+ buf.append(ssResult.getErrorMsg());
+ }
+
+ // write details of this test to file.
+ writer.write(buf.toString());
+ writer.newLine();
+ }
+
+ protected void writeHeaderLine(BufferedWriter writer) throws IOException
+ {
+ log.debug("Write the Report Header");
+ writer.write("TEST NAME, TEST DATE, REQ PER SEC, BYTES READ, BYTES WRITTEN, DURRATION, TOTOAL OPERATION COUNT, READ COUNT, WRITE COUNT" );
+ writer.newLine();
+ log.debug("Complted the Report Header");
+
+ }
+}
Modified: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/ReportGenerator.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,9 +1,8 @@
package org.cachebench.reportgenerators;
-import org.cachebench.TestResult;
import org.cachebench.config.ClusterConfig;
+import org.cachebench.tests.results.TestResult;
-import java.io.File;
import java.util.List;
import java.util.Map;
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithAssocs;
-import org.cachebench.testobjects.SerializableCustomTypeWithAssocs;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class AssociationsTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithAssocs.class : CustomTypeWithAssocs.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/CacheTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,8 +1,8 @@
package org.cachebench.tests;
import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
import org.cachebench.config.Configuration;
+import org.cachebench.tests.results.TestResult;
/**
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomType;
-import org.cachebench.testobjects.SerializableCustomType;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class CustomClassTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomType.class : CustomType.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,23 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class PrimitiveTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, Integer.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -3,7 +3,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
+import org.cachebench.tests.results.StatisticTestResult;
import org.cachebench.cluster.ClusterBarrier;
import org.cachebench.config.Configuration;
import org.cachebench.config.TestCase;
@@ -31,7 +31,7 @@
this.conf = configuration;
}
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
{
log.trace("TestCase = '" + testCaseName + "', TestName = " + testName);
barrierBeforeReplicationTest();
@@ -43,7 +43,7 @@
if (conf.getClusterConfig().getClusterSize() == 1)
{
log.info("Cluster size is one, no replication expected");
- TestResult result = new TestResult();
+ StatisticTestResult result = new StatisticTestResult();
result.setTestPassed(true);
result.setSkipReport(true);
return result;
@@ -76,9 +76,9 @@
barrier.barrier("BEFORE_REPLICATION_OCCURS_BARRIER");
}
- private TestResult allReplicatedFine(Map<SocketAddress, Object> receivedValues)
+ private StatisticTestResult allReplicatedFine(Map<SocketAddress, Object> receivedValues)
{
- TestResult result = new TestResult();
+ StatisticTestResult result = new StatisticTestResult();
result.setSkipReport(true);
for (Object value : receivedValues.values())
{
Added: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,145 @@
+package org.cachebench.tests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.CacheWrapper;
+import org.cachebench.config.Configuration;
+import org.cachebench.config.TestCase;
+import org.cachebench.config.TestConfig;
+import org.cachebench.tests.results.TestResult;
+
+import java.util.Random;
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class SessionSimulatorTest implements CacheTest
+{
+ private static final Log log = LogFactory.getLog(SessionSimulatorTest.class);
+
+ public static final String SESSION_PREFIX = "SESSION_";
+ Configuration configuration;
+ private TestConfig thisTestConfig;
+ private String sessionId;
+ private CacheWrapper cacheWrapper;
+
+ /**
+ * total number of request to be made against this session: reads + writes
+ */
+ private int numberOfRequests;
+
+ /**
+ * for each session there will be created fixed number of attributes. On those attributes all the GETs and PUTs
+ * are performed (for PUT is overwrite)
+ */
+ private int numberOfAttributes;
+
+ /**
+ * Each attribute will be a byte[] of this size
+ */
+ private int sizeOfAnAttribute;
+
+ /**
+ * Out of the total number of request, this define the frequency of writes (percentage)
+ */
+ private int writePercentage;
+
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ this.cacheWrapper = cache;
+ TestCase testCase = configuration.getTestCase(testCaseName);
+ thisTestConfig = testCase.getTest(testName);
+ readParams();
+ initSession();
+ return stressSession(testName, testCaseName);
+ }
+
+ private SessionSimulatorTestResult stressSession(String testName, String testCaseName) throws Exception
+ {
+
+ long totalBytesRead = 0;
+ long totalBytesWritten = 0;
+ long reads = 0;
+ long writes = 0;
+ int readPercentage = 100 - writePercentage;
+ Random r = new Random();
+ int randomAction;
+ int randomAttribute;
+ long start=System.currentTimeMillis();
+ for (int i = 0; i < numberOfRequests; i++)
+ {
+ randomAction = r.nextInt(100);
+ randomAttribute = r.nextInt(numberOfAttributes - 1);
+ byte[] buf;
+ if (randomAction < readPercentage)
+ { // read
+ try
+ {
+ buf = (byte[]) cacheWrapper.get(getSessionEntry(randomAttribute));
+ totalBytesRead += buf.length;
+ reads++;
+ } catch (Exception e)
+ {
+ log.trace("Error appeared whilst reading from cache:" + e.getMessage());
+ }
+ } else
+ { // write
+ buf = new byte[this.sizeOfAnAttribute];
+ try
+ {
+ cacheWrapper.put(getSessionEntry(randomAttribute), buf);
+ totalBytesWritten += buf.length;
+ writes++;
+ } catch (Exception e)
+ {
+ log.trace("Error appeared whilst writing to cache:" + e.getMessage());
+ }
+ }
+ }
+ long durration = System.currentTimeMillis() - start;
+ SessionSimulatorTestResult result = new SessionSimulatorTestResult(reads, writes, durration, totalBytesRead, totalBytesWritten);
+ result.setTestPassed(true);
+ result.setTestName(testCaseName + getNodeIndex());
+ result.setTestTime(new Date());
+ result.setTestType(testName);
+ log.trace("Returning result:" + result);
+ return result;
+ }
+
+ private void initSession() throws Exception
+ {
+ for (int i = 0; i < numberOfAttributes; i++)
+ {
+ cacheWrapper.put(getSessionEntry(i), new byte[sizeOfAnAttribute]);
+ }
+ }
+
+ private String getSessionEntry(int i)
+ {
+ return sessionId + i;
+ }
+
+ private void readParams ()
+ {
+ sessionId = SESSION_PREFIX + configuration.getClusterConfig().getCurrentNodeIndex();
+ log.debug("Session id is: " + sessionId);
+ numberOfRequests = thisTestConfig.getIntValue("numberOfRequest");
+ numberOfAttributes = thisTestConfig.getIntValue("numberOfAttributes");
+ writePercentage = thisTestConfig.getIntValue("writePercentage");
+ sizeOfAnAttribute = thisTestConfig.getIntValue("sizeOfAnAttribute");
+ log.debug("recieved follosing params[ numberOfRequests=" + numberOfRequests + ", numberOfAttributes="
+ + numberOfAttributes + ", writePercentage=" + writePercentage + ", sizeOfAnAttribute=" + sizeOfAnAttribute + " ]");
+ }
+
+ public String getNodeIndex()
+ {
+ return configuration.getClusterConfig().getCurrentNodeIndex() + "";
+ }
+}
Added: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,68 @@
+package org.cachebench.tests;
+
+import org.cachebench.tests.results.BaseTestResult;
+import org.cachebench.reportgenerators.CsvSessionSimlatorReportGenerator;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class SessionSimulatorTestResult extends BaseTestResult
+{
+
+ long readCount;
+ long writeCount;
+ long durration;
+ long bytesRead;
+ long bytesWritten;
+
+
+ public SessionSimulatorTestResult(long readCount, long writeCount, long durration, long bytesRead, long bytesWritten)
+ {
+ this.readCount = readCount;
+ this.writeCount = writeCount;
+ this.durration = durration;
+ this.bytesRead = bytesRead;
+ this.bytesWritten = bytesWritten;
+ }
+
+ public long getTotalOperationCount()
+ {
+ return readCount + writeCount;
+ }
+
+ public long getReadCount()
+ {
+ return readCount;
+ }
+
+ public long getWriteCount()
+ {
+ return writeCount;
+ }
+
+ public double getNoRequestPerSec()
+ {
+ return getTotalOperationCount() / (durration / 1000.0);
+ }
+
+ public long getBytesRead()
+ {
+ return bytesRead;
+ }
+
+ public long getBytesWritten()
+ {
+ return bytesWritten;
+ }
+
+ public long getDurration()
+ {
+ return durration;
+ }
+
+ public String getReportGeneratorClassName()
+ {
+ return CsvSessionSimlatorReportGenerator.class.getName();
+ }
+}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,296 +0,0 @@
-package org.cachebench.tests;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.config.Configuration;
-
-import java.io.Serializable;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.util.Date;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicLong;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public abstract class SimpleTest implements CacheTest
-{
- protected Log log = LogFactory.getLog(this.getClass());
- protected AtomicLong numberOfBytesPut = new AtomicLong(0);
- protected long elapsedSecondsForAllPuts = 0;
- protected ExecutorService executor;
- private static final int EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS = 60;
- protected Configuration configuration;
- protected final int LOG_FREQUENCY = 5000;
-
- protected TestResult performTestWithObjectType(String testCaseName, CacheWrapper cache, Class valueClass, String testName, int sampleSize, int numThreads) throws Exception
- {
- log.info("Number of threads " + numThreads);
- executor = Executors.newFixedThreadPool(numThreads);
-
- TestResult result = new TestResult();
- result.setTestName(testCaseName + getNodeIndex());
- result.setTestTime(new Date());
- result.setTestType(testName);
-
- log.info("Performing '" + sampleSize + "' PUTs");
- DescriptiveStatistics putStats = doPuts(cache, valueClass, sampleSize);
- executor = Executors.newFixedThreadPool(numThreads);
- log.info("Performing GETs");
- DescriptiveStatistics getStats = doGets(cache, sampleSize);
-
- result.setGetData(getStats);
- result.setPutData(putStats);
- result.setTestPassed(true); // The test is passed. The report would make use of this attribute.
-
- // calculate throughput, in transactions per second.
- // we only measure put operations for throughput.
-
- // calc tps.
-
- System.out.println("*** sum of time: " + elapsedSecondsForAllPuts);
- System.out.println("*** num puts occured: " + putStats.getN());
-
- try
- {
- result.setThroughputTransactionsPerSecond((int) (sampleSize / elapsedSecondsForAllPuts));
- }
- catch (ArithmeticException ae)
- {
- log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
- result.setThroughputTransactionsPerSecond(-999);
- }
-
- try
- {
- result.setThroughputBytesPerSecond((int) (numberOfBytesPut.longValue() / elapsedSecondsForAllPuts));
- }
- catch (ArithmeticException ae)
- {
- log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
- result.setThroughputBytesPerSecond(-999);
- }
-
-
- // set the number of members in the cluster
- result.setNumMembers(cache.getNumMembers());
- result.setNumThreads(numThreads);
-
- return result;
- }
-
- /**
- * @param cache The Cachewrapper on which the bechmark is conducted.
- * @param sampleSize The size of the cache.
- * @return The Descriptive statistics of the cache benchmarking.
- */
- private DescriptiveStatistics doGets(final CacheWrapper cache, int sampleSize) throws Exception
- {
- log.debug("Inside doGets for : " + cache);
- final String key = "baseKey";
- final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
- final boolean useSerializable = cache instanceof SerializableCacheWrapper;
-
- for (int i = 0; i < sampleSize; i++)
- {
- final int cycleNumber = i;
- Runnable r = new Runnable()
- {
- public void run()
- {
- try
- {
- if (!useSerializable)
- {
- // start your timer...
- long startTime = System.currentTimeMillis();
- cache.get(key + cycleNumber);
- long statValue = (System.currentTimeMillis() - startTime);
- stats.addValue(statValue);
- log.debug("The Get stat : " + statValue);
- }
- else
- {
- SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
- long startTime = System.currentTimeMillis();
- sCache.getSerializable(key + cycleNumber);
- long statValue = (System.currentTimeMillis() - startTime);
- stats.addValue(statValue);
- log.debug("The Get stat : " + statValue);
- }
- logOperation(cycleNumber, "GETS");
- }
- catch (Exception e)
- {
- // how should we handle this? Log for now...
- log.error("Operation failed!", e);
- }
- }
- };
-
- // submit task to be executed
- executor.execute(r);
- }
-
- // only leave once the task queue is empty!!
- blockTillTasksComplete();
-
- // return the raw data
- log.debug("Leaving doGets for : " + cache);
- return stats;
- }
-
- private void logOperation(int i, String s)
- {
- if ((i + 1) % LOG_FREQUENCY == 0)
- {
- log.info((i + 1) + " " + s + " were performed");
- }
- }
-
- /**
- * @param cache The Cachewrapper on which the bechmark is conducted.
- * @param valueClass The value class instance which is going to be inserted into the Cache.
- * @param sampleSize The size of the cache.
- * @return The Descriptive statistics of the cache benchmarking.
- */
- private DescriptiveStatistics doPuts(final CacheWrapper cache, final Class valueClass, int sampleSize) throws Exception
- {
- log.debug("Inside doPuts for " + cache);
- final String key = "baseKey";
- final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
- final boolean useSerializable = cache instanceof SerializableCacheWrapper;
- numberOfBytesPut.set(0);
- elapsedSecondsForAllPuts = 0;
- long startElapsedTime = System.currentTimeMillis();
-
- for (int i = 0; i < sampleSize; i++)
- {
- final int cycleNumber = i;
- Runnable r = new Runnable()
- {
- public void run()
- {
- try
- {
- // generate some value
- Object value;
- if (valueClass == null) value = null;
- else if (valueClass.getName().equals("java.lang.String")) value = "value" + cycleNumber;
- else if (valueClass.getName().equals("java.lang.Integer")) value = cycleNumber;
- else value = valueClass.newInstance();
-
- // even though some impls may use special marshalling to reduce the amount of data transmitted (such as JBoss Cache's
- // CacheMarshaller) we still want to measure the serialized size of objects for this metric.
-
- numberOfBytesPut.getAndAdd(calculateSerializedSize(value));
-
- if (!useSerializable)
- {
- // start your timer...
- long startTime = System.currentTimeMillis();
- cache.put(key + cycleNumber, value);
- long statValue = (System.currentTimeMillis() - startTime);
- stats.addValue(statValue);
- }
- else
- {
- SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
- Serializable sValue = (Serializable) value;
- long startTime = System.currentTimeMillis();
- sCache.putSerializable(key + cycleNumber, sValue);
- long statValue = (System.currentTimeMillis() - startTime);
- stats.addValue(statValue);
- }
- logOperation(cycleNumber,"PUTS");
- }
- catch (Exception e)
- {
- // how should we handle this? Log for now...
- log.error("Operation failed!", e);
- }
- }
- };
- // submit task to be executed
- executor.execute(r);
- }
-
- // only leave once the task queue is empty!!
- blockTillTasksComplete();
- elapsedSecondsForAllPuts = (System.currentTimeMillis() - startElapsedTime) / 1000;
-
- // return the raw data
- log.debug("Leaving doPuts for " + cache);
- return stats;
- }
-
- private void blockTillTasksComplete()
- {
- // now that just told us that all the tasks have been submitted. Lets check that the executor has finished everything.
- executor.shutdown();
- while (!executor.isTerminated())
- {
- try
- {
- executor.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS, TimeUnit.SECONDS);
- }
- catch (InterruptedException e)
- {
- // do nothing?
- }
- }
- }
-
- private long calculateSerializedSize(Object value)
- {
- ByteArrayOutputStream baos = null;
- ObjectOutputStream oos = null;
- try
- {
- baos = new ByteArrayOutputStream();
- oos = new ObjectOutputStream(baos);
- oos.writeObject(value);
- oos.close();
- baos.close();
- return baos.size();
- }
- catch (Exception e)
- {
- log.warn("Unable to calculate serialized size of object " + value, e);
- try
- {
- if (oos != null) oos.close();
- if (baos != null) baos.close();
- }
- catch (Exception e2)
- {
- log.warn("Unable to close streams", e2);
- }
- }
- return 0;
- }
-
- public String getNodeIndex()
- {
- try
- {
- return " - " + Integer.parseInt(System.getProperty("currentIndex"));
- } catch (Exception e) {
- return "";
- }
- }
-
- public void setConfiguration(Configuration configuration)
- {
- this.configuration = configuration;
- }
-}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,25 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithStatics;
-import org.cachebench.testobjects.SerializableCustomTypeWithStatics;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class StaticsTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithStatics.class : CustomTypeWithStatics.class, testCaseName, sampleSize, numThreads);
- }
-
-}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,23 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.TestResult;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class StringTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, String.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeSubclassOfAbstract;
-import org.cachebench.testobjects.SerializableCustomTypeSubclassOfAbstract;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class SubclassTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeSubclassOfAbstract.class : CustomTypeSubclassOfAbstract.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Deleted: cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java 2008-01-07 14:07:27 UTC (rev 5033)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -1,26 +0,0 @@
-package org.cachebench.tests;
-
-import org.cachebench.CacheWrapper;
-import org.cachebench.SerializableCacheWrapper;
-import org.cachebench.TestResult;
-import org.cachebench.testobjects.CustomTypeWithTransient;
-import org.cachebench.testobjects.SerializableCustomTypeWithTransient;
-
-
-/**
- * @author Manik Surtani (manik(a)surtani.org)
- * (C) Manik Surtani, 2004
- */
-public class TransientTest extends SimpleTest
-{
-
- /* (non-Javadoc)
- * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
- */
- public TestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
- {
- return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithTransient.class : CustomTypeWithTransient.class, testCaseName, sampleSize, numThreads);
-
- }
-
-}
Added: cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/BaseTestResult.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,99 @@
+package org.cachebench.tests.results;
+
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class BaseTestResult implements TestResult
+{
+
+ protected String testName;
+ protected String testType;
+ protected Date testTime;
+ protected boolean testPassed;
+ protected String errorMsg;
+ protected boolean skipReport;
+ protected String footNote = ""; // This is utilized if special notes need to be captured for this test.
+
+
+ public void setTestName(String testName)
+ {
+ this.testName = testName;
+ }
+
+ public void setTestType(String testType)
+ {
+ this.testType = testType;
+ }
+
+ public void setTestTime(Date testTime)
+ {
+ this.testTime = testTime;
+ }
+
+ public boolean isTestPassed()
+ {
+ return testPassed;
+ }
+
+ public void setTestPassed(boolean testPassed)
+ {
+ this.testPassed = testPassed;
+ }
+
+ public void setErrorMsg(String errorMsg)
+ {
+ this.errorMsg = errorMsg;
+ }
+ /**
+ * If set to true, no reports will be generated from this test result.
+ */
+ public boolean isSkipReport()
+ {
+ return skipReport;
+ }
+
+ public void setSkipReport(boolean skipReport)
+ {
+ this.skipReport = skipReport;
+ }
+
+
+ public String getTestName()
+ {
+ return testName;
+ }
+
+ public String getTestType()
+ {
+ return testType;
+ }
+
+ public Date getTestTime()
+ {
+ return testTime;
+ }
+
+ public String getErrorMsg()
+ {
+ return errorMsg;
+ }
+
+ public String getFootNote()
+ {
+ return footNote;
+ }
+
+ public void setFootNote(String footNote)
+ {
+ this.footNote = footNote;
+ }
+
+
+ public String getReportGeneratorClassName()
+ {
+ return null;
+ }
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/TestResult.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/StatisticTestResult.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,112 @@
+package org.cachebench.tests.results;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.cachebench.reportgenerators.CsvStatisticReportGenerator;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * @version $Id: StatisticTestResult.java,v 1.4 2007/04/18 19:09:30 msurtani Exp $
+ */
+public class StatisticTestResult extends BaseTestResult
+{
+ private DescriptiveStatistics putData, getData;
+ private int throughputTransactionsPerSecond;
+ private int throughputBytesPerSecond;
+ private int numMembers;
+ private int numThreads;
+
+ public DescriptiveStatistics getGetData()
+ {
+ return getData;
+ }
+
+ public void setGetData(DescriptiveStatistics getData)
+ {
+ this.getData = getData;
+ }
+
+ public DescriptiveStatistics getPutData()
+ {
+ return putData;
+ }
+
+ public void setPutData(DescriptiveStatistics putData)
+ {
+ this.putData = putData;
+ }
+
+
+ /**
+ * This is only measured on put() operations as it has little meaning for get()s.
+ */
+ public int getThroughputTransactionsPerSecond()
+ {
+ return throughputTransactionsPerSecond;
+ }
+
+ public void setThroughputTransactionsPerSecond(int throughputTransactionsPerSecond)
+ {
+ this.throughputTransactionsPerSecond = throughputTransactionsPerSecond;
+ }
+
+ /**
+ * This is only measured on put() operations as it has little meaning for get()s. Note that the serialized size of objects
+ * are used to calculate this, not the ACTUAL bytes transmitted, as some cache impls (JBoss Cache >= 1.4) has internal
+ * marshallers that reduce object sizes to smaller than what they would be if serialized. For the sake of comparing though,
+ * one must still consider that an object of, say, 200 bytes when serialized was transmitted, even if the cache compresses
+ * this to 100 bytes.
+ */
+ public int getThroughputBytesPerSecond()
+ {
+ return throughputBytesPerSecond;
+ }
+
+ public void setThroughputBytesPerSecond(int throughputBytesPerSecond)
+ {
+ this.throughputBytesPerSecond = throughputBytesPerSecond;
+ }
+
+ public int getNumMembers()
+ {
+ return numMembers;
+ }
+
+ public void setNumMembers(int numMembers)
+ {
+ this.numMembers = numMembers;
+ }
+
+ public int getNumThreads()
+ {
+ return numThreads;
+ }
+
+ public void setNumThreads(int numThreads)
+ {
+ this.numThreads = numThreads;
+ }
+
+ public String toString()
+ {
+ return "StatisticTestResult{" +
+ "testName='" + testName + '\'' +
+ ", testType='" + testType + '\'' +
+ ", testTime=" + testTime +
+ ", putData=" + putData +
+ ", getData=" + getData +
+ ", testPassed=" + testPassed +
+ ", errorMsg='" + errorMsg + '\'' +
+ ", footNote='" + footNote + '\'' +
+ ", throughputTransactionsPerSecond=" + throughputTransactionsPerSecond +
+ ", throughputBytesPerSecond=" + throughputBytesPerSecond +
+ ", numMembers=" + numMembers +
+ ", numThreads=" + numThreads +
+ '}';
+ }
+
+ public String getReportGeneratorClassName()
+ {
+ return CsvStatisticReportGenerator.class.getName();
+ }
+}
Added: cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/results/TestResult.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,36 @@
+package org.cachebench.tests.results;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public interface TestResult extends Serializable
+{
+
+ public String getReportGeneratorClassName();
+
+ void setTestName(String testCaseName);
+
+ void setTestTime(Date date);
+
+ void setTestType(String testName);
+
+ void setTestPassed(boolean b);
+
+ void setErrorMsg(String s);
+
+ boolean isTestPassed();
+
+ boolean isSkipReport();
+
+ String getTestName();
+
+ String getTestType();
+
+ void setFootNote(String s);
+
+ String getFootNote();
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/AssociationsTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/AssociationsTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithAssocs;
+import org.cachebench.testobjects.SerializableCustomTypeWithAssocs;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class AssociationsTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithAssocs.class : CustomTypeWithAssocs.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/CustomClassTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/CustomClassTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomType;
+import org.cachebench.testobjects.SerializableCustomType;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class CustomClassTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomType.class : CustomType.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/PrimitiveTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/PrimitiveTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,23 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class PrimitiveTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, Integer.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java (from rev 5007, cache-bench-fwk/trunk/src/org/cachebench/tests/SimpleTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,297 @@
+package org.cachebench.tests.simpletests;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.tests.CacheTest;
+import org.cachebench.config.Configuration;
+
+import java.io.Serializable;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Date;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicLong;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public abstract class SimpleTest implements CacheTest
+{
+ protected Log log = LogFactory.getLog(this.getClass());
+ protected AtomicLong numberOfBytesPut = new AtomicLong(0);
+ protected long elapsedSecondsForAllPuts = 0;
+ protected ExecutorService executor;
+ private static final int EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS = 60;
+ protected Configuration configuration;
+ protected final int LOG_FREQUENCY = 5000;
+
+ protected StatisticTestResult performTestWithObjectType(String testCaseName, CacheWrapper cache, Class valueClass, String testName, int sampleSize, int numThreads) throws Exception
+ {
+ log.info("Number of threads " + numThreads);
+ executor = Executors.newFixedThreadPool(numThreads);
+
+ StatisticTestResult result = new StatisticTestResult();
+ result.setTestName(testCaseName + getNodeIndex());
+ result.setTestTime(new Date());
+ result.setTestType(testName);
+
+ log.info("Performing '" + sampleSize + "' PUTs");
+ DescriptiveStatistics putStats = doPuts(cache, valueClass, sampleSize);
+ executor = Executors.newFixedThreadPool(numThreads);
+ log.info("Performing GETs");
+ DescriptiveStatistics getStats = doGets(cache, sampleSize);
+
+ result.setGetData(getStats);
+ result.setPutData(putStats);
+ result.setTestPassed(true); // The test is passed. The report would make use of this attribute.
+
+ // calculate throughput, in transactions per second.
+ // we only measure put operations for throughput.
+
+ // calc tps.
+
+ System.out.println("*** sum of time: " + elapsedSecondsForAllPuts);
+ System.out.println("*** num puts occured: " + putStats.getN());
+
+ try
+ {
+ result.setThroughputTransactionsPerSecond((int) (sampleSize / elapsedSecondsForAllPuts));
+ }
+ catch (ArithmeticException ae)
+ {
+ log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
+ result.setThroughputTransactionsPerSecond(-999);
+ }
+
+ try
+ {
+ result.setThroughputBytesPerSecond((int) (numberOfBytesPut.longValue() / elapsedSecondsForAllPuts));
+ }
+ catch (ArithmeticException ae)
+ {
+ log.warn("Divide by 0 - elapsedSecondsForAllPuts = 0?");
+ result.setThroughputBytesPerSecond(-999);
+ }
+
+
+ // set the number of members in the cluster
+ result.setNumMembers(cache.getNumMembers());
+ result.setNumThreads(numThreads);
+
+ return result;
+ }
+
+ /**
+ * @param cache The Cachewrapper on which the bechmark is conducted.
+ * @param sampleSize The size of the cache.
+ * @return The Descriptive statistics of the cache benchmarking.
+ */
+ private DescriptiveStatistics doGets(final CacheWrapper cache, int sampleSize) throws Exception
+ {
+ log.debug("Inside doGets for : " + cache);
+ final String key = "baseKey";
+ final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
+ final boolean useSerializable = cache instanceof SerializableCacheWrapper;
+
+ for (int i = 0; i < sampleSize; i++)
+ {
+ final int cycleNumber = i;
+ Runnable r = new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ if (!useSerializable)
+ {
+ // start your timer...
+ long startTime = System.currentTimeMillis();
+ cache.get(key + cycleNumber);
+ long statValue = (System.currentTimeMillis() - startTime);
+ stats.addValue(statValue);
+ log.debug("The Get stat : " + statValue);
+ }
+ else
+ {
+ SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
+ long startTime = System.currentTimeMillis();
+ sCache.getSerializable(key + cycleNumber);
+ long statValue = (System.currentTimeMillis() - startTime);
+ stats.addValue(statValue);
+ log.debug("The Get stat : " + statValue);
+ }
+ logOperation(cycleNumber, "GETS");
+ }
+ catch (Exception e)
+ {
+ // how should we handle this? Log for now...
+ log.error("Operation failed!", e);
+ }
+ }
+ };
+
+ // submit task to be executed
+ executor.execute(r);
+ }
+
+ // only leave once the task queue is empty!!
+ blockTillTasksComplete();
+
+ // return the raw data
+ log.debug("Leaving doGets for : " + cache);
+ return stats;
+ }
+
+ private void logOperation(int i, String s)
+ {
+ if ((i + 1) % LOG_FREQUENCY == 0)
+ {
+ log.info((i + 1) + " " + s + " were performed");
+ }
+ }
+
+ /**
+ * @param cache The Cachewrapper on which the bechmark is conducted.
+ * @param valueClass The value class instance which is going to be inserted into the Cache.
+ * @param sampleSize The size of the cache.
+ * @return The Descriptive statistics of the cache benchmarking.
+ */
+ private DescriptiveStatistics doPuts(final CacheWrapper cache, final Class valueClass, int sampleSize) throws Exception
+ {
+ log.debug("Inside doPuts for " + cache);
+ final String key = "baseKey";
+ final DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
+ final boolean useSerializable = cache instanceof SerializableCacheWrapper;
+ numberOfBytesPut.set(0);
+ elapsedSecondsForAllPuts = 0;
+ long startElapsedTime = System.currentTimeMillis();
+
+ for (int i = 0; i < sampleSize; i++)
+ {
+ final int cycleNumber = i;
+ Runnable r = new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ // generate some value
+ Object value;
+ if (valueClass == null) value = null;
+ else if (valueClass.getName().equals("java.lang.String")) value = "value" + cycleNumber;
+ else if (valueClass.getName().equals("java.lang.Integer")) value = cycleNumber;
+ else value = valueClass.newInstance();
+
+ // even though some impls may use special marshalling to reduce the amount of data transmitted (such as JBoss Cache's
+ // CacheMarshaller) we still want to measure the serialized size of objects for this metric.
+
+ numberOfBytesPut.getAndAdd(calculateSerializedSize(value));
+
+ if (!useSerializable)
+ {
+ // start your timer...
+ long startTime = System.currentTimeMillis();
+ cache.put(key + cycleNumber, value);
+ long statValue = (System.currentTimeMillis() - startTime);
+ stats.addValue(statValue);
+ }
+ else
+ {
+ SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
+ Serializable sValue = (Serializable) value;
+ long startTime = System.currentTimeMillis();
+ sCache.putSerializable(key + cycleNumber, sValue);
+ long statValue = (System.currentTimeMillis() - startTime);
+ stats.addValue(statValue);
+ }
+ logOperation(cycleNumber,"PUTS");
+ }
+ catch (Exception e)
+ {
+ // how should we handle this? Log for now...
+ log.error("Operation failed!", e);
+ }
+ }
+ };
+ // submit task to be executed
+ executor.execute(r);
+ }
+
+ // only leave once the task queue is empty!!
+ blockTillTasksComplete();
+ elapsedSecondsForAllPuts = (System.currentTimeMillis() - startElapsedTime) / 1000;
+
+ // return the raw data
+ log.debug("Leaving doPuts for " + cache);
+ return stats;
+ }
+
+ private void blockTillTasksComplete()
+ {
+ // now that just told us that all the tasks have been submitted. Lets check that the executor has finished everything.
+ executor.shutdown();
+ while (!executor.isTerminated())
+ {
+ try
+ {
+ executor.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT_POLL_SECS, TimeUnit.SECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ // do nothing?
+ }
+ }
+ }
+
+ private long calculateSerializedSize(Object value)
+ {
+ ByteArrayOutputStream baos = null;
+ ObjectOutputStream oos = null;
+ try
+ {
+ baos = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(value);
+ oos.close();
+ baos.close();
+ return baos.size();
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to calculate serialized size of object " + value, e);
+ try
+ {
+ if (oos != null) oos.close();
+ if (baos != null) baos.close();
+ }
+ catch (Exception e2)
+ {
+ log.warn("Unable to close streams", e2);
+ }
+ }
+ return 0;
+ }
+
+ public String getNodeIndex()
+ {
+ try
+ {
+ return " - " + Integer.parseInt(System.getProperty("currentIndex"));
+ } catch (Exception e) {
+ return "";
+ }
+ }
+
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/StaticsTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StaticsTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,25 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithStatics;
+import org.cachebench.testobjects.SerializableCustomTypeWithStatics;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class StaticsTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithStatics.class : CustomTypeWithStatics.class, testCaseName, sampleSize, numThreads);
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/StringTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/StringTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,23 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class StringTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, String.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/SubclassTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/SubclassTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeSubclassOfAbstract;
+import org.cachebench.testobjects.SerializableCustomTypeSubclassOfAbstract;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class SubclassTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeSubclassOfAbstract.class : CustomTypeSubclassOfAbstract.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
Copied: cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java (from rev 4958, cache-bench-fwk/trunk/src/org/cachebench/tests/TransientTest.java)
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/simpletests/TransientTest.java 2008-01-07 14:10:02 UTC (rev 5034)
@@ -0,0 +1,26 @@
+package org.cachebench.tests.simpletests;
+
+import org.cachebench.CacheWrapper;
+import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.testobjects.CustomTypeWithTransient;
+import org.cachebench.testobjects.SerializableCustomTypeWithTransient;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * (C) Manik Surtani, 2004
+ */
+public class TransientTest extends SimpleTest
+{
+
+ /* (non-Javadoc)
+ * @see org.cachebench.tests.CacheTest#doTest(org.cachebench.config.TestConfig)
+ */
+ public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
+ {
+ return performTestWithObjectType(testName, cache, cache instanceof SerializableCacheWrapper ? SerializableCustomTypeWithTransient.class : CustomTypeWithTransient.class, testCaseName, sampleSize, numThreads);
+
+ }
+
+}
16 years, 11 months
JBoss Cache SVN: r5033 - cache-bench-fwk/trunk/smartfrog.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-07 09:07:27 -0500 (Mon, 07 Jan 2008)
New Revision: 5033
Modified:
cache-bench-fwk/trunk/smartfrog/main.sf
Log:
overwritting with cluster config
Modified: cache-bench-fwk/trunk/smartfrog/main.sf
===================================================================
--- cache-bench-fwk/trunk/smartfrog/main.sf 2008-01-07 13:40:59 UTC (rev 5032)
+++ cache-bench-fwk/trunk/smartfrog/main.sf 2008-01-07 14:07:27 UTC (rev 5033)
@@ -3,15 +3,16 @@
BaseCacheBenchPrim extends Prim {
sfClass "org.cachebench.smartfrog.CacheBenchmarkPrim";
+ sfRootLocatorPort 3801;
- scriptToExec "runNode.bat"
+ scriptToExec "./runNode.sh";
//FQN of the directory where the framework was checked out (noramally is th eparent of the dir that contains this file)
//this should be edited
- cacheBenchmarkHome "/projects/jboss/cache/benchmark/cache-bench-fwk";
+ cacheBenchmarkHome "/qa/home/mmarkus/code/cache-bench-fwk";
//should be the name of a subdirectory of 'cache-products' directory.
- cacheDistribution "jbosscache-2.0.0";
+ cacheDistribution "terracotta-2.5.0";
//might take a value from 0..max_nr_of_nodes, representing the index of the current node in the cluster
nodeIndex TBD;
@@ -25,13 +26,14 @@
sfConfig extends Compound {
- minimumClusterSize 0;
- maximumClusterSize 9;
+ minimumClusterSize 2;
+ maximumClusterSize 7;
oneClusterSize extends Compound {
c1FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize 1;
minClusterSize ATTRIB minimumClusterSize;
@@ -44,7 +46,8 @@
sizeOfTheCluster 2;
c2FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -52,7 +55,8 @@
}
c2SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -65,7 +69,8 @@
sizeOfTheCluster 3;
c3FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -73,7 +78,8 @@
}
c3SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -81,7 +87,8 @@
}
c3ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -94,7 +101,8 @@
sizeOfTheCluster 4;
c4FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -102,7 +110,8 @@
}
c4SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -110,7 +119,8 @@
}
c4ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -118,7 +128,8 @@
}
c4ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -131,7 +142,8 @@
sizeOfTheCluster 5;
c5FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -139,7 +151,8 @@
}
c5SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -147,7 +160,8 @@
}
c5ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -155,7 +169,8 @@
}
c5ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -163,7 +178,8 @@
}
c5FifthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster05";
nodeIndex 4;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -176,7 +192,8 @@
sizeOfTheCluster 6;
c6FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -184,7 +201,8 @@
}
c6SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -192,7 +210,8 @@
}
c6ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -200,7 +219,8 @@
}
c6ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -208,7 +228,8 @@
}
c6FifthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster05";
nodeIndex 4;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -216,7 +237,8 @@
}
c6SixthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster06";
nodeIndex 5;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -229,7 +251,8 @@
sizeOfTheCluster 7;
c7FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -237,7 +260,8 @@
}
c7SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -245,7 +269,8 @@
}
c7ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -253,7 +278,8 @@
}
c7ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -261,7 +287,8 @@
}
c7FifthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster05";
nodeIndex 4;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -269,7 +296,8 @@
}
c7SixthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster06";
nodeIndex 5;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -277,7 +305,8 @@
}
c7SeventhMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster07";
nodeIndex 6;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -290,7 +319,8 @@
sizeOfTheCluster 8;
c8FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -298,7 +328,8 @@
}
c8SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -306,7 +337,8 @@
}
c8ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -314,7 +346,8 @@
}
c8ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -322,7 +355,8 @@
}
c8FifthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster05";
nodeIndex 4;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -330,7 +364,8 @@
}
c8SixthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster06";
nodeIndex 5;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -338,7 +373,8 @@
}
c8SeventhMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster07";
nodeIndex 6;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -346,7 +382,8 @@
}
c8EighthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster08";
nodeIndex 7;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -359,7 +396,8 @@
sizeOfTheCluster 9;
c9FirstMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster01";
nodeIndex 0;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -367,7 +405,8 @@
}
c9SecondMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster02";
nodeIndex 1;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -375,7 +414,8 @@
}
c9ThirdMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster03";
nodeIndex 2;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -383,7 +423,8 @@
}
c9ForthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster04";
nodeIndex 3;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -391,7 +432,8 @@
}
c9FifthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster05";
nodeIndex 4;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -399,7 +441,8 @@
}
c9SixthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster06";
nodeIndex 5;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -407,7 +450,8 @@
}
c9SeventhMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster07";
nodeIndex 6;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -415,7 +459,8 @@
}
c9EighthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
+
+ sfProcessHost "cluster08";
nodeIndex 7;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
@@ -423,12 +468,13 @@
}
c9NinthMember extends BaseCacheBenchPrim {
- sfProcessHost "localhost";
- nodeIndex 7;
+
+ sfProcessHost "cluster09";
+ nodeIndex 8;
clusterSize ATTRIB sizeOfTheCluster;
minClusterSize ATTRIB minimumClusterSize;
maxClusterSize ATTRIB maximumClusterSize;
}
}
+}
-}
16 years, 11 months
JBoss Cache SVN: r5032 - demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 08:40:59 -0500 (Mon, 07 Jan 2008)
New Revision: 5032
Modified:
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/DataTreeRefresher.java
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
Log:
UI refresh changes/improvements
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/DataTreeRefresher.java
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/DataTreeRefresher.java 2008-01-07 12:53:25 UTC (rev 5031)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/DataTreeRefresher.java 2008-01-07 13:40:59 UTC (rev 5032)
@@ -12,6 +12,7 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
@@ -110,11 +111,13 @@
public void repaint()
{
+ TreePath path = tree.getSelectionPath();
tableModel.setCurrentFqn(null);
Map<String, String> m = Collections.emptyMap();
tableModel.setData(m);
- tree.repaint();
((DefaultTreeModel) tree.getModel()).reload();
+ tree.setSelectionPath(path);
+ if (path != null) while ((path = path.getParentPath()) != null) tree.expandPath(path);
}
class FqnTreeNode extends DefaultMutableTreeNode implements Comparable
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 12:53:25 UTC (rev 5031)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 13:40:59 UTC (rev 5032)
@@ -120,9 +120,9 @@
</grid>
<grid id="73867" binding="dataViewTab" layout-manager="FormLayout">
<rowspec value="center:d:grow"/>
- <colspec value="fill:d:grow"/>
+ <colspec value="left:340px:grow"/>
<colspec value="left:4dlu:noGrow"/>
- <colspec value="fill:m:grow"/>
+ <colspec value="fill:p:grow"/>
<constraints>
<tabbedpane title="Data view" enabled="false">
<tooltip value="This tab contains a view of all the data in the cache."/>
@@ -134,44 +134,56 @@
</properties>
<border type="none"/>
<children>
- <scrollpane id="ea4d">
+ <splitpane id="5a803">
<constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="200" height="200"/>
+ </grid>
<forms defaultalign-horz="false" defaultalign-vert="false"/>
</constraints>
- <properties/>
+ <properties>
+ <dividerLocation value="600"/>
+ </properties>
<border type="none"/>
<children>
- <component id="a805d" class="javax.swing.JTree" binding="dataTree">
- <constraints/>
- <properties>
- <background color="-1"/>
- <editable value="false"/>
- <showsRootHandles value="true"/>
- <toolTipText value="Tree view of the cache"/>
- </properties>
- </component>
+ <scrollpane id="ea4d" binding="treeScrollPane">
+ <constraints>
+ <splitpane position="left"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="a805d" class="javax.swing.JTree" binding="dataTree">
+ <constraints/>
+ <properties>
+ <background color="-1"/>
+ <editable value="false"/>
+ <showsRootHandles value="true"/>
+ <toolTipText value="Tree view of the cache"/>
+ </properties>
+ </component>
+ </children>
+ </scrollpane>
+ <scrollpane id="f78a6" binding="nodeDataScrollPane">
+ <constraints>
+ <splitpane position="right"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="41fa4" class="javax.swing.JTable" binding="nodeDataTable">
+ <constraints/>
+ <properties>
+ <background color="-992313"/>
+ <gridColor color="-16777216"/>
+ <intercellSpacing width="3" height="3"/>
+ <toolTipText value="Data in currently selected node"/>
+ </properties>
+ </component>
+ </children>
+ </scrollpane>
</children>
- </scrollpane>
- <scrollpane id="f78a6" binding="nodeData">
- <constraints>
- <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
- <forms defaultalign-horz="false" defaultalign-vert="false"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <component id="41fa4" class="javax.swing.JTable" binding="nodeDataTable">
- <constraints/>
- <properties>
- <background color="-992313"/>
- <gridColor color="-16777216"/>
- <intercellSpacing width="3" height="3"/>
- <toolTipText value="Data in currently selected node"/>
- </properties>
- </component>
- </children>
- </scrollpane>
+ </splitpane>
</children>
</grid>
<grid id="b4b20" binding="clusterViewTab" layout-manager="FormLayout">
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 12:53:25 UTC (rev 5031)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 13:40:59 UTC (rev 5032)
@@ -11,10 +11,12 @@
import org.jboss.cache.Node;
import org.jboss.cache.notifications.annotation.BuddyGroupChanged;
import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeModified;
import org.jboss.cache.notifications.annotation.NodeRemoved;
import org.jboss.cache.notifications.annotation.ViewChanged;
import org.jboss.cache.notifications.event.BuddyGroupChangedEvent;
import org.jboss.cache.notifications.event.NodeCreatedEvent;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.notifications.event.NodeRemovedEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jgroups.Address;
@@ -76,7 +78,7 @@
private JRadioButton removeKeyRadioButton;
private JButton goButton;
private JTable nodeDataTable;
- private JScrollPane nodeData;
+ private JScrollPane nodeDataScrollPane;
private JButton randomGeneratorButton;
private JTextField maxNodesTextField;
private JTextField maxDepthTextField;
@@ -89,6 +91,7 @@
private JLabel statsLastUpdated;
private JTextArea configFileContents;
private JRadioButton getNodeRadioButton;
+ private JScrollPane treeScrollPane;
private String cacheConfigFile;
private Cache<String, String> cache;
private String startCacheButtonLabel = "Start Cache", stopCacheButtonLabel = "Stop Cache";
@@ -569,6 +572,19 @@
clusterDataModel.setBuddies();
}
+ @NodeModified
+ public void nodeModified(NodeModifiedEvent e)
+ {
+ if (!e.isPre())
+ {
+ // only if this is the current node selected in the tree do we bother refreshing it
+ if (nodeDataTableModel.getCurrentFqn() != null && nodeDataTableModel.getCurrentFqn().equals(e.getFqn()))
+ {
+ nodeDataTableModel.updateCurrentNode();
+ }
+ }
+ }
+
@NodeCreated
public void nodeCreated(NodeCreatedEvent e)
{
@@ -738,5 +754,10 @@
{
this.currentFqn = currentFqn;
}
+
+ public void updateCurrentNode()
+ {
+ setData(cache.getData(currentFqn));
+ }
}
}
16 years, 11 months
JBoss Cache SVN: r5031 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 07:53:25 -0500 (Mon, 07 Jan 2008)
New Revision: 5031
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
fixed class cast exceptions when comparing IpAddress instances
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-07 11:57:26 UTC (rev 5030)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-07 12:53:25 UTC (rev 5031)
@@ -813,7 +813,29 @@
class ReferencesMap
{
- private ArrayList<Object> referencedObjects = new ArrayList<Object>();
+ private ArrayList<Object> referencedObjects = new ArrayList<Object>()
+ {
+ @Override
+ public int indexOf(Object elem)
+ {
+ if (elem == null)
+ {
+ for (int i = 0; i < size(); i++)
+ {
+ if (get(i) == null) return i;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < size(); i++)
+ {
+ Object elInList = get(i);
+ if (elInList.getClass().equals(elem.getClass()) && elem.equals(elInList)) return i;
+ }
+ }
+ return -1;
+ }
+ };
void put(int reference, Object object)
{
16 years, 11 months
JBoss Cache SVN: r5030 - demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 06:57:26 -0500 (Mon, 07 Jan 2008)
New Revision: 5030
Modified:
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
Log:
updated colours, labels, resizability, added a get node option
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 02:43:18 UTC (rev 5029)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 11:57:26 UTC (rev 5030)
@@ -26,9 +26,7 @@
</grid>
<forms defaultalign-vert="false"/>
</constraints>
- <properties>
- <background color="-3355648"/>
- </properties>
+ <properties/>
<border type="none"/>
<children>
<grid id="7aed3" binding="controlPanelTab" layout-manager="FormLayout">
@@ -112,7 +110,7 @@
<component id="ded97" class="javax.swing.JTextArea" binding="configFileContents">
<constraints/>
<properties>
- <background color="-103"/>
+ <background color="-3355444"/>
<font name="Courier New" size="10"/>
</properties>
</component>
@@ -148,6 +146,7 @@
<constraints/>
<properties>
<background color="-1"/>
+ <editable value="false"/>
<showsRootHandles value="true"/>
<toolTipText value="Tree view of the cache"/>
</properties>
@@ -165,7 +164,7 @@
<component id="41fa4" class="javax.swing.JTable" binding="nodeDataTable">
<constraints/>
<properties>
- <background color="-103"/>
+ <background color="-992313"/>
<gridColor color="-16777216"/>
<intercellSpacing width="3" height="3"/>
<toolTipText value="Data in currently selected node"/>
@@ -202,7 +201,7 @@
<component id="d96d2" class="javax.swing.JTable" binding="clusterTable">
<constraints/>
<properties>
- <background color="-103"/>
+ <background color="-992313"/>
<gridColor color="-16777216"/>
<intercellSpacing width="3" height="3"/>
<showHorizontalLines value="true"/>
@@ -334,6 +333,8 @@
<rowspec value="top:3dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
<rowspec value="center:d:grow"/>
<rowspec value="top:3dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
@@ -357,7 +358,7 @@
<colspec value="left:4dlu:noGrow"/>
<colspec value="fill:200px:grow"/>
<constraints>
- <tabbedpane title="Data generator" enabled="false">
+ <tabbedpane title="Manipulate data" enabled="false">
<tooltip value="This tab provides you with the ability to add or remove data from the cache."/>
</tabbedpane>
</constraints>
@@ -435,7 +436,7 @@
</component>
<component id="11f60" class="javax.swing.JButton" binding="goButton" default-binding="true">
<constraints>
- <grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false"/>
</constraints>
<properties>
@@ -481,7 +482,7 @@
</component>
<component id="aacea" class="javax.swing.JLabel">
<constraints>
- <grid row="16" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
@@ -491,14 +492,14 @@
</component>
<component id="bf689" class="javax.swing.JSeparator">
<constraints>
- <grid row="14" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="16" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false" defaultalign-vert="false"/>
</constraints>
<properties/>
</component>
<component id="dbe5d" class="javax.swing.JLabel">
<constraints>
- <grid row="20" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="22" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
@@ -508,7 +509,7 @@
</component>
<component id="c9835" class="javax.swing.JLabel">
<constraints>
- <grid row="18" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="20" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
@@ -518,7 +519,7 @@
</component>
<component id="922d3" class="javax.swing.JLabel">
<constraints>
- <grid row="22" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="24" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
@@ -528,7 +529,7 @@
</component>
<component id="32377" class="javax.swing.JButton" binding="randomGeneratorButton">
<constraints>
- <grid row="24" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="26" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false"/>
</constraints>
<properties>
@@ -537,7 +538,7 @@
</component>
<component id="513f3" class="javax.swing.JTextField" binding="maxNodesTextField" default-binding="true">
<constraints>
- <grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <grid row="20" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
@@ -546,7 +547,7 @@
</component>
<component id="b6c72" class="javax.swing.JTextField" binding="maxDepthTextField" default-binding="true">
<constraints>
- <grid row="20" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
@@ -555,7 +556,7 @@
</component>
<component id="3108a" class="javax.swing.JTextField" binding="numberOfKeysPerTextField" default-binding="true">
<constraints>
- <grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <grid row="24" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
@@ -564,14 +565,14 @@
</component>
<component id="f036" class="javax.swing.JSeparator">
<constraints>
- <grid row="26" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="28" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false" defaultalign-vert="false"/>
</constraints>
<properties/>
</component>
<component id="43cf0" class="javax.swing.JButton" binding="cacheClearButton">
<constraints>
- <grid row="30" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="32" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false"/>
</constraints>
<properties>
@@ -580,7 +581,7 @@
</component>
<component id="dae1c" class="javax.swing.JLabel">
<constraints>
- <grid row="28" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="30" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
@@ -588,6 +589,15 @@
<text value="Clear cache"/>
</properties>
</component>
+ <component id="41b43" class="javax.swing.JRadioButton" binding="getNodeRadioButton" default-binding="true">
+ <constraints>
+ <grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <text value="Get &Node"/>
+ </properties>
+ </component>
</children>
</grid>
</children>
@@ -622,6 +632,7 @@
<member id="e9453"/>
<member id="f9bf"/>
<member id="f2b07"/>
+ <member id="41b43"/>
</group>
</buttonGroups>
</form>
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 02:43:18 UTC (rev 5029)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 11:57:26 UTC (rev 5030)
@@ -3,56 +3,50 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import static org.jboss.cache.CacheStatus.*;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Node;
+import org.jboss.cache.notifications.annotation.BuddyGroupChanged;
import org.jboss.cache.notifications.annotation.NodeCreated;
import org.jboss.cache.notifications.annotation.NodeRemoved;
import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.annotation.BuddyGroupChanged;
+import org.jboss.cache.notifications.event.BuddyGroupChangedEvent;
import org.jboss.cache.notifications.event.NodeCreatedEvent;
import org.jboss.cache.notifications.event.NodeRemovedEvent;
import org.jboss.cache.notifications.event.ViewChangedEvent;
-import org.jboss.cache.notifications.event.BuddyGroupChangedEvent;
import org.jgroups.Address;
import javax.swing.*;
-import javax.swing.border.TitledBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.tree.TreePath;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.*;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.URL;
+import java.text.NumberFormat;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
-import java.util.Date;
-import java.util.Collections;
+import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.BlockingQueue;
-import java.text.NumberFormat;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
-import com.jgoodies.forms.layout.FormLayout;
-import com.jgoodies.forms.layout.CellConstraints;
-
/**
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
*/
@@ -94,6 +88,7 @@
private JLabel statsSizeOfCachedData;
private JLabel statsLastUpdated;
private JTextArea configFileContents;
+ private JRadioButton getNodeRadioButton;
private String cacheConfigFile;
private Cache<String, String> cache;
private String startCacheButtonLabel = "Start Cache", stopCacheButtonLabel = "Stop Cache";
@@ -104,6 +99,7 @@
private NodeDataTableModel nodeDataTableModel;
private DataTreeRefresher treeRefresher;
private Random r = new Random();
+ private boolean isUsingBuddyReplication;
public static void main(String[] args)
{
@@ -119,7 +115,7 @@
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
- frame.setResizable(false);
+ frame.setResizable(true);
}
public JBossCacheDemo(String cfgFileName)
@@ -173,26 +169,32 @@
if (createNodeRadioButton.isSelected())
{
cache.put(fqnTextField.getText(), keyTextField.getText(), valueTextField.getText());
-// treeRefresher.addNode(Fqn.fromString(fqnTextField.getText()));
}
else if (removeNodeRadioButton.isSelected())
{
cache.removeNode(fqnTextField.getText());
-// treeRefresher.removeNode(Fqn.fromString(fqnTextField.getText()));
}
else if (addKeyRadioButton.isSelected())
{
cache.put(fqnTextField.getText(), keyTextField.getText(), valueTextField.getText());
-// treeRefresher.updateNode(Fqn.fromString(fqnTextField.getText()));
}
else if (removeKeyRadioButton.isSelected())
{
cache.remove(fqnTextField.getText(), keyTextField.getText());
-// treeRefresher.updateNode(Fqn.fromString(fqnTextField.getText()));
}
+ else if (getNodeRadioButton.isSelected())
+ {
+ // do a cache.get on the Fqn first, this may involve a data gravitation
+ // only do this if BR is enabled as it may involve a data gravitation event
+ if (isUsingBuddyReplication)
+ cache.getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
+ cache.getNode(fqnTextField.getText());
+ }
treeRefresher.repaint();
dataViewTab.repaint();
processAction(goButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
}
});
}
@@ -233,6 +235,16 @@
valueTextField.setEnabled(true);
}
});
+ getNodeRadioButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ fqnTextField.setEnabled(true);
+ keyTextField.setEnabled(false);
+ valueTextField.setEnabled(false);
+ }
+ });
+
dataTree.addTreeSelectionListener(new TreeSelectionListener()
{
public void valueChanged(TreeSelectionEvent e)
@@ -243,7 +255,8 @@
if (!f.equals(nodeDataTableModel.getCurrentFqn()))
{
nodeDataTableModel.setCurrentFqn(f);
- nodeDataTableModel.setData(cache.getNode(f).getData());
+ Node n = cache.getNode(f);
+ if (n != null) nodeDataTableModel.setData(n.getData());
}
}
});
@@ -304,6 +317,8 @@
}
processAction(randomGeneratorButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
}
});
}
@@ -335,6 +350,8 @@
cache.removeNode(Fqn.ROOT);
cache.getRoot().clearData();
processAction(cacheClearButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
}
});
}
@@ -471,7 +488,7 @@
try
{
configFileContents.setText(readContents(resource == null ? new FileInputStream(cacheConfigFile) : resource.openStream()));
- configFileContents.setEditable(false);
+ configFileContents.setEditable(false);
}
catch (Exception e)
{
@@ -480,6 +497,7 @@
configFileContents.repaint();
cache = new DefaultCacheFactory().createCache(cacheConfigFile);
+ isUsingBuddyReplication = cache.getConfiguration().getBuddyReplicationConfig() != null && cache.getConfiguration().getBuddyReplicationConfig().isEnabled();
}
else
{
@@ -603,12 +621,10 @@
this.members.addAll(members);
}
- CacheSPI spi = (CacheSPI) cache;
-
List<Address> buddies = Collections.emptyList();
- if (spi.getBuddyManager() != null)
+ if (isUsingBuddyReplication)
{
- buddies = spi.getBuddyManager().getBuddyAddresses();
+ buddies = ((CacheSPI) cache).getBuddyManager().getBuddyAddresses();
log.debug("Buddy addresses: " + buddies);
}
16 years, 11 months
JBoss Cache SVN: r5029 - in cache-bench-fwk/trunk: cache-products/terracotta-2.5.0 and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-06 21:43:18 -0500 (Sun, 06 Jan 2008)
New Revision: 5029
Modified:
cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
cache-bench-fwk/trunk/runNode.sh
Log:
updated terracotta script
Modified: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh 2008-01-07 02:40:18 UTC (rev 5028)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh 2008-01-07 02:43:18 UTC (rev 5029)
@@ -6,4 +6,11 @@
#export START_NODE_COMMAND="$TC_HOME/bin/dso-java.sh -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner"
-export START_NODE_COMMAND="java -Dtc.install-root=${TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/dso-boot/dso-boot-hotspot_win32_150_14.jar $SYS_PROPS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner"
\ No newline at end of file
+export START_NODE_COMMAND="java $JVM_ARGS -Dtc.install-root=${TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/dso-boot/dso-boot-hotspot_win32_150_14.jar $SYS_PROPS -cp $CLASSPATH $OTHER_SYS_ARGS org.cachebench.CacheBenchmarkRunner"
+
+#${JAVA_HOME}/bin/java -Dtc.install-root=${TC_HOME} -Xbootclasspath/p:<dso-boot-jar-path> -Dtc.config=<tc-config-path> <startup-classname>
+#executing command java -Xmx1024m -Dtc.install-root=/cygdrive/c/java/terracotta-2
+#.5.0 -Xbootclasspath/p:/cygdrive/c/java/terracotta-2.5.0/lib/dso-boot/dso-boot-h
+#otspot_win32_150_14.jar -DcurrentIndex=0 -Dorg.cachebench.debug=true -Djava.net.preferIPv4Stack=true -Dtc.config=./cache-products/terracotta-2.5.0/tc-client-con
+#fig.xml -cp :./lib/commons-beanutils.jar:./lib/commons-digester.jar:./lib/commons-logging.jar:./lib/commons-math-1.0.jar:./lib/log4j.jar:./lib/smartfrog-3.12.014.jar:./conf:./classes/production/Framework::./classes/production/terracotta-2.5.0 org.cachebench.CacheBenchmarkRunner
+#java -Dtc.install-root=c:\java\terracotta-2.5.0 -DcurrentIndex=0 -Dorg.cachebench.debug=true -Djava.net.preferIPv4Stack=true -Xbootclasspath/p:"c:\java\terracotta-2.5.0\lib\dso-boot\dso-boot-hotspot_win32_150_14.jar" -Dtc.config=C:\projects\jboss\cache\benchmark\cache-bench-fwk\cache-products\terracotta-2.5.0\tc-client-config.xml -cp ./lib/commons-beanutils.jar;./lib/commons-digester.jar;./lib/commons-logging.jar;./lib/commons-math-1.0.jar;./lib/log4j.jar;./conf;./classes/production/Framework;./classes/production/terracotta-2.5.0 org.cachebench.CacheBenchmarkRunner
\ No newline at end of file
Modified: cache-bench-fwk/trunk/runNode.sh
===================================================================
--- cache-bench-fwk/trunk/runNode.sh 2008-01-07 02:40:18 UTC (rev 5028)
+++ cache-bench-fwk/trunk/runNode.sh 2008-01-07 02:43:18 UTC (rev 5029)
@@ -5,7 +5,8 @@
CACHE_DEBUG=true
preferIPv4Stack=true
-export JVM_ARGS=-Xmx2048m
+export JVM_ARGS=-Xmx1024m
+export OTHER_SYS_ARGS=$3
if [ -z $1 ]
then
@@ -54,8 +55,8 @@
echo executing command $START_NODE_COMMAND
$START_NODE_COMMAND
else
- TO_EXECUTE="java $JVM_ARGS -cp $CLASSPATH $3 $SYS_PROPS org.cachebench.CacheBenchmarkRunner $4"
+ TO_EXECUTE="java $JVM_ARGS -cp $CLASSPATH $OTHER_SYS_ARGS $SYS_PROPS org.cachebench.CacheBenchmarkRunner $4"
echo executing $TO_EXECUTE
- java $JVM_ARGS -cp $CLASSPATH $3 $SYS_PROPS org.cachebench.CacheBenchmarkRunner $4
+ java $JVM_ARGS -cp $CLASSPATH $OTHER_SYS_ARGS $SYS_PROPS org.cachebench.CacheBenchmarkRunner $4
fi
16 years, 11 months
JBoss Cache SVN: r5028 - demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-06 21:40:18 -0500 (Sun, 06 Jan 2008)
New Revision: 5028
Modified:
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
Log:
Updated editable flag on cfg file display and some labels
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 02:27:01 UTC (rev 5027)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 02:40:18 UTC (rev 5028)
@@ -486,12 +486,12 @@
</constraints>
<properties>
<font style="3"/>
- <text value="Multiple node generator"/>
+ <text value="Random data generator"/>
</properties>
</component>
<component id="bf689" class="javax.swing.JSeparator">
<constraints>
- <grid row="14" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="14" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false" defaultalign-vert="false"/>
</constraints>
<properties/>
@@ -564,7 +564,7 @@
</component>
<component id="f036" class="javax.swing.JSeparator">
<constraints>
- <grid row="26" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="26" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<forms defaultalign-horz="false" defaultalign-vert="false"/>
</constraints>
<properties/>
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 02:27:01 UTC (rev 5027)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-07 02:40:18 UTC (rev 5028)
@@ -471,6 +471,7 @@
try
{
configFileContents.setText(readContents(resource == null ? new FileInputStream(cacheConfigFile) : resource.openStream()));
+ configFileContents.setEditable(false);
}
catch (Exception e)
{
16 years, 11 months
JBoss Cache SVN: r5027 - demos/core-demo-gui/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-06 21:27:01 -0500 (Sun, 06 Jan 2008)
New Revision: 5027
Modified:
demos/core-demo-gui/trunk/README.txt
Log:
Updated README
Modified: demos/core-demo-gui/trunk/README.txt
===================================================================
--- demos/core-demo-gui/trunk/README.txt 2008-01-07 02:18:01 UTC (rev 5026)
+++ demos/core-demo-gui/trunk/README.txt 2008-01-07 02:27:01 UTC (rev 5027)
@@ -4,9 +4,10 @@
------------------
To run the demo, all you need is a Java 5 compliant JVM. All dependencies are packaged in the demo ZIP file, which
-can be downloaded from http://www.jbosscache.org
+can be downloaded from http://snapshots.jboss.org/maven2/org/jboss/cache/jbosscache-demo/1.0-SNA...
-Simply unzip the demo distribution and use the "run.sh" shell script to launch the demo GUI.
+Simply unzip the demo distribution and use the "run.sh" shell script to launch the demo GUI. Click around,
+it's mostly pretty intuitive but some documentation will come along in good time.
* Building the demo
-------------------
16 years, 11 months
JBoss Cache SVN: r5026 - demos/core-demo-gui/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-06 21:18:01 -0500 (Sun, 06 Jan 2008)
New Revision: 5026
Modified:
demos/core-demo-gui/trunk/README.txt
Log:
Updated URL
Modified: demos/core-demo-gui/trunk/README.txt
===================================================================
--- demos/core-demo-gui/trunk/README.txt 2008-01-07 02:16:41 UTC (rev 5025)
+++ demos/core-demo-gui/trunk/README.txt 2008-01-07 02:18:01 UTC (rev 5026)
@@ -11,7 +11,7 @@
* Building the demo
-------------------
-You need to use Maven 2 to build the demo from sources. Simply check out the sources for the demo from http://anonsvn.jboss.org/repos/jbosscache/demo/trunk
+You need to use Maven 2 to build the demo from sources. Simply check out the sources for the demo from http://anonsvn.jboss.org/repos/jbosscache/demos/core-demo-gui/trunk
and build using "mvn clean install", which will generate the ZIP distribution in "target/distribution"
* Developing the demo
16 years, 11 months
JBoss Cache SVN: r5025 - demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-06 21:16:41 -0500 (Sun, 06 Jan 2008)
New Revision: 5025
Modified:
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
Log:
Changed form title
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 02:14:05 UTC (rev 5024)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-07 02:16:41 UTC (rev 5025)
@@ -13,7 +13,7 @@
<xy x="20" y="20" width="918" height="661"/>
</constraints>
<properties/>
- <border type="line" title="JBoss Cache Demo Application">
+ <border type="line" title="JBoss Cache GUI Demo Application">
<font size="14" style="3"/>
<title-color color="-16750951"/>
<color color="-16750951"/>
16 years, 11 months