JA-SIG 12/4/20051 JMX For Monitoring and Maintenance JA-SIG - December 4, 2005 – Atlanta, GA Eric Dalquist Division of Information Technology University of Wisconsin – Madison
JA-SIG 12/4/20052 The Problem How to monitor and manage JVMs? Heap usage Threads Connection pools Simultaneous users
JA-SIG 12/4/20053 Current Solutions Garbage collector logs –Not the easiest to read –Need to have a session open to each machine Custom monitoring code –Can’t always access interesting information –Code you have to maintain and modify
JA-SIG 12/4/20054 The JMX Solution Java Management eXtensions Open standard (JSR-160) API and tools included with Java 5 Provides both Monitoring and Management
JA-SIG 12/4/20055 Advantages of JMX Standards based means little or no coding Many applications already instrumented Existing tools to connect to MBean servers Frameworks to assist in instrumentation Very little impact on server performance
JA-SIG 12/4/20056 Instrumentation MBeans – Management beans –JavaBean style objects –Provide information Statistics, current state, overall summary –Provide notifications Application events, values out of bounds –Provide management Live configuration changes
JA-SIG 12/4/20057 Instrumentation MBean Server –MBeans are registered with the server –Management tools connect to the server –Aggregates information for tools –Polls MBeans and manages data –Manages MBean access rights
JA-SIG 12/4/20058 Monitoring & Management JMX Client –Can view all exposed MBeans and properties –Monitor multiple MBean servers (JVMs) –Subscribe to MBean event notifications –Modify writeable MBean properties
JA-SIG 12/4/20059 JMX Clients JConsole –Comes with Java 5 and later –Swing based desktop application MC4J –Open source Swing based desktop application –Remembers server configuration –Custom monitoring panel capabilities
JA-SIG 12/4/ JMX Clients JManage –Web based application Multiple users can monitor JVMs –Can connect to multiple JVMs Organize JVMs into clusters –2.0 beta recently released Roadmap includes logging data to a database
JA-SIG 12/4/ JConsole
JA-SIG 12/4/ MC4J
JA-SIG 12/4/ jManage
JA-SIG 12/4/ UW-Madison Metrics gathering for performance tuning –Monitor heap usage and GC activity –Tune caches & resource pools during tests Monitoring production servers –Watch for anomalies –Gather usage statistics
JA-SIG 12/4/ Performance Testing JMX adds another view of JVM metrics Heap usage for all three heap spaces Resource pool usage Cache performance and ratios Thread pool usage and sizing information
JA-SIG 12/4/ JVM Summary
JA-SIG 12/4/ Old Gen Heap
JA-SIG 12/4/ Production Monitoring JConsole & MC4J are used Heap usage for memory leaks Thread pools & session counts for capacity Connection pools for database health Time spent doing garbage collection Portlet output caches & query statistics
JA-SIG 12/4/ Tomcat Thread Pool
JA-SIG 12/4/ Portal Session Count
JA-SIG 12/4/ How To Instrument Spring MBean exporter –Easiest way to expose JavaBeans –Only need to declare beans to be exposed –Limited in exported bean configuration JDK MBean APIs –Powerful API for describing data to export –Non-trivial coding required
JA-SIG 12/4/ JMX & JA-SIG uPortal 3 Beans –Using Spring MBean exporter –Access to caches, thread pools, Hibernate stats Spring based portlets –Export caching, statistics and usage data –Bookmarks Portlet –XSLT Portlet
JA-SIG 12/4/ uPortal 3 RC1 Beans
JA-SIG 12/4/ Bookmarks Portlet
JA-SIG 12/4/ XSLT Portlet