[jbosscache-commits] JBoss Cache SVN: r6922 - in core/trunk: src/main and 3 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Oct 13 14:48:10 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-10-13 14:48:10 -0400 (Mon, 13 Oct 2008)
New Revision: 6922

Added:
   core/trunk/src/main/tutorial/
   core/trunk/src/main/tutorial/README-Tutorial.txt
   core/trunk/src/main/tutorial/build.xml
Modified:
   core/trunk/assembly/all.xml
   core/trunk/src/main/docbook/tutorial/en/master.xml
   core/trunk/src/test/java/org/jboss/cache/profiling/MemConsumptionTest.java
   core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
JBoss Cache tutorial stuff

Modified: core/trunk/assembly/all.xml
===================================================================
--- core/trunk/assembly/all.xml	2008-10-13 18:32:30 UTC (rev 6921)
+++ core/trunk/assembly/all.xml	2008-10-13 18:48:10 UTC (rev 6922)
@@ -82,14 +82,34 @@
          <directory>target/docbook</directory>
          <outputDirectory>doc/</outputDirectory>
       </fileSet>
+
+      <fileSet>
+         <directory>src/main/tutorial</directory>
+         <outputDirectory>tutorial/</outputDirectory>
+      </fileSet>
+
+      <fileSet>
+         <directory>target</directory>
+         <outputDirectory>tutorial/lib/</outputDirectory>
+         <includes>
+            <include>**/jbosscache-core-tests.jar</include>
+         </includes>
+      </fileSet>
    </fileSets>
 
    <!-- Make sure we filter out the junk that jboss-common-core pulls in -->
    <dependencySets>
       <dependencySet>
          <outputDirectory>lib</outputDirectory>
-         <outputFileNameMapping>${scope}/${artifactId}.${extension}</outputFileNameMapping>
+         <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
          <unpack>false</unpack>
+         <scope>runtime</scope>
+      </dependencySet>
+
+      <dependencySet>
+         <outputDirectory>tutorial/lib</outputDirectory>
+         <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+         <unpack>false</unpack>
          <scope>test</scope>
       </dependencySet>
    </dependencySets>

Modified: core/trunk/src/main/docbook/tutorial/en/master.xml
===================================================================
--- core/trunk/src/main/docbook/tutorial/en/master.xml	2008-10-13 18:32:30 UTC (rev 6921)
+++ core/trunk/src/main/docbook/tutorial/en/master.xml	2008-10-13 18:48:10 UTC (rev 6922)
@@ -29,12 +29,12 @@
       <para>
          JBoss Cache is an in-memory replicated, transactional, and fine-grained cache.
          This tutorial focuses on the core Cache API. Please refer to the accompanying tutorial
-         for the Pojo Cache API if it is the Pojo Cache API you are interested in.
+         for POJO Cache, if it is the POJO Cache API you are interested in.
       </para>
       <para>
          For details of configuration, usage and APIs, please refer to the
          <ulink
-               url="http://labs.jboss.org/portal/jbosscache/docs/index.html">user manuals
+               url="http://labs.jboss.org/jbosscache/docs/index.html">user manuals
          </ulink>
          .
       </para>
@@ -61,15 +61,14 @@
    <section>
       <title>Configuration</title>
 
-      <para>First download the JBoss Cache 2.x distribution from
+      <para>First download the JBoss Cache 3.x distribution from
          <ulink
-               url="http://labs.jboss.org/portal/jbosscache/download/index.html">the download page
+               url="http://labs.jboss.org/jbosscache/download/index.html">the download page
          </ulink>
-         . You probably want the
-         <literal>JBossCache-core-2.X.Y.zip</literal>
-         distribution.
+         . You will need the ALL distribution (
+         <literal>jbosscache-core-3.X.Y.GA-all.zip</literal>).
          Unzip it, and you will get a directory containing the distribution, such as
-         <literal>JBossCache-core-2.X.Y</literal>
+         <literal>jbosscache-core-3.X.Y</literal>
          .
          For the sake of this tutorial, I will refer to this as
          <literal>JBossCache</literal>
@@ -93,7 +92,7 @@
 
          <listitem>
             <para>
