> suppose again, that C1 and C2 have a certain object, O1. 
> suppose that C3
> asks for another object, O2. to load O2, the cache server CS 
> runs out of
> space and has to remove O1 from its cache. what happens now? 
> will C1 and C2 still hold O1? 

Yes they will.

> or will they get an invalidate message about it? 

No as it is not necessary.

>what if they change O1? can the cache server send an invalidate message
> around for an object it does not hold? 

Yes, once C1 or C2 changes O1, or if C3 loads O1 from the original data
source, the client cache will send the changed/new copy of O1 to RCS, which
in turn will propagate an invalidation message to all other cache clients.
Hence all other clients will retrieve the latest copy from RCS upon future
requests of O1.

>in short: does the chache server
> has to have as much cache space as all the cache clients combined?

It would improve performance if the RCS has more cache space than the
clients, and ideally has as much cache space as all clients linearly
combined.  In practice, however, the RCS must avoid the problem of throwing
an OutOfMemoryException.

One solution to the OutOfMemoryException problem is to implement some form
of SoftReference memory cache, or some form of hybrid cache that supports
both "hard" and "soft" cache items.  The soft caches therefore will adjust
according to the need of the garbage collector (GC).  In the case of 100%
SoftReference based RCS, the JVM will never run out of memory (assuming the
GC works.)

Hanson





Reply via email to