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 Russell East <re...@esri.com> on 2006/08/15 22:51:25 UTC

Re: some newbie user questions

Hello,
I've just started using JCS within a signed Web Start client 
application.  It will be possible for an end-user to start up several 
instances of this client application on the same machine.  JCS seems to 
work fine generally speaking.    I am using it to store http data that I 
download on behalf of the end-user.  I want to basically use it for 
something like a browser cache, so my code uses LRU plus the Indexed 
Disk Cache plugin.   Couple of questions:
    1) I suppose that only one application instance at a time, on a 
particular computer, can reliably use a jcs region, right?
    2) is there any code to synch access to the same cache region within 
2 or more apps running on the same machine?
    3) when the application ends, I call JCS.dispose() which takes 
several seconds to complete, presumably defragging the cache data - is 
there a way to prevent defragging upon dispose?   Would it be advisable 
to do that?
    4) correspondingly, is there a way to flush memory to disk every now 
and then, not necessarily defragging?

That'll will do for starters I think - thanks in advance.   j
-- Russell

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


Re: some newbie user questions

Posted by Aaron Smuts <as...@yahoo.com>.

--- Russell East <re...@esri.com> wrote:

> Thanks for your reply Aaron. 
> 
> > I run upwards of 5 or 6 tomcat instances running
> > different applications each using JCS on a single
> box.
> >    If they are using distribution plugins that
> require
> > them to bind to aprticular port, then I just
> configure
> > them to listen to different ports.
> Just to confirm.  In your system, do all the (5 or
> 6) tomcat instances 
> use precisely the same cache.ccf? 

No.  I run multiple applications, each in their own
tomcat instance, on the same machine.  They each have
their own configuration files.  I have dozens of
machines that run various sets of the applications. 
Most of my applications do not share cache data.  They
all use JCS though.  Some applications share cache
data via the tcp lateral auxiliary and some share data
via the rmi remote cache service.  

The cache is process specific.  You have to use a
distibution auxiliary to share data.  The indexed disk
cache cannot be used for distribution.  I uset he
tomcat work directory for the disk cache, typically. 
The jdbc disk cache could be used for distribution,
perhaps, but not the indexed disk cache. 

Aaron







 In other words,
> are they using 
> exactly the same cache on disk, and exactly the same
> cached data?   That 
> is what I want to do - well, maybe not quite 5 or 6
> instances, but at 
> least 2 or 3.   If they do, I'm wondering how you
> get all the instances 
> to synch the cache data and key index across the
> instance's in-memory 
> cache - or, does it just work?
> 
> -- Russell
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Aaron Smuts wrote:
> > --- Russell East <re...@esri.com> wrote:
> >  Couple of questions:
> >   
> >>     1) I suppose that only one application
> instance
> >> at a time, on a 
> >> particular computer, can reliably use a jcs
> region,
> >> right?
> >>     
> >
> > No.  I run upwards of 5 or 6 tomcat instances
> running
> > different applications each using JCS on a single
> box.
> >    If they are using distribution plugins that
> require
> > them to bind to aprticular port, then I just
> configure
> > them to listen to different ports.
> >
> >   
> >>     2) is there any code to synch access to the
> same
> >> cache region within 
> >> 2 or more apps running on the same machine?
> >>     
> >
> > Yes.  Just have them listen to different ports if
> use
> > the tcp lateral or the rmi remote cache.
> >
> >   
> >>     3) when the application ends, I call
> >> JCS.dispose() which takes 
> >> several seconds to complete, presumably
> defragging
> >> the cache data - is 
> >> there a way to prevent defragging upon dispose?  
> >> Would it be advisable 
> >> to do that?
> >>     
> >
> > No you can't stop it right now, but you can set a
> max
> > wait time.  The remote cache client does not
> shutdown
> > properly, forcing you to kill the application.
> >
> >   
> >>     4) correspondingly, is there a way to flush
> >> memory to disk every now 
> >> and then, not necessarily defragging?
> >>     
> >
> > Yes, there is a brand new method that will do
> this. 
> > You can tell it the number to free.  You can pass
> it
> > the size.  It's called freeMemoryElements.
> >
> >   
> >> That'll will do for starters I think - thanks in
> >> advance.   j
> >> -- Russell
> >>     
> >
> > Cheers,
> >
> > Aaron
> >
> >
>
---------------------------------------------------------------------
> > 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
> 
> 


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


