[jbosscache-commits] JBoss Cache SVN: r6838 - in benchmarks/benchmark-fwk/trunk: cache-products/jbosscache-3.0.0/conf and 4 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Oct 6 06:16:34 EDT 2008


Author: mircea.markus
Date: 2008-10-06 06:16:34 -0400 (Mon, 06 Oct 2008)
New Revision: 6838

Modified:
   benchmarks/benchmark-fwk/trunk/build.xml
   benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
Log:
register replication delay functionality

Modified: benchmarks/benchmark-fwk/trunk/build.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/build.xml	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/build.xml	2008-10-06 10:16:34 UTC (rev 6838)
@@ -77,7 +77,7 @@
    </target>
 
 
-   <target name="compile.module.framework" description="Compile module Framework">
+   <target name="fwk" description="Compile module Framework">
       <mkdir dir="${framework.output.dir}"/>
       <javac destdir="${framework.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}"
              fork="true">
@@ -86,7 +86,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.ehcache159" depends="compile.module.framework"
+   <target name="compile.module.ehcache159" depends="fwk"
            description="Compile module ehcache-1.5.0; production classes">
       <mkdir dir="./classes/production/ehcache-1.5.0"/>
       <javac destdir="./classes/production/ehcache-1.5.0" debug="${compiler.debug}"
@@ -102,7 +102,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.coherence331" depends="compile.module.framework"
+   <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"/>
       <javac destdir="./classes/production/coherence-3.3.1" debug="${compiler.debug}"
@@ -117,7 +117,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.terracotta250" depends="compile.module.framework"
+   <target name="compile.module.terracotta250" depends="fwk"
            description="Compile module terracotta-2.5.0; production classes">
       <mkdir dir="./classes/production/terracotta-2.5.0"/>
       <javac destdir="./classes/production/terracotta-2.5.0" debug="${compiler.debug}"
@@ -131,7 +131,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.jbosscache140" depends="compile.module.framework"
+   <target name="compile.module.jbosscache140" depends="fwk"
            description="Compile module jbosscache-1.4.1; production classes">
       <mkdir dir="./classes/production/jbosscache-1.4.1"/>
       <javac destdir="./classes/production/jbosscache-1.4.1" debug="${compiler.debug}"
@@ -148,7 +148,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.jbosscache200" depends="compile.module.framework"
+   <target name="compile.module.jbosscache200" depends="fwk"
            description="Compile module jbosscache-2.0.0">
       <mkdir dir="./classes/production/jbosscache-2.0.0"/>
       <javac destdir="./classes/production/jbosscache-2.0.0" debug="${compiler.debug}"
@@ -162,7 +162,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.jbosscache210" depends="compile.module.framework"
+   <target name="compile.module.jbosscache210" depends="fwk"
            description="Compile module jbosscache-2.1.0cr2; production classes">
       <mkdir dir="./classes/production/jbosscache-2.1.0"/>
       <javac destdir="./classes/production/jbosscache-2.1.0" debug="${compiler.debug}"
@@ -176,7 +176,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.jbosscache220" depends="compile.module.framework"
+   <target name="compile.module.jbosscache220" depends="fwk"
            description="Compile module jbosscache-2.2.0; production classes">
       <mkdir dir="./classes/production/jbosscache-2.2.0"/>
       <javac destdir="./classes/production/jbosscache-2.2.0" debug="${compiler.debug}"
@@ -190,7 +190,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.pojocache220" depends="compile.module.framework"
+   <target name="compile.module.pojocache220" depends="fwk"
            description="Compile module pojocache-2.2.0; production classes">
       <mkdir dir="./classes/production/pojocache-2.2.0"/>
       <javac destdir="./classes/production/pojocache-2.2.0" debug="${compiler.debug}"
@@ -204,7 +204,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.whirlycache101" depends="compile.module.framework"
+   <target name="compile.module.whirlycache101" depends="fwk"
            description="Compile module whirlycache-1.0.1; production classes">
       <mkdir dir="./classes/production/whirlycache-1.0.1"/>
       <javac destdir="./classes/production/whirlycache-1.0.1" debug="${compiler.debug}"
@@ -217,7 +217,7 @@
       </javac>
    </target>
 
-   <target name="compile.module.jbosscache300" depends="compile.module.framework"
+   <target name="compile.module.jbosscache300" depends="fwk"
            description="Compile module jbosscache-3.0.0">
       <mkdir dir="./classes/production/jbosscache-3.0.0"/>
       <javac destdir="./classes/production/jbosscache-3.0.0" debug="${compiler.debug}"
@@ -237,10 +237,10 @@
    </target>
 
    <target name="all"
-           depends="clean, compile.module.framework, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache159, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331"
+           depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache159, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331"
            description="build all"/>
 
