Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Jvm mbeans jmxtran

3,394 views

Published on

Presentation

Published in: Technology
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/2u6xbL5 ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ♥♥♥ http://bit.ly/2u6xbL5 ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Jvm mbeans jmxtran

  1. 1. JVM Inside & monitoring with MBean, jmxtrans, graphite Introduced by: Nghi Nguyen Van ~ March, 22nd 2012 ~ www.exoplatform.com Copyright 2011 eXo Platform
  2. 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. 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 systemThis 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. 4. Purposes of monitoring JVM www.exoplatform.com Copyright 2011 eXo Platform
  5. 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. 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. 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. 8. Why measure – mental model, its not the code ●●●●• We have mental model of the code• mental model, its not the code• Sometime, its wrong• Sometime, it’s a big mistake www.exoplatform.com 8 Copyright 2011 eXo Platform
  9. 9. Why measure – cont. ●●●●• We cant know until we measure it www.exoplatform.com 9 Copyright 2011 eXo Platform
  10. 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. 11. JVM & Memory Structure in JVM www.exoplatform.com Copyright 2011 eXo Platform
  12. 12. Java – how java code executed ●●●● www.exoplatform.com 12 Copyright 2011 eXo Platform
  13. 13. Java Virtual Machine architecture ●●●● www.exoplatform.com 13 Copyright 2011 eXo Platform
  14. 14. Java - JVM Memory Structure – Heap detail ●●●● www.exoplatform.com 14 Copyright 2011 eXo Platform
  15. 15. JMX and MBean www.exoplatform.com Copyright 2011 eXo Platform
  16. 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. 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. 18. The JMX architecture ●●●● www.exoplatform.com 18 Copyright 2011 eXo Platform
  19. 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. 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. 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 MBeans management interface for management agents and management www.exoplatform.com 21 Copyright 2011 eXo Platform
  22. 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. 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 MBeans 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. 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 servers JVM • The MBean server only exposes an MBeans management interface (not the MBeans direct reference) • Also provides standardized interface for accessing MBean within the same JVM www.exoplatform.com 24 Copyright 2011 eXo Platform
  25. 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. 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. 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. 28. Jmxtrans as a JVM query tool www.exoplatform.com Copyright 2011 eXo Platform
  29. 29. Jmxtrans introduction ●●●● • jmxtrans is a tool which allows you to connect to any number of Java Virtual Machines (JVMs) 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. 30. Jmxtrans introduction (cont.) ●●●● www.exoplatform.com 30 Copyright 2011 eXo Platform
  31. 31. Jmxtrans introduction (cont.) ●●●● www.exoplatform.com 31 Copyright 2011 eXo Platform
  32. 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. 33. eXo Platform MBean items (cont.) ●●●● www.exoplatform.com 33 Copyright 2011 eXo Platform
  34. 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. 35. Jmxtrans query – single query – MBean query part ●●●● www.exoplatform.com 35 Copyright 2011 eXo Platform
  36. 36. Jmxtrans query – single query – Output part ●●●● www.exoplatform.com 36 Copyright 2011 eXo Platform
  37. 37. Jmxtrans query – single query – list of query ●●●● www.exoplatform.com 37 Copyright 2011 eXo Platform
  38. 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. 39. Demo graphite as a JVM historical data manager tool www.exoplatform.com Copyright 2011 eXo Platform
  40. 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. 41. eXo Platform JVM historical data ●●●● www.exoplatform.com 41 Copyright 2011 eXo Platform
  42. 42. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 42 Copyright 2011 eXo Platform
  43. 43. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 43 Copyright 2011 eXo Platform
  44. 44. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 44 Copyright 2011 eXo Platform
  45. 45. eXo Platform JVM historical data (cont.) ●●●● www.exoplatform.com 45 Copyright 2011 eXo Platform
  46. 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. 47. Links1. http://code.google.com/p/jmxtrans2. http://graphite.wikidot.com/3. https://wiki-int.exoplatform.org/display/QAF/Graphite4. http://www.oracle.com/technetwork/java/javase/tech/doc5. http:// docs.oracle.com/javase/tutorial/jmx/MBean/index.html6. http://docs.oracle.com/javase/specs/jls/se5.0/html/j3TOC www.exoplatform.com Copyright 2011 eXo Platform
  48. 48. Q&A www.exoplatform.com Copyright 2011 eXo Platform
  49. 49. Thank you! www.exoplatform.com Copyright 2011 eXo Platform

×