JCS LateralTCPCacheFactory

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JCS LateralTCPCacheFactory

Greg Parker
I'm trying to get a sample cluster of tomcat servers (server A, B and C) to use a distributed cache.  The ‘hello’ cache is configured on each server with a different TcpListenerPort on each server (8020, 8021, 8022) like this:

jcs.region.hello=LTCP


jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021,localhost:8022


Server A has a page that sets a value in the cache like this:

        cache = JCS.getInstance("hello");
        cache.put(“message", “Hello from server A");


Server B, and C try to get the value without setting it:

        cache = JCS.getInstance("hello");
        add(new Label("message", "Server B -> cache has : " +  cache.get(“message");));


The first time I access the page on server A I get an exception -  "Cannot connect to localhost:8021”.  If I access the page on each server then things appear to start communicating; however, the “message” entry from the “hello” region is set on server A and null on B and C.  Sometimes I see the value on server C displayed properly but never on server B.

With a configuration like this should I expect to see values immediately distributed to the other servers?  

Is there a way I should be bootstrapping the cache when the server starts?  If the servers need to communicate with one another it would seem to me that they need to be listening long before the first time the server tries to access the cache.

For performance I would like to use the cache to store serialized XML data instead of storing it in the session or a database.  The data remains in the cache while the user transforms it through several request cycles.  So during a request cycle the XML data would be retrieved, transformed, and stored back in the cache.  In a clustered environment I need the XML data available on every server in the cluster.  Is this an acceptable use case for JCS?

Thanks



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCS LateralTCPCacheFactory

Russell Sherk
Hi Greg,

Tomcat uses two consecutive ports. The one you specify and the next one for shutdown. E.g if you specify 8020, the shutdown port by default is 8021.

Try spacing your ports out: 8020, 8022, 8024.

--Russ


On Jul 26, 2017 10:11 PM, Greg Parker <[hidden email]> wrote:
I'm trying to get a sample cluster of tomcat servers (server A, B and C) to use a distributed cache.  The ‘hello’ cache is configured on each server with a different TcpListenerPort on each server (8020, 8021, 8022) like this:

jcs.region.hello=LTCP


jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021,localhost:8022


Server A has a page that sets a value in the cache like this:

        cache = JCS.getInstance("hello");
        cache.put(“message", “Hello from server A");


Server B, and C try to get the value without setting it:

        cache = JCS.getInstance("hello");
        add(new Label("message", "Server B -> cache has : " +  cache.get(“message");));


The first time I access the page on server A I get an exception -  "Cannot connect to localhost:8021”.  If I access the page on each server then things appear to start communicating; however, the “message” entry from the “hello” region is set on server A and null on B and C.  Sometimes I see the value on server C displayed properly but never on server B.

With a configuration like this should I expect to see values immediately distributed to the other servers?

Is there a way I should be bootstrapping the cache when the server starts?  If the servers need to communicate with one another it would seem to me that they need to be listening long before the first time the server tries to access the cache.

For performance I would like to use the cache to store serialized XML data instead of storing it in the session or a database.  The data remains in the cache while the user transforms it through several request cycles.  So during a request cycle the XML data would be retrieved, transformed, and stored back in the cache.  In a clustered environment I need the XML data available on every server in the cluster.  Is this an acceptable use case for JCS?

Thanks




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCS LateralTCPCacheFactory

Greg Parker
Thanks Russ,

So the TcpListenerPort value should match the tomcat port?  So if tomcat is running on port 6080 the cache.ccf on that instance should set TcpListenerPort=6080?  I set things up this way and nothing seems to complain; however, now I get a SEVERE error on first access and caching is not working across the three instances.  Here are the details:

SEVERE [ajp-nio-6009-exec-1] org.apache.commons.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary Could not instantiate auxiliary cache named "hello".

jcs.region.hello=LTCP
jcs.region.hello.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.hello.cacheattributes.MaxObjects=1000
jcs.region.hello.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.hello.cacheattributes.UseMemoryShrinker=true
jcs.region.hello.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.hello.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.hello.cacheattributes.MaxSpoolPerRun=500
jcs.region.hello.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.hello.elementattributes.IsEternal=false


jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.TcpListenerPort=6080
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:7080,localhost:8080

Thanks



> On Jul 27, 2017, at 8:57 AM, Russell Sherk <[hidden email]> wrote:
>
> Hi Greg,
>
> Tomcat uses two consecutive ports. The one you specify and the next one for shutdown. E.g if you specify 8020, the shutdown port by default is 8021.
>
> Try spacing your ports out: 8020, 8022, 8024.
>
> --Russ
>
>
> On Jul 26, 2017 10:11 PM, Greg Parker <[hidden email]> wrote:
> I'm trying to get a sample cluster of tomcat servers (server A, B and C) to use a distributed cache.  The ‘hello’ cache is configured on each server with a different TcpListenerPort on each server (8020, 8021, 8022) like this:
>
> jcs.region.hello=LTCP
> …
>
> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021,localhost:8022
>
>
> Server A has a page that sets a value in the cache like this:
>
>        cache = JCS.getInstance("hello");
>        cache.put(“message", “Hello from server A");
>
>
> Server B, and C try to get the value without setting it:
>
>        cache = JCS.getInstance("hello");
>        add(new Label("message", "Server B -> cache has : " +  cache.get(“message");));
>
>
> The first time I access the page on server A I get an exception -  "Cannot connect to localhost:8021”.  If I access the page on each server then things appear to start communicating; however, the “message” entry from the “hello” region is set on server A and null on B and C.  Sometimes I see the value on server C displayed properly but never on server B.
>
> With a configuration like this should I expect to see values immediately distributed to the other servers?
>
> Is there a way I should be bootstrapping the cache when the server starts?  If the servers need to communicate with one another it would seem to me that they need to be listening long before the first time the server tries to access the cache.
>
> For performance I would like to use the cache to store serialized XML data instead of storing it in the session or a database.  The data remains in the cache while the user transforms it through several request cycles.  So during a request cycle the XML data would be retrieved, transformed, and stored back in the cache.  In a clustered environment I need the XML data available on every server in the cluster.  Is this an acceptable use case for JCS?
>
> Thanks
>
>
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: JCS LateralTCPCacheFactory

Russell Sherk
Hi Greg,

Don't know much about JCS. Just general Tomcat stuff.

See if this helps: http://sentineltechsupport.gemalto.com/2013/10/java-runtime-log-error-could-not-instantiate-auxfactory-named-dc/

If not, maybe someone else in the list can help.

Cheers,

--Russ

-----Original Message-----
From: Greg Parker [mailto:[hidden email]]
Sent: July-27-17 10:07 AM
To: Commons Users List <[hidden email]>
Subject: Re: JCS LateralTCPCacheFactory

Thanks Russ,

So the TcpListenerPort value should match the tomcat port?  So if tomcat is running on port 6080 the cache.ccf on that instance should set TcpListenerPort=6080?  I set things up this way and nothing seems to complain; however, now I get a SEVERE error on first access and caching is not working across the three instances.  Here are the details:

SEVERE [ajp-nio-6009-exec-1] org.apache.commons.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary Could not instantiate auxiliary cache named "hello".

jcs.region.hello=LTCP
jcs.region.hello.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.hello.cacheattributes.MaxObjects=1000
jcs.region.hello.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.hello.cacheattributes.UseMemoryShrinker=true
jcs.region.hello.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.hello.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.hello.cacheattributes.MaxSpoolPerRun=500
jcs.region.hello.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.hello.elementattributes.IsEternal=false


jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.Receive=true
jcs.auxiliary.LTCP.attributes.TcpListenerPort=6080
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:7080,localhost:8080

Thanks



> On Jul 27, 2017, at 8:57 AM, Russell Sherk <[hidden email]> wrote:
>
> Hi Greg,
>
> Tomcat uses two consecutive ports. The one you specify and the next one for shutdown. E.g if you specify 8020, the shutdown port by default is 8021.
>
> Try spacing your ports out: 8020, 8022, 8024.
>
> --Russ
>
>
> On Jul 26, 2017 10:11 PM, Greg Parker <[hidden email]> wrote:
> I'm trying to get a sample cluster of tomcat servers (server A, B and C) to use a distributed cache.  The ‘hello’ cache is configured on each server with a different TcpListenerPort on each server (8020, 8021, 8022) like this:
>
> jcs.region.hello=LTCP
> …
>
> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp
> .LateralTCPCacheFactory
> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral
> .socket.tcp.TCPLateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021
> ,localhost:8022
>
>
> Server A has a page that sets a value in the cache like this:
>
>        cache = JCS.getInstance("hello");
>        cache.put(“message", “Hello from server A");
>
>
> Server B, and C try to get the value without setting it:
>
>        cache = JCS.getInstance("hello");
>        add(new Label("message", "Server B -> cache has : " +  
> cache.get(“message");));
>
>
> The first time I access the page on server A I get an exception -  "Cannot connect to localhost:8021”.  If I access the page on each server then things appear to start communicating; however, the “message” entry from the “hello” region is set on server A and null on B and C.  Sometimes I see the value on server C displayed properly but never on server B.
>
> With a configuration like this should I expect to see values immediately distributed to the other servers?
>
> Is there a way I should be bootstrapping the cache when the server starts?  If the servers need to communicate with one another it would seem to me that they need to be listening long before the first time the server tries to access the cache.
>
> For performance I would like to use the cache to store serialized XML data instead of storing it in the session or a database.  The data remains in the cache while the user transforms it through several request cycles.  So during a request cycle the XML data would be retrieved, transformed, and stored back in the cache.  In a clustered environment I need the XML data available on every server in the cluster.  Is this an acceptable use case for JCS?
>
> Thanks
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCS LateralTCPCacheFactory

Mat Jaggard-2
Have you tested to see if any of the the TcpListenerPorts are open on your
server? If you're on Linux you can try `netstat -l`

On Thu, 27 Jul 2017 at 15:52 Russell Sherk <[hidden email]>
wrote:

> Hi Greg,
>
> Don't know much about JCS. Just general Tomcat stuff.
>
> See if this helps:
> http://sentineltechsupport.gemalto.com/2013/10/java-runtime-log-error-could-not-instantiate-auxfactory-named-dc/
>
> If not, maybe someone else in the list can help.
>
> Cheers,
>
> --Russ
>
> -----Original Message-----
> From: Greg Parker [mailto:[hidden email]]
> Sent: July-27-17 10:07 AM
> To: Commons Users List <[hidden email]>
> Subject: Re: JCS LateralTCPCacheFactory
>
> Thanks Russ,
>
> So the TcpListenerPort value should match the tomcat port?  So if tomcat
> is running on port 6080 the cache.ccf on that instance should set
> TcpListenerPort=6080?  I set things up this way and nothing seems to
> complain; however, now I get a SEVERE error on first access and caching is
> not working across the three instances.  Here are the details:
>
> SEVERE [ajp-nio-6009-exec-1]
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary
> Could not instantiate auxiliary cache named "hello".
>
> jcs.region.hello=LTCP
>
> jcs.region.hello.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
> jcs.region.hello.cacheattributes.MaxObjects=1000
>
> jcs.region.hello.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
> jcs.region.hello.cacheattributes.UseMemoryShrinker=true
> jcs.region.hello.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.region.hello.cacheattributes.ShrinkerIntervalSeconds=60
> jcs.region.hello.cacheattributes.MaxSpoolPerRun=500
>
> jcs.region.hello.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
> jcs.region.hello.elementattributes.IsEternal=false
>
>
>
> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
>
> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=6080
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:7080,localhost:8080
>
> Thanks
>
>
>
> > On Jul 27, 2017, at 8:57 AM, Russell Sherk <[hidden email]>
> wrote:
> >
> > Hi Greg,
> >
> > Tomcat uses two consecutive ports. The one you specify and the next one
> for shutdown. E.g if you specify 8020, the shutdown port by default is 8021.
> >
> > Try spacing your ports out: 8020, 8022, 8024.
> >
> > --Russ
> >
> >
> > On Jul 26, 2017 10:11 PM, Greg Parker <[hidden email]> wrote:
> > I'm trying to get a sample cluster of tomcat servers (server A, B and C)
> to use a distributed cache.  The ‘hello’ cache is configured on each server
> with a different TcpListenerPort on each server (8020, 8021, 8022) like
> this:
> >
> > jcs.region.hello=LTCP
> > …
> >
> > jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp
> > .LateralTCPCacheFactory
> > jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral
> > .socket.tcp.TCPLateralCacheAttributes
> > jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> > jcs.auxiliary.LTCP.attributes.AllowGet=true
> > jcs.auxiliary.LTCP.attributes.Receive=true
> > jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
> > jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021
> > ,localhost:8022
> >
> >
> > Server A has a page that sets a value in the cache like this:
> >
> >        cache = JCS.getInstance("hello");
> >        cache.put(“message", “Hello from server A");
> >
> >
> > Server B, and C try to get the value without setting it:
> >
> >        cache = JCS.getInstance("hello");
> >        add(new Label("message", "Server B -> cache has : " +
> > cache.get(“message");));
> >
> >
> > The first time I access the page on server A I get an exception -
> "Cannot connect to localhost:8021”.  If I access the page on each server
> then things appear to start communicating; however, the “message” entry
> from the “hello” region is set on server A and null on B and C.  Sometimes
> I see the value on server C displayed properly but never on server B.
> >
> > With a configuration like this should I expect to see values immediately
> distributed to the other servers?
> >
> > Is there a way I should be bootstrapping the cache when the server
> starts?  If the servers need to communicate with one another it would seem
> to me that they need to be listening long before the first time the server
> tries to access the cache.
> >
> > For performance I would like to use the cache to store serialized XML
> data instead of storing it in the session or a database.  The data remains
> in the cache while the user transforms it through several request cycles.
> So during a request cycle the XML data would be retrieved, transformed, and
> stored back in the cache.  In a clustered environment I need the XML data
> available on every server in the cluster.  Is this an acceptable use case
> for JCS?
> >
> > Thanks
> >
> >
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCS LateralTCPCacheFactory

Greg Parker
I reverted the ports back to the way they were and the SEVERE error goes away.  I also get some lateral caching going on but its very erratic.  In my test, server A is the only instance that writes to the cache.

Scenario 1 - success
- Start server A, B, C
- Access server B
- Access server C
- Access server A to put value in cache
- Server B and C display the value put by A

Scenaio 2 - fail
- Start server A, B, C
- Access server A to put value in cache
    - console displays connection exceptions
- Access server B
- Access server C
- Access server A to remove then put value to cache
- Server B and C displays null

Scenaio 3 - fail
- Start server A, B, C
- Access server B
- Access server C
- Access server A to put value in cache
- Server B and C display the value put by A
- Restart server B
- Access server A to put value in cache
  - server A displays exception about connection to B
- Server B  displays null


Just wondering if perhaps I have some fundamental misunderstanding about how the lateral caching should be working.  I would assume that values written to any of the local caches would be pushed into the other two.  When a instance restarts it would rejoin the group etc.  Am I missing something?

Thanks


> On Jul 27, 2017, at 12:00 PM, Mat Jaggard <[hidden email]> wrote:
>
> Have you tested to see if any of the the TcpListenerPorts are open on your
> server? If you're on Linux you can try `netstat -l`
>
> On Thu, 27 Jul 2017 at 15:52 Russell Sherk <[hidden email]>
> wrote:
>
>> Hi Greg,
>>
>> Don't know much about JCS. Just general Tomcat stuff.
>>
>> See if this helps:
>> http://sentineltechsupport.gemalto.com/2013/10/java-runtime-log-error-could-not-instantiate-auxfactory-named-dc/
>>
>> If not, maybe someone else in the list can help.
>>
>> Cheers,
>>
>> --Russ
>>
>> -----Original Message-----
>> From: Greg Parker [mailto:[hidden email]]
>> Sent: July-27-17 10:07 AM
>> To: Commons Users List <[hidden email]>
>> Subject: Re: JCS LateralTCPCacheFactory
>>
>> Thanks Russ,
>>
>> So the TcpListenerPort value should match the tomcat port?  So if tomcat
>> is running on port 6080 the cache.ccf on that instance should set
>> TcpListenerPort=6080?  I set things up this way and nothing seems to
>> complain; however, now I get a SEVERE error on first access and caching is
>> not working across the three instances.  Here are the details:
>>
>> SEVERE [ajp-nio-6009-exec-1]
>> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary
>> Could not instantiate auxiliary cache named "hello".
>>
>> jcs.region.hello=LTCP
>>
>> jcs.region.hello.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
>> jcs.region.hello.cacheattributes.MaxObjects=1000
>>
>> jcs.region.hello.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
>> jcs.region.hello.cacheattributes.UseMemoryShrinker=true
>> jcs.region.hello.cacheattributes.MaxMemoryIdleTimeSeconds=3600
>> jcs.region.hello.cacheattributes.ShrinkerIntervalSeconds=60
>> jcs.region.hello.cacheattributes.MaxSpoolPerRun=500
>>
>> jcs.region.hello.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
>> jcs.region.hello.elementattributes.IsEternal=false
>>
>>
>>
>> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
>>
>> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
>> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
>> jcs.auxiliary.LTCP.attributes.AllowGet=true
>> jcs.auxiliary.LTCP.attributes.Receive=true
>> jcs.auxiliary.LTCP.attributes.TcpListenerPort=6080
>> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:7080,localhost:8080
>>
>> Thanks
>>
>>
>>
>>> On Jul 27, 2017, at 8:57 AM, Russell Sherk <[hidden email]>
>> wrote:
>>>
>>> Hi Greg,
>>>
>>> Tomcat uses two consecutive ports. The one you specify and the next one
>> for shutdown. E.g if you specify 8020, the shutdown port by default is 8021.
>>>
>>> Try spacing your ports out: 8020, 8022, 8024.
>>>
>>> --Russ
>>>
>>>
>>> On Jul 26, 2017 10:11 PM, Greg Parker <[hidden email]> wrote:
>>> I'm trying to get a sample cluster of tomcat servers (server A, B and C)
>> to use a distributed cache.  The ‘hello’ cache is configured on each server
>> with a different TcpListenerPort on each server (8020, 8021, 8022) like
>> this:
>>>
>>> jcs.region.hello=LTCP
>>> …
>>>
>>> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp
>>> .LateralTCPCacheFactory
>>> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral
>>> .socket.tcp.TCPLateralCacheAttributes
>>> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
>>> jcs.auxiliary.LTCP.attributes.AllowGet=true
>>> jcs.auxiliary.LTCP.attributes.Receive=true
>>> jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
>>> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021
>>> ,localhost:8022
>>>
>>>
>>> Server A has a page that sets a value in the cache like this:
>>>
>>>       cache = JCS.getInstance("hello");
>>>       cache.put(“message", “Hello from server A");
>>>
>>>
>>> Server B, and C try to get the value without setting it:
>>>
>>>       cache = JCS.getInstance("hello");
>>>       add(new Label("message", "Server B -> cache has : " +
>>> cache.get(“message");));
>>>
>>>
>>> The first time I access the page on server A I get an exception -
>> "Cannot connect to localhost:8021”.  If I access the page on each server
>> then things appear to start communicating; however, the “message” entry
>> from the “hello” region is set on server A and null on B and C.  Sometimes
>> I see the value on server C displayed properly but never on server B.
>>>
>>> With a configuration like this should I expect to see values immediately
>> distributed to the other servers?
>>>
>>> Is there a way I should be bootstrapping the cache when the server
>> starts?  If the servers need to communicate with one another it would seem
>> to me that they need to be listening long before the first time the server
>> tries to access the cache.
>>>
>>> For performance I would like to use the cache to store serialized XML
>> data instead of storing it in the session or a database.  The data remains
>> in the cache while the user transforms it through several request cycles.
>> So during a request cycle the XML data would be retrieved, transformed, and
>> stored back in the cache.  In a clustered environment I need the XML data
>> available on every server in the cluster.  Is this an acceptable use case
>> for JCS?
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>
>>

Loading...