Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

distributed caching with ehcache

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having a few question about configurating ehcache for distributed cache replication.

I'm currently configurating cache replication (ehcache 1.4.1) between two servers using manual peer discovery over RMI(see config below).

I'm a bit confused about the output of the log files from the two servers in the following scenario:


step1: ServerA: User adds and object to cache. ServerB writes the following output to its log
DEBUG [net.sf.ehcache.distribution.RMICachePeer] - Remote put received. Element is: [ key = 1234, value=net.xzy.AnonymousCookieEntry@83c3cbfe, version=1221936368875, hitCount=0, CreationTime = 1221936356123, LastAccessTime = 0 ]

step2: ServerA: User request the object from step1 which is now in the cache (performing an element.getValue()). ServerB writes the following output to its log
DEBUG [net.sf.ehcache.distribution.RMICachePeer] - Remote remove received for key: 1234

step3: ServerA: User request the same object from step1 and get it from cache. ServerB now output the following.
DEBUG [net.sf.ehcache.store.MemoryStore] - net.xzy.ANONYMOUS_USER_CACHECache: Cannot remove entry as key 1234 was not found


I don't understand why ServerB in step2 performs a "Remote remove received". Is this the reason it can't find the cache key in step3? My understanding is that both servers should keep the cache objects in sync.

ehcache.xml
<code>
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,rmiUrls=//${app.system.cache.peer}:40001/net.xzy.ANONYMOUS_USER_CACHE"/>

<cache name="net.xzy.ANONYMOUS_USER_CACHE"
maxElementsInMemory="10000" eternal="true" overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
>
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
replicateUpdatesViaCopy=false, replicateRemovals=true "/>
</cache>

<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40001,socketTimeoutMillis=2000"/>
</code>


Thanks
S
 
bacon. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic