[jbosscache-commits] JBoss Cache SVN: r7765 - in benchmarks/benchmark-fwk/trunk: cache-products/ehcache-1.6.0 and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Feb 23 09:28:32 EST 2009


Author: manik.surtani at jboss.com
Date: 2009-02-23 09:28:32 -0500 (Mon, 23 Feb 2009)
New Revision: 7765

Removed:
   benchmarks/benchmark-fwk/trunk/runAllLocalRC.sh
Modified:
   benchmarks/benchmark-fwk/trunk/build.xml
   benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh
   benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java
   benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java
   benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java
   benchmarks/benchmark-fwk/trunk/runAllLocal.sh
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
Log:
EHCache 1.6.0

Modified: benchmarks/benchmark-fwk/trunk/build.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/build.xml	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/build.xml	2009-02-23 14:28:32 UTC (rev 7765)
@@ -60,7 +60,7 @@
 
          -Dorg.cachebench.plugins.jbosscache1=true -Dbind.address=${MYTESTIP_1}
          -Dorg.cachebench.plugins.jbosscache2=true -Dbind.address=${MYTESTIP_1}
-         -Dorg.cachebench.pluins.ehcache=true -Dbind.address=${MYTESTIP_1}
+         -Dorg.cachebench.plugins.ehcache=true -Dbind.address=${MYTESTIP_1}
          -Dorg.cachebench.plugins.coherence=true -Dtangosol.coherence.localhost=${MYTESTIP_1}
          // WORK IN PROGRESS
          -Dorg.cachebench.plugins.terracotta=true
@@ -102,6 +102,22 @@
       </javac>
    </target>
 
+   <target name="compile.module.ehcache160" depends="fwk"
+           description="Compile module ehcache-1.6.0; production classes">
+      <mkdir dir="./classes/production/ehcache-1.6.0"/>
+      <javac destdir="./classes/production/ehcache-1.6.0" debug="${compiler.debug}"
+             nowarn="${compiler.generate.no.warnings}" fork="true">
+         <classpath>
+            <fileset dir="./cache-products/ehcache-1.6.0/lib" includes="*.jar"/>
+            <fileset dir="./lib/common" includes="*.jar"/>
+            <pathelement location="./cache-products/ehcache-1.6.0/conf"/>
+            <pathelement location="${framework.output.dir}"/>
+            <pathelement location="./classes/production/ehcache-1.6.0"/>
+         </classpath>
+         <src path="./cache-products/ehcache-1.6.0/src"/>
+      </javac>
+   </target>
+
    <target name="compile.module.coherence331" depends="fwk"
            description="Compile module coherence331; production classes" if="coherence.jars.present">
       <mkdir dir="./classes/production/coherence-3.3.1"/>
@@ -252,7 +268,7 @@
    </target>
 
    <target name="all"
