SlideShare a Scribd company logo
JVM Inside & monitoring with
 MBean, jmxtrans, graphite




               Introduced by: Nghi Nguyen Van
                     ~ March, 22nd 2012 ~

                                     www.exoplatform.com
                               Copyright 2011 eXo Platform
Agenda                                                                 ●●●●
•   Introduction
•   JVM & Memory Structure in JVM
•   JMX and MBean
•   Jmxtrans as a JVM query tool
•   Demo graphite as a JVM historical data manager tool
•   Tips and tricks
•   Q&A




                                                         www.exoplatform.com
                               2
                                                   Copyright 2011 eXo Platform
Introduction
                                                                              ●●●●
Purpose of this presentation:
      Purposes of monitoring a JVM
      Introduce about a way to monitor a JVM
      Introduce about how to build an eXo product JVM monitoring
           system
This presentation serves to:
● Leaders to understand about performance test reports and to give
  advices & suggestions with performance test reports base on the JVM
  detail information
● Who is new in using JVM monitoring tools
● Testers who have to work directly and often with JVM
  monitoring tools



                                                                www.exoplatform.com
                                     3
                                                          Copyright 2011 eXo Platform
Purposes of monitoring JVM


                         www.exoplatform.com
                   Copyright 2011 eXo Platform
Value of code (Value of a product)                                             ●●●●
Value of a software product
         •   Meet the business requirement
         •   Users satisfaction
         •   Save time and money, give more business value
         •   Rich features
         •   Stable, high performance
         •   Easy to backup/maintain/improve
         •   …




                                                                   www.exoplatform.com
                                   5
                                                             Copyright 2011 eXo Platform
We want to make our code more value                          ●●●●
•   The code generates value when it is used/run/inherit not when we
    write it
•   We need to know how our code performed when it run
•   We cannot do this unless we measure it




                                                            www.exoplatform.com
                                  6
                                                      Copyright 2011 eXo Platform
Why measure                                                ●●●●

•   map ≠ territory
•   map of Ha noi ≠ city of Ha noi
•   the way we talk ≠ the way it is
•   the way we think of ≠ the way itself
•   perception ≠ reality




                                                 www.exoplatform.com
                                    7
                                           Copyright 2011 eXo Platform
Why measure – mental model, it's not the code               ●●●●
•   We have mental model of the code
•   mental model, it's not the code
•   Sometime, it's wrong
•   Sometime, it’s a big mistake




                                                  www.exoplatform.com
                                 8
                                            Copyright 2011 eXo Platform
Why measure – cont.                                        ●●●●
•   We cant know until we measure it




                                             www.exoplatform.com
                                 9
                                       Copyright 2011 eXo Platform
Why measure – cont.                                                                    ●●●●
•   This affect how we make decisions
    •   A better mental model make us better at deciding what to do
    •   A better mental model make us better at generating value
    •   Measuring make our decisions better




                                                                         www.exoplatform.com
                                         10
                                                                   Copyright 2011 eXo Platform
JVM & Memory Structure in JVM


                             www.exoplatform.com
                       Copyright 2011 eXo Platform
Java – how java code executed                       ●●●●




                                      www.exoplatform.com
                       12
                                Copyright 2011 eXo Platform
Java Virtual Machine architecture                       ●●●●




                                          www.exoplatform.com
                       13
                                    Copyright 2011 eXo Platform
Java - JVM Memory Structure – Heap detail                  ●●●●




                                             www.exoplatform.com
                       14
                                       Copyright 2011 eXo Platform
JMX and MBean



            www.exoplatform.com
      Copyright 2011 eXo Platform
What is the JMX                                                                    ●●●●
•   Java Management Extension
    •   It consists of:
                • An architecture
                • Design patterns
                • Java APIs
                • Services for application and network management




                                                                     www.exoplatform.com
                                       16
                                                               Copyright 2011 eXo Platform
