SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
JMX 2.0
The forgotten source
Jaroslav Bachorik
Staff Software
Engineer
Datadog
> 2000
> JMX 1.0
> The first version, JMX 1.0
> It established the core concepts and >
architecture that include MBeans
(Managed Beans), the MBeanServer, and
various services for monitoring and
management
> 2004
> JMX 1.2
> This version brought enhancements to
ease the development of management and
monitoring solutions. It included
improvements in the MBean model and the
overall API
> 2004
> JMX in Java 5 SE
> JMX became part of the standard Java platform. This integration greatly increased its
adoption, as it became available in all standard Java distributions
> Minor improvements (generics) for Java 6 in 2006
> JMX APIs are at Java 6 level
> Naming convention based
> Minimal support for annotations
> Long term open issues and improvements
> Security concerns
> Performance
> Ease of use
> JMX Annotations
> JDK-8044507 (JEP)
> By yours truly
> Update the JMX APIs to allow using
annotations to register and use MBeans
> JEP created in 2014 then went dormant
> Builds on JSR 255
> more comprehensive JMX spec update
> created: 2004
> withdrawn: 2016
> never fully implemented
> JMX Rest Connector
> JDK-8171311 (JEP)
> Provide a lightweight REST connector
> default instead of aging RMI
> JEP created in 2016, closed 2018
> considered unnecessary due eg.
Jolokia
> JMX still works only via RMI OOTB
> Improved Key Management
> Non-public issue (sec related)
> Allow SSH-like experience
> no more fumbling with keystore and
certstore on client and server
> Not sure about its fate
> most probably cancelled as well
> JMX Annotations
> Simple service
> A simple service MXBean
> Custom description for service, attributes and operations
> Custom units for attributes and operations
> Notification support
> “Traditional” JMX
> Needs SimpleServiceMXBean interface
> Needs SimpleServiceMXBeanImpl implementation
> For custom descriptions
> Create custom MBeanInfo for the service
> Implement DynamicMBean with reflective operation/attribute access
> For notifications
> SimpleServiceMXBean extends NotificationEmitter
> SimpleServiceMXBeanImpl implements NotificationBroadcaster
> SimpleServiceMXBeanImpl delegates to NotificationBroadcasterSupport
> SimpleServiceMXBeanImpl provides MBeanNotificationInfos
> Lot of boilerplate!
> JMX Annotations
> Managed service
@ManagedService(
objectName="net.java.jmx:type=StandardService",
description="A simple service exposed as an MXBean",
service=Service.class,
tags = {
@Tag(name = "tag1", value = "val1"),
@Tag(name = "tag2", value = "val2")
}
)
public class SimpleService {
…
}
> JMX Annotations
> Managed service
@ManagedService(
objectName="net.java.jmx:type=StandardService",
description="A simple service exposed as an MXBean",
service=Service.class,
tags = {
@Tag(name = "tag1", value = "val1"),
@Tag(name = "tag2", value = "val2")
}
)
public class SimpleService {
…
}
Freeform service name
Included ObjectName
Included description
Custom service class
Freeform tags
> JMX Annotations
> Managed attributes
public class SimpleService {
// A write-only attribute measured in "ticks"
@ManagedAttribute(access = AttributeAccess.WRITE, units = "ticks")
int counter = 1;
// A read-only attribute being an array of strings
@ManagedAttribute(access = AttributeAccess.READ,
description = "ReadOnly Attribute")
String[] arr = new String[]{"sa", "ba", "ca"};
// Declare a read-write attribute ...
@ManagedAttribute(access = AttributeAccess.READWRITE,
tags = {
@Tag(name = "tag1", value = "val1"),
@Tag(name = "tag2", value = "val2")
}
)
private String label = "the label";
…
}
> JMX Annotations
> Managed attributes
public class SimpleService {
// A write-only attribute measured in "ticks"
@ManagedAttribute(access = AttributeAccess.WRITE, units = "ticks")
int counter = 1;
// A read-only attribute being an array of strings
@ManagedAttribute(access = AttributeAccess.READ,
description = "ReadOnly Attribute")
String[] arr = new String[]{"sa", "ba", "ca"};
// Declare a read-write attribute ...
@ManagedAttribute(access = AttributeAccess.READWRITE,
tags = {
@Tag(name = "tag1", value = "val1"),
@Tag(name = "tag2", value = "val2")
}
)
private String label = "the label";
…
}
Attribute access
Support for units
Included description
Freeform tags
Custom getters/setters
> JMX Annotations
> Managed operations
public class SimpleService {
// an operation modifying the 'counter' attribute
@ManagedOperation(impact = Impact.ACTION,
description = "Increases the associated counter by 1")
public int count() {
return ++counter;
}
// an operation declaring custom 'units' metadata for one of its parameters
@ManagedOperation
public void checkTime(@Parameter(units = "ms") long ts) {
System.err.println(new Date(ts));
}
…
}
> JMX Annotations
> Managed operations
public class SimpleService {
// an operation modifying the 'counter' attribute
@ManagedOperation(impact = Impact.ACTION,
description = "Increases the associated counter by 1")
public int count() {
return ++counter;
}
// an operation declaring custom 'units' metadata for one of its parameters
@ManagedOperation
public void checkTime(@ParameterInfo(units = "ms") long ts) {
System.err.println(new Date(ts));
}
…
}
Service impact
Included description
Metadata for parameters
Custom units
Freeform tags
> JMX Annotations
> Notifications
public class SimpleService {
@NotificationInfos({
@NotificationInfo(types = "test.mbean.label", description = "Label was set")
@NotificationInfo(types = "test.mbean.threshold", description = "Counter threshold reached")
})
private NotificationSender ns;
@ManagedAttribute
public void setLabel(String l) {
ns.sendNotification("test.mbean.label", "Label set", l);
label = l;
}
@ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1")
public int count() {
if (counter >= 5) {
ns.sendNotification("test.mbean.threshold", "Threshold reached", counter);
}
return ++counter;
}
…
}
> JMX Annotations
> Notifications
public class SimpleService {
@NotificationInfos({
@NotificationInfo(types = "test.mbean.label", description = "Label was set")
@NotificationInfo(types = "test.mbean.threshold", description = "Counter threshold reached")
})
private NotificationSender ns;
@ManagedAttribute
public void setLabel(String l) {
ns.sendNotification("test.mbean.label", "Label set", l);
label = l;
}
@ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1")
public int count() {
if (counter >= 5) {
ns.sendNotification("test.mbean.threshold", "Threshold reached", counter);
}
return ++counter;
}
…
}
Injected notification sender
Notification info types
Simple emitter
> JMX Annotations
> Custom registration handler
public class SimpleService {
// handle the registration/unregsitration of the MBean
@RegistrationHandler
public void onRegistration(RegistrationEvent re) {
switch(re.getKind()) {
case REGISTER: {
System.err.println("Registered " + re.getObjectName().getCanonicalName());
break;
}
case UNREGISTER: {
System.err.println("Unregistered " + re.getObjectName().getCanonicalName());
break;
}
}
}
…
}
> JMX Annotations
> Custom registration handler
public class SimpleService {
// handle the registration/unregsitration of the MBean
@RegistrationHandler
public void onRegistration(RegistrationEvent re) {
switch(re.getKind()) {
case REGISTER: {
System.err.println("Registered " + re.getObjectName().getCanonicalName());
break;
}
case UNREGISTER: {
System.err.println("Unregistered " + re.getObjectName().getCanonicalName());
break;
}
}
}
…
}
Simple registration listener
‘When-registered’ hook
‘When-unregistered’ hook
> JMX Annotations
> Where to get it?
GitHub!
> https://github.com/DataDog/openjdk-jdk/tree/jb/jmx_annotations
> https://github.com/DataDog/openjdk-jdk/pull/4
> JMX REST Connector
> Simple, self-contained implementation
> Base URL - http[s]://<host_name>:<port>/jmx/default
> auto-discovery capable - JDP, perf-counter, JCMD
> Endpoints
> <root>/mbeans
GET : list of all registered MBeans
> <root>/<mbean_name>
GET : get corresponding MBeanInfo
> <root>/<mbean_name>/<attribute_name>
GET : get the attribute value
> <root>/<mbean_name>/?attributes=a,b,c|all
GET : get values of multiple MBean attributes
> <root>/domains
GET : get all available domains
> <root>/?domain=default
GET : get default domain
> <root>/?domain=<domain_name>/mbeans
GET : list of all MBeans in the domain
> JMX REST Connector
> Advanced Query
> Use HTTP POST
> Query JSON
[
{
"name": "<mbean_name_1>",
"read"|"write"|"exec": "<param_name/exec_name>",
"arguments" : {
…
}
},{
"name": "<mbean_name_2>",
"read"|"write"|"exec": "<param_name/exec_name>",
"arguments" : {
…
}
},
]
> JMX REST Connector
> Advanced Query
> Use HTTP POST
> Query JSON
[
{
"name": "<mbean_name_1>",
"read"|"write"|"exec": "<param_name/exec_name>",
"arguments" : {
…
}
},{
"name": "<mbean_name_2>",
"read"|"write"|"exec": "<param_name/exec_name>",
"arguments" : {
…
}
},
]
Multiple queries per request
Query specification
Optional arguments
> JMX REST Connector
> Query Response
> Wrapped in
// success
{
"status": 200,
"request": {
original HTTP request
},
"response": {
result of above request
}
}
// error
{
"status": 4XX/5XX,
"request": {
original HTTP request
},
"error": "<error message>"
}
> JMX REST Connector
> Query Response Body
> Java->JSON auto-serialization for
- MXBeans
- OpenMBeans
- String, primitive values and arrays of them
- BigInteger, BigDecimal
- Date, ObjectName, CompositeData, TabularData
> JMX REST Connector
> Mostly working but abandoned
> Harsha Wardhana’s CR space
> https://cr.openjdk.org/~hb/8171311/webrev.01/
> might be up for adoption(?)
> Summary
> JMX feels outdated
> Labour intensive APIs
> Coupled with RMI
> Needs persistent connection and pull loop from client
> There are proposals to improve it
> Evolution rather than revolution
> Some parts almost fully functional
> Million Dollar Question
> Has JMX any future?
> Who is willing to invest?
It’s a wrap-up!
Thanks, Qs are welcome!
Jaroslav Bachorik
X:
@Bachorik
J
GH: jbachorik All images generated by Dall-E

