[jbosscache-commits] JBoss Cache SVN: r6744 - in core/trunk: src/main/docs/Cache_User_Guide/en-US and 3 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Sep 17 07:42:53 EDT 2008


Author: mircea.markus
Date: 2008-09-17 07:42:53 -0400 (Wed, 17 Sep 2008)
New Revision: 6744

Added:
   core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
   core/trunk/src/test/resources/configs/repl-with-cl.xml
   core/trunk/src/test/resources/configs/repl-with-cl2.xml
Modified:
   core/trunk/pom.xml
   core/trunk/src/main/docs/Cache_User_Guide/en-US/Cache_Loaders.xml
   core/trunk/src/main/docs/Cache_User_Guide/en-US/resolved.xml
   core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java
   core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConfigTest.java
Log:
JBCACHE-1221 - enbled insert batching during state transfer

Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/pom.xml	2008-09-17 11:42:53 UTC (rev 6744)
@@ -191,7 +191,7 @@
 
    <profiles>
       <profile>
-         <!-- This profile generates Javadocs and the UserGuide, FAQs and Tutorial in the "package" phase. -->
+         <!-- This testMoreState generates Javadocs and the UserGuide, FAQs and Tutorial in the "package" phase. -->
          <id>Docs</id>
          <activation>
             <activeByDefault>false</activeByDefault>

Modified: core/trunk/src/main/docs/Cache_User_Guide/en-US/Cache_Loaders.xml
===================================================================
--- core/trunk/src/main/docs/Cache_User_Guide/en-US/Cache_Loaders.xml	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/main/docs/Cache_User_Guide/en-US/Cache_Loaders.xml	2008-09-17 11:42:53 UTC (rev 6744)
@@ -173,7 +173,9 @@
 	      cache.jdbc.user=root
 	      cache.jdbc.password=
 	      cache.jdbc.sql-concat=concat(1,2)
-	      &lt;/properties&gt;
+         cache.jdbc.batch.enable=true
+         cache.jdbc.batch.size=1000
+         &lt;/properties&gt;
 	      
 	      &lt;!-- whether the cache loader writes are asynchronous --&gt;
 	      &lt;async&gt;false&lt;/async&gt;
@@ -814,6 +816,8 @@
        cache.jdbc.user=SCOTT
        cache.jdbc.password=TIGER
        cache.jdbc.sql-concat=concat(1,2)
+       cache.jdbc.batch.enable=true
+       cache.jdbc.batch.size=1000
    &lt;/properties&gt;
        
    &lt;async&gt;false&lt;/async&gt;
@@ -872,7 +876,9 @@
 	       cache.jdbc.sql-concat=concat(1,2)
 	       cache.jdbc.connection.factory=org.jboss.cache.loader.C3p0ConnectionFactory
 	       c3p0.maxPoolSize=20
-       c3p0.checkoutTimeout=5000
+          c3p0.checkoutTimeout=5000
+          cache.jdbc.batch.enable=true
+          cache.jdbc.batch.size=1000
       &lt;/properties&gt;
 	       
        &lt;async&gt;false&lt;/async&gt;

Modified: core/trunk/src/main/docs/Cache_User_Guide/en-US/resolved.xml
===================================================================
--- core/trunk/src/main/docs/Cache_User_Guide/en-US/resolved.xml	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/main/docs/Cache_User_Guide/en-US/resolved.xml	2008-09-17 11:42:53 UTC (rev 6744)
@@ -3759,7 +3759,9 @@
 	      cache.jdbc.user=root
 	      cache.jdbc.password=
 	      cache.jdbc.sql-concat=concat(1,2)
-	      &lt;/properties&gt;
+         cache.jdbc.batch.enable=true
+         cache.jdbc.batch.size=1000
+         &lt;/properties&gt;
 	      
 	      &lt;!-- whether the cache loader writes are asynchronous --&gt;
 	      &lt;async&gt;false&lt;/async&gt;
@@ -4399,6 +4401,8 @@
        cache.jdbc.user=SCOTT
        cache.jdbc.password=TIGER
        cache.jdbc.sql-concat=concat(1,2)
+       cache.jdbc.batch.enable=true
+       cache.jdbc.batch.size=1000
    &lt;/properties&gt;
        
    &lt;async&gt;false&lt;/async&gt;
@@ -4455,9 +4459,11 @@
 	       cache.jdbc.user=SCOTT
 	       cache.jdbc.password=TIGER
 	       cache.jdbc.sql-concat=concat(1,2)
