You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Hans Liebenberg <ha...@cambrient.com> on 2008/03/12 09:33:29 UTC

Memory Cache, with Disk Persistence for initialization

Hi,

I have been reading through the docs and trying out a few permutations 
of configurations but am still not 100% sure I have solved my needs.

My system has always used LRUMemoryCache only. Which is fast and works 
perfectly for me. The obvious disadvantage is the entire cache being 
destroyed across restarts.
I now have the following requirements:
I effectively want a pure master LRUMemoryCache, but with background 
disk caching for restart initialization, i.e all reads are done from 
LRUMemoryCache , but the LRUMemoryCache cache gets initialized from disk 
on a restart.

 From what I understand the Purgatory system is exactly what I need as 
reads will first check purgatory then disk.

Is it possible to never have to check disk, i.e if its not in ram then 
assume it doesn't exist, the only disk READ should be on initialization?

The reason I ask this is I have set up a load test that hits my system, 
and it seems that alot of reads from cache (disk) is dramatically slower 
then when I use a pure memory cache.
So to sum it up, I want a LRUMemoryCache  with the ability to write 
itself to disk in the background asynchronously so that it can be 
initialized to its previous state (or even part thereof) across restarts.

Thank you for your time




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


Re: Memory Cache, with Disk Persistence for initialization

Posted by Niall Gallagher <ni...@switchfire.com>.
Hi Hans,

I can't help re:disk cache as we don't use that. If you only have one
machine then the disk cache is probably the best option. If you have
more than one machine you could look into the remote cache option.

Basically we have similar requirements here - to maintain cache data
between restarts. We are not a big company, we have about 20 web/app
servers. We are using the remote cache option to maintain data between
restarts. The configuration works very well for us.

Basically under this configuration when the client server puts an object
into the cache, it goes into local RAM immediately. If the client tries
to retrieve the object again, it is returned immediately. Also in the
background, JCS sends that object to the remote cache.

If the client is restarted, it loses the objects it had in local RAM.
When it tries to retrieve the object for the first time again, JCS
fetches it from the remote cache which is fairly fast but slower than
retrieving from local RAM. When the client tries to retrieve the object
from the cache a second time however, it is returned immediately. So JCS
seems to cache objects retrieved from the remote cache in local RAM
also, therefore rebuilding the local RAM cache on a lazy-load basis
after restarts.

On Wed, 2008-03-12 at 10:33 +0200, Hans Liebenberg wrote:
> Hi,
> 
> I have been reading through the docs and trying out a few permutations 
> of configurations but am still not 100% sure I have solved my needs.
> 
> My system has always used LRUMemoryCache only. Which is fast and works 
> perfectly for me. The obvious disadvantage is the entire cache being 
> destroyed across restarts.
> I now have the following requirements:
> I effectively want a pure master LRUMemoryCache, but with background 
> disk caching for restart initialization, i.e all reads are done from 
> LRUMemoryCache , but the LRUMemoryCache cache gets initialized from disk 
> on a restart.
> 
>  From what I understand the Purgatory system is exactly what I need as 
> reads will first check purgatory then disk.
> 
> Is it possible to never have to check disk, i.e if its not in ram then 
> assume it doesn't exist, the only disk READ should be on initialization?
> 
> The reason I ask this is I have set up a load test that hits my system, 
> and it seems that alot of reads from cache (disk) is dramatically slower 
> then when I use a pure memory cache.
> So to sum it up, I want a LRUMemoryCache  with the ability to write 
> itself to disk in the background asynchronously so that it can be 
> initialized to its previous state (or even part thereof) across restarts.
> 
> Thank you for your time
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org



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


Re: Memory Cache, with Disk Persistence for initialization

Posted by Aaron Smuts <as...@yahoo.com>.
Purgatory is simply a buffer that discards the oldest
when it fills up.  It's a buffer in front of the disk
cache.  Items can be retrieved from purgatory until
they are written to disk.  Once written to disk, they
are removed from purgatory.  At that point, they must
be retrieved.

By default, items only go to disk on two occasions: 1)
on order shutdown, and 2) when the memory size limit
is reached.

You can also configure the cache to put items on disk
when they are added to the cache by setting the
diskUsagePattern to UPDATE.  Items will then put put
on disk when they are put into the cache.  You still
need a relatively orderly shutdown to get the keys on
disk.

You could also use a JDBC disk cache which doesn't
keep the keys in memory.  This provides more crash
safety.

Aaron


--- Hans Liebenberg <ha...@cambrient.com> wrote:

> Hi,
> 
> I have been reading through the docs and trying out
> a few permutations 
> of configurations but am still not 100% sure I have
> solved my needs.
> 
> My system has always used LRUMemoryCache only. Which
> is fast and works 
> perfectly for me. The obvious disadvantage is the
> entire cache being 
> destroyed across restarts.
> I now have the following requirements:
> I effectively want a pure master LRUMemoryCache, but
> with background 
> disk caching for restart initialization, i.e all
> reads are done from 
> LRUMemoryCache , but the LRUMemoryCache cache gets
> initialized from disk 
> on a restart.
> 
>  From what I understand the Purgatory system is
> exactly what I need as 
> reads will first check purgatory then disk.
> 
> Is it possible to never have to check disk, i.e if
> its not in ram then 
> assume it doesn't exist, the only disk READ should
> be on initialization?
> 
> The reason I ask this is I have set up a load test
> that hits my system, 
> and it seems that alot of reads from cache (disk) is
> dramatically slower 
> then when I use a pure memory cache.
> So to sum it up, I want a LRUMemoryCache  with the
> ability to write 
> itself to disk in the background asynchronously so
> that it can be 
> initialized to its previous state (or even part
> thereof) across restarts.
> 
> Thank you for your time
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jcs-users-help@jakarta.apache.org
> 
> 


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