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

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 

Dernier (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 

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