-	       cache.jdbc.connection.factory=org.jboss.cache.loader.C3p0ConnectionFactory
+          cache.jdbc.batch.enable=true
+          cache.jdbc.batch.size=1000
+          cache.jdbc.connection.factory=org.jboss.cache.loader.C3p0ConnectionFactory
 	       c3p0.maxPoolSize=20
-       c3p0.checkoutTimeout=5000
+          c3p0.checkoutTimeout=5000
       &lt;/properties&gt;
 	       
        &lt;async&gt;false&lt;/async&gt;

Modified: core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java	2008-09-17 11:42:53 UTC (rev 6744)
@@ -404,9 +404,9 @@
     * Inserts a node into the database
     *
     * @param name the fqn
-    * @param node the node
+    * @param dataMap the node
     */
-   protected void insertNode(Fqn name, Map node)
+   protected void insertNode(Fqn name, Map dataMap)
    {
       Connection con = null;
       PreparedStatement ps = null;
@@ -420,37 +420,8 @@
          con = cf.getConnection();
          ps = con.prepareStatement(config.getInsertNodeSql());
 
-         ps.setString(1, name.toString());
+         populatePreparedStatementForInsert(name, dataMap, ps);
 
-         if (node != null)
-         {
-            ByteBuffer byteBuffer = marshall(node);
-            ps.setBinaryStream(2, byteBuffer.getStream(), byteBuffer.getLength());
-         }
-         else
-         {
-            // a hack to handles the incomp. of SQL server jdbc driver prior to SQL SERVER 2005
-            if (driverName != null && (driverName.contains("SQLSERVER")
-                  || driverName.contains("POSTGRESQL")))
-            {
-               ps.setNull(2, Types.LONGVARBINARY);
-            }
-            else
-            {
-               ps.setNull(2, Types.BLOB);
-            }
-            //ps.setNull(2, Types.LONGVARBINARY);
-         }
-
-         if (name.size() == 0)
-         {
-            ps.setNull(3, Types.VARCHAR);
-         }
-         else
-         {
-            ps.setString(3, name.getAncestor(name.size() - 1).toString());
-         }
-
          int rows = ps.executeUpdate();
          if (rows != 1)
          {
@@ -473,7 +444,45 @@
       }
    }
 