-               <literal>config-samples/replSync-service.xml</literal>
+               <literal>config-samples/total-replication.xml</literal>
                . Cache configuration file used for this tutorial.
             </para>
          </listitem>
@@ -104,7 +103,7 @@
       <title>Script</title>
 
       <para>The only script needed for this tutorial is the
-         <literal>JBossCache/build.xml</literal>
+         <literal>JBossCache/tutorial/build.xml</literal>
          ant script. You also need to have
          <ulink url="http://ant.apache.org/">ant</ulink>
          installed for running the demo.
@@ -115,15 +114,18 @@
       <title>Running The Demo GUI</title>
 
       <para>
-         The demo is run by calling the ant script with the
-         <literal>run.demo</literal>
-         target. E.g.,
+         The demo is run by:
+         <ol>
+            <li>Changing to the
+               <literal>tutorial</literal>
+               directory (e.g.,<literal>cd tutorial</literal>)
+            </li>
+            <li>And then running the ant script (e.g.,<literal>ant run</literal>)
+            </li>
+         </ol>
       </para>
 
       <para>
-         <literal>ant run.demo</literal>
-      </para>
-      <para>
          This will cause a GUI window to appear, giving you a tree view of the cache in the top pane and a BeanShell
          view
          of the JVM in the lower pane.

Added: core/trunk/src/main/tutorial/README-Tutorial.txt
===================================================================
--- core/trunk/src/main/tutorial/README-Tutorial.txt	                        (rev 0)
+++ core/trunk/src/main/tutorial/README-Tutorial.txt	2008-10-13 18:48:10 UTC (rev 6922)
@@ -0,0 +1,4 @@
+Please see the tutorial in the /doc directory.
+
+This directory contains script and code to run the tutorial.
+

Added: core/trunk/src/main/tutorial/build.xml
===================================================================
--- core/trunk/src/main/tutorial/build.xml	                        (rev 0)
+++ core/trunk/src/main/tutorial/build.xml	2008-10-13 18:48:10 UTC (rev 6922)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project name="JBoss Cache Demo" default="help" basedir=".">
+
+   <property name="className" value="org.jboss.cache.demo.JBossCacheView"/>
+   <property name="cfgFile" value="../etc/config-samples/total-replication.xml"/>
+   <property name="jvm.ipv4" value="-Djava.net.preferIPv4Stack=true"/>
+   <property name="jvm.localhost" value="-Dbind.address=127.0.0.1"/>
+   <property name="jvm.memory" value="-Xmx128M"/>
+
+
+   <path id="classpath">
+      <fileset dir="lib">
+         <include name="**/*.jar"/>
+      </fileset>
+      <fileset dir="../lib">
+         <include name="**/*.jar"/>
+      </fileset>
+      <fileset dir="..">
+         <include name="jbosscache-core.jar"/>
+      </fileset>
+   </path>
+
+   <target name="help">
+      <echo>
+         ________________ _________ ______
+         ______ /__ __ )____________________ __ ____/_____ _________ /______
+         ___ _ /__ __ | __ \_ ___/_ ___/ _ / _ __ `/ ___/_ __ \ _ \
+         / /_/ / _ /_/ // /_/ /(__ )_(__ ) / /___ / /_/ // /__ _ / / / __/
+         \____/ /_____/ \____//____/ /____/ \____/ \__,_/ \___/ /_/ /_/\___/
+
+         ________ _____ _____ ______
+         ___ __/___ ___ /________________(_)_____ ___ /
+         __ / _ / / / __/ __ \_ ___/_ /_ __ `/_ /
+         _ / / /_/ // /_ / /_/ / / _ / / /_/ /_ /
+         /_/ \__,_/ \__/ \____//_/ /_/ \__,_/ /_/
+
+
+         ----------------------------------------------------------------------------
+
+         To run the tutorial, type "ant run"
+      </echo>
+   </target>
+
+   <target name="run">
+      <echo>
+         ________________ _________ ______
+         ______ /__ __ )____________________ __ ____/_____ _________ /______
+         ___ _ /__ __ | __ \_ ___/_ ___/ _ / _ __ `/ ___/_ __ \ _ \
+         / /_/ / _ /_/ // /_/ /(__ )_(__ ) / /___ / /_/ // /__ _ / / / __/
+         \____/ /_____/ \____//____/ /____/ \____/ \__,_/ \___/ /_/ /_/\___/
+
+         ________ _____ _____ ______
+         ___ __/___ ___ /________________(_)_____ ___ /
+         __ / _ / / / __/ __ \_ ___/_ /_ __ `/_ /
+         _ / / /_/ // /_ / /_/ / / _ / / /_/ /_ /
+         /_/ \__,_/ \__/ \____//_/ /_/ \__,_/ /_/
+
+
+         ----------------------------------------------------------------------------
+
+      </echo>
+      <java classname="${className}" classpathref="classpath" fork="true">
+         <jvmarg value="${jvm.ipv4}"/>
+         <jvmarg value="${jvm.localhost}"/>
+         <jvmarg value="${jvm.memory}"/>
+         <arg value="-console"/>
+         <arg value="-config"/>
+         <arg value="${cfgFile}"/>
+      </java>
+   </target>
+</project>
\ No newline at end of file

