Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Feature/Statistics"

< Jetty‎ | Feature
Line 7: Line 7:
 
In addition to that, subclasses of [http://dev.eclipse.org/viewcvs/index.cgi/jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java?revision=1213&root=RT_Jetty&view=markup AbstractSessionHandler] optionally can collect session statistics.
 
In addition to that, subclasses of [http://dev.eclipse.org/viewcvs/index.cgi/jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java?revision=1213&root=RT_Jetty&view=markup AbstractSessionHandler] optionally can collect session statistics.
 
   
 
   
To view statistics, you have to be able to connect to Jetty using either JConsole or some other JMX agent. The Statistics Handler is not included in default Jetty configuration, and needs to be configured manually. AbstractConnector and AbstractSessionHandler statistics are turned off by default and must either be configured manually for each individual instance or turned on via JMX interface.
+
AbstractConnector and AbstractSessionHandler statistics are turned off by default and must either be configured manually for each instance or turned on via JMX interface. The Statistics Handler is not included in default Jetty configuration, and needs to be configured manually.  
 +
 
 +
To view statistics, you have to be able to connect to Jetty using either JConsole or some other JMX agent.
 
| body =
 
| body =
 
==Connector statistics==
 
==Connector statistics==
  
Detailed statistics on connection duration and number of requests are only collated when a connection is closed. The current and maximum number of connections is the only "live" statisticThe following example shows how to turn on connector statistics in jetty.xml, although this is not recommended and it is best to use a JMX agent to select statistics only when needed.
+
Detailed statistics on connection duration and number of requests are only collated when a connection is closed. The current and maximum number of connections are the only "live" statisticsTo learn how to turn on connector statistics please see [[Jetty/Tutorial/Statistics|Jetty Statistics tutorial]], although this is not recommended and it is best to use a JMX agent to select statistics only when needed.
 
+
<source lang="xml">
+
<Item>
+
  <New class="org.mortbay.jetty.nio.SelectChannelConnector">
+
    <Set name="port">8080</Set>
+
    <Set name="maxIdleTime">30000</Set>
+
    <Set name="lowResourceMaxIdleTime">3000</Set>
+
    <Set name="Acceptors">1</Set>
+
    <Set name="StatsOn">true</Set>
+
  </New>
+
</Item>
+
</source>
+
  
 
==Request Statistics==
 
==Request Statistics==
  
To collect request statistics a StatisticsHandler must be configured as one of the handlers of the server. Typically this can be done as the top level handler, but you may choose to configure a statistics handler for just one context by creating a context configuration file. The following jetty.xml fragment shows how to configure a top level statistics handler:
+
To collect request statistics a StatisticsHandler must be configured as one of the handlers of the server. Typically this can be done as the top level handler, but you may choose to configure a statistics handler for just one context by creating a context configuration file. To learn how to configure a top level statistics handler, please see [[Jetty/Tutorial/Statistics|Jetty Statistics tutorial]].
 
+
<source lang="xml">
+
<!-- =========================================================== -->
+
<!-- Set handler Collection Structure                            -->
+
<!-- =========================================================== -->
+
<Set name="handler">
+
  <New class="org.mortbay.jetty.handler.StatisticsHandler">
+
    <Set name="handler">
+
      <New id="handlers" class="org.mortbay.jetty.handler.HandlerCollection">
+
        <Set name="handlers">
+
        <Array type="org.mortbay.jetty.Handler">
+
          <Item><New id="contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/></Item>
+
          <Item><New id="defaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/></Item>
+
          <Item><New id="requestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/></Item>
+
        </Array>
+
        </Set>
+
      </New>
+
    </Set>
+
  </New>
+
</Set>
+
</source>
+
  
 
==Session Statistics==
 
==Session Statistics==
  
Session handling is automatically included in Jetty for any servlet or webapp context. Detailed statistics on session duration are only collated when a session is closed. The current, minimum, and maximum number of sessions is the only "live" statisticAlthough it is possible to turn on session statistics in the context configuration file, this is not recommended and it is best to use a JMX agent to select statistics only when needed.
+
Session handling is built into Jetty for any servlet or webapp context. Detailed statistics on session duration are only collated when a session is closed. The current, minimum, and maximum number of sessions are the only "live" statisticsTo learn how to turn on session statistics for a single context please see [[Jetty/Tutorial/Statistics|Jetty Statistics tutorial]], although this is not recommended and it is best to use a JMX agent to select statistics only when needed.
 
| more =
 
| more =
 
See [http://wiki.eclipse.org/Jetty/Tutorial/JMX Jetty JMX tutorial] for instructions on how to configure Jetty JMX integration.
 
See [http://wiki.eclipse.org/Jetty/Tutorial/JMX Jetty JMX tutorial] for instructions on how to configure Jetty JMX integration.
 
| category = [[Category:Jetty Feature]]
 
| category = [[Category:Jetty Feature]]
 
}}
 
}}

Revision as of 09:20, 13 February 2010



Introduction

Jetty currently has two levels of request statistic collection:

In addition to that, subclasses of AbstractSessionHandler optionally can collect session statistics.

AbstractConnector and AbstractSessionHandler statistics are turned off by default and must either be configured manually for each instance or turned on via JMX interface. The Statistics Handler is not included in default Jetty configuration, and needs to be configured manually.

To view statistics, you have to be able to connect to Jetty using either JConsole or some other JMX agent.

Feature

Connector statistics

Detailed statistics on connection duration and number of requests are only collated when a connection is closed. The current and maximum number of connections are the only "live" statistics. To learn how to turn on connector statistics please see Jetty Statistics tutorial, although this is not recommended and it is best to use a JMX agent to select statistics only when needed.

Request Statistics

To collect request statistics a StatisticsHandler must be configured as one of the handlers of the server. Typically this can be done as the top level handler, but you may choose to configure a statistics handler for just one context by creating a context configuration file. To learn how to configure a top level statistics handler, please see Jetty Statistics tutorial.

Session Statistics

Session handling is built into Jetty for any servlet or webapp context. Detailed statistics on session duration are only collated when a session is closed. The current, minimum, and maximum number of sessions are the only "live" statistics. To learn how to turn on session statistics for a single context please see Jetty Statistics tutorial, although this is not recommended and it is best to use a JMX agent to select statistics only when needed.

Additional Resources

See Jetty JMX tutorial for instructions on how to configure Jetty JMX integration.

Back to the top