+   /**
+    * Expects a PreparedStatement binded to {@link org.jboss.cache.loader.JDBCCacheLoaderConfig#getInsertNodeSql()}
+    */
+   protected void populatePreparedStatementForInsert(Fqn name, Map dataMap, PreparedStatement ps)
+         throws Exception
+   {
+      ps.setString(1, name.toString());
 
+      if (dataMap != null)
+      {
+         ByteBuffer byteBuffer = marshall(dataMap);
+         ps.setBinaryStream(2, byteBuffer.getStream(), byteBuffer.getLength());
+      }
+      else
+      {
+         // a hack to handles the incomp. of SQL server jdbc driver prior to SQL SERVER 2005
+         if (driverName != null && (driverName.contains("SQLSERVER")
+               || driverName.contains("POSTGRESQL")))
+         {
+            ps.setNull(2, Types.LONGVARBINARY);
+         }
+         else
+         {
+            ps.setNull(2, Types.BLOB);
+         }
+         //ps.setNull(2, Types.LONGVARBINARY);
+      }
+
+      if (name.size() == 0)
+      {
+         ps.setNull(3, Types.VARCHAR);
+      }
+      else
+      {
+         ps.setString(3, name.getAncestor(name.size() - 1).toString());
+      }
+   }
+
+
    /**
     * Updates a node in the database.
     *

Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java	2008-09-17 11:42:53 UTC (rev 6744)
@@ -4,16 +4,14 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.util.Immutables;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.marshall.NodeData;
 
 import java.io.InputStream;
 import java.io.ObjectInputStream;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
+import java.sql.*;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -27,8 +25,19 @@
  * <p/>
  * <p/>
  * Additional configuration info: <br>
- * cache.jdbc.sql-concat : DBMS specific function for concat strings. Most likely this will be concat(1,2), but might
- * be different for proprietary systems.
+ * <ul>
+ *  <li>cache.jdbc.sql-concat : DBMS specific function for concat strings. Most likely this will be concat(1,2), but might
+ * be different for proprietary systems.</li>
+ * <li>
+ * cache.jdbc.batch.enable: whether or not to use batching on repetitive operations (e.g. inserts during state transfer).
+ *  Enabling batching should give an important performance boost. It might be required to disable this if the JDBC driver
+ *  does not support batching. Default set to 'true'
+ * </li>
+   <li>
+   cache.jdbc.batch.size: number of operations afer which the batching buffer will be flushed. If 'cache.jdbc.batch.enable'
+   is false, this will be ignored. Default value is 1000.
+   </li>
+ * </ul>
  *
  * @author Mircea.Markus at iquestint.com
  * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
@@ -82,28 +91,76 @@
    @Override
    protected void storeStateHelper(Fqn subtree, List nodeData, boolean moveToBuddy) throws Exception
    {
-      for (Object aNodeData : nodeData)
+      lock.acquireLock(subtree, true);
+      Connection con = null;
+      PreparedStatement ps = null;
+      boolean autocommitPrev = true;//this initialization is here only for making code compilable, ignore it
+      int batchCaount = 0;
+      try
       {
-         NodeData nd = (NodeData) aNodeData;
-         if (nd.isMarker()) break;
-         Fqn fqn;
-         if (moveToBuddy)
+         con = cf.getConnection();
+         autocommitPrev = con.getAutoCommit();
+         if (config.isBatchEnabled()) con.setAutoCommit(false);
+         ps = con.prepareStatement(config.getInsertNodeSql());
+         for (Object aNodeData : nodeData)
          {
-            fqn = buddyFqnTransformer.getBackupFqn(subtree, nd.getFqn());
+            NodeData nd = (NodeData) aNodeData;
+            if (nd.isMarker()) break;
+            Fqn fqn;
+            if (moveToBuddy)
+            {
+               fqn = buddyFqnTransformer.getBackupFqn(subtree, nd.getFqn());
+            }
+            else
+            {
+               fqn = nd.getFqn();
+            }
+
+            Map attributes = nd.getAttributes() == null ? null : Immutables.immutableMapCopy(nd.getAttributes());
+            populatePreparedStatementForInsert(fqn, attributes, ps);
+            if (!config.isBatchEnabled())
+            {
+               if (ps.executeUpdate() != 1)
+               {
+                  throw new IllegalStateException("One and only one row must have been updated!");
+               }
+            }
+            else
+            {
+               ps.addBatch();
+               batchCaount ++;
+               if (batchCaount >= config.getBatchSize())
+               {
+                  int result[] = ps.executeBatch();
+                  for (int aResult : result)
+                  {
+                     if (aResult != 1 /* one and only one row must have been updated */
+                           && aResult != Statement.SUCCESS_NO_INFO)
+                     {
+                        throw new IllegalStateException("Failure executing batch insert during state transfer!");
+                     }
+                  }
+                  batchCaount = 0;
+               }
+            }
          }
-         else
+         if (batchCaount > 0)
          {
-            fqn = nd.getFqn();
+            if (batchCaount > config.getBatchSize())
+            {
+               throw new IllegalStateException("batchCaount > config.getBatchSize() should never happen!");
+            }
+            ps.executeBatch();//flush the batch here
          }
-
-         if (nd.getAttributes() != null)
+      } finally
+      {
+         lock.releaseLock(subtree);
+         if (con != null)
          {
-            this.put(fqn, nd.getAttributes(), true);// creates a node with 0 or more attributes
+            con.setAutoCommit(autocommitPrev);
+            safeClose(ps);
+            cf.close(con);
          }
-         else
-         {
-            this.put(fqn, null);// creates a node with null attributes
-         }
       }
    }
 

Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java	2008-09-17 11:42:53 UTC (rev 6744)
@@ -28,6 +28,10 @@
    private String startingWith;
    private String appendSepparator;
 
