11.04.19

Monitoring SDL Micro Services via JMX and JConsole

By Jonathan Primmer

Let’s talk tech. In this post, we outline how to set up the profiling of an SDL Spring Boot Micro Service for monitoring of the memory, threads, classes, and MBeans.

The MBeans allow us to monitor the addition / usage / invalidation of the EhCache.

The process consists of two parts:

  1. Configuring the micro service for JMX remote management
  2. Connecting to the JMX management from the JConsole application.

Note: This does impact performance, so it should not be used in a production scenario.

Setup

Complete this section in the order presented.

Configuring JMX Remote Management on the Micro Service

  1. Open the start.sh of your micro service
  2. Add the following entries to the JVM_OPTIONS
    1. Dcom.sun.management.jmxremote 
    2. Djava.rmi.server.hostname=<server ip address>
    3. Dcom.sun.management.jmxremote.port=<port of your choice>
    4. Dcom.sun.management.jmxremote.rmi.port=<same port as above>
    5. Dcom.sun.management.jmxremote.ssl=false 
    6. Dcom.sun.management.jmxremote.authenticate=false
  3. Restart the micro service

We’d recommend removing this configuration once you’ve finished monitoring.

Optionally, add the “authenticate” value depending on your authentication requirements. Additional information on providing authentication credentials can be found in the official JMX documentation.

Connect JConsole to Your Micro Service

  1. Navigate to /Contents/Home/Bin under your JDK folder
  2. Run the jconsole application
  3. Under New Connection -> Remote Process enter the host of the server your micro service runs on and the port you configured for your JMX management
  4. Click Connect

Firewall

Update your firewall to allow TCP for the port you configured.

Were you able to set up profiling? Let us know!
Facebook | LinkedIn | Twitter

CATEGORIES |
SDL