jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerome.pic...@mpsa.com
Subject Problem with the Lateral Cache.
Date Fri, 25 Jun 2004 12:38:57 GMT




Hello,

I use "Lateral Cache" for test.

In another mail, you have explain me the functionality of the "Lateral"
Cache. I thank you.

This is your text :

"Lateral cache treats all caches as peers. When a cache gets a cache miss,
it
asks all the other caches if they have the object in question. If one of
them responds, the object is returned as a cache hit, but IS NOT stored
locally. This topology is useful when you have caches which for the most
part maintain separate and unique indexes, but occasionally overlap. Also
note that a local put does NOT result in a broadcast put to other laterals,
but a remove WILL."

But when I execute a test, I obtain another behaviour.

I have two class "A" and "B".

class "A" has a local cache "A".
class "B" has a local cache "B".

First test :

I launch in first the class "B", this class want to retrieve many object
"User" in her local cache.

I launch in second time the class "A", this class put in her local cache
many object "User".

At this moment, the class "B" retrieve and display all object "User". It's
work.

I stop the class "A" and her local cache.
I am surprised , the class "B" always display object "User".
However you said that : "If one of
them responds, the object is returned as a cache hit, but IS NOT stored
locally."

Second test :

I launch in first the class "A" which put in her local cache many object
"User".

I launch in second time the class "B" which try to retrieve all object
"User".

In this test, the class "B" always display NULL object.

For this case you sai that : "When a cache gets a cache miss, it
asks all the other caches if they have the object in question."

In my test, it is not working.

Is this a probleme of configuration ?

Have you an idea ?

Thanks for your answers.

Regards,


I join the cache file and code for the class "A" and "B".


###
### Cache A
###
# JCS Config for unit testing, just a simple memory only cache

jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.IsLateral=false

# SYSTEM GROUP ID CACHE
jcs.system.groupIdCache=
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache


jcs.region.TEST=LTCP
jcs.region.TEST.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.TEST.cacheattributes.MaxObjects=1000
jcs.region.TEST.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.TEST.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.TEST.elementattributes.IsRemote=false
jcs.region.TEST.elementattributes.IsEternal=false
jcs.region.TEST.elementattributes.IsLateral=true


# simple Lateral TCP auxiliary
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1110
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false


###
### Cache B
###
# JCS Config for unit testing, just a simple memory only cache

jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.IsLateral=false

# SYSTEM GROUP ID CACHE
jcs.system.groupIdCache=
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache


jcs.region.TEST=LTCP
jcs.region.TEST.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.TEST.cacheattributes.MaxObjects=1000
jcs.region.TEST.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.TEST.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.TEST.elementattributes.IsRemote=false
jcs.region.TEST.elementattributes.IsEternal=false
jcs.region.TEST.elementattributes.IsLateral=true


# simple Lateral TCP auxiliary
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false

#
# code of class A
#
      try{
                  JCS.setConfigFilename("/cacheA.ccf");

                  JCS cache = JCS.getInstance("TEST");


                        for(int i=0;i<500;i++){
                              User usr = new User(new Long(i));
                                    usr.setName("USER_" + i);

                              cache.put("USER_" + i ,usr);
                        }


                        System.out.println("end...");


                  while(true){
                        // Nothing
                  }


            }catch(CacheException cexp){
                  cexp.printStackTrace();
            }

#
# code of class B
#

            try{
                  JCS.setConfigFilename("/cacheB.ccf");

                  JCS cache = JCS.getInstance("TEST");

                  while(true){

                        for(int i=0;i<500;i++){
                              User usr = (User)cache.get("USER_" + i);

                              if(usr!=null)
                                    System.out.println("User N° " + i + "
:" + usr.getName());

                        }


                  }

            }catch(CacheException cexp){
                  cexp.printStackTrace();
            }


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-user-help@jakarta.apache.org


Mime
View raw message