-   <target name="checkClusterAddresses" depends="compile.module.framework"
+   <target name="checkClusterAddresses" depends="fwk"
            description="Check whether the cluster config is a valid one">
       <java classname="org.cachebench.ClusterConfigurationCheck" clonevm="true" fork="true">
          <classpath>
@@ -250,7 +250,7 @@
       </java>
    </target>
 
-   <target name="deploy.sf" depends="compile.module.framework" description="builds the smartfrog jar and deploys it">
+   <target name="deploy.sf" depends="fwk" description="builds the smartfrog jar and deploys it">
       <rmic classname="org.cachebench.smartfrog.CacheBenchmarkPrim" base="${framework.output.dir}" verify="true"
             debug="true">
          <classpath refid="framework.module.classpath"/>

Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/conf/mvcc-repl-async.xml	2008-10-06 10:16:34 UTC (rev 6838)
@@ -6,14 +6,14 @@
    <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
    <transport clusterName="JBossCache-Cluster">
       <jgroupsConfig>
-         <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+         <UDP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="false" ip_ttl="2"
               loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
               mcast_port="45588" mcast_recv_buf_size="100000000" mcast_send_buf_size="640000"
               oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="20"
               oob_thread_pool.min_threads="8" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
               oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
-              thread_pool.keep_alive_time="10000" thread_pool.max_threads="30" thread_pool.min_threads="8"
-              thread_pool.queue_enabled="false" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+              thread_pool.keep_alive_time="10000" thread_pool.max_threads="15" thread_pool.min_threads="8"
+              thread_pool.queue_enabled="true" thread_pool.queue_max_size="100000" thread_pool.rejection_policy="Discard"
               tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
               use_incoming_packet_handler="true"/>
          <PING num_initial_members="3" timeout="2000"/>
@@ -22,7 +22,7 @@
          <FD max_tries="5" shun="true" timeout="10000"/>
          <VERIFY_SUSPECT timeout="1500"/>
          <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
-                        use_mcast_xmit="false"/>
+                        use_mcast_xmit="true"/>
          <UNICAST timeout="300,600,1200,2400,3600"/>
          <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
          <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
@@ -34,6 +34,6 @@
       </jgroupsConfig>
    </transport>
    <replication>
-      <async/>
+      <async useReplQueue="true" replQueueInterval="3000" replQueueMaxElements="30000"/>
    </replication>
 </jbosscache>

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -57,6 +57,7 @@
       {
          bindAddr = InetAddress.getByName(bindAddrStr);
       }
+      clusterConfig.validateMembers();
       log.trace("Bind address is:" + bindAddr + "; startPort is:" + startPort);
       nodes = clusterConfig.getMemberAddresses();
       connectionTable = new ConnectionTable(nodes);

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/ClusterConfig.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -6,6 +6,8 @@
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * Configuration for this cache instance.
@@ -118,4 +120,14 @@
    {
       return "{bindAddress:" + bindAddress + ", members:" + getMembers() + ", clusterSize:" + getClusterSize() + "}";
    }
+
+   public void validateMembers()
+   {
+      List<InetSocketAddress> addressList = getMemberAddresses();
+      Set addressSet = new HashSet(addressList);
+      if (addressList.size() != addressSet.size())
+      {
+         throw new RuntimeException("There are memebers defined which point to the same host:port. Verify the configuration");
+      }
+   }
 }

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/config/GenericParamsConfig.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -36,4 +36,9 @@
    {
       return Integer.parseInt(configParams.get(name));
    }
+
+   public boolean getBooleanValue(String paramName)
+   {
+      return Boolean.valueOf(getParamValue(paramName));
+   }
 }

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/CsvSessionSimlatorReportGenerator.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -36,6 +36,11 @@
          buf.append(ssResult.getReadCount());
          buf.append(",");
          buf.append(ssResult.getWriteCount());
