Wednesday, 25 July 2018

Introduction to JMX

JMX stands for Java Managing Extensions, it provides a way to monitor and manage remote java applications. Using JMX, you can expose your application attributes, components to management tools like jconsole. This process of exposing components, attributes to management tools is called instrumentation.

By using JMX, 
a.   You can monitor number of threads used by your application
b.   You can trigger request for garbage collection
c. You can even register custom resources using MBeans and monitor, manage them remotely.
d.   You can perform runtime configuration and management
e.   You can keep track of important events and get notifications via predefined listeners. You can use these listeners to log the events, send emails etc.,
f.    Managing the application using JMX is very simple and straight forward. A java developer can learn JMX concepts within a short span of time.
g.   No heavy investment required to monitor/manage the application using JMX

Architecture of JMX technology
JMX technology is divided into three components.
a.   Instrumentation
b.   JMX Agent
c.   Remote Management

Instrumentation
To manage resources using the JMX technology, we need to instrument the resources in the Java programming language. once a resource is instrumented by MBeans (MBean stands for Managed bean), it can be monitored/managed by JMX agent.

JMX Agent
JMX agent directly control the application resources and makes them available to remote management applications. ‘MBean Server’ is the core component of JMX Agent. All the MBean objects are registered with MBean server.

Remote Management
Remote management system allows you to connect to the JMX agent from a remote location. Once you connected to the JMX agent, you can able to monitor/manage the exposed MBean resources.

As shown in below image, MBeans are registered to MBean Server and remote management systems like (jconsole) get access to the beans by contacting MBean Server.




JMX key terms
Manageable Resource: A resource that is accessible for management via JMX. It can be any java object, network resource like printer etc.,

MBean:  It is a java managed bean constructed by some naming and inheritance standards proposed by JMX specification.

JMX specification defines 5 types of MBeans.
a.   Standard MBeans
b.   Dynamic MBeans
c.   Open MBeans
d.   Model MBeans
e.   MXBeans

MBean Server: It is the registry for MBean and responsible for managing MBeans. It provide APIs to identify the MBeans managed by it.

JMX Agent: It is the container for MBean Server. It directly control the resources and make them available to remote management systems.

Adapters and Connectors: These objects reside in JMX agent, expose the agent to remote management system like jconsole. A JMX agent can have multiple adapters and connectors.

Adapter: Provide access to MBeans via different protocols like HTTP, SNMP

Connector: Expose agent APIs to other distributed technologies like RMI. A JMX connector contains two components.
a.   Connector Client
b.   Connector Server
A connector server is attached to an MBean server and listens for connection requests from clients. A connector client is responsible for establishing a connection with the connector server. A connector client usually located in different Java Virtual Machine (JVM). JMX client connects to the MBean in an MBean server, which is located in remote machine via Remote Method Invocation (RMI).

Instrumentation: It is the process of exposing manageable resource using MBean.

MBean: MBean stands for Managed bean, it is a managed resource by JMX agent. It can represent a java object, network device like printer etc.,

MXBean: It is an MBean that references only a pre-defined set of data types.

Who is using JMX technology?
a.   Many application servers like BEA WebLogic, JBOSS already using JMX.
b.   Monitoring systems like IBM Tivoli, HP OpenView using JMX

Is JMX part of Java Standard Edition?
Yes, it is available from Java 2 Platform, Standard Edition (J2SE) 5.0 release.

Can I use JMX technology to monitor and manage JVM?
Yes

In my next post, I am going to explain basic example of JMX.

Previous                                                 Next                                                 Home

No comments:

Post a Comment