Re: some newbie user questions

Posted by Russell East <re...@esri.com>.
Thanks for your reply Aaron. 

> I run upwards of 5 or 6 tomcat instances running
> different applications each using JCS on a single box.
>    If they are using distribution plugins that require
> them to bind to aprticular port, then I just configure
> them to listen to different ports.
Just to confirm.  In your system, do all the (5 or 6) tomcat instances 
use precisely the same cache.ccf?  In other words, are they using 
exactly the same cache on disk, and exactly the same cached data?   That 
is what I want to do - well, maybe not quite 5 or 6 instances, but at 
least 2 or 3.   If they do, I'm wondering how you get all the instances 
to synch the cache data and key index across the instance's in-memory 
cache - or, does it just work?

-- Russell
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Aaron Smuts wrote:
> --- Russell East <re...@esri.com> wrote:
>  Couple of questions:
>   
>>     1) I suppose that only one application instance
>> at a time, on a 
>> particular computer, can reliably use a jcs region,
>> right?
>>     
>
> No.  I run upwards of 5 or 6 tomcat instances running
> different applications each using JCS on a single box.
>    If they are using distribution plugins that require
> them to bind to aprticular port, then I just configure
> them to listen to different ports.
>
>   
>>     2) is there any code to synch access to the same
>> cache region within 
>> 2 or more apps running on the same machine?
>>     
>
> Yes.  Just have them listen to different ports if use
> the tcp lateral or the rmi remote cache.
>
>   
>>     3) when the application ends, I call
>> JCS.dispose() which takes 
>> several seconds to complete, presumably defragging
>> the cache data - is 
>> there a way to prevent defragging upon dispose?  
>> Would it be advisable 
>> to do that?
>>     
>
> No you can't stop it right now, but you can set a max
> wait time.  The remote cache client does not shutdown
> properly, forcing you to kill the application.
>
>   
>>     4) correspondingly, is there a way to flush
>> memory to disk every now 
>> and then, not necessarily defragging?
>>     
>
> Yes, there is a brand new method that will do this. 
> You can tell it the number to free.  You can pass it
> the size.  It's called freeMemoryElements.
>
>   
>> That'll will do for starters I think - thanks in
>> advance.   j
>> -- Russell
>>     
>
> Cheers,
>
> Aaron
>
> ---------------------------------------------------------------------
> 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: some newbie user questions

Posted by Aaron Smuts <as...@yahoo.com>.

--- Russell East <re...@esri.com> wrote:
 Couple of questions:
>     1) I suppose that only one application instance
> at a time, on a 
> particular computer, can reliably use a jcs region,
> right?

No.  I run upwards of 5 or 6 tomcat instances running
different applications each using JCS on a single box.
   If they are using distribution plugins that require
them to bind to aprticular port, then I just configure
them to listen to different ports.

>     2) is there any code to synch access to the same
> cache region within 
> 2 or more apps running on the same machine?

Yes.  Just have them listen to different ports if use
the tcp lateral or the rmi remote cache.

>     3) when the application ends, I call
> JCS.dispose() which takes 
> several seconds to complete, presumably defragging
> the cache data - is 
> there a way to prevent defragging upon dispose?  
> Would it be advisable 
> to do that?

No you can't stop it right now, but you can set a max
wait time.  The remote cache client does not shutdown
properly, forcing you to kill the application.

>     4) correspondingly, is there a way to flush
> memory to disk every now 
> and then, not necessarily defragging?

Yes, there is a brand new method that will do this. 
You can tell it the number to free.  You can pass it
the size.  It's called freeMemoryElements.

> 
> That'll will do for starters I think - thanks in
> advance.   j
> -- Russell

Cheers,

Aaron

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