I’m using Hibernate 5.1.0.Final with the accompanying ehcache module. I have two independent app servers (JBoss 7.1.3.AS.Final) — they are not clustered. I wanted to set up cache replication between the servers. I have the following ehcache.xml configuration …
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<!-- This is a default configuration for 256Mb of cached data using the JVM's heap, but it must be adjusted
according to specific requirement and heap sizes -->
<defaultCache maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="false"
memoryStoreEvictionPolicy="LRU">
</defaultCache>
<cache name="main" maxElementsInMemory="10000" />
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=32"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40001,
socketTimeoutMillis=2000"/>
</ehcache>
I noticed when I restarted one of the servers, 15 minutes later, it had a dramatically smaller cache size than the first app server, indicating to me my replication was not working, despite the fact I don’t see any errors in the logs.
What’s wrong with my configuration above, or barring that, how do I determine if there is a network issue? I want to have the same ehcache.xml configuration file for each server if that’s possible (allows us to deploy the same WAR to every machine in the environment).