fhanik      2004/06/08 13:23:55

  Modified:    modules/cluster/src/share/org/apache/catalina/cluster/tcp
                        ReplicationValve.java
  Log:
  Improved the performance message, now the user sees the average request time and the 
average clustering overhead time
  
  Revision  Changes    Path
  1.13      +11 -6     
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java
  
  Index: ReplicationValve.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ReplicationValve.java     7 Apr 2004 20:43:55 -0000       1.12
  +++ ReplicationValve.java     8 Jun 2004 20:23:55 -0000       1.13
  @@ -101,15 +101,19 @@
   
   
       // --------------------------------------------------------- Public Methods
  +    protected static long totalRequestTime=0;
       protected static long totalSendTime=0;
       protected static long nrOfRequests =0;
       protected static long lastSendTime =0;
  -    protected static synchronized void addClusterSendTime(long time) {
  -        totalSendTime+=time;
  +    
  +    protected static synchronized void addClusterSendTime(long requestTime, long 
clusterTime) {
  +        totalSendTime+=clusterTime;
  +        totalRequestTime+=requestTime;
           nrOfRequests++;
           if ( (nrOfRequests % 100) == 0 ) {
  -            log.info("Average cluster serialize/send 
time="+(totalSendTime/nrOfRequests)+" ms for "+
  -                     nrOfRequests+" requests ("+totalSendTime+"ms).");
  +            log.info("Average request time="+(totalRequestTime/nrOfRequests)+" ms 
for "+
  +                     "Cluster overhead time="+(totalSendTime/nrOfRequests)+" ms for 
"+
  +                     nrOfRequests+" requests (Request="+totalRequestTime+"ms 
Cluster="+totalSendTime+"ms).");
               lastSendTime=System.currentTimeMillis();
           }//end if
       }
  @@ -131,6 +135,7 @@
                          ValveContext context)
           throws IOException, ServletException
       {
  +        long totalstart = System.currentTimeMillis();
           //this happens before the request
           //long _debugstart = System.currentTimeMillis();
           context.invokeNext(request, response);
  @@ -201,7 +206,7 @@
   
               cluster.send(msg);
               long stop = System.currentTimeMillis();
  -            addClusterSendTime(stop-start);
  +            addClusterSendTime(stop-totalstart,stop-start);
   
           }catch (Exception x)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to