You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Murali Thirugnanam (Jira)" <ji...@apache.org> on 2023/10/11 12:51:00 UTC

[jira] [Commented] (JCS-238) Every update to JCS Remote Cache update takes nearly ~2 seconds

    [ https://issues.apache.org/jira/browse/JCS-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774049#comment-17774049 ] 

Murali Thirugnanam commented on JCS-238:
----------------------------------------

Both client and the server are in the same machine. Our applications are deployed in JBoss and want to share the data between the applications (.war). Hence, remote cache server with JCS is deployed as a war and common for all the other applications.  
 
Please find the below code which is used to update the Remote Cache Server and get the values from it.
Also, ccf files used was already here, kindly refer the same.
 
Here, after update the cache value is not available immediately upon get call. It requires atleast 2 seconds delay, hence added Thread.sleep(2000).
We want to avoid this additional delay in the application due to cache update requirement, kindly review and help to overcome this delay.
 
 
{code:java}
final ICompositeCacheManager cacheMgr = CompositeCacheManager.getInstance(); 
final RemoteCacheAttributes rca = new RemoteCacheAttributes(); 
final RemoteCacheFactory factory = new RemoteCacheFactory(); 
rca.setRemoteLocation("localhost", 1101);     
rca.setCacheName("testCache");     
factory.initialize();     
final RemoteCacheManager remoteCacheMgr = factory.getManager(rca , cacheMgr , new CacheEventLoggerDebugLogger(), new StandardSerializer());     
AuxiliaryCache<CacheKey, CacheValue> testCache = remoteCacheMgr.getCache(rca);   

// Update cache     
CacheElement<CacheKey, CacheValue> cacheElement = new CacheElement<CacheKey, CacheValue>("testCache", key, value);     
testCache.update( cacheElement ); 
Thread.sleep(2000);   

// Get cache value  
CacheValue cacheValue = (testCache.get(key) != null) ? testCache.get(key).getVal() : null;  {code}
Also, noticed in all the test classes of JCS, wherever cache.update(element) is used, there is a delay added using "SleepUtil.sleepAtLeast(2000)". Please confirm if the delay should be added after cache update and is expected for JCS Remote Cache Server.

> Every update to JCS Remote Cache update takes nearly ~2 seconds
> ---------------------------------------------------------------
>
>                 Key: JCS-238
>                 URL: https://issues.apache.org/jira/browse/JCS-238
>             Project: Commons JCS
>          Issue Type: Bug
>          Components: RMI Remote Cache
>    Affects Versions: jcs-3.1
>            Reporter: Murali Thirugnanam
>            Priority: Major
>             Fix For: jcs-3.1
>
>         Attachments: cache-client.ccf, cache-server.ccf
>
>
> We are using JCS Remote Cache to have cache available for all the applications, but the every update to the remote cache takes approximately 2 seconds.
> Attaching the client and server cache.ccf files for your reference. Please suggest if anything in the configuration to avoid this issue.
> Kindly help to avoid this delay required to update the cache. 
> [^cache-client.ccf]
> [^cache-server.ccf]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)