Capturing performance metrics with Cryostat

A user can collect performance metrics about memory allocation and CPU usage with Cryostat.

About Cryostat

Cryostat is Java Flight Recorder handling for Containerized Java Applications.

Visit the Cryostat website for more information.

This is not using async profiling as this is not available inside OpenShift AFAIK. Therefore, the recordings will have the Safepoint bias problem. See Profiling Java in a container.

Opening Cryostat

Cryostat is deployed by default.

The URL is shown when running the isup.sh shell script.

Minikube

Assuming the command minikube ip returned 192.168.39.39, the console is available on http://cryostat.192.168.39.39.nip.io.

OpenShift

Navigate to the routes of the project where Keycloak is installed. Open the URL listed for cryostat.

https://cryostat-aschwart-keycloak.apps.....openshiftapps.com

Creating a Java Flight Recorder recording

  • Open the Cryostat instance’s website.

  • Click on the menu item Recordings.

  • Select a target VM.

  • Click on button Create to create a new recording and follow the dialogs.

  • As the template, choose Profiling to capture CPU and memory profiling information.

cryostat create

Downloading a recording

Once the recording is complete, download it directly or archive it to the persistent volume of Cryostat to download it later.

cryostat download

Accessing Grafana

When running minikube, there are no extra credentials necessary to access Grafana. When running on OpenShift, the Cryostat docs contain the details on how to retrieve the password.

Analyzing a Java Flight Recorder recording

Open the recording in IntelliJ Ultimate (the community edition isn’t sufficient), or use Java Mission Control (JMC) version 8.

When opening it in IntelliJ Ultimate, choose the Profiler tool window, and press the button Open Snapshot. Choose either the tab Flame Graph or Method List. In the upper right corner the user can switch between CPU and memory profiling results.

When opening it in JMC, select the menu item Method Profiling or Memory. Unfortunately, the flame view seems to be broken in version 8.2.1 on Fedora; it is simply blank. Still, the list of methods provides some value.