jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <asm...@yahoo.com>
Subject Re: Disk Cache and MemoryShrinker
Date Tue, 25 Apr 2006 00:53:34 GMT
The memory shrinker does 2 things.  

(1) It removes items that have exceeded their max
life.  That is, it removes them altogether.  It
doesn't put them on disk; it simply gets rid of them. 
If you don't run the memory shrinker these items can
hang around in memory, but they will not be returned
by the jcs.get call.  Each time you get an item from
the cache, JCS checks to see if it has expired.  If it
has expired, it will not be returned.  

(2) The memory shrinker moves items from memory to
disk if the items have exceeded their max memory time.
 In you cache.ccf file this is set on the line that
looks like this:
jcs.region.listDS.cacheattributes.MaxMemoryIdleTimeSeconds=5
You have it set to a mere 5 seconds.  This is why the
items are being put to disk so quickly.  Remember that
items are also put to disk when the max memory size. 
If you are using the LRU memory cache, which is the
defualt, the lest recently used item will be spooled
to disk when an item is put into memory.  Items are
put into memory in three ways: (a) An item goes into
memory if you call put( key, value ). (b) Items are
put into memory if they are retrieved from disk.  (c)
If an item is put into the cache from a lateral or
remote auxiliary, it will be added to memory.  

I hope this helps.

Cheers,

Aaron

--- Eddie Liu <eidde.com@gmail.com> wrote:

> I might not understand enough, but when I enabled
> MemoryShrinker, in the log
> when it says:
> 
> [4/24/06 17:17:16:688 EDT] 00000036 CacheEventQue I 
>  Cache event queue
> created: CacheEventQueue [listenerId=-842985658,
> cacheName=enforce2ListDS]
> [4/24/06 17:17:26:703 EDT] 00000041 CacheEventQue I 
>  QProcessor exiting for
> CacheEventQueue [listenerId=-842985658,
> cacheName=enforce2ListDS]
> 
> From my observation, that was when it wrote to disk
> cache?  Right after I
> saw that, I made another request for the same cached
> data, but this time it
> returned null on the jcs.get(id) call.
> 
> Why it didn't load it from disk?  I timed it and
> made sure I made the new
> request after it wrote to disk but BEFORE it exceed
> the maxLifeSeconds.  But
> it behaved as if it has already expired.  Is there
> anything else I need to
> do to get the data from disk-cache?
> 
> Thanks alot!
> 
> Eddie
> 
> Configuration as follow:
>
-----------------------------------------------------------------------------
> jcs.region.listDS=DC
>
jcs.region.listDS.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.region.listDS.cacheattributes.MaxObjects=1200
>
jcs.region.listDS.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> jcs.region.listDS.elementattributes.IsEternal=false
>
jcs.region.listDS.elementattributes.MaxLifeSeconds=30
> jcs.region.listDS.elementattributes.IdleTime=1800
> jcs.region.listDS.elementattributes.IsSpool=true
> jcs.region.listDS.elementattributes.IsRemote=true
> jcs.region.listDS.elementattributes.IsLateral=true
>
jcs.region.listDS.cacheattributes.UseMemoryShrinker=true
>
jcs.region.listDS.cacheattributes.MaxMemoryIdleTimeSeconds=5
>
jcs.region.listDS.cacheattributes.ShrinkerIntervalSeconds=5
> jcs.region.listDS.cacheattributes.MaxSpoolPerRun=500
>
-----------------------------------------------------------------------------
> 


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


Mime
View raw message