What is the JMX (cont.)                                                                 ●●●●
      • Enables Java applications to be managed without heavy
        investment
          – Little impact on Java application design
      • Provides scaleable management architecture
          – Component architecture, pick and choose components
      • Integrates existing management solutions
          – Can be managed via multiple protocols, e.g. SNMP, WBEM, HTTP
          – Information model independent
      • Leverages existing standard Java




                                                                           www.exoplatform.com
                                        17
                                                                    Copyright 2011 eXo Platform
The JMX architecture                            ●●●●




                                  www.exoplatform.com
                       18
                            Copyright 2011 eXo Platform
The JMX architecture (cont.)                                                  ●●●●
 • The JMX architecture defines three levels:
   – Instrumentation Level
       • How to instrument managed resources
   – Server Level
       • How managed resources are managed via the management server
   – Distributed Services Level
       • How distributed clients and management applications access and
         interact with servers and the managed resources in the servers




                                                                www.exoplatform.com
                                   19
                                                          Copyright 2011 eXo Platform
The JMX architecture (cont.)                                                       ●●●●
 • Basic goal
   – In a running Java application, we would like to be able to:
       • Manage existing Java objects:
           – get an attribute value
           – change an attribute value
           – invoke an operation
       • Add new Java objects:
           – using existing Java classes
           – using new classes from an arbitrary location
       • And do all this from a remote location




                                                                     www.exoplatform.com
                                     20
                                                               Copyright 2011 eXo Platform
MBean                                                                        ●●●●
 • MBean: Managed bean. Java class implementing a management
   interface and representing a resource to be managed or
   monitored
 • MBean
   – Defines how resources are instrumented using MBean
   – MBean instrumentation allows the resource to be manageable
     through JMX-compliant agents
 • Notification Model
   – MBean and other JMX components
   may emit notifications
 • MBean Metadata Classes
   – Describes the MBean's management
   interface for management agents
   and management


                                                               www.exoplatform.com
                                  21
                                                         Copyright 2011 eXo Platform
MBean (cont.)                                                                    ●●●●
 • An MBean exposes the management interface of the
   managed resource/object
   – The management interface is the set of information and controls that
     a management application uses to operate on the resource




                                                                   www.exoplatform.com
                                    22
                                                             Copyright 2011 eXo Platform
MBean (cont.)                                                                   ●●●●
 • An MBean exposes the management interface as:
   – Attributes which may be accessed
   – Operations which may be invoked
   – Notifications which may be emitted (optional)
   – Constructors for the MBean's Java class
 • An MBean follows design patterns
   – The way an attribute or operation to be exposed has to be declared
 • An MBean must be registered in the MBean server to be
   visible remotely
 • An MBean does not know about its MBean




                                                                  www.exoplatform.com
                                    23
                                                            Copyright 2011 eXo Platform
