Skip to content

Latest commit

 

History

History
189 lines (171 loc) · 11.7 KB

File metadata and controls

189 lines (171 loc) · 11.7 KB

Jetty Server Dump

The dump feature in Jetty provides a snapshot of the bean containment tree of the main Jetty components together with a summary of their configuration. This includes threadpool, connectors, contexts, webapplications, servlets and so forth.

Configuring the Jetty Server Dump

You can request that Jetty do a dump immediately after starting and just before stopping by calling the appropriate setters on the Server instance. For embedded usage this can be used by calling the setters directly.

server.setDumpAfterStart(true);
server.setDumpBeforeStop(true);

Standalone Jetty uses two properties to control this behaviour which are referenced in jetty.xml to call these setters. These properties are jetty.server.dumpAfterStart and jetty.server.dumpBeforeStop.

These can be temporarily enabled by supplying these properties as command line arguments, or they can be enabled via the server.ini file (see [quick-start-configure]).

java -jar $JETTY_HOME/start.jar jetty.server.dumpAfterStart=true jetty.server.dumpBeforeStop=true

Extra ThreadPool Information

To get maximum detail from the QueuedThreadPool in the dump, you need to setDetailDump(true) on any instances of QueuedThreadPool you are using. This extra detail in the detailed dump consists of full stack traces for every running thread, and a list of queued jobs waiting to be run.

For embedded usage this can be used by calling the setters directly.

threadPool.setDetailedDump(true);

For standalone jetty you can enable the threadpool module and configure the jetty.threadPool.detailedDump property. See [startup-modules] for information on how to enable a module. This same property can also be set via the command line the same as the server dump property.

Using the Dump Feature via JMX

The dump method is on the Server instance and many of its nested components (Handlers, Connectors, and so forth). Dumps may be obtained by calling these methods either in code or via JMX (see [using-jmx]).

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

Explanation of the Dump Key

  • +- bean is a java POJO that is contained by the parent object as a bean added with the addBean method.

  • += managed is a bean that is also a LifeCycle that is started and stopped with the parent object.

  • +~ unmanaged is a bean that is also a LifeCycle that is started and stopped with the parent object. It is typically shared with other objects (hence its children are not dumped).

  • +? auto is a bean that has been added to an unstarted parent. If it is a LifeCycle that is not started when the parent is started, then it is started and becomes a managed bean, otherwise it becomes either unmanaged or just a bean.

  • +: iterable is an object that is contained within an iterable field of the parent (eg a list, set etc).

  • +] array is an object that is contained within an array field of the parent.

  • +@ map is an object that is contained within an map field of the parent.

  • +> undefined is an object that is contained within the parent by an undefined relationship.

Jetty Server Dump Example

This is a dump of the OneServletContext embedded example with extra threadpool information:

Server@5ed828d{STARTED}[9.4.32-SNAPSHOT] - STARTED
+= QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}] - STARTED
|  += ReservedThreadExecutor@77e4c80f{s=0/1,p=0} - STARTED
|  +> threads size=8
|  |  +> 13 qtp731260860-13 RUNNABLE 5 SELECTING
|  |  +> 15 qtp731260860-15 TIMED_WAITING 5 IDLE
|  |  +> 17 qtp731260860-17 TIMED_WAITING 5 IDLE
|  |  +> 14 qtp731260860-14-acceptor-0@2bf41367-ServerConnector@614ddd49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} RUNNABLE 3 ACCEPTING
|  |  +> 18 qtp731260860-18 TIMED_WAITING 5 IDLE
|  |  +> 19 qtp731260860-19 TIMED_WAITING 5 IDLE
|  |  +> 16 qtp731260860-16 TIMED_WAITING 5 IDLE
|  |  +> 12 qtp731260860-12 RUNNABLE 5 SELECTING
|  +> jobs size=0
+= ServerConnector@614ddd49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} - STARTED
|  +~ Server@5ed828d{STARTED}[9.4.32-SNAPSHOT] - STARTED
|  +~ QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}] - STARTED
|  += ScheduledExecutorScheduler@35fc6dc4{STARTED} - STARTED
|  +- org.eclipse.jetty.io.ArrayByteBufferPool@7fe8ea47
|  += HttpConnectionFactory@71bbf57e[HTTP/1.1] - STARTED
|  |  +- HttpConfiguration@226a82c4{32768/8192,8192/8192,https://:0,[]}
|  |     +> customizers size=0
|  |     +> formEncodedMethods size=2
|  |     |  +> POST
|  |     |  +> PUT
|  |     +> outputBufferSize=32768
|  |     +> outputAggregationSize=8192
|  |     +> requestHeaderSize=8192
|  |     +> responseHeaderSize=8192
|  |     +> headerCacheSize=1024
|  |     +> secureScheme=https
|  |     +> securePort=0
|  |     +> idleTimeout=-1
|  |     +> blockingTimeout=-1
|  |     +> sendDateHeader=true
|  |     +> sendServerVersion=true
|  |     +> sendXPoweredBy=false
|  |     +> delayDispatchUntilContent=true
|  |     +> persistentConnectionsEnabled=true
|  |     +> maxErrorDispatches=10
|  |     +> minRequestDataRate=0
|  |     +> minResponseDataRate=0
|  |     +> cookieCompliance=RFC6265
|  |     +> setRequestCookieCompliance=RFC6265
|  |     +> notifyRemoteAsyncErrors=true
|  |     +> relativeRedirectAllowed=false
|  += SelectorManager@ServerConnector@614ddd49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} - STARTED
|  |  += ManagedSelector@2b4a2ec7{STARTED} id=0 keys=0 selected=0 updates=0 - STARTED
|  |  |  += EatWhatYouKill@564718df/SelectorProducer@51b7e5df/PRODUCING/p=false/QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}][pc=0,pic=0,pec=0,epc=0]@2020-09-03T15:01:52.497766+10:00 - STARTED
|  |  |  |  +- SelectorProducer@51b7e5df
|  |  |  |  +~ QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}] - STARTED
|  |  |  +> updates @ 2020-09-03T15:01:52.493299+10:00 size=0
|  |  |  +> keys @ 2020-09-03T15:01:52.494024+10:00 size=0
|  |  += ManagedSelector@18a70f16{STARTED} id=1 keys=0 selected=0 updates=0 - STARTED
|  |     += EatWhatYouKill@62e136d3/SelectorProducer@c8e4bb0/PRODUCING/p=false/QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}][pc=0,pic=0,pec=0,epc=0]@2020-09-03T15:01:52.499773+10:00 - STARTED
|  |     |  +- SelectorProducer@c8e4bb0
|  |     |  +~ QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}] - STARTED
|  |     +> updates @ 2020-09-03T15:01:52.498655+10:00 size=0
|  |     +> keys @ 2020-09-03T15:01:52.49884+10:00 size=0
|  +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080]
|  +- qtp731260860-14-acceptor-0@2bf41367-ServerConnector@614ddd49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
+= AttributeContainerMap@6279cee3{size=0} - STARTED
+= o.e.j.s.ServletContextHandler@3444d69d{/,file:///tmp/,AVAILABLE} - STARTED
|  += org.eclipse.jetty.server.session.SessionHandler1904324159==dftMaxIdleSec=-1 - STARTED
|  |  += ServletHandler@4206a205{STARTED} - STARTED
|  |  |  +> listeners ServletHandler@4206a205{STARTED} size=2
|  |  |  |  +> ListenerHolder@29ba4338{STARTED}: org.eclipse.jetty.embedded.OneServletContext$InitListener - STARTED
|  |  |  |  +> ListenerHolder@57175e74{STARTED}: org.eclipse.jetty.embedded.OneServletContext$RequestListener - STARTED
|  |  |  +> filters ServletHandler@4206a205{STARTED} size=2
|  |  |  |  +> org.eclipse.jetty.embedded.OneServletContext$TestFilter-44c8afef@44c8afef==org.eclipse.jetty.embedded.OneServletContext$TestFilter,inst=true,async=true - STARTED
|  |  |  |  |  +> org.eclipse.jetty.embedded.OneServletContext$TestFilter@7bb58ca3
|  |  |  |  +> org.eclipse.jetty.embedded.OneServletContext$TestFilter-46daef40@46daef40==org.eclipse.jetty.embedded.OneServletContext$TestFilter,inst=true,async=true - STARTED
|  |  |  |     +> org.eclipse.jetty.embedded.OneServletContext$TestFilter@c540f5a
|  |  |  +> filterMappings ServletHandler@4206a205{STARTED} size=2
|  |  |  |  +> [/test/*]/[]/[REQUEST]=>org.eclipse.jetty.embedded.OneServletContext$TestFilter-44c8afef
|  |  |  |  +> [*.test]/[]/[ASYNC, REQUEST]=>org.eclipse.jetty.embedded.OneServletContext$TestFilter-46daef40
|  |  |  +> servlets ServletHandler@4206a205{STARTED} size=3
|  |  |  |  +> org.eclipse.jetty.embedded.HelloServlet-42d8062c@2eda1f60==org.eclipse.jetty.embedded.HelloServlet,jsp=null,order=-1,inst=false,async=true - STARTED
|  |  |  |  |  +> class org.eclipse.jetty.embedded.HelloServlet
|  |  |  |  +> debug@5b09653==org.eclipse.jetty.embedded.DumpServlet,jsp=null,order=-1,inst=false,async=true - STARTED
|  |  |  |  |  +> class org.eclipse.jetty.embedded.DumpServlet
|  |  |  |  +> org.eclipse.jetty.servlet.DefaultServlet-59906517@ad9ec77f==org.eclipse.jetty.servlet.DefaultServlet,jsp=null,order=-1,inst=false,async=true - STARTED
|  |  |  |     +> class org.eclipse.jetty.servlet.DefaultServlet
|  |  |  +> servletMappings ServletHandler@4206a205{STARTED} size=4
|  |  |     +> [/hello/*]=>org.eclipse.jetty.embedded.HelloServlet-42d8062c
|  |  |     +> [/dump/*]=>debug
|  |  |     +> [*.dump]=>debug
|  |  |     +> [/]=>org.eclipse.jetty.servlet.DefaultServlet-59906517
|  |  += org.eclipse.jetty.server.session.DefaultSessionCache@2357d90a[evict=-1,removeUnloadable=false,saveOnCreate=false,saveOnInactiveEvict=false] - STARTED
|  |  |  += org.eclipse.jetty.server.session.NullSessionDataStore@6328d34a[passivating=false,graceSec=3600] - STARTED
|  |  +~ DefaultSessionIdManager@145eaa29{STARTED}[worker=node0] - STARTED
|  +> No ClassLoader
|  +> eventListeners o.e.j.s.ServletContextHandler@3444d69d{/,file:///tmp/,AVAILABLE} size=2
|  |  +> org.eclipse.jetty.embedded.OneServletContext$InitListener@15bb6bea
|  |  +> org.eclipse.jetty.embedded.OneServletContext$RequestListener@8b96fde
|  +> handler attributes o.e.j.s.ServletContextHandler@3444d69d{/,file:///tmp/,AVAILABLE} size=1
|  |  +> org.eclipse.jetty.server.Executor=QueuedThreadPool[qtp731260860]@2b9627bc{STARTED,8<=8<=10,i=5,r=1,q=0}[ReservedThreadExecutor@77e4c80f{s=0/1,p=0}]
|  +> context attributes o.e.j.s.ServletContextHandler@3444d69d{/,file:///tmp/,AVAILABLE} size=2
|  |  +> org.eclipse.jetty.util.DecoratedObjectFactory=org.eclipse.jetty.util.DecoratedObjectFactory[decorators=1]
|  |  +> X-Init=true
|  +> initparams o.e.j.s.ServletContextHandler@3444d69d{/,file:///tmp/,AVAILABLE} size=0
+= ErrorHandler@4c40b76e{STARTED} - STARTED
+= DefaultSessionIdManager@145eaa29{STARTED}[worker=node0] - STARTED
|  += HouseKeeper@dbd940d{STARTED}[interval=600000, ownscheduler=true] - STARTED
+> jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15
   +> jdk.internal.loader.ClassLoaders$PlatformClassLoader@2ea6137
key: +- bean, += managed, +~ unmanaged, +? auto, +: iterable, +] array, +@ map, +> undefined