+   private boolean batchEnabled = true;//by default enable batching during state transfer
+
+   private long batchSize = 1000; //default state transfer batch size
+
    public JDBCCacheLoaderConfig(IndividualCacheLoaderConfig base)
    {
       super(base);
@@ -50,6 +54,12 @@
       deleteNodeSql = constructDeleteNodeSql();
       recursiveChildrenSql = constructRecursiveChildrenSql();
       nodeCountSql = constructNodeCountSql();
+
+      batchEnabled = Boolean.valueOf(props.getProperty("cache.jdbc.batch.enable"));
+      if  (props.containsKey("cache.jdbc.batch.size"))
+      {
+         batchSize = Long.parseLong(props.getProperty("cache.jdbc.batch.size"));
+      }
    }
 
    /**
@@ -136,6 +146,25 @@
       this.appendSepparator = appendSepparator;
    }
 
+   /**
+    * If batch is enabled certain operations (e.g. state transfer) will use {@link java.sql.PreparedStatement#addBatch(String)}
+    * approach for insertig data into the database. This normally brings significant performance improvements. 
+    * @return
+    */
+   public boolean isBatchEnabled()
+   {
+      return batchEnabled;
+   }
+
+   /**
+    * The statement will be flushed after batching batchSize operations.
+    * @see #isBatchEnabled()
+    */
+   public long getBatchSize()
+   {
+      return batchSize;
+   }
+
    private void disectSqlConcat()
    {
       if (sqlConcat == null)
@@ -160,5 +189,5 @@
    private String constructDeleteNodeSql()
    {
       return "delete from " + table + " where " + appendSepparator + " like " + startingWith;
-   }   
+   }
 }
\ No newline at end of file

Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConfigTest.java	2008-09-16 18:05:14 UTC (rev 6743)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConfigTest.java	2008-09-17 11:42:53 UTC (rev 6744)
@@ -12,12 +12,15 @@
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
+import java.util.Properties;
+
 /**
  * Unit test for JDBCCacheLoaderConfigTest
  *
  * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  */
- at Test(groups = {"functional"})
+ at Test(groups = {"unit"})
 public class JDBCCacheLoaderConfigTest
 {
    private AdjListJDBCCacheLoaderConfig cacheLoaderConfig;
@@ -45,4 +48,29 @@
       other.setConnectionFactoryClass("com.ibm.flaming.Gala");
       assertFalse(cacheLoaderConfig.equals(other));
    }
+
+   public void testSetGetBatchInfo()
+   {
+      Properties props = new Properties();
+      props.put("ache.jdbc.table.name","jbosscache");
+      props.put("cache.jdbc.table.create", "true");
+      props.put("cache.jdbc.table.drop","true");
+      props.put("cache.jdbc.table.primarykey","jbosscache_pk");
+      props.put("cache.jdbc.fqn.column","fqn");
+      props.put("cache.jdbc.fqn.type", "varchar(255)");
+      props.put("cache.jdbc.node.column","node");
+      props.put("cache.jdbc.node.type", "blob");
+      props.put("cache.jdbc.parent.column","parent");
+      props.put("cache.jdbc.sql-concat","1 || 2");
+      props.put("cache.jdbc.driver","org.apache.derby.jdbc.EmbeddedDriver");
+      props.put("cache.jdbc.url","jdbc:derby:jbossdb;create=true");
+      props.put("cache.jdbc.user","user1");
+      props.put("cache.jdbc.password","user1");
+      props.put("cache.jdbc.batch.enable","false");
+      props.put("cache.jdbc.batch.size","1001");
+      JDBCCacheLoaderConfig config = new JDBCCacheLoaderConfig();
+      config.setProperties(props);
+      assert !config.isBatchEnabled();
+      assert config.getBatchSize() == 1001;
+   }
 }

Added: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderStateTransferTest.java	2008-09-17 11:42:53 UTC (rev 6744)
@@ -0,0 +1,88 @@
+/*
+ * 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.jboss.cache.loader;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.AfterMethod;
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+
+/**
+ * UT for testing JDBCCacheLoader during state transfer.
+ * @author Mircea.Markus at jboss.com
+ * @since 3.0
+ */
+ at Test(groups = "functional")
+public class JDBCCacheLoaderStateTransferTest
+{
+
+   CacheSPI first;
+   CacheSPI second;
+
+   @AfterMethod
+   public void tearDown()
+   {
+      if (first != null) first.stop();
+      if (second != null) second.stop();
+   }
+
+   public void testSimpleStateTransfer() throws Exception
+   {
+      first = (CacheSPI) new DefaultCacheFactory().createCache("configs/repl-with-cl.xml");
+      first.put("/a/b/c", "key", "value");
+      first.put("/a/b/d", "key", "value");
+      first.put("/a/b/e", "key", "value");
+
+      second = (CacheSPI) new DefaultCacheFactory().createCache("configs/repl-with-cl2.xml");
+      assert second.get("/a/b/c","key").equals("value");
+      assert second.get("/a/b/d","key").equals("value");
+      assert second.get("/a/b/e","key").equals("value");
+      JDBCCacheLoader cacheLoader = (JDBCCacheLoader) second.getCacheLoaderManager().getCacheLoader();
+      assert cacheLoader.exists(Fqn.fromString("/a"));
+      assert cacheLoader.exists(Fqn.fromString("/a/b"));
+   }
+
+
+   public void testMoreState()
+   {
+      long startTime = System.currentTimeMillis();
+      first = (CacheSPI) new DefaultCacheFactory().createCache("configs/repl-with-cl.xml");
+      long cacheStartTime = System.currentTimeMillis() - startTime;
+      System.out.println("cacheStartTime = " + cacheStartTime);
+      for (int i = 0; i < 5012; i++)
+      {
+         first.put("a/b/"+i, "k","v");
+         if (i%1000 == 0) System.out.println(i + " operations executed so far");
+      }
+      startTime = System.currentTimeMillis();
+      second = (CacheSPI) new DefaultCacheFactory().createCache("configs/repl-with-cl2.xml");
+
+      long stateTranferTime = System.currentTimeMillis() - startTime - cacheStartTime;
+      for (int i = 0; i < 5012; i+=100)
+      {
+         second.get("a/b/"+ i, "k").equals("v");
+      }
+      System.out.println("stateTranferTime = " + stateTranferTime);
+   }
+}