MBean (cont.)                                                                 ●●●●
 • The MBean server is a registry of objects which are exposed
   to management operations in a server
   – Only registered MBean can be managed from outside the server's
     JVM
      • The MBean server only exposes an MBean's management
        interface (not the MBean's direct reference)
 • Also provides standardized interface for accessing MBean
   within the same JVM




                                                                www.exoplatform.com
                                  24
                                                          Copyright 2011 eXo Platform
Tools that allow to connect to JVM remotely via JMX
                                                                    ●●●●
 •   Jconsole
 •   visualvm
 •   Memory Analyzer Tool
 •   …




                                                      www.exoplatform.com
                             25
                                                Copyright 2011 eXo Platform
Tools that allow to deal with MBean through web interface
                                                                               ●●●●
 • JBoss jmx console
    – Enable user name and password here: server/default/conf/props/jmx-
      console-users.properties
 • javamelody
 • …




                                                                 www.exoplatform.com
                                    26
                                                           Copyright 2011 eXo Platform
JMX notice – enable JMX RMI connection first
                                                                    ●●●●
 -Dcom.sun.management.jmxremote=true
 -Dcom.sun.management.jmxremote.ssl=false
 -Dcom.sun.management.jmxremote.port=8004
 -Dcom.sun.management.jmxremote.authenticate=false




                                                      www.exoplatform.com
                             27
                                                Copyright 2011 eXo Platform
Jmxtrans as a JVM query tool


                            www.exoplatform.com
                      Copyright 2011 eXo Platform
Jmxtrans introduction
                                                                             ●●●●
 • jmxtrans is a tool which allows you to connect to any
   number of Java Virtual Machines (JVM's) and query them for
   their attributes without writing a single line of Java code
 • The attributes are exported from the JVM via Java
   Management Extensions (JMX)
 • eXo Platform and others implement MBean interface

 • The query language: JSON format.
 • OutputWriters:
    – write output automatically base on class name
    – can output to: graphite, gangila, keyout, RRD...




                                                               www.exoplatform.com
                                      29
                                                         Copyright 2011 eXo Platform
Jmxtrans introduction (cont.)
                                                         ●●●●




                                           www.exoplatform.com
                                30
                                     Copyright 2011 eXo Platform
Jmxtrans introduction (cont.)
                                                         ●●●●




                                           www.exoplatform.com
                                31
                                     Copyright 2011 eXo Platform
eXo Platform MBean items
                                                                               ●●●●
 • eXo JCR session
   – exo:portal="portal",repository="repository",service=SessionRegistry
      • Size
      • TimeOut
 • eXo Cache: collaboration
   – exo:portal="portal",repository="repository",workspace="collaboratio
     n",cache-type=JCR_CACHE,jmx-resource=CacheMgmtInterceptor
      • Size
      • MissCount
      • HitCount
      • Capacity
      • TimeToLive




                                                                 www.exoplatform.com
                                   32
                                                           Copyright 2011 eXo Platform
eXo Platform MBean items (cont.)
                                                       ●●●●




                                         www.exoplatform.com
                            33
                                   Copyright 2011 eXo Platform
Jmxtrans query – single query
                                                                       ●●●●
 •   TARGET_JMX_PORT = eXo product JMX port
 •   TARGET_JMX_HOST = eXo product host address
 •   TARGET_GRAPHITE_HOST = graphite server address
 •   TARGET_GRAPHITE_PORT = graphite server port
 •   outputWriters class:
     com.googlecode.jmxtrans.model.output.GraphiteWriter




                                                         www.exoplatform.com
                                34
                                                   Copyright 2011 eXo Platform
Jmxtrans query – single query – MBean query part             ●●●●




                                               www.exoplatform.com
                         35
                                         Copyright 2011 eXo Platform
Jmxtrans query – single query – Output part
                                                                  ●●●●




                                                    www.exoplatform.com
                             36
                                              Copyright 2011 eXo Platform
Jmxtrans query – single query – list of query
                                                                    ●●●●




                                                      www.exoplatform.com
                              37
                                                Copyright 2011 eXo Platform
Jmxtrans query – wildcard syntax
                                                                      ●●●●
 • Jmxtrans support wildcard syntax
 • typeNames should be defined wildcard applied
    – Purpose is: filtering and classifying




                                                        www.exoplatform.com
                                       38
                                                  Copyright 2011 eXo Platform
Demo graphite as a JVM historical data
                        manager tool


                                    www.exoplatform.com
                              Copyright 2011 eXo Platform
Install & using graphite

    Install graphite

    Build graphite dashboards

    Data calculation while building graphs

    get single image by URL

    Export graph data to csv data format




                                                      www.exoplatform.com
                                                Copyright 2011 eXo Platform
eXo Platform JVM historical data
                                                       ●●●●




                                         www.exoplatform.com
                             41
                                   Copyright 2011 eXo Platform
eXo Platform JVM historical data (cont.)
                                                               ●●●●




                                                 www.exoplatform.com
                              42
                                           Copyright 2011 eXo Platform
eXo Platform JVM historical data (cont.)
                                                               ●●●●




                                                 www.exoplatform.com
                              43
                                           Copyright 2011 eXo Platform
eXo Platform JVM historical data (cont.)
                                                               ●●●●




                                                 www.exoplatform.com
                              44
                                           Copyright 2011 eXo Platform
eXo Platform JVM historical data (cont.)
                                                               ●●●●




                                                 www.exoplatform.com
                              45
                                           Copyright 2011 eXo Platform
Tips & tricks

• Perform jmxtrans.sh start many time until the messgae
  that there is a jmxtrans process exist
• jmxtrans must start after the application start
• use curl, wget… to collect specific data/graph from
  graphite automatically
• use the graphs’ csv datasheet to compare data between
  graphs’ content
• A graph with multiple data lines can hide some
  information from some line. Try to expand into multiple
  graphs
• try to export all the data in a needed term to use later
• Default graphite data history is 24hours, it should be
  changed to longer to avoid missing of needed data

                                                      www.exoplatform.com
                                                Copyright 2011 eXo Platform
Links

1. http://code.google.com/p/jmxtrans
2. http://graphite.wikidot.com/
3. https://wiki-int.exoplatform.org/display/QAF/Graphite
4. http://www.oracle.com/technetwork/java/javase/tech/doc
5. http://
   docs.oracle.com/javase/tutorial/jmx/MBean/index.html
6. http://docs.oracle.com/javase/specs/jls/se5.0/html/j3TOC




                                                  www.exoplatform.com
                                            Copyright 2011 eXo Platform
Q&A


       www.exoplatform.com
 Copyright 2011 eXo Platform
Thank you!


             www.exoplatform.com
       Copyright 2011 eXo Platform

More Related Content

KEY
Jmxtrans presentation
PPTX
JavaFX 8 everywhere; write once run anywhere by Mohamed Taman
ODP
Eureka moment
ODP
The Evolution of Java
PDF
itft-Java evolution
PDF
Ad110 - Unleash the Power of Xpages
PDF
Ad106 - XPages Just Keep Getting Better
PPT
PALASH SL GUPTA
Jmxtrans presentation
JavaFX 8 everywhere; write once run anywhere by Mohamed Taman
Eureka moment
The Evolution of Java
itft-Java evolution
Ad110 - Unleash the Power of Xpages
Ad106 - XPages Just Keep Getting Better
PALASH SL GUPTA

What's hot (19)

PPTX
1 java introduction
PDF
02 java programming features of java i
PPT
The Evolution of Java
PDF
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
PPTX
PDF
Lec 3 01_aug13
PPTX
Java History
PDF
CBDW2014 - Down the RabbitMQ hole with ColdFusion
PPTX
Evolution of java By Abbas khan
ODP
Eureka moment
PDF
History of Java 1/2
PPT
Evolution Of Java
PDF
Ad102 - Extreme Makeover -- LotusScript and Java Editor Edition
PPTX
Java Presentation
PPTX
LUGOD Raspberry Pi Hacking
PDF
NetBeans IDE & Platform
PPTX
An evening with React Native
PDF
November 2009 - Whats Cooking At JBoss Tools
PDF
History of java
1 java introduction
02 java programming features of java i
The Evolution of Java
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
Lec 3 01_aug13
Java History
CBDW2014 - Down the RabbitMQ hole with ColdFusion
Evolution of java By Abbas khan
Eureka moment
History of Java 1/2
Evolution Of Java
Ad102 - Extreme Makeover -- LotusScript and Java Editor Edition
Java Presentation
LUGOD Raspberry Pi Hacking
NetBeans IDE & Platform
An evening with React Native
November 2009 - Whats Cooking At JBoss Tools
History of java
Ad

Viewers also liked (20)

PPT
xoxooo tkmmm
PDF
Tachyon memory centric, fault tolerance storage for cluster framworks
PPTX
teaching methods
PDF
Interactive big data analytics
PDF
Social media strategies for libraries poster
PDF
William Gross Sues Pimco for Hundreds of Millions
PDF
Moving to the Right Side of Safety
PPTX
The Rules - SGS
PPTX
God Is Forgiving
PPTX
Latin Dansları
PPTX
Torque
PPT
Ultimate Platform Hotness Smackdown (Twitter, Facebook, iPhone, Native Web / ...
PPTX
Charitable Giving and Happiness
PDF
Jobs consultant
PDF
Challenging our Notions of Learning: Understanding How Web 2.0 Technology Wor...
DOC
Guia De Estudio Digestivo
PPTX
Balanceo de una ecuación química
PDF
The State of Facilities at Eastern Region Institutions JUNE16
PDF
How to increase traffic to your WordPress website.
PDF
Practica 2 quimica organica -espol
xoxooo tkmmm
Tachyon memory centric, fault tolerance storage for cluster framworks
teaching methods
Interactive big data analytics
Social media strategies for libraries poster
William Gross Sues Pimco for Hundreds of Millions
Moving to the Right Side of Safety
The Rules - SGS
God Is Forgiving
Latin Dansları
Torque
Ultimate Platform Hotness Smackdown (Twitter, Facebook, iPhone, Native Web / ...
Charitable Giving and Happiness
Jobs consultant
Challenging our Notions of Learning: Understanding How Web 2.0 Technology Wor...
Guia De Estudio Digestivo
Balanceo de una ecuación química
The State of Facilities at Eastern Region Institutions JUNE16
How to increase traffic to your WordPress website.
Practica 2 quimica organica -espol
Ad

Similar to Jvm mbeans jmxtran (20)

PPT
Performance testing and reporting with JMeter
PDF
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
PPT
IOC and AOP presentation
PPT
IOC and AOP presentation
PDF
AD116 XPages Extension Library: Making Application Development Even Easier
PDF
Jython in workflow and rules engines
PDF
01/2009 - Portral development with liferay
PPTX
Domino X Pages 8.5
PDF
Are app servers still fascinating
PDF
Soccnx III - Using Social Controls in XPages
PDF
Developing XPages Applications
PDF
eSoftHead - groupware solution
PDF
Microsoft power point automation-opensourcetestingtools_matrix-1
PDF
Microsoft power point automation-opensourcetestingtools_matrix-1
PDF
Ad101 - IBM Lotus Domino Designer: Full Speed Ahead!
PDF
NELotus - OpenNTF.org & XPages Mobile Controls
KEY
Introduction to eXo ECM Suite
PDF
JBPM Past Present Future
PPT
ERP project
PPTX
Mobile applications chapter 5
Performance testing and reporting with JMeter
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
IOC and AOP presentation
IOC and AOP presentation
AD116 XPages Extension Library: Making Application Development Even Easier
Jython in workflow and rules engines
01/2009 - Portral development with liferay
Domino X Pages 8.5
Are app servers still fascinating
Soccnx III - Using Social Controls in XPages
Developing XPages Applications
eSoftHead - groupware solution
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
Ad101 - IBM Lotus Domino Designer: Full Speed Ahead!
NELotus - OpenNTF.org & XPages Mobile Controls
Introduction to eXo ECM Suite
JBPM Past Present Future
ERP project
Mobile applications chapter 5

More from adm_exoplatform (14)

PPT
ODP
E xo mobile_overview_best_practice_in_mobile_application_design
PPT
Advance jquery-plugin
PPT
Development withforce
PPT
PPT
Jquery ui
PPT
PPT
PPT
Java application server in the cloud
PPT
Memory and runtime analysis
PPT
Git training
PPT
Cluster mode and plf cluster
PPT
Cluster mode and plf cluster
E xo mobile_overview_best_practice_in_mobile_application_design
Advance jquery-plugin
Development withforce
Jquery ui
Java application server in the cloud
Memory and runtime analysis
Git training
Cluster mode and plf cluster
Cluster mode and plf cluster

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
Spectroscopy.pptx food analysis technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Jvm mbeans jmxtran

  • 1. JVM Inside & monitoring with MBean, jmxtrans, graphite Introduced by: Nghi Nguyen Van ~ March, 22nd 2012 ~ www.exoplatform.com Copyright 2011 eXo Platform
  • 2. Agenda ●●●● • Introduction • JVM & Memory Structure in JVM • JMX and MBean • Jmxtrans as a JVM query tool • Demo graphite as a JVM historical data manager tool • Tips and tricks • Q&A www.exoplatform.com 2 Copyright 2011 eXo Platform
  • 3. Introduction ●●●● Purpose of this presentation: Purposes of monitoring a JVM Introduce about a way to monitor a JVM Introduce about how to build an eXo product JVM monitoring system This presentation serves to: ● Leaders to understand about performance test reports and to give advices & suggestions with performance test reports base on the JVM detail information ● Who is new in using JVM monitoring tools ● Testers who have to work directly and often with JVM monitoring tools www.exoplatform.com 3 Copyright 2011 eXo Platform
  • 4. Purposes of monitoring JVM www.exoplatform.com Copyright 2011 eXo Platform
  • 5. Value of code (Value of a product) ●●●● Value of a software product • Meet the business requirement • Users satisfaction • Save time and money, give more business value • Rich features • Stable, high performance • Easy to backup/maintain/improve • … www.exoplatform.com 5 Copyright 2011 eXo Platform
  • 6. We want to make our code more value ●●●● • The code generates value when it is used/run/inherit not when we write it • We need to know how our code performed when it run • We cannot do this unless we measure it www.exoplatform.com 6 Copyright 2011 eXo Platform
  • 7. Why measure ●●●● • map ≠ territory • map of Ha noi ≠ city of Ha noi • the way we talk ≠ the way it is • the way we think of ≠ the way itself • perception ≠ reality www.exoplatform.com 7 Copyright 2011 eXo Platform
  • 8. Why measure – mental model, it's not the code ●●●● • We have mental model of the code • mental model, it's not the code • Sometime, it's wrong • Sometime, it’s a big mistake www.exoplatform.com 8 Copyright 2011 eXo Platform
  • 9. Why measure – cont. ●●●● • We cant know until we measure it www.exoplatform.com 9 Copyright 2011 eXo Platform
  • 10. Why measure – cont. ●●●● • This affect how we make decisions • A better mental model make us better at deciding what to do • A better mental model make us better at generating value • Measuring make our decisions better www.exoplatform.com 10 Copyright 2011 eXo Platform
  • 11. JVM & Memory Structure in JVM www.exoplatform.com Copyright 2011 eXo Platform
  • 12. Java – how java code executed ●●●● www.exoplatform.com 12 Copyright 2011 eXo Platform
  • 13. Java Virtual Machine architecture ●●●● www.exoplatform.com 13 Copyright 2011 eXo Platform
  • 14. Java - JVM Memory Structure – Heap detail ●●●● www.exoplatform.com 14 Copyright 2011 eXo Platform
  • 15. JMX and MBean www.exoplatform.com Copyright 2011 eXo Platform
  • 16. What is the JMX ●●●● • Java Management Extension • It consists of: • An architecture • Design patterns • Java APIs • Services for application and network management www.exoplatform.com 16 Copyright 2011 eXo Platform
  • 17. What is the JMX (cont.) ●●●● • Enables Java applications to be managed without heavy investment – Little impact on Java application design • Provides scaleable management architecture – Component architecture, pick and choose components • Integrates existing management solutions – Can be managed via multiple protocols, e.g. SNMP, WBEM, HTTP – Information model independent • Leverages existing standard Java www.exoplatform.com 17 Copyright 2011 eXo Platform
  • 18. The JMX architecture ●●●● www.exoplatform.com 18 Copyright 2011 eXo Platform
  • 19. The JMX architecture (cont.) ●●●● • The JMX architecture defines three levels: – Instrumentation Level • How to instrument managed resources – Server Level • How managed resources are managed via the management server – Distributed Services Level • How distributed clients and management applications access and interact with servers and the managed resources in the servers www.exoplatform.com 19 Copyright 2011 eXo Platform
  • 20. The JMX architecture (cont.) ●●●● • Basic goal – In a running Java application, we would like to be able to: • Manage existing Java objects: – get an attribute value – change an attribute value – invoke an operation • Add new Java objects: – using existing Java classes – using new classes from an arbitrary location • And do all this from a remote location www.exoplatform.com 20 Copyright 2011 eXo Platform
  • 21. MBean ●●●● • MBean: Managed bean. Java class implementing a management interface and representing a resource to be managed or monitored • MBean – Defines how resources are instrumented using MBean – MBean instrumentation allows the resource to be manageable through JMX-compliant agents • Notification Model – MBean and other JMX components may emit notifications • MBean Metadata Classes – Describes the MBean's management interface for management agents and management www.exoplatform.com 21 Copyright 2011 eXo Platform
  • 22. MBean (cont.) ●●●● • An MBean exposes the management interface of the managed resource/object – The management interface is the set of information and controls that a management application uses to operate on the resource www.exoplatform.com 22 Copyright 2011 eXo Platform
  • 23. MBean (cont.) ●●●● • An MBean exposes the management interface as: – Attributes which may be accessed – Operations which may be invoked – Notifications which may be emitted (optional) – Constructors for the MBean's Java class • An MBean follows design patterns – The way an attribute or operation to be exposed has to be declared • An MBean must be registered in the MBean server to be visible remotely • An MBean does not know about its MBean www.exoplatform.com 23 Copyright 2011 eXo Platform
  • 24. MBean (cont.) ●●●● • The MBean server is a registry of objects which are exposed to management operations in a server – Only registered MBean can be managed from outside the server's JVM • The MBean server only exposes an MBean's management interface (not the MBean's direct reference) • Also provides standardized interface for accessing MBean within the same JVM www.exoplatform.com 24 Copyright 2011 eXo Platform
  • 25. Tools that allow to connect to JVM remotely via JMX ●●●● • Jconsole • visualvm • Memory Analyzer Tool • … www.exoplatform.com 25 Copyright 2011 eXo Platform
  • 26. Tools that allow to deal with MBean through web interface ●●●● • JBoss jmx console – Enable user name and password here: server/default/conf/props/jmx- console-users.properties • javamelody • … www.exoplatform.com 26 Copyright 2011 eXo Platform
  • 27. JMX notice – enable JMX RMI connection first ●●●● -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8004 -Dcom.sun.management.jmxremote.authenticate=false www.exoplatform.com 27 Copyright 2011 eXo Platform
  • 28. Jmxtrans as a JVM query tool www.exoplatform.com Copyright 2011 eXo Platform
  • 29. Jmxtrans introduction ●●●● • jmxtrans is a tool which allows you to connect to any number of Java Virtual Machines (JVM's) and query them for their attributes without writing a single line of Java code • The attributes are exported from the JVM via Java Management Extensions (JMX) • eXo Platform and others implement MBean interface • The query language: JSON format. • OutputWriters: – write output automatically base on class name – can output to: graphite, gangila, keyout, RRD... www.exoplatform.com 29 Copyright 2011 eXo Platform
  • 30. Jmxtrans introduction (cont.) ●●●● www.exoplatform.com 30 Copyright 2011 eXo Platform
  • 31. Jmxtrans introduction (cont.) ●●●● www.exoplatform.com 31 Copyright 2011 eXo Platform
  • 32. eXo Platform MBean items ●●●● • eXo JCR session – exo:portal="portal",repository="repository",service=SessionRegistry • Size • TimeOut • eXo Cache: collaboration – exo:portal="portal",repository="repository",workspace="collaboratio n",cache-type=JCR_CACHE,jmx-resource=CacheMgmtInterceptor • Size • MissCount • HitCount • Capacity • TimeToLive www.exoplatform.com 32 Copyright 2011 eXo Platform
  • 33. eXo Platform MBean items (cont.) ●●●● www.exoplatform.com 33 Copyright 2011 eXo Platform
  • 34. Jmxtrans query – single query ●●●● • TARGET_JMX_PORT = eXo product JMX port • TARGET_JMX_HOST = eXo product host address • TARGET_GRAPHITE_HOST = graphite server address • TARGET_GRAPHITE_PORT = graphite server port • outputWriters class: com.googlecode.jmxtrans.model.output.GraphiteWriter www.exoplatform.com 34 Copyright 2011 eXo Platform
  • 35. Jmxtrans query – single query – MBean query part ●●●● www.exoplatform.com 35 Copyright 2011 eXo Platform
  • 36. Jmxtrans query – single query – Output part ●●●● www.exoplatform.com 36 Copyright 2011 eXo Platform
  • 37. Jmxtrans query – single query – list of query ●●●● www.exoplatform.com 37 Copyright 2011 eXo Platform
  • 38. Jmxtrans query – wildcard syntax ●●●● • Jmxtrans support wildcard syntax • typeNames should be defined wildcard applied – Purpose is: filtering and classifying www.exoplatform.com 38 Copyright 2011 eXo Platform
  • 39. Demo graphite as a JVM historical data manager tool www.exoplatform.com Copyright 2011 eXo Platform
  • 40. Install & using graphite  Install graphite  Build graphite dashboards  Data calculation while building graphs  get single image by URL  Export graph data to csv data format www.exoplatform.com Copyright 2011 eXo Platform
  • 41. eXo Platform JVM historical data ●●●● www.exoplatform.com 41 Copyright 2011 eXo Platform
  • 42. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 42 Copyright 2011 eXo Platform
  • 43. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 43 Copyright 2011 eXo Platform
  • 44. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 44 Copyright 2011 eXo Platform
  • 45. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 45 Copyright 2011 eXo Platform
  • 46. Tips & tricks • Perform jmxtrans.sh start many time until the messgae that there is a jmxtrans process exist • jmxtrans must start after the application start • use curl, wget… to collect specific data/graph from graphite automatically • use the graphs’ csv datasheet to compare data between graphs’ content • A graph with multiple data lines can hide some information from some line. Try to expand into multiple graphs • try to export all the data in a needed term to use later • Default graphite data history is 24hours, it should be changed to longer to avoid missing of needed data www.exoplatform.com Copyright 2011 eXo Platform
  • 47. Links 1. http://code.google.com/p/jmxtrans 2. http://graphite.wikidot.com/ 3. https://wiki-int.exoplatform.org/display/QAF/Graphite 4. http://www.oracle.com/technetwork/java/javase/tech/doc 5. http:// docs.oracle.com/javase/tutorial/jmx/MBean/index.html 6. http://docs.oracle.com/javase/specs/jls/se5.0/html/j3TOC www.exoplatform.com Copyright 2011 eXo Platform
  • 48. Q&A www.exoplatform.com Copyright 2011 eXo Platform
  • 49. Thank you! www.exoplatform.com Copyright 2011 eXo Platform

Editor's Notes

  • #10: * "our application is slow, this page takes 5s, fix it!" find the bottleneck! - template rendering? - SQL query? - Session storage? find the bottleneck! - template rendering? - SQL query? - Session storage?
  • #11: * "our application is slow, this page takes 5s, fix it!" find the bottleneck! - template rendering? - SQL query? - Session storage? find the bottleneck! - template rendering? - SQL query? - Session storage?
  • #13: A runtime instance of the Java virtual machine has a clear mission in life: to run one Java application. When a Java application starts, a runtime instance is born. When the application completes, the instance dies. If you start three Java applications at the same time, on the same computer, using the same concrete implementation, you'll get three Java virtual machine instances. Each Java application runs inside its own Java virtual machine.
  • #17: * "our application is slow, this page takes 5s, fix it!" find the bottleneck! - template rendering? - SQL query? - Session storage? find the bottleneck! - template rendering? - SQL query? - Session storage?
  • #19: • Client: Application controlling servers by submitting requests, activating new services, etc ... • Server: Application making local resources available remotely and providing one or more services • MBean server: Registry for MBean in the server • MBean: Managed bean. Java class implementing a management interface and representing a resource to be managed or monitored