| net.sf.ehcache.AbstractCacheTest net.sf.ehcache.distribution.RMICacheReplicatorTest
RMICacheReplicatorTest | public class RMICacheReplicatorTest extends AbstractCacheTest (Code) | | Tests replication of Cache events
Note these tests need a live network interface running in multicast mode to work
If running involving RMIAsynchronousCacheReplicator individually the test will fail because
the VM will gobble up the SoftReferences rather than allocating more memory. Uncomment the
forceVMGrowth() method usage in setup.
author: Greg Luck version: $Id: RMICacheReplicatorTest.java 575 2008-01-30 07:22:04Z gregluck $ |
Inner Class :class ClusterExecutable implements Executable | |
Method Summary | |
protected int | getNumberOfReplicatingCachesInCacheManager() The number of caches there should be. | public static void | main(String[] args) | public void | manualStabilityTest() Enables long stabilty runs using replication to be done. | public void | putTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | public void | putTestWithThreadKiller(Ehcache fromCache, Ehcache toCache, boolean asynchronous) Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | public void | removeAllTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) Tests removeAll initiated from a cache to another cache in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | public void | removeTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) Tests put and remove initiated from a cache to another cache in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | protected void | setUp() Sets up two caches: cache1 is local. | protected void | tearDown() | public void | testBigPutsProgagatesAsynchronous() Performance and capacity tests.
The numbers given are for the remote peer tester (java -jar ehcache-1.x-remote-debugger.jar ehcache-distributed1.xml)
running on a 10Mbit ethernet network and are measured from the time the peer starts receiving to when
it has fully received.
r37 and earlier - initial implementation
38 seconds to get all notifications with 6 peers, 2000 Elements and 400 byte payload
18 seconds to get all notifications with 2 peers, 2000 Elements and 400 byte payload
40 seconds to get all notifications with 2 peers, 2000 Elements and 10k payload
22 seconds to get all notifications with 2 peers, 2000 Elements and 1k payload
26 seconds to get all notifications with 2 peers, 200 Elements and 100k payload
r38 - RMI stub lookup on registration rather than at each lookup. | public void | testBigPutsProgagatesSynchronous() Performance and capacity tests. | public void | testBigRemovesProgagatesAsynchronous() Performance and capacity tests. | public void | testBootstrap() Performance and capacity tests. | public void | testCacheOperationsAynchronousMultiThreaded() Distributed operations create extra scope for deadlock.
This test checks whether a distributed deadlock scenario exists for asynchronous replication
of each distributed operation all at once.
It shows that no distributed deadlock exists for asynchronous replication. | public void | testCacheOperationsSynchronousMultiThreaded() Distributed operations create extra scope for deadlock.
This test checks whether a distributed deadlock scenario exists for synchronous replication
of each distributed operation all at once.
It shows that no distributed deadlock exists for asynchronous replication. | public void | testInfiniteNotificationsLoop() | public void | testPutProgagatesFromAndToEveryCacheManagerAndCache() Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | public void | testPutProgagatesFromAndToEveryCacheManagerAndCacheDirty() Tests what happens when a CacheManager in the cluster comes and goes. | public void | testPutWithEmptyReplicationPropertiesConfig() Test put replicated for cache4 - no properties. | public void | testPutWithExplicitReplicationConfig() | public void | testPutWithExplicitReplicationSynchronousConfig() | public void | testPutWithNewCacheAddedProgressively() manager1 adds a replicating cache, then manager2 and so on. | public void | testPutWithOneMissingReplicationPropertyConfig() Test put replicated for cache4 - missing replicatePuts property. | public void | testPutWithThreadKiller() | public void | testRemoteCachePeersDetectsDownCacheManager() | public void | testRemoteCachePeersDetectsDownCacheManagerSlow() | public void | testRemoteCachePeersDetectsNewCacheManager() | public void | testRemoteCachePeersEqualsNumberOfCacheManagersInCluster() | public void | testRemotePutNotificationGetsToOtherListeners() Checks that a put received from a remote cache notifies any registered listeners. | public void | testRemotelyReceivedPutNotifiesCountingListener() CacheEventListeners that are not CacheReplicators should receive cache events originated from receipt
of a remote event by a CachePeer. | public void | testRemoveAllAsynchronous() | public void | testRemoveAllSynchronous() | public void | testRemoveWithEmptyReplicationPropertiesConfig() Test put replicated for cache4 - no properties. | public void | testRemoveWithExplicitReplicationConfig() | public void | testRemoveWithExplicitReplicationSynchronousConfig() | public void | testReplicatePerf() Shows result of perf problem and fix in flushReplicationQueue
Behaviour before change:
INFO: Items written: 10381
Oct 29, 2007 11:40:04 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 29712
Oct 29, 2007 11:40:57 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 1
Oct 29, 2007 11:40:58 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 32354
Oct 29, 2007 11:42:34 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 322
Oct 29, 2007 11:42:35 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 41909
Behaviour after change:
INFO: Items written: 26356
Oct 29, 2007 11:44:39 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 33656
Oct 29, 2007 11:44:40 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 32234
Oct 29, 2007 11:44:42 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 38677
Oct 29, 2007 11:44:43 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 43418
Oct 29, 2007 11:44:44 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 31277
Oct 29, 2007 11:44:45 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 27769
Oct 29, 2007 11:44:46 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 29596
Oct 29, 2007 11:44:47 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 17142
Oct 29, 2007 11:44:48 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 14775
Oct 29, 2007 11:44:49 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 4088
Oct 29, 2007 11:44:51 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 5492
Oct 29, 2007 11:44:52 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 10188
Also no pauses noted. | public void | testUpdateViaInvalidate() Tests put and update through invalidation initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | public void | testUpdateWithEmptyReplicationPropertiesConfig() Test put replicated for cache4 - no properties. | public void | testUpdateWithExplicitReplicationConfig() | public void | testUpdateWithExplicitReplicationSynchronousConfig() | public void | updateViaCopyTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) Tests put and update through copy initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken. | protected void | waitForProgagate() | protected void | waitForSlowProgagate() | public void | xTestHugePutsBreaksAsynchronous() Drive everything to point of breakage within a 64MB VM. |
ASYNCHRONOUS | final protected static boolean ASYNCHRONOUS(Code) | | A value to represent replicate asynchronously
|
SYNCHRONOUS | final protected static boolean SYNCHRONOUS(Code) | | A value to represent replicate synchronously
|
cache1 | protected Ehcache cache1(Code) | | CacheManager 1 of 2s cache being replicated
|
cache2 | protected Ehcache cache2(Code) | | CacheManager 2 of 2s cache being replicated
|
cacheName | protected String cacheName(Code) | | The name of the cache under test
|
cacheNameBase | protected String cacheNameBase(Code) | | Allows setup to be the same
|
getNumberOfReplicatingCachesInCacheManager | protected int getNumberOfReplicatingCachesInCacheManager()(Code) | | The number of caches there should be.
|
manualStabilityTest | public void manualStabilityTest() throws InterruptedException(Code) | | Enables long stabilty runs using replication to be done.
This test has been run in a profile for 15 hours without any observed issues.
throws: InterruptedException - |
putTest | public void putTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) throws CacheException, InterruptedException(Code) | | Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
putTestWithThreadKiller | public void putTestWithThreadKiller(Ehcache fromCache, Ehcache toCache, boolean asynchronous) throws CacheException, InterruptedException(Code) | | Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
removeAllTest | public void removeAllTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) throws Exception(Code) | | Tests removeAll initiated from a cache to another cache in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
removeTest | public void removeTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) throws CacheException, InterruptedException(Code) | | Tests put and remove initiated from a cache to another cache in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
setUp | protected void setUp() throws Exception(Code) | | Sets up two caches: cache1 is local. cache2 is to be receive updates
throws: Exception - |
testBigPutsProgagatesAsynchronous | public void testBigPutsProgagatesAsynchronous() throws CacheException, InterruptedException(Code) | | Performance and capacity tests.
The numbers given are for the remote peer tester (java -jar ehcache-1.x-remote-debugger.jar ehcache-distributed1.xml)
running on a 10Mbit ethernet network and are measured from the time the peer starts receiving to when
it has fully received.
r37 and earlier - initial implementation
38 seconds to get all notifications with 6 peers, 2000 Elements and 400 byte payload
18 seconds to get all notifications with 2 peers, 2000 Elements and 400 byte payload
40 seconds to get all notifications with 2 peers, 2000 Elements and 10k payload
22 seconds to get all notifications with 2 peers, 2000 Elements and 1k payload
26 seconds to get all notifications with 2 peers, 200 Elements and 100k payload
r38 - RMI stub lookup on registration rather than at each lookup. Saves quite a few lookups. Also change to 5 second heartbeat
38 seconds to get 2000 notifications with 6 peers, Elements with 400 byte payload (1 second heartbeat)
16 seconds to get 2000 notifications with 6 peers, Elements with 400 byte payload (5 second heartbeat)
13 seconds to get 2000 notifications with 2 peers, Elements with 400 byte payload
r39 - Batching asyn replicator. Send all queued messages in one RMI call once per second.
2 seconds to get 2000 notifications with 6 peers, Elements with 400 byte payload (5 second heartbeat)
|
testBigPutsProgagatesSynchronous | public void testBigPutsProgagatesSynchronous() throws CacheException, InterruptedException(Code) | | Performance and capacity tests.
5 seconds to send all notifications synchronously with 5 peers, 2000 Elements and 400 byte payload
The numbers given below are for the remote peer tester (java -jar ehcache-1.x-remote-debugger.jar ehcache-distributed1.xml)
running on a 10Mbit ethernet network and are measured from the time the peer starts receiving to when
it has fully received.
|
testBigRemovesProgagatesAsynchronous | public void testBigRemovesProgagatesAsynchronous() throws CacheException, InterruptedException(Code) | | Performance and capacity tests.
The numbers given are for the remote peer tester (java -jar ehcache-1.x-remote-debugger.jar ehcache-distributed1.xml)
running on a 10Mbit ethernet network and are measured from the time the peer starts receiving to when
it has fully received.
4 seconds to get all remove notifications with 6 peers, 5000 Elements and 400 byte payload
|
testCacheOperationsAynchronousMultiThreaded | public void testCacheOperationsAynchronousMultiThreaded() throws Exception, InterruptedException(Code) | | Distributed operations create extra scope for deadlock.
This test checks whether a distributed deadlock scenario exists for asynchronous replication
of each distributed operation all at once.
It shows that no distributed deadlock exists for asynchronous replication. It is multi thread
and multi process safe.
It uses sampleCache2, which is configured to be asynchronous
Carefully tailored to exercise:
- overflow to disk. We put in 20 things and the memory size is 10
- each peer is working on the same set of keys thus maximising contention
- we do puts, gets and removes to explore all the execution paths
|
testCacheOperationsSynchronousMultiThreaded | public void testCacheOperationsSynchronousMultiThreaded() throws Exception, InterruptedException(Code) | | Distributed operations create extra scope for deadlock.
This test checks whether a distributed deadlock scenario exists for synchronous replication
of each distributed operation all at once.
It shows that no distributed deadlock exists for asynchronous replication. It is multi thread
and multi process safe.
Carefully tailored to exercise:
- overflow to disk. We put in 20 things and the memory size is 10
- each peer is working on the same set of keys thus maximising contention
- we do puts, gets and removes to explore all the execution paths
If a deadlock occurs, processing will stop until a SocketTimeout exception is thrown and
the deadlock will be released.
|
testInfiniteNotificationsLoop | public void testInfiniteNotificationsLoop() throws InterruptedException(Code) | | What happens when two cache instances replicate to each other and a change is initiated
|
testPutProgagatesFromAndToEveryCacheManagerAndCache | public void testPutProgagatesFromAndToEveryCacheManagerAndCache() throws CacheException, InterruptedException(Code) | | Tests put and remove initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
testPutProgagatesFromAndToEveryCacheManagerAndCacheDirty | public void testPutProgagatesFromAndToEveryCacheManagerAndCacheDirty() throws CacheException, InterruptedException(Code) | | Tests what happens when a CacheManager in the cluster comes and goes. In ehcache-1.2.4 this would cause the new RMI CachePeers in the CacheManager to
be permanently corrupt.
|
testPutWithEmptyReplicationPropertiesConfig | public void testPutWithEmptyReplicationPropertiesConfig() throws InterruptedException(Code) | | Test put replicated for cache4 - no properties.
Defaults should be replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true
|
testPutWithExplicitReplicationConfig | public void testPutWithExplicitReplicationConfig() throws InterruptedException(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testPutWithExplicitReplicationSynchronousConfig | public void testPutWithExplicitReplicationSynchronousConfig() throws InterruptedException(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=false, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testPutWithNewCacheAddedProgressively | public void testPutWithNewCacheAddedProgressively() throws InterruptedException(Code) | | manager1 adds a replicating cache, then manager2 and so on. Then we remove one. Does everything work as expected?
|
testPutWithOneMissingReplicationPropertyConfig | public void testPutWithOneMissingReplicationPropertyConfig() throws InterruptedException(Code) | | Test put replicated for cache4 - missing replicatePuts property.
replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true
should equal replicateAsynchronously=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true
|
testPutWithThreadKiller | public void testPutWithThreadKiller() throws InterruptedException(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testRemoteCachePeersDetectsDownCacheManager | public void testRemoteCachePeersDetectsDownCacheManager() throws InterruptedException(Code) | | Does a down cache manager in the cluster get removed?
|
testRemoteCachePeersDetectsDownCacheManagerSlow | public void testRemoteCachePeersDetectsDownCacheManagerSlow() throws InterruptedException(Code) | | Does a down cache manager in the cluster get removed?
|
testRemoteCachePeersDetectsNewCacheManager | public void testRemoteCachePeersDetectsNewCacheManager() throws InterruptedException(Code) | | Does a new cache manager in the cluster get detected?
|
testRemoteCachePeersEqualsNumberOfCacheManagersInCluster | public void testRemoteCachePeersEqualsNumberOfCacheManagersInCluster()(Code) | | 5 cache managers should means that each cache has four remote peers
|
testRemotePutNotificationGetsToOtherListeners | public void testRemotePutNotificationGetsToOtherListeners() throws CacheException, InterruptedException(Code) | | Checks that a put received from a remote cache notifies any registered listeners.
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
testRemotelyReceivedPutNotifiesCountingListener | public void testRemotelyReceivedPutNotifiesCountingListener() throws InterruptedException(Code) | | CacheEventListeners that are not CacheReplicators should receive cache events originated from receipt
of a remote event by a CachePeer.
|
testRemoveAllAsynchronous | public void testRemoveAllAsynchronous() throws Exception(Code) | | test removeAll sync
|
testRemoveAllSynchronous | public void testRemoveAllSynchronous() throws Exception(Code) | | test removeAll async
|
testRemoveWithEmptyReplicationPropertiesConfig | public void testRemoveWithEmptyReplicationPropertiesConfig() throws InterruptedException(Code) | | Test put replicated for cache4 - no properties.
Defaults should be replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true
|
testRemoveWithExplicitReplicationConfig | public void testRemoveWithExplicitReplicationConfig() throws InterruptedException(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testRemoveWithExplicitReplicationSynchronousConfig | public void testRemoveWithExplicitReplicationSynchronousConfig() throws InterruptedException(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testReplicatePerf | public void testReplicatePerf() throws InterruptedException(Code) | | Shows result of perf problem and fix in flushReplicationQueue
Behaviour before change:
INFO: Items written: 10381
Oct 29, 2007 11:40:04 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 29712
Oct 29, 2007 11:40:57 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 1
Oct 29, 2007 11:40:58 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 32354
Oct 29, 2007 11:42:34 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 322
Oct 29, 2007 11:42:35 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 41909
Behaviour after change:
INFO: Items written: 26356
Oct 29, 2007 11:44:39 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 33656
Oct 29, 2007 11:44:40 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 32234
Oct 29, 2007 11:44:42 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 38677
Oct 29, 2007 11:44:43 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 43418
Oct 29, 2007 11:44:44 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 31277
Oct 29, 2007 11:44:45 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 27769
Oct 29, 2007 11:44:46 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 29596
Oct 29, 2007 11:44:47 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 17142
Oct 29, 2007 11:44:48 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 14775
Oct 29, 2007 11:44:49 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 4088
Oct 29, 2007 11:44:51 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 5492
Oct 29, 2007 11:44:52 AM net.sf.ehcache.distribution.RMICacheReplicatorTest testReplicatePerf
INFO: Items written: 10188
Also no pauses noted.
|
testUpdateViaInvalidate | public void testUpdateViaInvalidate() throws CacheException, InterruptedException, IOException(Code) | | Tests put and update through invalidation initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
testUpdateWithEmptyReplicationPropertiesConfig | public void testUpdateWithEmptyReplicationPropertiesConfig() throws Exception(Code) | | Test put replicated for cache4 - no properties.
Defaults should be replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true
|
testUpdateWithExplicitReplicationConfig | public void testUpdateWithExplicitReplicationConfig() throws Exception(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
testUpdateWithExplicitReplicationSynchronousConfig | public void testUpdateWithExplicitReplicationSynchronousConfig() throws Exception(Code) | | Test various cache configurations for cache1 - explicit setting of:
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true "/>
|
updateViaCopyTest | public void updateViaCopyTest(Ehcache fromCache, Ehcache toCache, boolean asynchronous) throws Exception(Code) | | Tests put and update through copy initiated from cache1 in a cluster
This test goes into an infinite loop if the chain of notifications is not somehow broken.
|
|
|