Contenu connexe

Similaire à JMX 2.0 - the Forgotten Source.pptx

What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFMax Katz
 
Google Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixGoogle Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixMax Kuzkin
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09Daniel Bryant
 
Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Particular Software
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1MariaDB plc
 
DrupalCafe4 Kiev Services
DrupalCafe4 Kiev ServicesDrupalCafe4 Kiev Services
DrupalCafe4 Kiev ServicesYuriy Gerasimov
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Memcached Functions For My Sql Seemless Caching In My Sql
Memcached Functions For My Sql Seemless Caching In My SqlMemcached Functions For My Sql Seemless Caching In My Sql
Memcached Functions For My Sql Seemless Caching In My SqlMySQLConference
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces Skills Matter
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioGünter Obiltschnig
 
Rich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFXRich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFXMax Katz
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4RapidValue
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2MariaDB plc
 

Similaire à JMX 2.0 - the Forgotten Source.pptx (20)

What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSF
 
Google Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixGoogle Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with Zabbix
 
Library Project
Library ProjectLibrary Project
Library Project
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
 
Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code
 
J boss
J bossJ boss
J boss
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
 
DrupalCafe4 Kiev Services
DrupalCafe4 Kiev ServicesDrupalCafe4 Kiev Services
DrupalCafe4 Kiev Services
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
Memcached Functions For My Sql Seemless Caching In My Sql
Memcached Functions For My Sql Seemless Caching In My SqlMemcached Functions For My Sql Seemless Caching In My Sql
Memcached Functions For My Sql Seemless Caching In My Sql
 
