[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
ehCache distribution of cached objects too slow in aSynch mode?  XML
Forum Index -> Ehcache
Author Message
jjbrunia

neo

Joined: 07/11/2011 10:16:41
Messages: 2
Offline

Hi,

We're doing a proof of concept with ehCache and ran into issues with
the distribution of cached objects. In asynchronous mode we are able
to beat the distribution speed with a 2nd request on another Node Y
requests the session object put in on Node X.

The only way we can have it fault free, that is requested objects are
always available, is operate the cache in synchronous mode.

I have a feeling that when a node gets busy lots of threads running
the ehcache send and receive threads might get pushed into a corner and
are not scheduled in time. In other words the real-time aspect deteriorates.

I was wondering if other people have see this before and also which parameters in the configuration file can positively influence the distribution speed, so that ehCache its distribution speed becomes more predictable.

Thanks!

Jan
steve

ophanim

Joined: 05/24/2006 14:22:53
Messages: 619
Offline

Async vs Sync are not the right knobs to determine when you see something on another node. What you may be seeing is a race condition in your test caused by not locking in the application thread.

If you want what you describe try using the explicit locking API. This allows you to be coherent into your application threads instead of just within the cache itself.

http://ehcache.org/documentation/explicitlocking.html

Hope this helps

Want to post to this forum? Join the Terracotta Community
jjbrunia

neo

Joined: 07/11/2011 10:16:41
Messages: 2
Offline

Hi Steve!

Thanks for your reply. Allow me to share with you the asynch and synch cache replication parameter explanation from the ehcache.xml config file {see at the end of this reply}

The parameter is replicateAsynchronously which is an insert and run {send and pray} kind of action resulting in the highest insertion speed where the data to be inserted is passed on to the cache and return before it has been replicated to all other nodes.

I see there is another parameter asynchronousReplicationIntervalMillis which minimum is 10ms which makes me think that maybe the bottem line in replication speed; 10ms.

Maybe I misunderstood your suggestion but it seemed it's only beneficial when reading on the same node as where you do the insert and that replicateAsynchronously influences when the put returns and consequently whether I will know for shure whether the object is replicated to other nodes. Would be great if you can elaborate a bit on it in case I misunderstood.

Thanks!

Jan


RMI Cache Replication
+++++++++++++++++++++

Each cache that will be distributed needs to set a cache event listener which replicates
messages to the other CacheManager peers. For the built-in RMI implementation this is done
by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
distributed cache's configuration as per the following example:

<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=false,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true
asynchronousReplicationIntervalMillis=<number of milliseconds"
propertySeparator="," />

The RMICacheReplicatorFactory recognises the following properties:

* replicatePuts=true|false - whether new elements placed in a cache are
replicated to others. Defaults to true.

* replicatePutsViaCopy=true|false - whether the new elements are
copied to other caches (true), or whether a remove message is sent. Defaults to true.

* replicateUpdates=true|false - whether new elements which override an
element already existing with the same key are replicated. Defaults to true.

* replicateRemovals=true - whether element removals are replicated. Defaults to true.

* replicateAsynchronously=true | false - whether replications are
asynchronous (true) or synchronous (false). Defaults to true.


* replicateUpdatesViaCopy=true | false - whether the new elements are
copied to other caches (true), or whether a remove message is sent. Defaults to true.

* asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
replicator runs at a set interval of milliseconds. The default is 1000. The minimum
is 10. This property is only applicable if replicateAsynchronously=true


 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team