Added: core/trunk/src/test/resources/configs/repl-with-cl.xml
===================================================================
--- core/trunk/src/test/resources/configs/repl-with-cl.xml	                        (rev 0)
+++ core/trunk/src/test/resources/configs/repl-with-cl.xml	2008-09-17 11:42:53 UTC (rev 6744)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+   <!--
+       isolationLevel :   SERIALIZABLE - (not supported in mvcc)
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED (not supported in mvcc)
+                            NONE
+       lockAcquisitionTimeout: max number of milliseconds to wait for a lock acquisition
+       nodeLockingScheme : mvcc (default)
+                           optimistic
+                           pessimistic
+   -->
+   <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="mvcc"/>
+   
+   <!-- Configure the TransactionManager -->
+   <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+
+   <transport clusterName="JBossCache-Cluster">
+      <jgroupsConfig>
+         <TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
+              max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" enable_bundling="true"
+              enable_unicast_bundling="true" enable_diagnostics="true" use_concurrent_stack="true"
+              thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.min_threads="1"
+              thread_pool.max_threads="4" thread_pool.keep_alive_time="30000" thread_pool.queue_enabled="true"
+              thread_pool.queue_max_size="50000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
+              oob_thread_pool.min_threads="2" oob_thread_pool.max_threads="4" oob_thread_pool.keep_alive_time="10000"
+              oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
+              oob_thread_pool.rejection_policy="Run"/>
+         <MPING mcast_addr="232.1.2.3" timeout="2000" num_initial_members="3"/>
+         <MERGE2 max_interval="30000" min_interval="10000"/>
+         <FD_SOCK/>
+         <FD timeout="10000" max_tries="5" shun="true"/>
+         <VERIFY_SUSPECT timeout="1500"/>
+         <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+                        discard_delivered_msgs="true"/>
+         <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
+         <pbcast.GMS print_local_addr="true" join_timeout="5000" join_retry_timeout="2000" shun="false"
+                     view_bundling="true" view_ack_collection_timeout="5000"/>
+         <FC max_credits="5000000" min_threshold="0.20"/>
+         <FRAG2 frag_size="60000"/>
+         <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+         <pbcast.FLUSH timeout="0"/>
+      </jgroupsConfig>
+   </transport>
+   
+
+   <!-- Cache Passivation for Tree Cache
+   On passivation, The objects are written to the backend store on eviction if passivation
+   is true, otherwise the objects are persisted. On activation, the objects are restored in
+   the memory cache and removed from the cache loader if 'passivation' attribute is true,
+   otherwise the objects are only loaded from the cache loader -->
+   <loaders passivation="false" shared="false">
+      <preload>
+         <node fqn="/"/>
+      </preload>
+      <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+      <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="true"
+              ignoreModifications="false" purgeOnStartup="true">
+         <properties>
+            cache.jdbc.table.name=jbosscache
+            cache.jdbc.table.create=true
+            cache.jdbc.table.drop=true
+            cache.jdbc.table.primarykey=jbosscache_pk
+            cache.jdbc.fqn.column=fqn
+            cache.jdbc.fqn.type=varchar(255)
+            cache.jdbc.node.column=node
+            cache.jdbc.node.type=blob
+            cache.jdbc.parent.column=parent
+            cache.jdbc.sql-concat=1 || 2
+            cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+            cache.jdbc.url=jdbc:derby:jbossdb;create=true
+            cache.jdbc.user=user1
+            cache.jdbc.password=user1
+         </properties>
+      </loader>
+   </loaders>
+   <replication>
+      <sync replTimeout="30000"/>
+   </replication>
+   
+</jbosscache>

