<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Clustered JBoss Cache and JDBCCacheLoader
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/vdeminico">valerio de minico</a> in <i>JBoss Cache</i> - <a href="http://community.jboss.org/message/617840#617840">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi all,</p><p>I'm clustering an app which uses a jboss cache to cache data. For JBoss Cache I use a JDBCCacheLoader and mysql as DBMS. My question is how clusterize this scenario??? I should have a shared mysql instance or an instance on all machines????? I use JBoss Cache 3.1.0.GA (bundled in JBoss AS 5.1.0.GA).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here my *-service.xml file:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper"
          name="jboss.cache:service=PojoCache"></span>
     
      <span class="jive-xml-tag"><depends></span>jboss:service=TransactionManager<span class="jive-xml-tag"></depends></span>
      <span class="jive-xml-comment"><!-- Configure the TransactionManager (test only!)-->
            <!--
      <span class="jive-xml-tag"><attribute name="TransactionManagerLookupClass"></span>
         org.jboss.cache.transaction.DummyTransactionManagerLookup
      <span class="jive-xml-tag"></attribute></span>
            -->
           
      <!-- Isolation level : SERIALIZABLE
                             REPEATABLE_READ (default)
                             READ_COMMITTED
                             READ_UNCOMMITTED
                             NONE
      -->
      <span class="jive-xml-tag"><attribute name="IsolationLevel"></span>REPEATABLE_READ<span class="jive-xml-tag"></attribute></span>
      <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
      <span class="jive-xml-tag"><attribute name="CacheMode"></span>REPL_SYNC<span class="jive-xml-tag"></attribute></span>
      <!-- Name of cluster. Needs to be the same for all caches,
           in order for them to find each other
      -->
      <span class="jive-xml-tag"><attribute name="ClusterName"></span>PojoCacheCluster<span class="jive-xml-tag"></attribute></span>
               <!-- JGroups protocol stack properties. -->
      <span class="jive-xml-tag"><attribute name="ClusterConfig"></span>
         <span class="jive-xml-tag"><config></span>
            <!-- UDP: if you have a multihomed machine, set the bind_addr
                 attribute to the appropriate NIC IP address -->
            <!-- UDP: On Windows machines, because of the media sense feature
                 being broken with multicast (even after disabling media sense)
                 set the loopback attribute to true -->
            <span class="jive-xml-tag"><UDP mcast_addr="228.1.2.3" mcast_port="48866"
                 ip_ttl="64" ip_mcast="true"
                 mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
                 ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
                 loopback="false"/></span>
            <span class="jive-xml-tag"><PING timeout="2000" num_initial_members="3"/></span>
            <span class="jive-xml-tag"><MERGE2 min_interval="10000" max_interval="20000"/></span>
            <span class="jive-xml-tag"><FD shun="true"/></span>
            <span class="jive-xml-tag"><FD_SOCK/></span>
            <span class="jive-xml-tag"><VERIFY_SUSPECT timeout="1500"/></span>
            <span class="jive-xml-tag"><pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
                           max_xmit_size="8192"/></span>
            <span class="jive-xml-tag"><UNICAST timeout="600,1200,2400,4800"/></span>
            <span class="jive-xml-tag"><pbcast.STABLE desired_avg_gossip="400000"/></span>
            <span class="jive-xml-tag"><FC max_credits="2000000" min_threshold="0.10"/></span>
            <span class="jive-xml-tag"><FRAG2 frag_size="8192"/></span>
            <span class="jive-xml-tag"><pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
                        shun="true" print_local_addr="true"/></span>
            <span class="jive-xml-tag"><pbcast.STATE_TRANSFER/></span>
         <span class="jive-xml-tag"></config></span>
      <span class="jive-xml-tag"></attribute></span>
