On Sep 18, 2013, at 9:00 AM, Nicholas Violi <nvi...@globalgiving.org> wrote:

> Thanks Daniel.
> 
> On Tue, Sep 17, 2013 at 5:30 PM, Daniel Mikusa <dmik...@gopivotal.com>wrote:
>> 
>> Tried a quick two node setup on my Mac w/out HTTPD and it worked OK.  Go
>> to one Tomcat instance's port in chrome, it increments the counter in my
>> app.  Refresh a few times.  Open a second tab, go to the second Tomcat
>> instance's port.  The counter picks up where it left off and continues
>> incrementing.   Flipping back and forth between tabs / servers works fine.
>> 
>> Here's the cluster config that I used in case it helps.
>> 
>>             <Cluster channelSendOptions="8"
>> 
>> className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
>>                <Manager
>> className="org.apache.catalina.ha.session.DeltaManager"
>>                         expireSessionsOnShutdown="false"
>>                         notifyListenersOnReplication="true"/>
>>                <Channel
>> className="org.apache.catalina.tribes.group.GroupChannel">
>>                    <Membership address="228.0.0.4"
>> 
>> className="org.apache.catalina.tribes.membership.McastService"
>>                                dropTime="3000"
>>                                frequency="500"
>>                                port="45564"/>
>>                    <Receiver address="auto"
>>                              autoBind="100"
>> 
>> className="org.apache.catalina.tribes.transport.nio.NioReceiver"
>>                              maxThreads="6"
>>                              port="4000"
>>                              selectorTimeout="5000"/>
>>                    <Sender
>> className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
>>                        <Transport
>> className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
>>                    </Sender>
>>                    <Interceptor
>> className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
>>                    <Interceptor
>> className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
>>                </Channel>
>>                <Valve
>> className="org.apache.catalina.ha.tcp.ReplicationValve"
>>                       filter=""/>
>>                <Valve
>> className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
>>                <ClusterListener
>> className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
>>                <ClusterListener
>> className="org.apache.catalina.ha.session.ClusterSessionListener"/>
>>            </Cluster>
>> 
> 
> Just tried this with the same results. My test that replication is behaving
> is accessing my webapp on the two ports and monitoring the session counter
> and list in the tomcat manager, and as I said before, I can only see the
> sessions created on the server attached to the manager instance. Is that a
> reasonable test? With the clustering config pretty well ruled out as the
> culprit, maybe my webapp is not dealing with sessions appropriately? Would
> you mind sending me your counter test app?

Here's what I've been using:


WEB-INF/web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>

    <distributable/>

</web-app>


index.jsp:

<%
    Integer count = (Integer) session.getAttribute("counter");
    if (count == null) {
        count = 0;
        session.setAttribute("counter", 0);
    } else {
        session.setAttribute("counter", count + 1);
    }
%>
<html>
<head>
    <title>Index</title>
</head>
<body>
    <h2>Session [<%= session.getId() %>]</h2>
    <p>Current count is <%= count %></p>
</body>
</html>


It's crude, but effective for testing session replication.


> 
> Beyond that, have you tried increasing the log levels?
> 
> 
> I found conflicting information about enabling logging. What I had
> previously was
> 
> org.apache.catalina.tribes.level = FINE
> org.apache.catalina.tribes.MESSAGES = FINE
> 
> in logging.properties, which was reporting the FINE log statements in my
> original post. I just added some more:
> 
> org.apache.catalina.ha.level = FINE
> org.apache.catalina.ha.session.level = FINE
> org.apache.catalina.ha.session.DeltaManager.level = FINE
> org.apache.catalina.ha.tcp.level = FINE
> org.apache.catalina.ha.tcp.level = FINE
> org.apache.catalina.ha.tcp.ReplicationValve.level = FINE
> org.apache.catalina.ha.session.ClusterSessionListener.level = FINE
> org.apache.catalina.ha.session.JvmRouteSessionIDBinterListener.level = FINE
> 
> And I still don't see any messages when interacting with the webapp in the
> browser. Are there any other classes I should be logging?

Use the information Mark sent.  That worked for me with one minor change.  I 
had to set this level to FINER.

  org.apache.catalina.tribes.MESSAGES.level = FINER

With this, I see messages like this in the logs:

19-Sep-2013 09:02:07.930 FINER [Tribes-Task-Receiver-3] 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel 
NioReplicationThread - Received msg:UniqueId{126, 49, 93, 96, -109, -4, 64, 
-43, -70, 66, -70, -118, 104, 59, 39, 6} at 2013-09-19 09:02:07.929
19-Sep-2013 09:02:07.930 FINER [Tribes-Task-Receiver-3] 
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived 
ChannelCoordinator - Received msg:UniqueId{126, 49, 93, 96, -109, -4, 64, -43, 
-70, 66, -70, -118, 104, 59, 39, 6} at 2013-09-19 09:02:07.93 from tcp://{192, 
168, 0, 6}:4000
19-Sep-2013 09:02:07.930 FINER [Tribes-Task-Receiver-3] 
org.apache.catalina.tribes.group.GroupChannel.messageReceived GroupChannel - 
Received msg:UniqueId{126, 49, 93, 96, -109, -4, 64, -43, -70, 66, -70, -118, 
104, 59, 39, 6} at 2013-09-19 09:02:07.93 from tcp://{192, 168, 0, 6}:4000
19-Sep-2013 09:02:07.931 FINER [Tribes-Task-Receiver-3] 
org.apache.catalina.tribes.group.GroupChannel.messageReceived GroupChannel - 
Receive Message:UniqueId{126, 49, 93, 96, -109, -4, 64, -43, -70, 66, -70, 
-118, 104, 59, 39, 6} is 
SESSION-DELTA#localhost#/test#20845635BA34BD2304B8574809161BFC.tc-runtime-1
19-Sep-2013 09:02:07.931 FINER [Tribes-Task-Receiver-3] 
org.apache.catalina.tribes.group.GroupChannel.messageReceived GroupChannel 
delivered[true] id:UniqueId{126, 49, 93, 96, -109, -4, 64, -43, -70, 66, -70, 
-118, 104, 59, 39, 6}

Dan

> 
> Thanks,
> Nick


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to