Modified: core/trunk/src/test/java/org/jboss/cache/profiling/MemConsumptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/MemConsumptionTest.java	2008-10-13 18:32:30 UTC (rev 6921)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/MemConsumptionTest.java	2008-10-13 18:48:10 UTC (rev 6922)
@@ -29,6 +29,7 @@
 
 import java.io.IOException;
 import java.text.NumberFormat;
+import java.util.Arrays;
 import java.util.Random;
 
 @Test(groups = "profiling")
@@ -43,13 +44,16 @@
 
    public void testMemConsumption() throws IOException
    {
-      int kBytesCached = (numNodes * (payloadSize + keySize)) / 1024;
+      int kBytesCached = (2 * numNodes * (payloadSize + keySize)) / 1024;
       System.out.println("Bytes to be cached: " + NumberFormat.getIntegerInstance().format(kBytesCached) + " kb");
 
-      Cache<String, String> c = new DefaultCacheFactory<String, String>().createCache(); // default LOCAL cache
+      Cache<String, String> c = new DefaultCacheFactory<String, String>().createCache(false); // default LOCAL cache
+//      c.getConfiguration().setConcurrencyLevel(numNodes);
+      c.start();
       for (int i = 0; i < numNodes; i++)
       {
          c.put(Fqn.fromString("/node" + i), generateRandomString(keySize), generateRandomString(payloadSize));
+         if (i % 1000 == 0) System.out.println("Added " + i + " entries");
       }
 
       System.out.println("Calling System.gc()");
@@ -72,4 +76,24 @@
       assert sb.length() == stringSize;
       return sb.toString();
    }
+
+   private byte[] generateUniqueKey(int runNumber, int keySize)
+   {
+      byte[] b = new byte[keySize];
+      b[0] = (byte) (runNumber >>> 0);
+      b[1] = (byte) (runNumber >>> 8);
+      b[2] = (byte) (runNumber >>> 16);
+      b[3] = (byte) (runNumber >>> 24);
+
+      for (int i = 4; i < keySize; i++) b[i] = 0;
+      return b;
+   }
+
+   private byte[] generateBytePayload(int payloadSize)
+   {
+      byte[] b = new byte[payloadSize];
+      Arrays.fill(b, (byte) 0);
+      return b;
+   }
+
 }

Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java	2008-10-13 18:32:30 UTC (rev 6921)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java	2008-10-13 18:48:10 UTC (rev 6922)
@@ -38,7 +38,7 @@
    /*
       Test configuration options
     */
-   protected static final long NUM_OPERATIONS = 1000000; // DURATION is replaced with a fixed number of operations instead.
+   protected static final long NUM_OPERATIONS = 5000000; // DURATION is replaced with a fixed number of operations instead.
    protected static final int NUM_THREADS = 25;
    protected static final int MAX_RANDOM_SLEEP_MILLIS = 1;
    protected static final int MAX_DEPTH = 3;
@@ -81,6 +81,7 @@
    {
       cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
       cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_ASYNC);
+      cache.getConfiguration().setSerializationExecutorPoolSize(0);
       cache.getConfiguration().setConcurrencyLevel(5000);
       cache.getConfiguration().setClusterConfig(getJGroupsConfig());
       runCompleteTest();




More information about the jbosscache-commits mailing list