The dump feature in Jetty provides a good snapshot of the status of the threadpool, select sets, classloaders, and so forth. To get maximum detail from the dump, you need to ''setDetailDump(true)'' on any QueuedThreadPools you are using. You can do this by a direct call if you are embedding Jetty, or with the following in jetty.xml:

+

The dump feature in Jetty provides a good snapshot of the status of the threadpool, select sets, classloaders, and so forth. To get maximum detail from the dump, you need to <code>setDetailDump(true)</code> on any QueuedThreadPools you are using. You can do this by a direct call if you are embedding Jetty, or in <code>jetty.xml</code>.

+

+

== Configuring the Dump Feature in jetty.xml==

+

+

You can request that Jetty does a dump immediately after staring and just before stopping by calling the appropriate setters on the Server instance. This can be done in <code>jetty.xml</code> with:

+

+

<source lang="xml">

+

<Set name="dumpAfterStart">true</Set>

+

<Set name="dumpBeforeStop">true</Set>

+

</source>

+

+

=== Extra ThreadPool Information ===

+

Additional detail can be dumped from the QueueudThreadPool if setDetailedDump(true) is called on the thread pool instance. This can be done in <code>jetty.xml</code> as follows:

<source lang="xml">

<source lang="xml">

Line 19:

Line 31:

</source>

</source>

−

There are also two new methods on Server:

+

== Using the Dump Feature via JMX ==

−

<source lang="xml">

+

−

<Set name="dumpAfterStart">true</Set>

+

−

<Set name="dumpBeforeStop">true</Set>

+

−

</source>

+

−

These methods cause a dump at startup (to verify structure) and at shutdown (to see the current state). With ''dumpBeforeStop(true)'', you can hit Ctrl-C at any time to see server status (for example, if it is in 100% or a strange pause).

+

The dump method is on the Server instance and many of it's nested components (Handlers, Connectors etc.). Dumps maybe obtained by calling these methods either in code or via JMX (see [[Jetty/Tutorial/JMX|Configuring Jetty JMX]]).

−

To get a dump that is not so fatal, you can trigger a dump via JMX.

+

The Server MBean has a <code>dump()</code> method, which dumps everything, plus a <code>dumpStdErr()</code> operation that dumps to stderr rather than replying to jconsole.

−

If you are running embedded, set up Jetty JMX mbeans as follows:

+

==Examining a Jetty Hightide Dump==

−

+

−

<source lang=java>

+

−

// Setup JMX

+

−

MBeanContainer mbContainer=new

+

−

MBeanContainer(ManagementFactory.

+

−

getPlatformMBeanServer());

+

−

server.getContainer().addEventListener(mbContainer);

+

−

server.addBean(mbContainer);

+

−

mbContainer.addBean(Log.getLog());

+

−

</source>

+

−

+

−

You can also configure JMX with:

+

−

<source lang=java>

+

−

java -jar start.jar OPTIONS=jmx --pre=etc/jetty-jmx.xml

+

−

</source>

+

−

+

−

A third option is to uncomment the same within start.ini (done by default in Jetty Hightide).

+

−

+

−

Once you enable JMX, you can use jconsole or any other JMX client to see the Jetty mbeans. In jconsole this is under the mbeans tab. You should see many mbeans under org.eclipse.jetty.* name spaces. Many mbeans (handlers, connectors, etc.) now have individual dump() methods; for example you can go to the mbean org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0, call the dump() operation, and see stack traces of the idle threads in that threadpool.

+

−

+

−

The Server mbean also has a dump() method, which dumps everything, plus a dumpStdErr() operation that dumps to stderr rather than replying to jconsole.

+

This is a dump of jetty-hightide with two cometd clients running:

This is a dump of jetty-hightide with two cometd clients running:

−

<br> ^Corg.eclipse.jetty.server.Server@4178460d STOPPING

+

<source lang="text">

+

^Corg.eclipse.jetty.server.Server@4178460d STOPPING

+- org.eclipse.jetty.server.handler.HandlerCollection@16aeea66 STARTED

+- org.eclipse.jetty.server.handler.HandlerCollection@16aeea66 STARTED

Revision as of 18:45, 11 July 2012

Contents

Introduction

The dump feature in Jetty provides a good snapshot of the status of the threadpool, select sets, classloaders, and so forth. To get maximum detail from the dump, you need to setDetailDump(true) on any QueuedThreadPools you are using. You can do this by a direct call if you are embedding Jetty, or in jetty.xml.

Configuring the Dump Feature in jetty.xml

You can request that Jetty does a dump immediately after staring and just before stopping by calling the appropriate setters on the Server instance. This can be done in jetty.xml with:

Using the Dump Feature via JMX

The dump method is on the Server instance and many of it's nested components (Handlers, Connectors etc.). Dumps maybe obtained by calling these methods either in code or via JMX (see Configuring Jetty JMX).

The Server MBean has a dump() method, which dumps everything, plus a dumpStdErr() operation that dumps to stderr rather than replying to jconsole.