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 Aleksandar Matijaca <am...@gmail.com> on 2007/04/23 17:51:59 UTC

newbie questions

Hi there,
I have downloaded JCS (latest version I believe), and I have had some
limited success with it.
I am using TCPLateral cache, since I don't know of any available directories
in production where
it can store messages...

So, I am using this TCPLateral cache instead, my questions are:

1)  I have deployed a small web app on two different machines, and could see
from the log
messages that they are "discovering" each other.  This is all good and well,
but when I stick
something into the cache on machine A, I see that value in another servlet
on machine Ano
problem (JCS is static).  However, I do NOT see that same value on machine B
(same program,
same cache name, same config ccf file etc..).

So the quesiton is:  What is the real purpose of the networking and
"discovery" functions of
TCP Lateral cache, if I am NOT able to see that same cached value on ALL my
machines which
are using the cache with the same config, same net etc...???

2)  If in question 1, I AM able to use TCP Lateral cache as a true
distributed cache, what would
a "proper" cache config look like?

3)  What is the preferred and simplest way to do distributed caching??

4)  Is there a simple "hello world" for a distributed cache, including code
and config?

I am including a copy of my config on machine A and machine B.

Thank you.
Alex.

===================================================================
MACHINE A

# DEFAULT CACHE REGION

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

# PRE-DEFINED CACHE REGIONS

jcs.region.testCache1=LTCP
#jcs.default=DC,LTCP
jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
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=60
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.testCache1.elementattributes.IsEternal=false


# AVAILABLE AUXILIARY CACHES
#jcs.auxiliary.DC=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
#jcs.auxiliary.DC.attributes=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
#jcs.auxiliary.DC.attributes.DiskPath=/
#jcs.auxiliary.DC.attributes.maxKeySize=100000

jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
#jcs.auxiliary.LTCP.attributes.TcpServers=
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1119
jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.10
jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=false
jcs.auxiliary.LTCP.attributes.FilterRemoveByHashCode=false


==================================================

MACHINE B

# DEFAULT CACHE REGION

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

# PRE-DEFINED CACHE REGIONS

jcs.region.testCache1=LTCP
#jcs.default=DC,LTCP
jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
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=60
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.testCache1.elementattributes.IsEternal=false


# AVAILABLE AUXILIARY CACHES
#jcs.auxiliary.DC=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
#jcs.auxiliary.DC.attributes=
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
#jcs.auxiliary.DC.attributes.DiskPath=/
#jcs.auxiliary.DC.attributes.maxKeySize=100000

jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
#jcs.auxiliary.LTCP.attributes.TcpServers=
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1118
jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.10
jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=false
jcs.auxiliary.LTCP.attributes.FilterRemoveByHashCode=false

Re: newbie questions

Posted by Joshua Szmajda <jo...@loki.ws>.
Hey, I don't use the TCPLateralCache, but I did write a test program 
that should work with that system regardless.
http://loki.ws/~josh/testJCS.java

you'll need to set your classpath to include the various jars JCS 
requires, plus your code's classpath. You'll also need the cache.ccf in 
the base of the classpath, as usual.

Once you've compiled it, you'll be presented with a (very) simple 
interface. You can read values by specifying 'region:variableName' or 
you can put values with 'put:region:variableName:value'.

It's really basic, but it works for my purposes.

Hope this helps,
-Josh

Aleksandar Matijaca wrote:
> Hi there,
> I have downloaded JCS (latest version I believe), and I have had some
> limited success with it.
> I am using TCPLateral cache, since I don't know of any available 
> directories
> in production where
> it can store messages...
>
> So, I am using this TCPLateral cache instead, my questions are:
>
> 1)  I have deployed a small web app on two different machines, and 
> could see
> from the log
> messages that they are "discovering" each other.  This is all good and 
> well,
> but when I stick
> something into the cache on machine A, I see that value in another 
> servlet
> on machine Ano
> problem (JCS is static).  However, I do NOT see that same value on 
> machine B
> (same program,
> same cache name, same config ccf file etc..).
>
> So the quesiton is:  What is the real purpose of the networking and
> "discovery" functions of
> TCP Lateral cache, if I am NOT able to see that same cached value on 
> ALL my
> machines which
> are using the cache with the same config, same net etc...???
>
> 2)  If in question 1, I AM able to use TCP Lateral cache as a true
> distributed cache, what would
> a "proper" cache config look like?
>
> 3)  What is the preferred and simplest way to do distributed caching??
>
> 4)  Is there a simple "hello world" for a distributed cache, including 
> code
> and config?
>
> I am including a copy of my config on machine A and machine B.
>
> Thank you.
> Alex.
>
> ===================================================================
> MACHINE A
>
> # DEFAULT CACHE REGION
>
> jcs.default=LTCP
> #jcs.default=DC,LTCP
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes 
>
> jcs.default.cacheattributes.MaxObjects=1000
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache 
>
>
> # PRE-DEFINED CACHE REGIONS
>
> jcs.region.testCache1=LTCP
> #jcs.default=DC,LTCP
> jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes 
>
> jcs.region.testCache1.cacheattributes.MaxObjects=1000
> 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=60
> jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
> jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes 
>
> jcs.region.testCache1.elementattributes.IsEternal=false
>
>
> # AVAILABLE AUXILIARY CACHES
> #jcs.auxiliary.DC=
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
> #jcs.auxiliary.DC.attributes=
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
> #jcs.auxiliary.DC.attributes.DiskPath=/
> #jcs.auxiliary.DC.attributes.maxKeySize=100000
>
> jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory 
>
> jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes 
>
> #jcs.auxiliary.LTCP.attributes.TcpServers=
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=1119
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.10
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=false
> jcs.auxiliary.LTCP.attributes.FilterRemoveByHashCode=false
>
>
> ==================================================
>
> MACHINE B
>
> # DEFAULT CACHE REGION
>
> jcs.default=LTCP
> #jcs.default=DC,LTCP
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes 
>
> jcs.default.cacheattributes.MaxObjects=1000
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache 
>
>
> # PRE-DEFINED CACHE REGIONS
>
> jcs.region.testCache1=LTCP
> #jcs.default=DC,LTCP
> jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes 
>
> jcs.region.testCache1.cacheattributes.MaxObjects=1000
> 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=60
> jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
> jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes 
>
> jcs.region.testCache1.elementattributes.IsEternal=false
>
>
> # AVAILABLE AUXILIARY CACHES
> #jcs.auxiliary.DC=
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
> #jcs.auxiliary.DC.attributes=
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
> #jcs.auxiliary.DC.attributes.DiskPath=/
> #jcs.auxiliary.DC.attributes.maxKeySize=100000
>
> jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory 
>
> jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes 
>
> #jcs.auxiliary.LTCP.attributes.TcpServers=
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=1118
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.10
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=false
> jcs.auxiliary.LTCP.attributes.FilterRemoveByHashCode=false
>

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