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 Jan Swaelens <ja...@sofico.be> on 2009/03/13 11:42:45 UTC

Relation between client and remote server cache regions

I understand that the client cache needs to configure its cache regions 
and auxiliaries (incl the RemoteCacheFactory) to establish the client 
cache configuration.
I also understand that the remote server needs to be configured with the 
registry(host, port, behavior) information to establish the server.
What I don't quite get is how to configure the cache regions of the cache 
server.
> Configuring regions on the cache server is obviously required (I get 
errors when I don't)
> When I configure a region called X with let's say a disk auxiliary => I 
still see the regions A and B as defined by the cache clients when I 
access the JCSAdmin page, nothing to be seen of the region X
I wonder how I should configure the regions of my cache server and how 
these client and server regions work together.

Thanks for helping me understand this puzzle!

Re: Relation between client and remote server cache regions

Posted by Jan Swaelens <ja...@sofico.be>.
Hello Niall,

We are also deploying the JCS war on an application server (WebLogic, 
WebSphere ...) which seems to be the most 'robust' approach to running a 
cache server.
I also found that the properties file must be called 'cache.ccf' if you 
use this approach. If you use the startup scripts to run the server 
outside of a servlet container the file must be called 'remote.cache.ccf'.

Thanks for your information about the automatic configuration of the 
server cache region upon a client's store, that response was what I was 
looking for!

Thanks!

Re: Relation between client and remote server cache regions

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

You can configure regions on the remote server much like you configure
regions on client machines.

We've found the easiest way to deploy JCS as a remote cache server is to
package JCS as a web application as described on the JCS site:
http://jakarta.apache.org/jcs/RemoteAuxCache.html We then deployed JCS
to JBoss as a regular web application and it works fine.

Anyway-  you'll need to include a cache.ccf file in the remote cache
server .war file you made, or make sure it's on the classpath on the
server. When JBoss/tomcat (or whatever) initialises the
RemoteCacheStartupServlet, that servlet will try to load a cache.ccf
file from the classpath.

In the cache.ccf file you put on the server, you configure the host,
port etc. that the remote cache should listen on. Additionally, you can
configure regions in the server's cache.ccf file too, exactly like you
do on client servers.

Basically our remote cache server's cache.ccf file is almost identical
to our client servers' cache.ccf files, except that the cache.ccf on our
remote server has 2 extra lines (which tell it which host and port to
bind to) and the regions on our client machines are configured to use
the remote cache auxiliary whereas server-side our regions (obviously)
don't use that auxiliary.

By the way the documentation on the JCS site specifies that the the ccf
file on the remote server should be named "remote.cache.ccf". I think
that is wrong. We found that it needed to be named "cache.ccf" just like
on clients. The relevant source code in RemoteCacheStartupServlet which
looks for the file as "cache.ccf" is here:
http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java?view=markup


By the way if you don't explicitly configure a region at all on the
server and a client machine puts an object into a region which has been
configured client-side only and is configured to use the remote cache
auxiliary (whether configured explicitly in client-side cache.ccf or by
putting an object into an unconfigured region which inherits some
default settings), the object will be sent to the server and the server
will configure the region server-side automatically, but settings for
that region server-side will inherit from the *default* settings you
configured in the server's cache.ccf file.

Be aware of that because if your client-side settings for a region
differ from the server-side settings for a region, objects in that
region will have different lifetimes etc. depending on (say) whether
they've been retrieved from the remote server to the client server or
not. This behaviour is logical and sometimes useful, but we generally
ensure that we configure the same settings for a region server-side as
we do client-side to make the lifetime of objects consistent.

Good luck,
Niall

On Fri, 2009-03-13 at 11:42 +0100, Jan Swaelens wrote:

> I understand that the client cache needs to configure its cache regions 
> and auxiliaries (incl the RemoteCacheFactory) to establish the client 
> cache configuration.
> I also understand that the remote server needs to be configured with the 
> registry(host, port, behavior) information to establish the server.
> What I don't quite get is how to configure the cache regions of the cache 
> server.
> > Configuring regions on the cache server is obviously required (I get 
> errors when I don't)
> > When I configure a region called X with let's say a disk auxiliary => I 
> still see the regions A and B as defined by the cache clients when I 
> access the JCSAdmin page, nothing to be seen of the region X
> I wonder how I should configure the regions of my cache server and how 
> these client and server regions work together.
> 
> Thanks for helping me understand this puzzle!