-           depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache150, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331, compile.module.starobrno"
+           depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache150, compile.module.ehcache160, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331, compile.module.starobrno"
            description="build all"/>
 
    <target name="checkClusterAddresses" depends="fwk"

Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh	2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#see "$CACHE_ROOT/cache-products/cache.sh" for details
+
+THIS_DIR="./cache-products/ehcache-1.6.0"
+
+#setting up classpath
+for JAR in $THIS_DIR/lib/*
+do
+   CLASSPATH=$CLASSPATH:$JAR
+done
+
+CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.6.0"
+CLASSPATH="$CLASSPATH:$THIS_DIR/conf"
+#--classpath was set
+
+#additional JVM options
+JVM_OPTIONS="$JVM_OPTIONS -Djava.net.preferIPv4Stack=true" JVM_OPTIONS="$JVM_OPTIONS -DcacheBenchFwk.cacheWrapperClassName=org.cachebench.cachewrappers.EHCacheWrapper"

Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java	2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.cachebench.cachewrappers;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.Ehcache;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ */
+ at Test
+public class EHCacheReplicationTest
+{
+
+   @BeforeMethod
+   public void setUp()
+   {
+      System.setProperty("bind.address","127.0.0.1");//bind address referenced from config file
+   }
+
+
+   public void testSyncReplication() throws Exception
+   {
+      Ehcache cache1;
+      Ehcache cache2;
+
+      CacheManager c1 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-repl-sync.xml");
+      CacheManager c2 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-repl-sync.xml");
+
+
+      cache1 = c1.getCache("cache");
+      cache2 = c2.getCache("cache");
+
+      Thread.sleep(5000);
+
+      System.out.println("c1 members: " + c1.getCachePeerListener("RMI").getBoundCachePeers());
+      System.out.println("c2 members" + c2.getCachePeerListener("RMI").getBoundCachePeers());
+      assert c1.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+      assert c2.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+
+      for (int i = 0; i < 100; i++)
+      {
+         cache1.put(new Element("key" + i, "value" + i));
+         assert cache2.get("key" + i).getValue().equals("value" + i);
+      }
+      System.out.println(cache1.getKeys());
+      System.out.println(cache2.getKeys());
+
+      c1.shutdown();
+      c2.shutdown();
+   }
+
+
+   public void testInvalidation() throws Exception 
+   {
+      Ehcache cache1;
+      Ehcache cache2;
+
+      CacheManager c1 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-invalidate-sync.xml");
+      CacheManager c2 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-invalidate-sync.xml");
+
+      cache1 = c1.getCache("cache");
+      cache2 = c2.getCache("cache");
+
+      Thread.sleep(5000);
+
+      System.out.println("c1 members: " + c1.getCachePeerListener("RMI").getBoundCachePeers());
+      System.out.println("c2 members" + c2.getCachePeerListener("RMI").getBoundCachePeers());
+      assert c1.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+      assert c2.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+
+      cache1.put(new Element("key","value"));
+      assert cache2.get("key").getValue().equals("value");
+      cache2.put(new Element("key","newValue"));
+      assert cache1.get("key") == null;
+
+      c1.shutdown();
+      c2.shutdown();
+   }
+}

Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java	2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,53 @@
+package org.cachebench.cachewrappers;
+
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import java.net.URL;
+import java.io.File;
+import java.util.Properties;
+
+import org.cachebench.CacheWrapper;
+
+/**
+ * // TODO: Add Javadocs
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public class EHCacheTest
+{
+
+   public static void main(String[] args) throws Exception
+   {
+
+
+      CacheWrapper w = new EHCacheWrapper();
+      Properties p = new Properties();
+      p.setProperty("config", "ehcache-repl-sync.xml");
+      w.init(p);
+
+      Ehcache cache;
+      URL url = new URL("file:///Users/manik/Code/CacheBenchFwk/cache-products/ehcache-1.2.4/conf/ehcache-repl-sync.xml");
+
+      System.out.println("URL " + url);
+
+      System.out.println("FIle: " + url.getFile());
+      CacheManager m = CacheManager.create(url);
+
+      System.out.println("Caches:");
+      for (String s : m.getCacheNames()) System.out.println("   " + s);
+
+      cache = m.getCache("cache");
+
+      for (int i=0; i<100; i++) cache.put(new Element("key" + i, "value" + i));
+
+      System.out.println(cache.getKeys());
+
+      System.out.println("members: " + m.getCachePeerListener("RMI").getBoundCachePeers());
+
+      m.shutdown();
+
+   }
+}

Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java	2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,149 @@
+package org.cachebench.cachewrappers;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.config.Configuration;
+import net.sf.ehcache.config.ConfigurationFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.CacheWrapper;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * An implementation of SerializableCacheWrapper that uses EHCache as an underlying implementation.
+ * <p/>
+ * Pass in a -Dbind.address=IP_ADDRESS
+ * ehcache propery files allows referencing system properties through syntax ${bind.address}.
+ *
+ * @author Manik Surtani (manik at surtani.org)
+ * @version $Id: EHCacheWrapper.java,v 1.6 2007/05/21 16:17:56 msurtani Exp $
+ */
+public class EHCacheWrapper implements CacheWrapper
+{
+   private CacheManager manager;
+   private Ehcache cache;
+   private Log log = LogFactory.getLog("org.cachebench.cachewrappers.EHCacheWrapper");
+   boolean localmode;
+
+   /* (non-Javadoc)
+   * @see org.cachebench.CacheWrapper#init(java.util.Properties)
+   */
+   public void init(Map parameters) throws Exception
+   {
+      if (log.isTraceEnabled()) log.trace("Entering EHCacheWrapper.init()");
+      localmode = (Boolean.parseBoolean((String) parameters.get("localOnly")));
+      log.debug("Initializing the cache with props " + parameters);
+      URL url = getClass().getClassLoader().getResource((String) parameters.get("config"));
+      log.debug("Config URL = " + url);
+      Configuration c = ConfigurationFactory.parseConfiguration(url);
+      c.setSource("URL of " + url);
+
+      manager = new CacheManager(c);
+      setUp();
+      log.debug("Finish Initializing the cache");
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.CacheWrapper#setUp()
+   */
+   public void setUp() throws Exception
+   {
+      log.info("Caches avbl:");
+      for (String s : manager.getCacheNames()) log.info("    * " + s);
+      cache = manager.getCache("cache");
+      log.info("Using named cache " + cache);
+      if (!localmode)
+      {
+         log.info("Bounded peers: " + manager.getCachePeerListener("RMI").getBoundCachePeers());
+         log.info("Remote peers: " + manager.getCacheManagerPeerProvider("RMI").listRemoteCachePeers(cache));
+      }
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.CacheWrapper#tearDown()
+   */
+   public void tearDown() throws Exception
+   {
+      manager.shutdown();
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.SerializableCacheWrapper#putSerializable(java.io.Serializable, java.io.Serializable)
+   */
+   public void putSerializable(Serializable key, Serializable value) throws Exception
+   {
+      Element element = new Element(key, value);
+      cache.put(element);
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.SerializableCacheWrapper#getSerializable(java.io.Serializable)
+   */
+   public Object getSerializable(Serializable key) throws Exception
+   {
+      return cache.get(key);
+   }
+
+   public void empty() throws Exception
+   {
+      cache.removeAll();
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.CacheWrapper#put(java.lang.Object, java.lang.Object)
+   */
+   public void put(List<String> path, Object key, Object value) throws Exception
+   {
+      putSerializable((Serializable) key, (Serializable) value);
+   }
+
+   /* (non-Javadoc)
+   * @see org.cachebench.CacheWrapper#get(java.lang.Object)
+   */
+   public Object get(List<String> path, Object key) throws Exception
+   {
+      Object s = getSerializable((Serializable) key);
+      if (s instanceof Element)
+      {
+         return ((Element) s).getValue();
+      }
+      else return s;
+   }
+
+   public int getNumMembers()
+   {
+
+      return localmode ? 0 : manager.getCacheManagerPeerProvider("RMI").listRemoteCachePeers(cache).size();
+   }
+
+   public String getInfo()
+   {
+      return cache.getKeys().toString() + (localmode ? "" : (" remote peers: " + manager.getCachePeerListener("RMI").getBoundCachePeers()));
+   }
+
+   public Object getReplicatedData(List<String> path, String key) throws Exception
+   {
+      Object o = get(path, key);
+      if (log.isTraceEnabled())
+      {
+         log.trace("Result for the key: '" + key + "' is value '" + o + "'");
+      }
+      return o;
+   }
+
+   public Object startTransaction()
+   {
+      throw new UnsupportedOperationException("Does not support JTA!");
+   }
+
+   public void endTransaction(boolean successful)
+   {
+      throw new UnsupportedOperationException("Does not support JTA!");
+   }
+}

Modified: benchmarks/benchmark-fwk/trunk/runAllLocal.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runAllLocal.sh	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/runAllLocal.sh	2009-02-23 14:28:32 UTC (rev 7765)
@@ -7,7 +7,12 @@
 export PLAIN_JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.fwkCfgFile=cachebench-local.xml -Xms2g -Xmx2g"
 unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS} -DcacheBenchFwk.productSuffix=(3.0.3.GA)"
 ./runLocalNode.sh jbosscache-3.0.0 mvcc-local-RC.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS}"
 ./runLocalNode.sh ehcache-1.5.0 ehcache-local.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS} -DcacheBenchFwk.productSuffix=(1.6.0.Beta3)"
+./runLocalNode.sh ehcache-1.6.0 ehcache-local.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS}"
+./runLocalNode.sh whirlycache-1.0.1
 
 mkdir output
 mv data* ./output

Deleted: benchmarks/benchmark-fwk/trunk/runAllLocalRC.sh
===================================================================

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java	2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java	2009-02-23 14:28:32 UTC (rev 7765)
@@ -63,7 +63,7 @@
 
    private JFreeChart createChart(String title, DefaultCategoryDataset data, int numOperations)
    {
-      JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operations performed (approx): " + NumberFormat.getIntegerInstance().format(numOperations), "Average time (" + MU + "-seconds)", data, PlotOrientation.VERTICAL, true, false, false);
+      JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operations performed (approx): " + NumberFormat.getIntegerInstance().format(numOperations), "Average time (" + MU + "-seconds)", data, PlotOrientation.VERTICAL, true, true, false);
       BarRenderer3D renderer = (BarRenderer3D) chart.getCategoryPlot().getRenderer();
       renderer.setBaseItemLabelsVisible(true);
 




More information about the jbosscache-commits mailing list