+         if (ssResult.registeredReplicationDelays())
+         {
+            buf.append(",");
+            buf.append(ssResult.getReplicationDelayMillis());
+         }
       }
       else
       {
@@ -57,7 +62,7 @@
    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, DURATION, TOTAL OPERATION COUNT, READ COUNT, WRITE COUNT" );
+      writer.write("TEST NAME, TEST DATE, REQ PER SEC, BYTES READ, BYTES WRITTEN, DURATION, TOTAL OPERATION COUNT, READ COUNT, WRITE COUNT, REPLICATION DELAY" );
       writer.newLine();
       log.debug("Complted the Report Header");
 

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -8,14 +8,13 @@
 import org.cachebench.config.TestConfig;
 import org.cachebench.tests.results.TestResult;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Random;
+import java.util.*;
 
 /**
  * Simulates work with a web session.
+ * <p/>
+ * todo mmarkus - improve the test to support multiple threads. Correlate this with usage of message_bundling in JBC
  *
- * todo mmarkus - improve the test to support multiple threads. Correlate this with usage of message_bundling in JBC
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
@@ -30,6 +29,7 @@
    private String sessionId;
    private CacheWrapper cacheWrapper;
    private boolean reportNanos = false;
+   private boolean registerReplicationDelay = false;
 
 
    /**
@@ -122,21 +122,62 @@
             }
          }
       }
+      long replicationDelay = System.currentTimeMillis();
+      replicationDelay = verifyReplicationDelay(replicationDelay);
       long duration = this.reportNanos ? durationNanos : durationNanos / 1000000;
       SessionSimulatorTestResult result = new SessionSimulatorTestResult(reads, writes, duration, totalBytesRead, totalBytesWritten);
       result.setTestPassed(true);
       result.setTestName(testCaseName + getNodeIndex());
       result.setTestTime(new Date());
       result.setTestType(testName);
+      if (registerReplicationDelay)
+      {
+         result.setReplicationDelayMillis(replicationDelay);
+      }
       log.trace("Returning result:" + result);
       return result;
    }
 
+   private long verifyReplicationDelay(long replicationDelay)
+         throws Exception
+   {
+      if (registerReplicationDelay)
+      {
+         log.info("Gathering replication delay");
+         String key = "registerReplicationDelay";
+         List<String> path = Arrays.asList(key);
+         cacheWrapper.put(path, key + getNodeIndex(), "value" + getNodeIndex());
+         Set received = new HashSet();
+         int clusterSize = configuration.getClusterConfig().getClusterSize();
+         while (received.size() < clusterSize)
+         {
+            for (int i = 0; i < clusterSize; i++)
+            {
+               Object replicatedValue = cacheWrapper.get(path, key + i);
+               if (log.isTraceEnabled()) log.trace("replication delay value from node " + i + " is " + replicatedValue);
+               if (replicatedValue != null)
+               {
+                  received.add(replicatedValue);
+               }
+            }
+            if (received.size() < clusterSize)
+            {
+               //todo mmarkus this brings a delay of 1 sec to the async replication config 
+               log.info("Recieved " + received.size() + " replication messages. Sleeping 1 sec before moving on");
+               Thread.sleep(1000);
+            }
+         }
+         replicationDelay = System.currentTimeMillis() - replicationDelay;
+         log.info("Replication delay is " + replicationDelay + " millis.");
+      }
+      return replicationDelay;
+   }
+
    private void logRunCount(int i)
    {
-      if (i % LOG_AFTER_OPERATION_COUNT == 0)
+      if (((i + 1) % LOG_AFTER_OPERATION_COUNT == 0) || (i == 0))
       {
-         log.info("SessionSimulatorTest performed " + i + " operations");
+         log.info("SessionSimulatorTest performed " + (i == 0 ? 0 : (i+1)) + " operations");
       }
    }
 
@@ -170,8 +211,12 @@
       sizeOfAnAttribute = thisTestConfig.getIntValue("sizeOfAnAttribute");
       if (thisTestConfig.existsParam("reportNanos"))
       {
-         this.reportNanos = Boolean.valueOf(thisTestConfig.getParamValue("reportNanos"));
+         this.reportNanos = thisTestConfig.getBooleanValue("reportNanos");
       }
+      if (thisTestConfig.existsParam("registerReplicationDelay"))
+      {
+         this.registerReplicationDelay = thisTestConfig.getBooleanValue("registerReplicationDelay");
+      }
       log.debug("recieved follosing params[ numberOfRequests=" + numberOfRequests + ", numberOfAttributes="
             + numberOfAttributes + ", writePercentage=" + writePercentage + ", sizeOfAnAttribute=" + sizeOfAnAttribute + " ]");
    }
@@ -180,4 +225,5 @@
    {
       return configuration.isLocalOnly() ? "0" : configuration.getClusterConfig().getCurrentNodeIndex() + "";
    }
+
 }

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java	2008-10-03 16:38:10 UTC (rev 6837)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTestResult.java	2008-10-06 10:16:34 UTC (rev 6838)
@@ -16,7 +16,9 @@
    long bytesRead;
    long bytesWritten;
 
+   long replicationDelayMillis = -1;
 
+
    public SessionSimulatorTestResult(long readCount, long writeCount, long durration, long bytesRead, long bytesWritten)
    {
       this.readCount = readCount;
@@ -65,4 +67,19 @@
    {
       return CsvSessionSimlatorReportGenerator.class.getName();
    }
+
+   public long getReplicationDelayMillis()
+   {
+      return replicationDelayMillis;
+   }
+
+   public void setReplicationDelayMillis(long replicationDelayMillis)
+   {
+      this.replicationDelayMillis = replicationDelayMillis;
+   }
+
+   public boolean registeredReplicationDelays()
+   {
+      return replicationDelayMillis != -1;
+   }
 }




More information about the jbosscache-commits mailing list