Hi ... i am trying to use JCS remote server configuration, My server and client are on different machines. I have started the server in tomcat. But the performance is really slow. For sending and receiving 150000 keys its taking almost 7 minutes.
At server side cache.ccf is
# Registry used to register and provide the IRmiCacheService service.registry.host=192.168.2.165registry.port=1101# call back port to local caches.remote.cache.service.port=1101# cluster settingremote.cluster.LocalClusterConsistency=true
# ############################################################## ################# DEFAULT CACHE REGION ###################### sets the default aux value for any non configured cachesjcs.default=jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributesjcs.default.cacheattributes.MaxObjects=200000jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCachejcs.default.cacheattributes.UseMemoryShrinker=truejcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600jcs.default.cacheattributes.ShrinkerIntervalSeconds=60jcs.default.cacheattributes.ShrinkerIntervalSeconds=60jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributesjcs.default.elementattributes.IsEternal=falsejcs.default.elementattributes.MaxLifeSeconds=7000jcs.default.elementattributes.IdleTime=1800jcs.default.elementattributes.IsSpool=truejcs.default.elementattributes.IsRemote=truejcs.default.elementattributes.IsLateral=true
# ############################################################## ################# CACHE REGIONS AVAILABLE #################### Regions preconfirgured for cachingjcs.region.testCache1=DCjcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributesjcs.region.testCache1.cacheattributes.MaxObjects=1000000jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCachejcs.region.testCache1.cacheattributes.UseMemoryShrinker=truejcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=30jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=300jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=100jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributesjcs.region.testCache1.elementattributes.IsEternal=falsejcs.region.testCache1.elementattributes.MaxLifeSeconds=60000jcs.region.testCache1.elementattributes.IsLateral=truejcs.region.testCache1.elementattributes.IsRemote=true
client side code is :
public void testSinglePut() throws Exception { // SETUP CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
RemoteCacheAttributes attributes = new RemoteCacheAttributes(); attributes.setRemoteHost( "192.168.4.138" ); attributes.setLocalPort( 1102 ); attributes.setRemotePort( 1101 );
RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager ); String regionName = "testCache1"; AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); System.out.println("these are stats"); if(server == null) System.out.println("null it is"); System.out.println("server.getClientHost()"+server.getRef()); // DO WORK int numPutsPrior = server.getPutCount(); System.out.println("numPutsPrior"+ numPutsPrior); ICacheElement elements[] = new ICacheElement[150000]; JCS.setConfigFilename("TestRemoteCacheClientServer.ccf"); JCS cache1 = JCS.getInstance("testCache1"); for(int i=0;i<150000;i++) { elements[i]= new CacheElement(regionName,i+"",i+""); } ICacheElement element = new CacheElement( regionName, "key", "value1" ); cache.update( element ); long startTime = System.currentTimeMillis(); for(int i=0;i<150000;i++) { //cache.update( elements[i] ); cache1.put(i+"",i+""); } long endTime = System.currentTimeMillis(); long totalTime = endTime - startTime; System.out.print("Time to load 1500000 (in ms) "); System.out.println(totalTime); SleepUtil.sleepAtLeast( 500 );
// VERIFY System.out.println(" server.getPutCount()"+server.getPutCount()); System.out.println(cache.get( "key" )); // assertEquals( "Wrong number of puts", 1, server.getPutCount() - numPutsPrior );
// DO WORK ICacheElement result = cache.get( "key" ); startTime = System.currentTimeMillis(); System.out.println("started fetching"); for(int i=0;i<150000;i++) { cache.get(i+"" ); } endTime = System.currentTimeMillis(); totalTime = endTime - startTime; System.out.print("Time to load 1500000 (in ms) "); System.out.println(totalTime); // VERIFY assertEquals( "Wrong element.", element.getVal(), result.getVal() ); }
--------------------------------------
I am not able to do bulk send and bulk get, is there any way ?
Is the architecture right or i should do it some other way ?? I dont want the client and server to use same JVM.