I'm using JCS 1.2.7.9 to accomplish something similar (I believe).  Try
configuring the cache region (memory) with:
jcs.default.cacheattributes.DiskUsagePatternName=UPDATE

This will force the write out to disk when putting items in the cache,
instead of waiting for a shutdown.  In order to get the keys written out as
well I shutdown the cache.  I've had some trouble getting it to shutdown
gracefully if it needs to do a lot of cleanup (large disk optimizations or
serialization from the memory cache); by using the UPDATE option to write to
disk during puts this keeps the shutdown quick and tidy.

There's probably an api which you could call in code to write out keys as
well without shutting down, but I haven't tried it.  Once the keys are
written out you can just copy the .key and .data files to any number of
target machines.

Best of luck,

Dennis

-----Original Message-----
From: vinay b 
Sent: Sunday, July 20, 2008 10:15 PM
To: jcs-users@jakarta.apache.org
Subject: Re: what happened to my cache keys


Well, later on Friday, I fixed the cache keys not being inserted using the
following config (mainly settling the MaxObjects = -1 ) . I still have a few
issues but let me start by explaining what I'm attempting to achieve.

1.  Create a persistant object store on DISK that can be  created once and
deployed on various machines, .. a database, essentially . The intent is to
provide a data mapping that can be readily be used by multiple applications
and has good read performance speed. That is why I'm trying to get
everything on disk.

2. During application usage, we expect to maintain a reasonable balance
between in-memory entries and in-disk entries.

3. we expect a fairly large number of entries (about 500,000 objects)
Now for my issues.
1. How does one force everything to disk gracefully. I tried using the
dispose method at the end of my insertion routing (see program) and it works
okay for smaller sizes but when we get to larger entries, ..it sometimes
fails to write and / or sets the index key file to  size 0, ..corrupting the
entire disk cache.

2. How can I get these many entries to disk. Smaller numbers are fine but
once I get above 300K - 400K, I can sometimes get "out of memory .. heap
exceptions" . I can tune this out to an extent by introducing a periodic
sleep() (currently 10 seconds every 10000 inserts), or possibly increasing
the heap size, but wanted to know if there were better methods.


Thanks,
Vin


2. I can now

# DEFAULT CACHE REGION

#jcs.default=DC,LTCP
jcs.default=DC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=-1
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru
.LRUMemoryCache

# PRE-DEFINED CACHE REGIONS


jcs.region.testCache1=DC
jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAt
tributes
jcs.region.testCache1.cacheattributes.MaxObjects=-1
jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.
memory.lru.LRUMemoryCache
jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=5
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttribu
tes
jcs.region.testCache1.elementattributes.IsEternal=true
jcs.region.testCache1.atttributes.maxKeySize=1000000

# AVAILABLE AUXILIARY CACHES
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFacto
ry
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDis
kCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=c:/tmp
jcs.auxiliary.DC.attributes.maxKeySize=1000000
jcs.auxiliary.DC.attributes.MaxPurgatorySize=-1

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to