tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Chandel <amitchan...@gmail.com>
Subject making compression work using GzipInterceptor in tomcat cluster
Date Fri, 27 Feb 2009 17:21:58 GMT
I have been able to set up a working tomcat cluster with 2 physically
separate tomcat instances (IP: 172.17.1.102 and 172.17.1.103) with tomcat
version 6.0.10, using following config (showing just one here, the other one
is similar instead the jvmRoute and Receiver address attribute):

 <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
              channelSendOptions="10">
          <Manager className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership
className="org.apache.catalina.tribes.membership.McastService"
                        address="224.0.0.3"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="172.17.1.102"
                      port="4000"
                      autoBind="100"
                      selectorTimeout="5000"
                      maxThreads="6"/>
            <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=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.txt;.*\.css"/>
          <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>
           <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
          </Host>
    </Engine>

I am using Apche 2.2 and mod_jk 1.2.27 (for load balancing and session
affinity).
This works great, and sessions are replicated nicely,  but I now want to add
compression of data while its being sent for session replication.

I tried adding the interceptor  <Interceptor
className="org.apache.catalina.tribes.group.interceptors.GzipInterceptor" />
between the TcpFailureDetector, and MessageDispatch15Interceptor under the
<Channel> node.
But I am getting the follwing error on both the instances:
Feb 27, 2009 11:37:58 AM org.apache.catalina.tribes.io.BufferPool
getBufferPool
INFO: Created a buffer pool with max size:104857600 bytes of
type:org.apache.catalina.tribes.io.BufferPool15Impl
Feb 27, 2009 11:37:58 AM
org.apache.catalina.tribes.group.interceptors.GzipInterceptor
messageReceived
SEVERE: Unable to decompress byte contents
java.io.IOException: Not in GZIP format
        at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
        at
org.apache.catalina.tribes.group.interceptors.GzipInterceptor.decompress(GzipInterceptor.java:83)
        at
org.apache.catalina.tribes.group.interceptors.GzipInterceptor.messageReceived(GzipInterceptor.java:57)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:243)
        at
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:226)
        at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:185)
        at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:88)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
Feb 27, 2009 11:37:59 AM org.apache.catalina.ha.tcp.SimpleTcpCluster
memberAdded
INFO: Replication member
added:org.apache.catalina.tribes.membership.MemberImpl[tcp://
172.17.1.103:4000,172.17.1.103,4000, alive=1010,id={-112 -66 -20 -50 7 121
 75 126 -103 -85 -56 55 21 -112 36 88 }, payload={}, command={}, domain={},
]

I guess, this means the Sender is not sending the compressed data, but the
receiver is assuming compressed data, and trying to decompress it, and
erroring. The tomcat instances don't bail out and die after this error, but
there is no session replication.

I tried adding the attribute compress="true" in the <Sender> node (as listed
in tomcat 5.5 docs), but it also didn't work.

Please let me know what I am missing here?

Thanks,
- Amit

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message