<span class="jive-xml-tag"><attribute name="EvictionPolicyConfig"></span>
   <span class="jive-xml-tag"><config></span>
      <span class="jive-xml-tag"><attribute name="wakeUpIntervalSeconds"></span>5<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="policyClass"></span>org.jboss.cache.eviction.LRUPolicy<span class="jive-xml-tag"></attribute></span>
      <!-- Cache wide default -->
      <span class="jive-xml-tag"><region name="/profile"></span>
          <span class="jive-xml-tag"><attribute name="maxNodes"></span>5000<span class="jive-xml-tag"></attribute></span>
          <span class="jive-xml-tag"><attribute name="timeToLiveSeconds"></span>3<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"></region></span>
   <span class="jive-xml-tag"></config></span>
<span class="jive-xml-tag"></attribute></span>
      <!-- CacheLoaderConfiguration -->
<span class="jive-xml-tag"><attribute name="CacheLoaderConfig"></span>
   <span class="jive-xml-tag"><config></span>
      <span class="jive-xml-tag"><passivation></span>true<span class="jive-xml-tag"></passivation></span>
      <span class="jive-xml-tag"><preload></span>/profile<span class="jive-xml-tag"></preload></span>
      <span class="jive-xml-tag"><shared></span>false<span class="jive-xml-tag"></shared></span>
      <!-- we can now have multiple cache loaders, which get chained -->
      <span class="jive-xml-tag"><cacheloader></span>
         <span class="jive-xml-tag"><class></span>org.jboss.cache.loader.JDBCCacheLoader<span class="jive-xml-tag"></class></span>
          <span class="jive-xml-tag"><properties></span>
                                cache.jdbc.driver=com.mysql.jdbc.Driver
                          cache.jdbc.url=jdbc:mysql://localhost:3306/db_cache
                                cache.jdbc.user=root
                            cache.jdbc.password=admin
                              cache.jdbc.node.type=LONGBLOB
                              cache.jdbc.table.drop=false
                              cache.jdbc.table.create=false
         <span class="jive-xml-tag"></properties></span>
         <!-- whether the cache loader writes are asynchronous -->
         <span class="jive-xml-tag"><async></span>false<span class="jive-xml-tag"></async></span>
         <!-- only one cache loader in the chain may set fetchPersistentState to true.
              An exception is thrown if more than one cache loader sets this to true. -->
         <span class="jive-xml-tag"><fetchPersistentState></span>true<span class="jive-xml-tag"></fetchPersistentState></span>
         <!-- determines whether this cache loader ignores writes - defaults to false. -->
         <span class="jive-xml-tag"><ignoreModifications></span>false<span class="jive-xml-tag"></ignoreModifications></span>
      <span class="jive-xml-tag"></cacheloader></span>
   <span class="jive-xml-tag"></config></span>
<span class="jive-xml-tag"></attribute></span>
      <!-- Whether or not to fetch state on joining a cluster -->
      <span class="jive-xml-tag"><attribute name="FetchInMemoryState"></span>true<span class="jive-xml-tag"></attribute></span>
      <!-- The max amount of time (in milliseconds) we wait until the
           initial state (ie. the contents of the cache) are retrieved from
           existing members in a clustered environment
      -->
      <span class="jive-xml-tag"><attribute name="InitialStateRetrievalTimeout"></span>15000<span class="jive-xml-tag"></attribute></span>
      <!-- Number of milliseconds to wait until all responses for a
           synchronous call have been received.
      -->
      <span class="jive-xml-tag"><attribute name="SyncReplTimeout"></span>15000<span class="jive-xml-tag"></attribute></span>
      <!--  Max number of milliseconds to wait for a lock acquisition --></span>
      <span class="jive-xml-tag"><attribute name="LockAcquisitionTimeout"></span>10000<span class="jive-xml-tag"></attribute></span>
  
   <span class="jive-xml-tag"></mbean></span>
<span class="jive-xml-tag"></server></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks, </p><p>Valerio.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/617840#617840">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Cache at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>