Reactive Data System
Reactive Data SystemReactive Data System
Reactive Data System
 
Mysql
MysqlMysql
Mysql
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.io
 
struts
strutsstruts
struts
 
Rich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFXRich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFX
 
Migration to Extent Report 4
Migration to Extent Report 4Migration to Extent Report 4
Migration to Extent Report 4
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2
 
MariaDB training
MariaDB trainingMariaDB training
MariaDB training
 

Dernier

WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
Novo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNovo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNeo4j
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 

Dernier (20)

WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Novo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNovo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMs
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in Uganda
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 

JMX 2.0 - the Forgotten Source.pptx

  • 1. JMX 2.0 The forgotten source Jaroslav Bachorik Staff Software Engineer Datadog
  • 2. > 2000 > JMX 1.0 > The first version, JMX 1.0 > It established the core concepts and > architecture that include MBeans (Managed Beans), the MBeanServer, and various services for monitoring and management > 2004 > JMX 1.2 > This version brought enhancements to ease the development of management and monitoring solutions. It included improvements in the MBean model and the overall API > 2004 > JMX in Java 5 SE > JMX became part of the standard Java platform. This integration greatly increased its adoption, as it became available in all standard Java distributions > Minor improvements (generics) for Java 6 in 2006
  • 3. > JMX APIs are at Java 6 level > Naming convention based > Minimal support for annotations > Long term open issues and improvements > Security concerns > Performance > Ease of use
  • 4. > JMX Annotations > JDK-8044507 (JEP) > By yours truly > Update the JMX APIs to allow using annotations to register and use MBeans > JEP created in 2014 then went dormant > Builds on JSR 255 > more comprehensive JMX spec update > created: 2004 > withdrawn: 2016 > never fully implemented > JMX Rest Connector > JDK-8171311 (JEP) > Provide a lightweight REST connector > default instead of aging RMI > JEP created in 2016, closed 2018 > considered unnecessary due eg. Jolokia > JMX still works only via RMI OOTB > Improved Key Management > Non-public issue (sec related) > Allow SSH-like experience > no more fumbling with keystore and certstore on client and server > Not sure about its fate > most probably cancelled as well
  • 5. > JMX Annotations > Simple service > A simple service MXBean > Custom description for service, attributes and operations > Custom units for attributes and operations > Notification support > “Traditional” JMX > Needs SimpleServiceMXBean interface > Needs SimpleServiceMXBeanImpl implementation > For custom descriptions > Create custom MBeanInfo for the service > Implement DynamicMBean with reflective operation/attribute access > For notifications > SimpleServiceMXBean extends NotificationEmitter > SimpleServiceMXBeanImpl implements NotificationBroadcaster > SimpleServiceMXBeanImpl delegates to NotificationBroadcasterSupport > SimpleServiceMXBeanImpl provides MBeanNotificationInfos > Lot of boilerplate!
  • 6. > JMX Annotations > Managed service @ManagedService( objectName="net.java.jmx:type=StandardService", description="A simple service exposed as an MXBean", service=Service.class, tags = { @Tag(name = "tag1", value = "val1"), @Tag(name = "tag2", value = "val2") } ) public class SimpleService { … }
  • 7. > JMX Annotations > Managed service @ManagedService( objectName="net.java.jmx:type=StandardService", description="A simple service exposed as an MXBean", service=Service.class, tags = { @Tag(name = "tag1", value = "val1"), @Tag(name = "tag2", value = "val2") } ) public class SimpleService { … } Freeform service name Included ObjectName Included description Custom service class Freeform tags
  • 8. > JMX Annotations > Managed attributes public class SimpleService { // A write-only attribute measured in "ticks" @ManagedAttribute(access = AttributeAccess.WRITE, units = "ticks") int counter = 1; // A read-only attribute being an array of strings @ManagedAttribute(access = AttributeAccess.READ, description = "ReadOnly Attribute") String[] arr = new String[]{"sa", "ba", "ca"}; // Declare a read-write attribute ... @ManagedAttribute(access = AttributeAccess.READWRITE, tags = { @Tag(name = "tag1", value = "val1"), @Tag(name = "tag2", value = "val2") } ) private String label = "the label"; … }
  • 9. > JMX Annotations > Managed attributes public class SimpleService { // A write-only attribute measured in "ticks" @ManagedAttribute(access = AttributeAccess.WRITE, units = "ticks") int counter = 1; // A read-only attribute being an array of strings @ManagedAttribute(access = AttributeAccess.READ, description = "ReadOnly Attribute") String[] arr = new String[]{"sa", "ba", "ca"}; // Declare a read-write attribute ... @ManagedAttribute(access = AttributeAccess.READWRITE, tags = { @Tag(name = "tag1", value = "val1"), @Tag(name = "tag2", value = "val2") } ) private String label = "the label"; … } Attribute access Support for units Included description Freeform tags Custom getters/setters
  • 10. > JMX Annotations > Managed operations public class SimpleService { // an operation modifying the 'counter' attribute @ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1") public int count() { return ++counter; } // an operation declaring custom 'units' metadata for one of its parameters @ManagedOperation public void checkTime(@Parameter(units = "ms") long ts) { System.err.println(new Date(ts)); } … }
  • 11. > JMX Annotations > Managed operations public class SimpleService { // an operation modifying the 'counter' attribute @ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1") public int count() { return ++counter; } // an operation declaring custom 'units' metadata for one of its parameters @ManagedOperation public void checkTime(@ParameterInfo(units = "ms") long ts) { System.err.println(new Date(ts)); } … } Service impact Included description Metadata for parameters Custom units Freeform tags
  • 12. > JMX Annotations > Notifications public class SimpleService { @NotificationInfos({ @NotificationInfo(types = "test.mbean.label", description = "Label was set") @NotificationInfo(types = "test.mbean.threshold", description = "Counter threshold reached") }) private NotificationSender ns; @ManagedAttribute public void setLabel(String l) { ns.sendNotification("test.mbean.label", "Label set", l); label = l; } @ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1") public int count() { if (counter >= 5) { ns.sendNotification("test.mbean.threshold", "Threshold reached", counter); } return ++counter; } … }
  • 13. > JMX Annotations > Notifications public class SimpleService { @NotificationInfos({ @NotificationInfo(types = "test.mbean.label", description = "Label was set") @NotificationInfo(types = "test.mbean.threshold", description = "Counter threshold reached") }) private NotificationSender ns; @ManagedAttribute public void setLabel(String l) { ns.sendNotification("test.mbean.label", "Label set", l); label = l; } @ManagedOperation(impact = Impact.ACTION, description = "Increases the associated counter by 1") public int count() { if (counter >= 5) { ns.sendNotification("test.mbean.threshold", "Threshold reached", counter); } return ++counter; } … } Injected notification sender Notification info types Simple emitter
  • 14. > JMX Annotations > Custom registration handler public class SimpleService { // handle the registration/unregsitration of the MBean @RegistrationHandler public void onRegistration(RegistrationEvent re) { switch(re.getKind()) { case REGISTER: { System.err.println("Registered " + re.getObjectName().getCanonicalName()); break; } case UNREGISTER: { System.err.println("Unregistered " + re.getObjectName().getCanonicalName()); break; } } } … }
  • 15. > JMX Annotations > Custom registration handler public class SimpleService { // handle the registration/unregsitration of the MBean @RegistrationHandler public void onRegistration(RegistrationEvent re) { switch(re.getKind()) { case REGISTER: { System.err.println("Registered " + re.getObjectName().getCanonicalName()); break; } case UNREGISTER: { System.err.println("Unregistered " + re.getObjectName().getCanonicalName()); break; } } } … } Simple registration listener ‘When-registered’ hook ‘When-unregistered’ hook
  • 16. > JMX Annotations > Where to get it? GitHub! > https://github.com/DataDog/openjdk-jdk/tree/jb/jmx_annotations > https://github.com/DataDog/openjdk-jdk/pull/4
  • 17. > JMX REST Connector > Simple, self-contained implementation > Base URL - http[s]://<host_name>:<port>/jmx/default > auto-discovery capable - JDP, perf-counter, JCMD > Endpoints > <root>/mbeans GET : list of all registered MBeans > <root>/<mbean_name> GET : get corresponding MBeanInfo > <root>/<mbean_name>/<attribute_name> GET : get the attribute value > <root>/<mbean_name>/?attributes=a,b,c|all GET : get values of multiple MBean attributes > <root>/domains GET : get all available domains > <root>/?domain=default GET : get default domain > <root>/?domain=<domain_name>/mbeans GET : list of all MBeans in the domain
  • 18. > JMX REST Connector > Advanced Query > Use HTTP POST > Query JSON [ { "name": "<mbean_name_1>", "read"|"write"|"exec": "<param_name/exec_name>", "arguments" : { … } },{ "name": "<mbean_name_2>", "read"|"write"|"exec": "<param_name/exec_name>", "arguments" : { … } }, ]
  • 19. > JMX REST Connector > Advanced Query > Use HTTP POST > Query JSON [ { "name": "<mbean_name_1>", "read"|"write"|"exec": "<param_name/exec_name>", "arguments" : { … } },{ "name": "<mbean_name_2>", "read"|"write"|"exec": "<param_name/exec_name>", "arguments" : { … } }, ] Multiple queries per request Query specification Optional arguments
  • 20. > JMX REST Connector > Query Response > Wrapped in // success { "status": 200, "request": { original HTTP request }, "response": { result of above request } } // error { "status": 4XX/5XX, "request": { original HTTP request }, "error": "<error message>" }
  • 21. > JMX REST Connector > Query Response Body > Java->JSON auto-serialization for - MXBeans - OpenMBeans - String, primitive values and arrays of them - BigInteger, BigDecimal - Date, ObjectName, CompositeData, TabularData
  • 22. > JMX REST Connector > Mostly working but abandoned > Harsha Wardhana’s CR space > https://cr.openjdk.org/~hb/8171311/webrev.01/ > might be up for adoption(?)
  • 23. > Summary > JMX feels outdated > Labour intensive APIs > Coupled with RMI > Needs persistent connection and pull loop from client > There are proposals to improve it > Evolution rather than revolution > Some parts almost fully functional > Million Dollar Question > Has JMX any future? > Who is willing to invest?
  • 24. It’s a wrap-up! Thanks, Qs are welcome! Jaroslav Bachorik X: @Bachorik J GH: jbachorik All images generated by Dall-E