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

A clear path to value: Overcome challenges on your FinOps journey 

3 min read - In recent years, cloud adoption services have accelerated, with companies increasingly moving from traditional on-premises hosting to public cloud solutions. However, the rise of hybrid and multi-cloud patterns has led to challenges in optimizing value and controlling cloud expenditure, resulting in a shift from capital to operational expenses.   According to a Gartner report, cloud operational expenses are expected to surpass traditional IT spending, reflecting the ongoing transformation in expenditure patterns by 2025. FinOps is an evolving cloud financial management discipline…

IBM Power8 end of service: What are my options?

3 min read - IBM Power8® generation of IBM Power Systems was introduced ten years ago and it is now time to retire that generation. The end-of-service (EoS) support for the entire IBM Power8 server line is scheduled for this year, commencing in March 2024 and concluding in October 2024. EoS dates vary by model: 31 March 2024: maintenance expires for Power Systems S812LC, S822, S822L, 822LC, 824 and 824L. 31 May 2024: maintenance expires for Power Systems S812L, S814 and 822LC. 31 October…

24 IBM offerings winning TrustRadius 2024 Top Rated Awards

2 min read - TrustRadius is a buyer intelligence platform for business technology. Comprehensive product information, in-depth customer insights and peer conversations enable buyers to make confident decisions. “Earning a Top Rated Award means the vendor has excellent customer satisfaction and proven credibility. It’s based entirely on reviews and customer sentiment,” said Becky Susko, TrustRadius, Marketing Program Manager of Awards. Top Rated Awards have to be earned: Gain 10+ new reviews in the past 12 months Earn a trScore of 7.5 or higher from…

IBM Newsletters

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