tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r381861 - in /tomcat/container/tc5.5.x/modules: groupcom/etc/ groupcom/src/share/org/apache/catalina/tribes/tcp/ ha/etc/
Date Wed, 01 Mar 2006 01:25:10 GMT
Author: fhanik
Date: Tue Feb 28 17:25:07 2006
New Revision: 381861

URL: http://svn.apache.org/viewcvs?rev=381861&view=rev
Log:
Simple modifications, got rid of the SocketSender class, it aint doing nothing 

Removed:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SocketSender.java
Modified:
    tomcat/container/tc5.5.x/modules/groupcom/etc/cluster-server.xml
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationListener.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/TcpReplicationThread.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ThreadPool.java
    tomcat/container/tc5.5.x/modules/ha/etc/cluster-server.xml

Modified: tomcat/container/tc5.5.x/modules/groupcom/etc/cluster-server.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/etc/cluster-server.xml?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/etc/cluster-server.xml (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/etc/cluster-server.xml Tue Feb 28 17:25:07 2006
@@ -1,4 +1,4 @@
-<!-- Example Server Configuration File  - Search for Cluster-->
+<!-- Example Server Configuration File -->
 <!-- Note that component elements are nested corresponding to their
      parent-child relationships with each other -->
 
@@ -10,21 +10,15 @@
      define subcomponents such as "Valves" or "Loggers" at this level.
  -->
 
-<Server port="8005" shutdown="SHUTDOWN" debug="0">
+<Server port="7005" shutdown="SHUTDOWN">
 
+  <!-- Comment these entries out to disable JMX MBeans support used for the 
+       administration web application -->
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
+  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
 
-  <!-- Comment these entries out to disable JMX MBeans support -->
-  <!-- You may also configure custom components (e.g. Valves/Realms) by 
-       including your own mbean-descriptor file(s), and setting the 
-       "descriptors" attribute to point to a ';' seperated list of paths
-       (in the ClassLoader sense) of files to add to the default list.
-       e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
-  -->
-  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
-            debug="0"/>
-  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
-            debug="0"/>
-  
   <!-- Global JNDI resources -->
   <GlobalNamingResources>
 
@@ -35,18 +29,9 @@
          UserDatabaseRealm to authenticate users -->
     <Resource name="UserDatabase" auth="Container"
               type="org.apache.catalina.UserDatabase"
-       description="User database that can be updated and saved">
-    </Resource>
-    <ResourceParams name="UserDatabase">
-      <parameter>
-        <name>factory</name>
-        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
-      </parameter>
-      <parameter>
-        <name>pathname</name>
-        <value>conf/tomcat-users.xml</value>
-      </parameter>
-    </ResourceParams>
+       description="User database that can be updated and saved"
+           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+          pathname="conf/tomcat-users.xml" />
 
   </GlobalNamingResources>
 
@@ -60,7 +45,7 @@
    -->
 
   <!-- Define the Tomcat Stand-Alone Service -->
-  <Service name="Tomcat-Standalone">
+  <Service name="Catalina">
 
     <!-- A "Connector" represents an endpoint by which requests are received
          and responses are returned.  Each Connector passes requests on to the
@@ -88,40 +73,41 @@
          IP address of the remote client.
     -->
 
-    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
-    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
-               port="8080" minProcessors="5" maxProcessors="100"
-               enableLookups="true" redirectPort="8443" acceptCount="100"
-               debug="0" connectionTimeout="20000" 
-               disableUploadTimeout="true" />
+    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+    <Connector port="7080" maxHttpHeaderSize="8192"
+               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+               enableLookups="false" redirectPort="8443" acceptCount="100"
+               connectionTimeout="20000" disableUploadTimeout="true" />
     <!-- Note : To disable connection timeouts, set connectionTimeout value
-     to -1 -->
+     to 0 -->
+	
+	<!-- Note : To use gzip compression you could set the following properties :
+	
+			   compression="on" 
+			   compressionMinSize="2048" 
+			   noCompressionUserAgents="gozilla, traviata" 
+			   compressableMimeType="text/html,text/xml"
+	-->
 
-    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
+    <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
     <!--
-    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
-               port="8443" minProcessors="5" maxProcessors="75"
-               enableLookups="true" disableUploadTimeout="true"
-           acceptCount="100" debug="0" scheme="https" secure="true">
-      <Factory className="org.apache.coyote.tomcat5.CoyoteServerSocketFactory"
-               clientAuth="false" protocol="TLS" />
-    </Connector>
+    <Connector port="8443" maxHttpHeaderSize="8192"
+               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+               enableLookups="false" disableUploadTimeout="true"
+               acceptCount="100" scheme="https" secure="true"
+               clientAuth="false" sslProtocol="TLS" />
     -->
 
-    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
-    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
-               port="8009" minProcessors="5" maxProcessors="75"
-               enableLookups="true" redirectPort="8443"
-               acceptCount="10" debug="0"
-               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
+    <!-- Define an AJP 1.3 Connector on port 8009 -->
+    <Connector port="7009" 
+               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
 
     <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
     <!-- See proxy documentation for more information about using this. -->
     <!--
-    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
-               port="8082" minProcessors="5" maxProcessors="75"
-               enableLookups="true"
-               acceptCount="100" debug="0" connectionTimeout="20000"
+    <Connector port="7082" 
+               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+               enableLookups="false" acceptCount="100" connectionTimeout="20000"
                proxyPort="80" disableUploadTimeout="true" />
     -->
 
@@ -130,12 +116,12 @@
          analyzes the HTTP headers included with the request, and passes them
          on to the appropriate Host (virtual host). -->
 
-    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
-    <Engine name="Standalone" defaultHost="localhost" debug="0" jmvRoute="jvm1">  
      
+    <!-- You should set jvmRoute to support load-balancing via AJP ie :
+    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">         
     --> 
          
     <!-- Define the top level container in our container hierarchy -->
-    <Engine name="Standalone" defaultHost="localhost" debug="0">
+    <Engine name="Catalina" defaultHost="localhost">
 
       <!-- The request dumper valve dumps useful debugging information about
            the request headers and cookies that were received, and the response
@@ -155,11 +141,6 @@
       <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
       -->
 
-      <!-- Global logger unless overridden at lower levels -->
-      <Logger className="org.apache.catalina.logger.FileLogger"
-              prefix="catalina_log." suffix=".txt"
-              timestamp="true"/>
-
       <!-- Because this Realm is here, an instance will be shared globally -->
 
       <!-- This Realm uses the UserDatabase configured in the global JNDI
@@ -167,7 +148,7 @@
            that are performed against this UserDatabase are immediately
            available for use by the Realm.  -->
       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
-                 debug="0" resourceName="UserDatabase"/>
+             resourceName="UserDatabase"/>
 
       <!-- Comment out the old realm but leave here for now in case we
            need to go back quickly -->
@@ -179,7 +160,7 @@
            stored in a database and accessed via JDBC -->
 
       <!--
-      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
+      <Realm  className="org.apache.catalina.realm.JDBCRealm"
              driverName="org.gjt.mm.mysql.Driver"
           connectionURL="jdbc:mysql://localhost/authority"
          connectionName="test" connectionPassword="test"
@@ -188,7 +169,7 @@
       -->
 
       <!--
-      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
+      <Realm  className="org.apache.catalina.realm.JDBCRealm"
              driverName="oracle.jdbc.driver.OracleDriver"
           connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
          connectionName="scott" connectionPassword="tiger"
@@ -197,38 +178,44 @@
       -->
 
       <!--
-      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
+      <Realm  className="org.apache.catalina.realm.JDBCRealm"
              driverName="sun.jdbc.odbc.JdbcOdbcDriver"
           connectionURL="jdbc:odbc:CATALINA"
               userTable="users" userNameCol="user_name" userCredCol="user_pass"
           userRoleTable="user_roles" roleNameCol="role_name" />
       -->
 
-      <!-- Define the default virtual host -->
-      <Host name="localhost" debug="0" appBase="webapps"
-       unpackWARs="true" autoDeploy="true">
-       
-        
+      <!-- Define the default virtual host
+           Note: XML Schema validation will not work with Xerces 2.2.
+       -->
+      <Host name="localhost" appBase="webapps"
+       unpackWARs="true" autoDeploy="true"
+       xmlValidation="false" xmlNamespaceAware="false">
+
         <!-- Defines a cluster for this node,
              By defining this element, means that every manager will be changed.
              So when running a cluster, only make sure that you have webapps in there
              that need to be clustered and remove the other ones.
              A cluster has the following parameters:
-             
+
              className = the fully qualified name of the cluster class
-             
-             name = a descriptive name for your cluster, can be anything
-             
-             debug = the debug level, higher means more output
-             
+
+             clusterName = a descriptive name for your cluster, can be anything
+
              mcastAddr = the multicast address, has to be the same for all the nodes
-             
+
              mcastPort = the multicast port, has to be the same for all the nodes
              
-             mcastFrequency = the number of milliseconds in between sending a "I'm alive"
heartbeat
+             mcastBindAddr = bind the multicast socket to a specific address
              
-             mcastDropTime = the number a milliseconds before a node is considered "dead"
if no heartbeat is received
+             mcastTTL = the multicast TTL if you want to limit your broadcast
              
+             mcastSoTimeout = the multicast readtimeout 
+
+             mcastFrequency = the number of milliseconds in between sending a "I'm alive"
heartbeat
+
+             mcastDropTime = the number a milliseconds before a node is considered "dead"
if no heartbeat is received
+
              tcpThreadCount = the number of threads to handle incoming replication requests,
optimal would be the same amount of threads as nodes 
 
              tcpListenAddress = the listen address (bind address) for TCP cluster request
on this host, 
@@ -237,7 +224,7 @@
                                 InetAddress.getLocalHost().getHostAddress()
 
              tcpListenPort = the tcp listen port
-             
+
              tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case
the OS
                                   has a wakup bug in java.nio. Set to 0 for no timeout
 
@@ -247,32 +234,24 @@
 
              useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute
has been called.
                             false means to replicate the session after each request.
-                            false means that replication would work for the following piece
of code:
+                            false means that replication would work for the following piece
of code: (only for SimpleTcpReplicationManager)
                             <%
-                            HashMap map = new HashMap();
-                            session.setAttribute("map",map);
+                            HashMap map = (HashMap)session.getAttribute("map");
                             map.put("key","value");
                             %>
+             replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+                               * Pooled means that the replication happens using several
sockets in a synchronous way. Ie, the data gets replicated, then the request return. This
is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded.
This is the fastest and safest configuration. To use this, also increase the nr of tcp threads
that you have dealing with replication.
+                               * Synchronous means that the thread that executes the request,
is also the
+                               thread the replicates the data to the other nodes, and will
not return until all
+                               nodes have received the information.
+                               * Asynchronous means that there is a specific 'sender' thread
for each cluster node,
+                               so the request thread will queue the replication request into
a "smart" queue,
+                               and then return to the client.
+                               The "smart" queue is a queue where when a session is added
to the queue, and the same session
+                               already exists in the queue from a previous request, that
session will be replaced
+                               in the queue instead of replicating two requests. This almost
never happens, unless there is a 
+                               large network delay.
         -->             
-             
-            
-        <Cluster  className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
-                  name="FilipsCluster"
-                  debug="10"
-                  serviceclass="org.apache.catalina.cluster.mcast.McastService"
-                  mcastAddr="228.0.0.4"
-                  mcastPort="45564"
-                  mcastFrequency="500"
-                  mcastDropTime="3000"
-                  tcpThreadCount="2"
-                  tcpListenAddress="auto"
-                  tcpListenPort="4001"
-                  tcpSelectorTimeout="100"
-                  printToScreen="false"
-                  expireSessionsOnShutdown="false"
-                  useDirtyFlag="true"
-        />
-        
         <!--
             When configuring for clustering, you also add in a valve to catch all the requests
             coming in, at the end of the request, the session may or may not be replicated.
@@ -280,38 +259,80 @@
             1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
             2. a session exists (has been created)
             3. the request is not trapped by the "filter" attribute
-            
+
             The filter attribute is to filter out requests that could not modify the session,
             hence we don't replicate the session after the end of this request.
             The filter is negative, ie, anything you put in the filter, you mean to filter
out,
             ie, no replication will be done on requests that match one of the filters.
             The filter attribute is delimited by ;, so you can't escape out ; even if you
wanted to.
-            
+
             filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests
with the URI
             ending with .gif and .js are intercepted.
+            
+            The deployer element can be used to deploy apps cluster wide.
+            Currently the deployment only deploys/undeploys to working members in the cluster
+            so no WARs are copied upons startup of a broken node.
+            The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+            When a new war file is added the war gets deployed to the local instance,
+            and then deployed to the other instances in the cluster.
+            When a war file is deleted from the watchDir the war is undeployed locally 
+            and cluster wide
         -->
+        
+        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
+                 managerClassName="org.apache.catalina.ha.session.DeltaManager"
+                 expireSessionsOnShutdown="false"
+                 useDirtyFlag="true"
+                 notifyListenersOnReplication="true">
+
+            <Channel className="org.apache.catalina.tribes.group.GroupChannel">
+                <Membership 
+                    className="org.apache.catalina.tribes.mcast.McastService"
+                    mcastAddr="228.0.0.4"
+                    mcastPort="45564"
+                    mcastFrequency="500"
+                    mcastDropTime="3000"/>
+
+                <Receiver 
+                    className="org.apache.catalina.tribes.tcp.ReplicationListener"
+                    tcpListenAddress="auto"
+                    tcpListenPort="4001"
+                    tcpSelectorTimeout="100"
+                    tcpThreadCount="6"
+                    sendAck="true"
+                    synchronized="true"
+                    rxBufSize="4096"
+                    txBufSize="128"/>
+
+                <Sender
+                    className="org.apache.catalina.tribes.tcp.ReplicationTransmitter"
+                    replicationMode="pooled"
+                    ackTimeout="15000"
+                    waitForAck="true"
+                    rxBufSize="4096"
+                    txBufSize="128"/>
+                    
+                <!--
+                <Interceptor className="org.apache.catalina.tribes.group.interceptors.GzipInterceptor"/>
+                <Interceptor className="org.apache.catalina.tribes.group.interceptors.FragmentationInterceptor"/>
+                <Interceptor className="org.apache.catalina.tribes.group.interceptors.OrderInterceptor"/>
+                -->
+            </Channel>
             
-        <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
-               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
+            <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
+                   filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
+                   
+            <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
+                      tempDir="/tmp/war-temp/"
+                      deployDir="/tmp/war-deploy/"
+                      watchDir="/tmp/war-listen/"
+                      watchEnabled="false"/>
+                      
+            <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
+        </Cluster>
+    
 
-      <!-- Add the following attributes if you want to turn XML validation
-           on. Remember to comment the Host element above. 
-           
-           Note: XML Schema validationn will works with Xerces 2.0.1 or 
-           Xerces 2.1. Xerces 2.0.2 and Xerces 2.2 have bugs that prevent 
-           their use with Tomcat-->
-      <!--
-      <Host name="localhost" debug="0" appBase="webapps"
-       unpackWARs="true" autoDeploy="true"
-       xmlValidation="true" xmlNamespaceAware="true">
-      -->
 
-        <!-- Uncomment this to cluster this host using JavaGroups. The
-             protocol attribute can be used to configure the JavaGroups
-             network stack (the defaults are used if it's not specified). -->
-        <!--
-        <Cluster className="org.apache.catalina.cluster.JGCluster"/>
-        -->
 
         <!-- Normally, users must authenticate themselves to each web app
              individually.  Uncomment the following entry if you would like
@@ -320,10 +341,9 @@
              user identity maintained across *all* web applications contained
              in this virtual host. -->
         <!--
-        <Valve className="org.apache.catalina.authenticator.SingleSignOn"
-                   debug="0"/>
+        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
         -->
-        
+
         <!-- Access log processes all requests for this virtual host.  By
              default, log files are created in the "logs" directory relative to
              $CATALINA_HOME.  If you wish, you can specify a different
@@ -336,28 +356,35 @@
                  pattern="common" resolveHosts="false"/>
         -->
 
-        <!-- Logger shared by all Contexts related to this virtual host.  By
-             default (when using FileLogger), log files are created in the "logs"
-             directory relative to $CATALINA_HOME.  If you wish, you can specify
-             a different directory with the "directory" attribute.  Specify either a
-             relative (to $CATALINA_HOME) or absolute path to the desired
-             directory.-->
-        <Logger className="org.apache.catalina.logger.FileLogger"
-                 directory="logs"  prefix="localhost_log." suffix=".txt"
-            timestamp="true"/>
-
-        <!-- Define properties for each web application.  This is only needed
-             if you want to set non-default properties, or have web application
-             document roots in places other than the virtual host's appBase
-             directory.  -->
+        <!-- Access log processes all requests for this virtual host.  By
+             default, log files are created in the "logs" directory relative to
+             $CATALINA_HOME.  If you wish, you can specify a different
+             directory with the "directory" attribute.  Specify either a relative
+             (to $CATALINA_HOME) or absolute path to the desired directory.
+             This access log implementation is optimized for maximum performance,
+             but is hardcoded to support only the "common" and "combined" patterns.
+        -->
+        <!--
+        <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
+                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
+                 pattern="common" resolveHosts="false"/>
+        -->
+        <!-- Access log processes all requests for this virtual host.  By
+             default, log files are created in the "logs" directory relative to
+             $CATALINA_HOME.  If you wish, you can specify a different
+             directory with the "directory" attribute.  Specify either a relative
+             (to $CATALINA_HOME) or absolute path to the desired directory.
+             This access log implementation is optimized for maximum performance,
+             but is hardcoded to support only the "common" and "combined" patterns.
 
-        <!-- Tomcat Root Context -->
+             This valve use NIO direct Byte Buffer to asynchornously store the
+             log.
+        -->
         <!--
-        <Context path="/reptest" docBase="reptest" debug="0">
-            
-        </Context>
+        <Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve"
+                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
+                 pattern="common" resolveHosts="false"/>
         -->
-        
 
       </Host>
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
Tue Feb 28 17:25:07 2006
@@ -213,7 +213,9 @@
      * After failure make a resend
      */
     private boolean resend = false ;
-    
+    private int rxBufSize = 1024;
+    private int txBufSize = 4096;
+
     // ------------------------------------------------------------- Constructor
     
     public DataSender(String domain,InetAddress host, int port) {
@@ -228,6 +230,12 @@
         this(domain,host,port);
         if ( state != null ) this.senderState = state;
     }
+    public DataSender(String domain,InetAddress host, int port, SenderState state, int rxBufSize,
int txBufSize) {
+        this(domain,host,port,state);
+        this.rxBufSize = rxBufSize;
+        this.txBufSize = txBufSize;
+    }
+
     // ------------------------------------------------------------- Properties
 
     /**
@@ -550,12 +558,29 @@
         return senderState;
     }
 
+    public int getRxBufSize() {
+        return rxBufSize;
+    }
+
+    public int getTxBufSize() {
+        return txBufSize;
+    }
+
     /**
      * @param socket The socket to set.
      */
     public void setSocket(Socket socket) {
         this.socket = socket;
     }
+
+    public void setRxBufSize(int rxBufSize) {
+        this.rxBufSize = rxBufSize;
+    }
+
+    public void setTxBufSize(int txBufSize) {
+        this.txBufSize = txBufSize;
+    }
+
     // --------------------------------------------------------- Public Methods
 
     /**
@@ -685,10 +710,11 @@
             if (log.isDebugEnabled())
                 log.debug(sm.getString("IDataSender.openSocket", address.getHostAddress(),
new Integer(port),new Long(socketOpenCounter)));
       } catch (IOException ex1) {
-            socketOpenFailureCounter++ ;
-            if (log.isDebugEnabled())
-                log.debug(sm.getString("IDataSender.openSocket.failure",address.getHostAddress(),
new Integer(port),new Long(socketOpenFailureCounter)), ex1);
-            throw ex1;
+          getSenderState().setSuspect();
+          socketOpenFailureCounter++ ;
+          if (log.isDebugEnabled())
+              log.debug(sm.getString("IDataSender.openSocket.failure",address.getHostAddress(),
new Integer(port),new Long(socketOpenFailureCounter)), ex1);
+          throw ex1;
         }
         
      }
@@ -699,6 +725,8 @@
      */
     protected void createSocket() throws IOException, SocketException {
         socket = new Socket(getAddress(), getPort());
+        socket.setSendBufferSize(getTxBufSize());
+        socket.setReceiveBufferSize(getRxBufSize());
         this.socketout = socket.getOutputStream();
     }
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
Tue Feb 28 17:25:07 2006
@@ -44,5 +44,7 @@
     public boolean checkKeepAlive();
     public String getDomain() ;
     public void setDomain(String domain) ;
+    public void setRxBufSize(int size);
+    public void setTxBufSize(int size);
 
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
Tue Feb 28 17:25:07 2006
@@ -19,7 +19,6 @@
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.LinkedList;
-import org.apache.catalina.tribes.io.*;
 import org.apache.catalina.tribes.ChannelMessage;
 
 /**
@@ -106,7 +105,7 @@
     }
 
     /**
-     * send message and use a pool of SocketSenders
+     * send message and use a pool of DataSenders
      * 
      * @param messageId Message unique identifier
      * @param data Message data
@@ -120,7 +119,7 @@
                     connect();
             }
         }
-        SocketSender sender = senderQueue.getSender(0);
+        DataSender sender = senderQueue.getSender(0);
         if (sender == null) {
             log.warn(sm.getString("PoolSocketSender.noMoreSender", this.getAddress(), new
Integer(this.getPort())));
             return;
@@ -187,8 +186,8 @@
             return queue.size();
         }
 
-        public SocketSender getSender(long timeout) {
-            SocketSender sender = null;
+        public DataSender getSender(long timeout) {
+            DataSender sender = null;
             long start = System.currentTimeMillis();
             long delta = 0;
             do {
@@ -197,9 +196,9 @@
                         throw new IllegalStateException(
                                 "Socket pool is closed.");
                     if (queue.size() > 0) {
-                        sender = (SocketSender) queue.removeFirst();
+                        sender = (DataSender) queue.removeFirst();
                     } else if (inuse.size() < limit) {
-                        sender = getNewSocketSender();
+                        sender = getNewDataSender();
                     } else {
                         try {
                             mutex.wait(timeout);
@@ -218,7 +217,7 @@
             return sender;
         }
 
-        public void returnSender(SocketSender sender) {
+        public void returnSender(DataSender sender) {
             //to do
             synchronized (mutex) {
                 queue.add(sender);
@@ -227,18 +226,19 @@
             }
         }
 
-        private SocketSender getNewSocketSender() {
-            //new SocketSender(
-            SocketSender sender = new SocketSender(getDomain(),
-                                                   parent.getAddress(), 
-                                                   parent.getPort(),
-                                                   parent.getSenderState() );
-            sender.setKeepAliveMaxRequestCount(parent
-                    .getKeepAliveMaxRequestCount());
+        private DataSender getNewDataSender() {
+            //new DataSender(
+            DataSender sender = new DataSender(getDomain(),
+                                               parent.getAddress(),
+                                               parent.getPort(),
+                                               parent.getSenderState() );
+            sender.setKeepAliveMaxRequestCount(parent.getKeepAliveMaxRequestCount());
             sender.setKeepAliveTimeout(parent.getKeepAliveTimeout());
             sender.setAckTimeout(parent.getAckTimeout());
             sender.setWaitForAck(parent.isWaitForAck());
             sender.setResend(parent.isResend());
+            sender.setRxBufSize(parent.getRxBufSize());
+            sender.setTxBufSize(parent.getTxBufSize());
             return sender;
 
         }
@@ -246,11 +246,11 @@
         public void close() {
             synchronized (mutex) {
                 for (int i = 0; i < queue.size(); i++) {
-                    SocketSender sender = (SocketSender) queue.get(i);
+                    DataSender sender = (DataSender) queue.get(i);
                     sender.disconnect();
                 }//for
                 for (int i = 0; i < inuse.size(); i++) {
-                    SocketSender sender = (SocketSender) inuse.get(i);
+                    DataSender sender = (DataSender) inuse.get(i);
                     sender.disconnect();
                 }//for
                 queue.clear();

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationListener.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationListener.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationListener.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationListener.java
Tue Feb 28 17:25:07 2006
@@ -43,11 +43,11 @@
     /**
      * @todo make this configurable
      */
-    public static int BUFFER_RECEIVE_SIZE = XByteBuffer.DEF_SIZE;
+    protected int rxBufSize = XByteBuffer.DEF_SIZE;
     /**
      * We are only sending acks
      */
-    public static int BUFFER_SEND_SIZE = 128;
+    protected int txBufSize = 128;
 
     protected static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ReplicationListener.class);
 
@@ -123,7 +123,13 @@
      */
     public void start() {
         try {
-            pool = new ThreadPool(tcpThreadCount, TcpReplicationThread.class, interestOpsMutex,
getWorkerThreadOptions());
+            TcpReplicationThread[] receivers = new TcpReplicationThread[tcpThreadCount];
+            for ( int i=0; i<receivers.length; i++ ) {
+                receivers[i] = new TcpReplicationThread();
+                receivers[i].setRxBufSize(getRxBufSize());
+                receivers[i].setOptions(getWorkerThreadOptions());
+            }
+            pool = new ThreadPool(interestOpsMutex, receivers);
         } catch (Exception e) {
             log.error("ThreadPool can initilzed. Listener not started", e);
             return;
@@ -191,8 +197,8 @@
                         ServerSocketChannel server =
                             (ServerSocketChannel) key.channel();
                         SocketChannel channel = server.accept();
-                        channel.socket().setReceiveBufferSize(BUFFER_RECEIVE_SIZE);
-                        channel.socket().setSendBufferSize(BUFFER_SEND_SIZE);
+                        channel.socket().setReceiveBufferSize(rxBufSize);
+                        channel.socket().setSendBufferSize(txBufSize);
                         Object attach = new ObjectReader(channel, selector,this);
                         registerChannel(selector,
                                         channel,
@@ -372,6 +378,14 @@
         return direct;
     }
 
+    public int getRxBufSize() {
+        return rxBufSize;
+    }
+
+    public int getTxBufSize() {
+        return txBufSize;
+    }
+
     public MessageListener getMessageListener() {
         return listener;
     }
@@ -382,6 +396,14 @@
 
     public void setDirect(boolean direct) {
         this.direct = direct;
+    }
+
+    public void setRxBufSize(int rxBufSize) {
+        this.rxBufSize = rxBufSize;
+    }
+
+    public void setTxBufSize(int txBufSize) {
+        this.txBufSize = txBufSize;
     }
 
     public void setSynchronized(boolean sync) {

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
Tue Feb 28 17:25:07 2006
@@ -25,6 +25,7 @@
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.ChannelSender;
 import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.util.IDynamicProperty;
 import org.apache.catalina.util.StringManager;
 import org.apache.tomcat.util.IntrospectionUtils;
@@ -54,6 +55,15 @@
 
     private Map map = new HashMap();
 
+    /**
+     * @todo make this configurable
+     */
+    protected int rxBufSize = XByteBuffer.DEF_SIZE;
+    /**
+     * We are only sending acks
+     */
+    protected int txBufSize = 128;
+
     public ReplicationTransmitter() {
     }
 
@@ -299,14 +309,29 @@
     public int getProcessSenderFrequency() {
         return processSenderFrequency;
     }
-    
+
+    public int getTxBufSize() {
+        return txBufSize;
+    }
+
+    public int getRxBufSize() {
+        return rxBufSize;
+    }
+
     /**
      * @param processSenderFrequency The processSenderFrequency to set.
      */
     public void setProcessSenderFrequency(int processSenderFrequency) {
         this.processSenderFrequency = processSenderFrequency;
     }
-    
+
+    public void setTxBufSize(int txBufSize) {
+        this.txBufSize = txBufSize;
+    }
+
+    public void setRxBufSize(int rxBufSize) {
+        this.rxBufSize = rxBufSize;
+    }
 
     /**
      * @return True if synchronized sender
@@ -511,6 +536,8 @@
                 IDataSender sender = IDataSenderFactory.getIDataSender(
                         replicationMode, member);
                 transferSenderProperty(sender);
+                sender.setRxBufSize(getRxBufSize());
+                sender.setTxBufSize(getTxBufSize());
                 map.put(key, sender);
             }
         } catch (java.io.IOException x) {

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/TcpReplicationThread.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/TcpReplicationThread.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/TcpReplicationThread.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/TcpReplicationThread.java
Tue Feb 28 17:25:07 2006
@@ -46,6 +46,7 @@
         org.apache.commons.logging.LogFactory.getLog( TcpReplicationThread.class );
     private ByteBuffer buffer = null;
     private SelectionKey key;
+    private int rxBufSize;
     TcpReplicationThread ()
     {
     }
@@ -54,9 +55,9 @@
     public synchronized void run()
     {
         if ( (getOptions() & OPTION_DIRECT_BUFFER) == OPTION_DIRECT_BUFFER ) {
-            buffer = ByteBuffer.allocateDirect(ReplicationListener.BUFFER_RECEIVE_SIZE);
+            buffer = ByteBuffer.allocateDirect(getRxBufSize());
         }else {
-            buffer = ByteBuffer.allocate (ReplicationListener.BUFFER_RECEIVE_SIZE);
+            buffer = ByteBuffer.allocate (getRxBufSize());
         }
         while (doRun) {
             try {
@@ -228,5 +229,13 @@
         } catch ( java.io.IOException x ) {
             log.warn("Unable to send ACK back through channel, channel disconnected?: "+x.getMessage());
         }
+    }
+
+    public void setRxBufSize(int rxBufSize) {
+        this.rxBufSize = rxBufSize;
+    }
+
+    public int getRxBufSize() {
+        return rxBufSize;
     }
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ThreadPool.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ThreadPool.java?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ThreadPool.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ThreadPool.java
Tue Feb 28 17:25:07 2006
@@ -35,13 +35,27 @@
     Object mutex = new Object();
     Object interestOpsMutex = null;
 
+    ThreadPool (Object interestOpsMutex, WorkerThread[] threads) throws Exception {
+        // fill up the pool with worker threads
+        this.interestOpsMutex = interestOpsMutex;
+        for (int i = 0; i < threads.length; i++) {
+            WorkerThread thread = threads[i];
+            thread.setPool(this);
+            thread.setName (thread.getClass().getName()+"[" + (i + 1)+"]");
+            thread.setDaemon(true);
+            thread.setPriority(Thread.MAX_PRIORITY);
+            thread.start();
+            idle.add (thread);
+        }
+    }
+
+
     ThreadPool (int poolSize, Class threadClass, Object interestOpsMutex, int threadOptions)
throws Exception {
         // fill up the pool with worker threads
         this.interestOpsMutex = interestOpsMutex;
         for (int i = 0; i < poolSize; i++) {
             WorkerThread thread = (WorkerThread)threadClass.newInstance();
             thread.setPool(this);
-
             // set thread name for debugging, start it
             thread.setName (threadClass.getName()+"[" + (i + 1)+"]");
             thread.setDaemon(true);

Modified: tomcat/container/tc5.5.x/modules/ha/etc/cluster-server.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/etc/cluster-server.xml?rev=381861&r1=381860&r2=381861&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/etc/cluster-server.xml (original)
+++ tomcat/container/tc5.5.x/modules/ha/etc/cluster-server.xml Tue Feb 28 17:25:07 2006
@@ -279,8 +279,8 @@
             and cluster wide
         -->
         
-        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
-                 managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
+                 managerClassName="org.apache.catalina.ha.session.DeltaManager"
                  expireSessionsOnShutdown="false"
                  useDirtyFlag="true"
                  notifyListenersOnReplication="true">
@@ -296,31 +296,35 @@
                 <Receiver 
                     className="org.apache.catalina.tribes.tcp.ReplicationListener"
                     tcpListenAddress="auto"
-                    tcpListenPort="4002"
+                    tcpListenPort="4001"
                     tcpSelectorTimeout="100"
                     tcpThreadCount="6"
                     sendAck="true"
-                    synchronized="true"/>
+                    synchronized="true"
+                    rxBufSize="4096"
+                    txBufSize="128"/>
 
                 <Sender
                     className="org.apache.catalina.tribes.tcp.ReplicationTransmitter"
                     replicationMode="pooled"
                     ackTimeout="15000"
-                    waitForAck="true"/>
+                    waitForAck="true"
+                    rxBufSize="4096"
+                    txBufSize="128"/>
                     
                 <Interceptor className="org.apache.catalina.tribes.group.interceptors.GzipInterceptor"/>
             </Channel>
             
-            <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+            <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                    filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                    
-            <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+            <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                       tempDir="/tmp/war-temp/"
                       deployDir="/tmp/war-deploy/"
                       watchDir="/tmp/war-listen/"
                       watchEnabled="false"/>
                       
-            <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
+            <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
         </Cluster>
     
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message