April 8, 2020 By Kazuki Nobutani 4 min read

How to generate, download, and analyze the dump files from your Java Liberty application running on Cloud Foundry.

Cloud Foundry (CF) is a Platform-as-a-Service (PaaS) offering on IBM Cloud. Through CF, you can deploy your own application in different languages, such as Node.js, PHP, Java Liberty, etc. 

In this article, I’m are going to share how to generate and download dump files from your Java Liberty application running on Cloud Foundry. Then I’ll show an analysis example using a tool called IBM Thread and Monitor Dump Analyzer for Java.

The analysis method might be useful if you want to investigate thread hang and performance problems. For this example, I prepared a demo app that was having a problem with performance. I then collected multiple thread dump files (javacore) to analyze why the app was running slow.

Generating dump files

In order to generate dump files, you need to install ibmcloud cli on your cmd or terminal. We will use pkill -3 java to take the snapshot of the running Java:

  1. Log in to IBM Cloud and select the account that your app is running:
    > ibmcloud login
  2. Specify the CF organization where your app is running:
    > ibmcloud target --cf
  3. List all apps running in your organization and get the app name:
    > ibmcloud cf apps
  4. Once we observe the performance issue, run the command and generate dump files. Make sure you replace the <appname> to the actual app name you obtained in Step 3:
    > ibmcloud cf ssh <appname> -c "pkill -3 java"
  5. Repeat Step 4 a few more times to capture if there are any hanging threads over time.

How to download dump files

In order to download the dump files for analysis, use the following commands:

  1. List dump files you generated:
    > ibmcloud cf ssh <appname> -c "ls -l dumps"
  2. To download dump files, run the following command. In this example, we download javacore files:
    > ibmcloud cf ssh <appname> -i <instance_id> -c "cat dumps/<dump_file_name>" > <local_dump_file_name>

How to use IBM Thread and Monitor Dump Analyzer for Java

Follow the IBM Thread and Monitor Dump Analyzer for Java (TMDA) link and download the tool on your machine. Then, follow these steps:

  1. Once it is downloaded, run the tool:
  2. Go to File > Open Thread Dumps and open the javacore files. 
  3. Select all javacore files and click Compare Threads:
  4. Compare threads shows how the threads are running. We’ve imported 10 javacore files here, so there will be 10 columns. Each row represents a thread running when the dump was captured. Threads in green mean they are running threads, whereas ones in red means these threads are stopped or blocked:

What can we tell from the dump files?

In this example, we found threads that were running for a few minutes. We checked the detail of the thread and it turned out it is was a query to the backend database.

We checked the problematic thread in Monitor Detail. In the very first javacore collected, it showed there were three threads blocked by the long running thread. In the later javacore, we saw the number of blocked threads increased to 24.

We can conclude that the issue is due to fact that the query running against the DB had not yet finished. This is an extreme case, but you can use this tool to troubleshoot or analyze memory- or thread-related problems. 

Where to get more help

Due to the nature of PaaS, performance issues in general are outside of the IBM Cloud support scope. However, using this analysis tool, you might be able to narrow down where the cause of the problem lies. 

For any questions about Cloud Foundry or other information about the platform, please contact IBM Cloud support.

If you have questions for Java Liberty itself, please open a ticket from IBM Support portal.

The TMDA tool is provided as is without any warranty or support; however, we try to fix and enhance the tool as time permits. The tool was originally created by Jinwoo Hwang. Since Mr. Hwang’s departure from IBM, the tool is maintained as time permits by Kevin Grigorenko.

Was this article helpful?
YesNo

More from Cloud

New 4th Gen Intel Xeon profiles and dynamic network bandwidth shake up the IBM Cloud Bare Metal Servers for VPC portfolio

3 min read - We’re pleased to announce that 4th Gen Intel® Xeon® processors on IBM Cloud Bare Metal Servers for VPC are available on IBM Cloud. Our customers can now provision Intel’s newest microarchitecture inside their own virtual private cloud and gain access to a host of performance enhancements, including more core-to-memory ratios (21 new server profiles/) and dynamic network bandwidth exclusive to IBM Cloud VPC. For anyone keeping track, that’s 3x as many provisioning options than our current 2nd Gen Intel Xeon…

IBM and AWS: Driving the next-gen SAP transformation  

5 min read - SAP is the epicenter of business operations for companies around the world. In fact, 77% of the world’s transactional revenue touches an SAP system, and 92% of the Forbes Global 2000 companies use SAP, according to Frost & Sullivan.   Global challenges related to profitability, supply chains and sustainability are creating economic uncertainty for many companies. Modernizing SAP systems and embracing cloud environments like AWS can provide these companies with a real-time view of their business operations, fueling growth and increasing…

Experience unmatched data resilience with IBM Storage Defender and IBM Storage FlashSystem

3 min read - IBM Storage Defender is a purpose-built end-to-end data resilience solution designed to help businesses rapidly restart essential operations in the event of a cyberattack or other unforeseen events. It simplifies and orchestrates business recovery processes by providing a comprehensive view of data resilience and recoverability across primary and  auxiliary storage in a single interface. IBM Storage Defender deploys AI-powered sensors to quickly detect threats and anomalies. Signals from all available sensors are aggregated by IBM Storage Defender, whether they come…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters