Joe,

Are you refering to Jetty's raw jmx statistics available from the
management console or to Jetty's JSR77 implementation?

Jetty supports JSR77 via a filter. Have a look at the Jetty extra/jsr77 package in the Jetty source tree. It is part of the JettyPlus server, but
should be able to be extracted to work with vanilla jetty. I've attached
the jettyplus config files that enables it for your info.

I can work with you on this to enable jsr77 for jetty if you'd like.

cheers
Jan


Joe Bohn wrote:

I'm working a new JSR77 like management API for performance monitoring of Jetty (soon to be followed by Tomcat) started by Aaron. However, I'm hitting some incompatibilities between the currently available Jetty statistics from the server (and displayed in the console today) and JSR77 performance monitoring style reporting.

Jetty can report averages for some attributes such as the number of connection requests, the duration of connections and the duration of requests. When Jetty provides an average of some statistic the only other value typically provided is the maximum (this is true for all three).

JSR77 performance monitoring does not track/store any averages. Rather, for TimeStatistics only, it is expected that the average can be computed by dividing the total time by the total count. There is not a way to compute the average for range statistics (such as the connection requests). I would like to be able to infer the missing values from the average but I don't have enough information available from Jetty.

Given this mismatch I can do one of the following:
1) Don't make available the reporting of averages from Jetty for the three statistics. Since there are no other values available, the result will be that we will only display the maximum value for the particular statistic(for Time values we'd be missing minimum, total time, and count - for Range that's current and LowWaterMark). 2) Provide some extensions on the JSR77 Statistics in the console or geronimo Jetty packages to store and retrieve the averages in addition to the other values. Once again we would not have values for the other statistic fields ... just average and maximum.

I'll need to work out the same or similar performance statistics for Tomcat as soon as I have the Jetty capability resolved (which I hope is still in the next day). So, I'll need some help from you Tomcat experts soon! :-)

Joe



<?xml version="1.0"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd";>


<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!-- =============================================================== -->
<Configure>
  
  <Call id="jmxserver" class="javax.management.MBeanServerFactory" name="createMBeanServer">
  
     <Arg>org.mortbay</Arg>

     <Call name="createMBean">
       <Arg>org.mortbay.util.jmx.MX4JHttpAdaptor</Arg>
       <Arg><New class="javax.management.ObjectName"><Arg>mx4j.tools:adaptor=http</Arg></New></Arg>
       <Arg><Array type="java.lang.Object"><Item type="int">8082</Item><Item>localhost</Item></Array></Arg>
       <Arg><Array type="java.lang.String"><Item>int</Item><Item>java.lang.String</Item></Array></Arg>
     </Call>

     <Call name="createMBean">
       <Arg>org.mortbay.jetty.jmx.ServerMBean</Arg>
       <Arg><New class="javax.management.ObjectName"><Arg>org.mortbay:jetty=admin</Arg></New></Arg>
       <Arg><Array type="java.lang.Object"><Item>etc/admin.xml</Item></Array></Arg>
       <Arg><Array type="java.lang.String"><Item>java.lang.String</Item></Array></Arg>
     </Call>

     <Call name="createMBean">
       <Arg>org.mortbay.jetty.plus.jmx.ServerMBean</Arg>
       <Arg><New class="javax.management.ObjectName"><Arg>org.mortbay:jetty=default</Arg></New></Arg>
       <Arg><Array type="java.lang.Object"><Item>extra/etc/jettyplus.xml</Item></Array></Arg>
       <Arg><Array type="java.lang.String"><Item>java.lang.String</Item></Array></Arg>
     </Call>

  </Call>

</Configure>
<?xml version="1.0"  encoding="ISO-8859-1"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd";>



<!-- =============================================================== -->
<!-- Configure the JettyPlus Server                                  -->
<!-- =============================================================== -->
<Configure class="org.mortbay.jetty.plus.Server">

  <!-- =============================================================== -->
  <!-- Configure context specific log4j logging                        -->
  <!-- =============================================================== -->
  <!-- Uncomment to enable per-context logging. You will also need to  -->
  <!-- create and register a  ServletContextListener that will clean   -->
  <!-- the repository when the context is stopped, by calling this line-->
  <!-- in the contextDestroyed() method:                               -->
  <!--  org.mortbay.log4j.CRS.remove(Thread.currentThread().getContextClassLoader()) -->
  <!-- 
  <Call class="org.apache.log4j.LogManager" name="setRepositorySelector">
    <Arg><New class="org.mortbay.log4j.CRS"/></Arg>
    <Arg><New class="java.lang.Object"/></Arg>
  </Call>
  -->

  <!-- =============================================================== -->
  <!-- Add a transaction manager and XA datasources                    -->
  <!-- =============================================================== -->
  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.JotmService">
        <Set name="Name">TransactionMgr</Set>
         <!-- set up a pooled XADataSource -->
         <Call name="addDataSource">
             <Arg>jdbc/myDB</Arg>   <!-- client lookup jndi name of datasource  -->
             <!-- set up the datasource -->
             <Arg>
               <!-- Uncomment one of the following types of XADataSource        -->
               <!-- according to your type of database:                         -->
               <!-- New class="org.enhydra.jdbc.sybase.SybaseXADataSource"      -->
               <!-- New class="org.enhydra.jdbc.informix.InformixXADataSource"  -->
               <!-- New class="org.enhydra.jdbc.oracle.OracleXADataSource"      -->
               <New class="org.enhydra.jdbc.standard.StandardXADataSource">
                 <Set name="DriverName">org.hsqldb.jdbcDriver</Set>
                 <Set name="Url">jdbc:hsqldb:extra/etc/tmtest</Set>
                 <Set name="User">sa</Set>
                 <Set name="Password"></Set>
                 <!-- Uncomment to setup isolation level as required            -->
                 <!--
                 <Set name="TransactionIsolation"><Get class="java.sql.Connection" name="TRANSACTION_SERIALIZABLE"/></Set> 
                 -->
               </New>
             </Arg>
             <!-- set up a pool for the datasource -->
             <Arg>
               <New class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
                 <Arg type="Integer">4</Arg>          <!-- initial size of pool -->                
                 <Set name="MinSize">1</Set>                
                 <Set name="MaxSize">2</Set> 
                 <!-- Uncomment to setup other pool params as required          -->
                 <!--
                 <Set name="SleepTime">10</Set>        
                 <Set name="LifeTime">10</Set>         
                 <Set name="DeadLockMaxWait">10</Set>  
                 <Set name="DeadLockRetryWait">10</Set> 
                 <Set name="LoginTimeout">10</Set>      
                 <Set name="Debug" type="boolean">true</Set>
                 -->
               </New>
             </Arg>               
        </Call>
        <!-- set up a DataSource where the driver does the pooling                 -->
        <Call name="addDataSource">
             <Arg>jdbc/otherDB</Arg>   <!-- client lookup jndi name of datasource  -->
             <Arg>
               <New class="org.enhydra.jdbc.standard.StandardXADataSource">
                 <Set name="DriverName">com.mysql.jdbc.Driver</Set>
                 <Set name="Url">jdbc:mysql://localhost:3306/oln </Set>
                 <Set name="User"></Set>
                 <Set name="Password"></Set>
               </New>
             </Arg>
        </Call>
     </New>
   </Arg>
  </Call>
  
  
  <!-- =============================================================== -->  
  <!-- Set up a DataSourceService for non-XA types of DataSources      -->
  <!-- Any number of DataSources can be configured by calling          -->
  <!-- addDataSource().                                                -->
  <!-- =============================================================== --> 
  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.DefaultDataSourceService">
        <Set name="Name">DataSourceService</Set>
        <!-- Add a javax.sql.DataSource. The implementation class can  -->
        <!-- be anything. StandardDataSource from XAPool is used here  -->
        <!-- as an example because it is included with the download.   -->
        <!-- Note that no support for connection pooling will be       -->
        <!-- available for connections from this DataSource unless     -->
        <!-- the DataSource implemenation provides it itself           -->
         <Call name="addDataSource">
             <Arg>jdbc/myNonXADataSource</Arg>  
             <!-- Configure the DataSource impl                        -->
             <Arg>
               <New class="org.enhydra.jdbc.standard.StandardDataSource">
                 <Set name="DriverName">org.hsqldb.jdbcDriver</Set>
                 <Set name="Url">jdbc:hsqldb:extra/etc/tmtest</Set>
                 <Set name="User">sa</Set>
                 <Set name="Password"></Set>
                <!-- bug work around only for StandardDataSource       -->
                 <Set name="Logger">
                   <New class="org.enhydra.jdbc.util.Logger">
                     <Arg>
                       <Call class="org.apache.commons.logging.LogFactory" name="getLog">
                         <Arg>org.enhydra.jdbc.xapool</Arg>
                       </Call>
                     </Arg>
                   </New>
                 </Set>                 
               </New>
             </Arg>
         </Call>
         <!-- Set up a connection pool using JDBC2 interfaces.         -->
         <!-- The DefaultDataSourceService uses XAPool to provide the -->
         <!-- pooling implementation.                                 -->
         <!-- If your driver vendor does not support the              -->
         <!-- javax.sql.ConnectionPoolDataSource interface, use the   -->
         <!-- StandardConnectionPoolDataSource from XAPool as an      -->
         <!-- adapter.                                                -->     
         <Call name="addConnectionPoolDataSource">
           <Arg>jdbc/myPooledDataSource</Arg>
           <Arg>                               
             <New class="org.enhydra.jdbc.standard.StandardConnectionPoolDataSource">
                 <Set name="DriverName">org.hsqldb.jdbcDriver</Set>
                 <Set name="Url">jdbc:hsqldb:extra/etc/tmtest</Set>
                 <Set name="User">sa</Set>
                 <Set name="Password"></Set>
                 <!-- workaround for XAPool bug                       -->
                 <Set name="Logger">
                   <New class="org.enhydra.jdbc.util.Logger">
                     <Arg>
                       <Call class="org.apache.commons.logging.LogFactory" name="getLog">
                         <Arg>org.enhydra.jdbc.xapool</Arg>
                       </Call>
                     </Arg>
                   </New>
                 </Set>                              
             </New>
           </Arg>
           <!-- configure the pool                                   -->
           <Set name="user">sa</Set>   
           <Set name="password"></Set>
           <Set name="minSize">1</Set>
           <Set name="maxSize">5</Set> 
         </Call>        
       </New>
     </Arg>
   </Call>
 

   


  <!-- =============================================================== -->
  <!-- Add a mail service                                              -->
  <!--  You must replace all XXX values below with values appropriate  -->
  <!--  for your installation.                                         -->
  <!-- =============================================================== -->
  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.MailService">
        <Set name="Name">MailService</Set>
        <Set name="JNDI">mail/Session</Set>
	<!-- set up the id of the smtp user                 -->
        <Set name="User">janb</Set>
	<!-- set up the password of the smtp user           -->
        <Set name="Password">Chocolate</Set>
	<!-- set up the hostname/ip addr of the smtp server -->
        <Put name="mail.smtp.host">mail.mortbay.com</Put>
	<!-- setup any javax.mail.smtp provider variables   -->
        <Put name="mail.pop3.user">zzz</Put>
        <Put name="mail.pop3.host">vvv</Put>
        <Put name="mail.from">[EMAIL PROTECTED]</Put>
        <Put name="mail.debug">true</Put>
      </New>
    </Arg>
  </Call>
         

  <!-- =============================================================== -->
  <!-- Configure the Request Listeners                                 -->
  <!-- =============================================================== -->

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add and configure a HTTP listener to port 8080                       -->
  <!-- The default port can be changed using: java -Djetty.port=80     -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.SocketListener">
        <Set name="Port"><SystemProperty name="jetty.port" default="8080"/></Set>
        <Set name="MinThreads">10</Set>
        <Set name="MaxThreads">100</Set>
        <Set name="MaxIdleTimeMs">30000</Set>
        <Set name="LowResourcePersistTimeMs">5000</Set>
      </New>
    </Arg>
  </Call>




  <!-- =============================================================== -->
  <!-- Configure the Contexts                                          -->
  <!-- =============================================================== -->


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Uncomment to configure a list of configurations to be applied   -->
  <!-- to each webapp context.                                         -->
  <!-- Note that order is significant. This can be changed per webapp  -->
  <!-- by calling setConfigurationClassNames() on the webapp context.  -->
  <!--                                                                 -->
  <!-- The jsr77 configuration is optional - if specified, jsr77       -->
  <!-- statistics will be enabled. You will also need to build the     -->
  <!-- extra/jsr77 package, include the jsr77 jars and start Jetty with -->
  <!-- jmx enabled. To make this easier, the JettyPlus start config     -->
  <!-- file sets up the classpath correctly, so make sure you use       -->
  <!-- -DSTART=extra/etc/start-plus.config and see the JettyPlus        -->
  <!-- README.TXT file for instructions on how to run with JMX enabled. -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--
  <Set name="WebApplicationConfigurationClassNames">
    <Array type="java.lang.String">
      <Item>org.mortbay.jetty.plus.PlusWebAppContext$Configuration</Item>
      <Item>org.mortbay.jetty.servlet.JettyWebConfiguration</Item>
      <Item>org.mortbay.jetty.servlet.jsr77.Configuration</Item>
    </Array>
  </Set>
  -->


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add and configure a specific web application                    -->
  <!-- + Set Unpack WAR files                                          -->
  <!-- + Set Default Descriptor.  Resource, file or URL                -->
  <!-- + Set Virtual Hosts. A Null host or empty array means all hosts -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
    <Arg>/jettyplus</Arg>
    <Arg><SystemProperty name="jetty.home"/>/extra/plus/demo/webapps/jettyplus</Arg>
    <!-- uncomment to allow env entries specified in this config file  -->
    <!-- to override env-entrys in web.xml                             -->
    <!--
    <Set name="WebXmlEnvEntryOverride">false</Set>
    -->
    <Call name="addEnvEntry">
      <Arg>my/trivial/name</Arg>
      <Arg type="Integer">99</Arg>
    </Call>
  </Call>


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add tomcat examples                                             -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
      <Arg>/servlets-examples/*</Arg>
      <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/servlets-examples.war</Arg>
      <!-- Uncomment to set up jsr77 statistics specifically for this webapp -->
      <!--
      <Set name="ConfigurationClassNames">
        <Array type="java.lang.String">
          <Item>org.mortbay.jetty.plus.PlusWebAppContext$Configuration</Item>
          <Item>org.mortbay.jetty.servlet.JettyWebConfiguration</Item>
          <Item>org.mortbay.jetty.servlet.jsr77.Configuration</Item>
        </Array>
    </Set>
    -->
  </Call>

  <Call name="addWebApplication">
      <Arg>/jsp-examples/*</Arg>
      <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/jsp-examples.war</Arg>
  </Call>

  <!-- =============================================================== -->
  <!-- Configure the Request Log                                       -->
  <!-- =============================================================== -->
  <Set name="RequestLog">
    <New class="org.mortbay.http.NCSARequestLog">
      <Arg><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Arg>
      <Set name="retainDays">90</Set>
      <Set name="append">true</Set>
      <Set name="extended">false</Set>
      <Set name="buffered">false</Set>
      <Set name="LogTimeZone">GMT</Set>
    </New>
  </Set>

  <!-- =============================================================== -->
  <!-- Configure the Other Server Options                              -->
  <!-- =============================================================== -->
  <Set name="requestsPerGC">2000</Set>
  <Set name="statsOn">false</Set>

</Configure>

Reply via email to