27 Jan 2019

Monitoring an ADF Application in a Docker Container. Easy Way.

In this short post I am going to show a simple approach to make sure that your ADF application running inside a Docker container is a healthy Java application in terms of memory utilization. I am going to use a standard tool JConsole which comes as a part of JDK installation on your computer. If there is a problem (i.e. a memory leak,  often GCs, long GCs, etc.) you will see it with JConsole. In an effort to analyze the root of the problem and find the solution you might want to use more powerful and fancy tools. I will discuss that in one of my following posts. A story of tuning JVM for an ADF application is available here.

So there is an ADF application running on top of Tomcat. The application and the Tomcat are packaged into a Docker container running on dkrlp01.flexagon host. There are some slides on running an ADF application in a Docker container.
In order to connect with JConsole from my laptop to a JVM running inside the container, we need to add the following JVM arguments in tomcat/bin/setenv.sh:
 -Dcom.sun.management.jmxremote=true
 -Dcom.sun.management.jmxremote.rmi.port=9010
 -Dcom.sun.management.jmxremote.port=9010
 -Dcom.sun.management.jmxremote.ssl=false
 -Dcom.sun.management.jmxremote.authenticate=false
 -Dcom.sun.management.jmxremote.local.only=false
 -Djava.rmi.server.hostname=dkrlp01.flexagon

Besides that the container has to expose port 9010, so it should be created with
"docker run -p 9010:9010 ..." command.

Having done that we can invoke jconsole command locally and connect to the container:


Now just give the application some load with you favorite testing tool (JMeter, OATS, SOAP UI, Selenium, etc..) and observe the memory utilization:



That's it!