Added: core/trunk/src/test/resources/configs/repl-with-cl2.xml
===================================================================
--- core/trunk/src/test/resources/configs/repl-with-cl2.xml	                        (rev 0)
+++ core/trunk/src/test/resources/configs/repl-with-cl2.xml	2008-09-17 11:42:53 UTC (rev 6744)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+   <!--
+       isolationLevel :   SERIALIZABLE - (not supported in mvcc)
+                            REPEATABLE_READ (default)
+                            READ_COMMITTED
+                            READ_UNCOMMITTED (not supported in mvcc)
+                            NONE
+       lockAcquisitionTimeout: max number of milliseconds to wait for a lock acquisition
+       nodeLockingScheme : mvcc (default)
+                           optimistic
+                           pessimistic
+   -->
+   <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="mvcc"/>
+
+   <!-- Configure the TransactionManager -->
+   <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+
+   <transport clusterName="JBossCache-Cluster">
+      <jgroupsConfig>
+         <TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
+              max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" enable_bundling="true"
+              enable_unicast_bundling="true" enable_diagnostics="true" use_concurrent_stack="true"
+              thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.min_threads="1"
+              thread_pool.max_threads="4" thread_pool.keep_alive_time="30000" thread_pool.queue_enabled="true"
+              thread_pool.queue_max_size="50000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
+              oob_thread_pool.min_threads="2" oob_thread_pool.max_threads="4" oob_thread_pool.keep_alive_time="10000"
+              oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
+              oob_thread_pool.rejection_policy="Run"/>
+         <MPING mcast_addr="232.1.2.3" timeout="2000" num_initial_members="3"/>
+         <MERGE2 max_interval="30000" min_interval="10000"/>
+         <FD_SOCK/>
+         <FD timeout="10000" max_tries="5" shun="true"/>
+         <VERIFY_SUSPECT timeout="1500"/>
+         <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+                        discard_delivered_msgs="true"/>
+         <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
+         <pbcast.GMS print_local_addr="true" join_timeout="5000" join_retry_timeout="2000" shun="false"
+                     view_bundling="true" view_ack_collection_timeout="5000"/>
+         <FC max_credits="5000000" min_threshold="0.20"/>
+         <FRAG2 frag_size="60000"/>
+         <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+         <pbcast.FLUSH timeout="0"/>
+      </jgroupsConfig>
+   </transport>
+
+   <stateRetrieval fetchInMemoryState="false" timeout="0"/>
+   
+
+   <!-- Cache Passivation for Tree Cache
+   On passivation, The objects are written to the backend store on eviction if passivation
+   is true, otherwise the objects are persisted. On activation, the objects are restored in
+   the memory cache and removed from the cache loader if 'passivation' attribute is true,
+   otherwise the objects are only loaded from the cache loader -->
+   <loaders passivation="false" shared="false">
+      <preload>
+         <node fqn="/"/>
+      </preload>
+      <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+      <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="true"
+              ignoreModifications="false" purgeOnStartup="true">
+         <properties>
+            cache.jdbc.table.name=jbosscache
+            cache.jdbc.table.create=true
+            cache.jdbc.table.drop=true
+            cache.jdbc.table.primarykey=jbosscache_pk
+            cache.jdbc.fqn.column=fqn
+            cache.jdbc.fqn.type=varchar(255)
+            cache.jdbc.node.column=node
+            cache.jdbc.node.type=blob
+            cache.jdbc.parent.column=parent
+            cache.jdbc.sql-concat=1 || 2
+            cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+            cache.jdbc.url=jdbc:derby:jbossdb2;create=true
+            cache.jdbc.user=user1
+            cache.jdbc.password=user1
+            cache.jdbc.batch.enable=true
+            cache.jdbc.batch.size=1000
+         </properties>
+      </loader>
+   </loaders>
+
+   <replication>
+      <sync replTimeout="30000"/>
+   </replication>
+</jbosscache>




More information about the jbosscache-commits mailing list