<!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;">&#160;</p><p>Here my *-service.xml file:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper" 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name="jboss.cache:service=PojoCache"&gt;</span>
&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;depends&gt;</span>jboss:service=TransactionManager<span class="jive-xml-tag">&lt;/depends&gt;</span>


&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- Configure the TransactionManager (test only!)--&gt;
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; &lt;!--
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="TransactionManagerLookupClass"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; org.jboss.cache.transaction.DummyTransactionManagerLookup
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; --&gt;
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160; &lt;!-- Isolation level : SERIALIZABLE
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; REPEATABLE_READ (default)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; READ_COMMITTED
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; READ_UNCOMMITTED
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; NONE
&#160;&#160;&#160;&#160;&#160; --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="IsolationLevel"&gt;</span>REPEATABLE_READ<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="CacheMode"&gt;</span>REPL_SYNC<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!-- Name of cluster. Needs to be the same for all caches, 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; in order for them to find each other
&#160;&#160;&#160;&#160;&#160; --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="ClusterName"&gt;</span>PojoCacheCluster<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- JGroups protocol stack properties. --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="ClusterConfig"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- UDP: if you have a multihomed machine, set the bind_addr 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; attribute to the appropriate NIC IP address --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- UDP: On Windows machines, because of the media sense feature
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; being broken with multicast (even after disabling media sense)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; set the loopback attribute to true --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;UDP mcast_addr="228.1.2.3" mcast_port="48866"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ip_ttl="64" ip_mcast="true"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; loopback="false"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;PING timeout="2000" num_initial_members="3"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;MERGE2 min_interval="10000" max_interval="20000"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;FD shun="true"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;FD_SOCK/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;VERIFY_SUSPECT timeout="1500"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; max_xmit_size="8192"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;UNICAST timeout="600,1200,2400,4800"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;pbcast.STABLE desired_avg_gossip="400000"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;FC max_credits="2000000" min_threshold="0.10"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;FRAG2 frag_size="8192"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; shun="true" print_local_addr="true"/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;pbcast.STATE_TRANSFER/&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/attribute&gt;</span>


<span class="jive-xml-tag">&lt;attribute name="EvictionPolicyConfig"&gt;</span>
&#160;&#160; <span class="jive-xml-tag">&lt;config&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="wakeUpIntervalSeconds"&gt;</span>5<span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="policyClass"&gt;</span>org.jboss.cache.eviction.LRUPolicy<span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160;&#160;&#160;&#160; &lt;!-- Cache wide default --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;region name="/profile"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="maxNodes"&gt;</span>5000<span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="timeToLiveSeconds"&gt;</span>3<span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/region&gt;</span>
&#160;&#160; <span class="jive-xml-tag">&lt;/config&gt;</span>
<span class="jive-xml-tag">&lt;/attribute&gt;</span>




&#160;&#160;&#160;&#160;&#160; &lt;!-- CacheLoaderConfiguration --&gt;
<span class="jive-xml-tag">&lt;attribute name="CacheLoaderConfig"&gt;</span>
&#160;&#160; <span class="jive-xml-tag">&lt;config&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;passivation&gt;</span>true<span class="jive-xml-tag">&lt;/passivation&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;preload&gt;</span>/profile<span class="jive-xml-tag">&lt;/preload&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;shared&gt;</span>false<span class="jive-xml-tag">&lt;/shared&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!-- we can now have multiple cache loaders, which get chained --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;cacheloader&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>org.jboss.cache.loader.JDBCCacheLoader<span class="jive-xml-tag">&lt;/class&gt;</span>
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="jive-xml-tag">&lt;properties&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cache.jdbc.driver=com.mysql.jdbc.Driver
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cache.jdbc.url=jdbc:mysql://localhost:3306/db_cache
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cache.jdbc.user=root
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cache.jdbc.password=admin
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cache.jdbc.node.type=LONGBLOB
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cache.jdbc.table.drop=false
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cache.jdbc.table.create=false
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/properties&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- whether the cache loader writes are asynchronous --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;async&gt;</span>false<span class="jive-xml-tag">&lt;/async&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- only one cache loader in the chain may set fetchPersistentState to true.
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; An exception is thrown if more than one cache loader sets this to true. --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;fetchPersistentState&gt;</span>true<span class="jive-xml-tag">&lt;/fetchPersistentState&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- determines whether this cache loader ignores writes - defaults to false. --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;ignoreModifications&gt;</span>false<span class="jive-xml-tag">&lt;/ignoreModifications&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/cacheloader&gt;</span>
&#160;&#160; <span class="jive-xml-tag">&lt;/config&gt;</span>
<span class="jive-xml-tag">&lt;/attribute&gt;</span>




&#160;&#160;&#160;&#160;&#160; &lt;!-- Whether or not to fetch state on joining a cluster --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="FetchInMemoryState"&gt;</span>true<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!-- The max amount of time (in milliseconds) we wait until the
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; initial state (ie. the contents of the cache) are retrieved from
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; existing members in a clustered environment
&#160;&#160;&#160;&#160;&#160; --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="InitialStateRetrievalTimeout"&gt;</span>15000<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!-- Number of milliseconds to wait until all responses for a
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; synchronous call have been received.
&#160;&#160;&#160;&#160;&#160; --&gt;
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="SyncReplTimeout"&gt;</span>15000<span class="jive-xml-tag">&lt;/attribute&gt;</span>


&#160;&#160;&#160;&#160;&#160; &lt;!--&#160; Max number of milliseconds to wait for a lock acquisition --&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="LockAcquisitionTimeout"&gt;</span>10000<span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160;&#160; 
&#160;&#160; <span class="jive-xml-tag">&lt;/mbean&gt;</span>


<span class="jive-xml-tag">&lt;/server&gt;</span>

</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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>