jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spaggiari, Jean-Marc" <jmspaggi...@rgare.ca>
Subject RE: Is JCS slow ?
Date Tue, 20 Jan 2004 21:06:01 GMT
but DC is not used in my cache.cff file ... It's only here for remind, but I
have jxs.default= with nothing else ...

I'm applying the Aaron suggestion ... Wait a minute for the result ...

-----Original Message-----
From: James Taylor [mailto:james@jamestaylor.org]
Sent: Tuesday, January 20, 2004 4:02 PM
To: Turbine JCS Users List
Subject: Re: Is JCS slow ?


It looks like your memory caches are bounded at 1000 items (MaxObjects  
= 1000). Thus if you put 1600 items in the cache, and then look for any  
of the first 600 items, the cache will need to read them from disk,  
which takes time.

On Jan 20, 2004, at 3:14 PM, Spaggiari, Jean-Marc wrote:

> I am caching String (key) for Vector (value) ...
>
> But I found somethings. Y have a disk cache. By disable it, I can  
> improved
> my speed when cache is empty. But if I fill cache with 1600 items, it  
> take
> about 1 min for looking for 100 items inside :(
>
> Here is my cache.cff file, the code follow ...
>
> I'm trying with Hashtable, but I really don't like it :(
>
> # DEFAULT CACHE REGION
>
> jcs.default=
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribu 
> tes
> jcs.default.cacheattributes.MaxObjects=1000
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memor 
> y.lru
> .LRUMemoryCache
>
> # System CACHE REGION
> jcs.system.groupIdCache=
> jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.Composite 
> Cache
> Attributes
> jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
> jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs. 
> engin
> e.memory.lru.LRUMemoryCache
>
> # PRE-DEFINED CACHE REGIONS
>
> jcs.region.testCache1=
> jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCa 
> cheAt
> tributes
> jcs.region.testCache1.cacheattributes.MaxObjects=1000
> jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.en 
> gine.
> memory.lru.LRUMemoryCache
> jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
> jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
>
> jcs.region.HandlerDonnees=
> jcs.region.HandlerDonnees.cacheattributes=org.apache.jcs.engine.Composi 
> teCac
> heAttributes
> jcs.region.HandlerDonnees.cacheattributes.MaxObjects=1000
> jcs.region.HandlerDonnees.cacheattributes.MemoryCacheName=org.apache.jc 
> s.eng
> ine.memory.lru.LRUMemoryCache
> jcs.region.HandlerDonnees.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.region.HandlerDonnees.cacheattributes.ShrinkerIntervalSeconds=60
>
>
> # AVAILABLE AUXILIARY CACHES
> jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache 
> Facto
> ry
> jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Index 
> edDis
> kCacheAttributes
> jcs.auxiliary.DC.attributes.DiskPath=/tmp
>
>
>
> Initialisation in constructor ... (Handler is different than  
> HandlerDonnees)
>
>         private Handler()
>         {
>                 try
>                 {
>                         //cache = JCS.getInstance("Handler");
>                         hashCache = new Hashtable ();
>                 }
>                 catch (Exception e)
>                 {
>                         // Handle cache region initialization failure
>                         e.printStackTrace();
>                 }
>         }
>
>
> Reading the cache :
>
>  Vector enCache = new Vector ();
>  Vector aTraiter = new Vector ();
>  try
>  {
>          System.out.println (new Date ());
>          for (int indexMot = 0; indexMot < mots.size(); indexMot++)
>          {
>                  if (indexMot % 100 == 0)
>                          System.out.println (indexMot + " = " + new  
> Date
> ());
>                  String mot = (String) mots.elementAt(indexMot);
>                  Vector liste = (Vector) hashCache.get(mot + suffix);
>                  if (liste == null)
>                          aTraiter.addElement (mot);
>                  else
>                          enCache.addElement (mot);
>          }
>          System.out.println (new Date ());
>  }
>  catch (Exception e)
>  {
>          e.printStackTrace();
>  }
>
>
> Writing in cache :
>
>
>                    try
>                    {
>                            hashCache.put(motATraiter + suffix,
> result.elementAt(indexATraiter));
>                    }
>                    catch (Exception e)
>                    {
>                            e.printStackTrace();
>                    }
>
>
> -----Original Message-----
> From: Aaron Smuts [mailto:aasmuts@wisc.edu]
> Sent: Tuesday, January 20, 2004 3:07 PM
> To: 'Turbine JCS Users List'
> Subject: RE: Is JCS slow ?
>
>
> No, no one has ever asked if JCS is slow.  Something is definitely
> wrong.  The cache is not significantly slower than a hashtable.  Can  
> you
> give more details about your configuration (i.e. the cache.ccf file)  
> and
> what you are caching.
>
>> -----Original Message-----
>> From: Spaggiari, Jean-Marc [mailto:jmspaggiari@rgare.ca]
>> Sent: Tuesday, January 20, 2004 1:18 PM
>> To: 'turbine-jcs-user@jakarta.apache.org'
>> Subject: Is JCS slow ?
>>
>> Hi all.
>>
>> Sorry if it's a question that you have always see, but i'm not able to
>> look
>> at the archives ...
>>
>> I'm using JCS in an application where i need to look 1600 time on the
>> cache
>> in a loop.
>>
>> The cache is empty at this time.
>>
>> For loop take about 160 seconds.
>>
>> Using hashtable instead of JCS take about 1s ...
>>
>> Where is my mistake ? Because I think I have do a mistake. It's not
>> posible
>> that JCS was 160 time slower than a Hashable ...
>>
>> An running JCS in a servlet on JBoss. Is it posible it come from here
> ?
>>
>> Thanks for your help.
>>
>> JMS.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
> turbine-jcs-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
> turbine-jcs-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:  
> turbine-jcs-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:  
> turbine-jcs-user-help@jakarta.apache.org
>


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

---------------------------------------------------------------------
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