Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Set up JDK Mission Control with Red Hat Build of OpenJDK

March 15, 2019
Syed M Shaaf
Related topics:
JavaLinux
Related products:
Red Hat Enterprise Linux

    JDK Mission Control is now the newest member of the Red Hat Software Collections (RHSCL). JDK Mission Control is a powerful profiler for HotSpot Java virtual machines (JVMs) and has an advanced set of tools that enable efficient and detailed analysis of the extensive data collected by JDK Flight Recorder. The toolchain enables developers and administrators to collect and analyze data from Java applications running locally or deployed in production environments using OpenJDK 11.

    In this article, I will go through a primary example of setting up JDK Mission Control. For Linux, JDK Mission Control is part of the RHSCL and, for Windows, it is available as part of the OpenJDK zip distribution on the Red Hat Customer Portal.  For Linux, these instructions assume that Red Hat Build of OpenJDK 11 is already installed. I will show how to set up the system to install software from RHSCL, which provides the latest development technologies for Red Hat Enterprise Linux. Then, I will install the JDK Mission Control and run a simple sample application. The whole tutorial should take fewer than 10 minutes to complete.

    Installing Mission Control

    For Microsoft Windows

    For Microsoft Windows, the OpenJDK zip available via the Red Hat Customer Portal now contains JDK Mission Control and JDK Flight Recorder. Once un-archived, the JMC binary can be found in the bin directory.

    For Red Hat Enterprise Linux

    You can add or remove software repositories from the command line using the subscription-manager tool as the root user. Use the --list option to view the available software repositories and verify that you have access to RHSCL:

    $ su -
    # subscription-manager repos --list | egrep rhscl

    Depending which variant is used (e.g., server or workstation), you can enable the repo with the following command:

    # subscription-manager repos --enable  rhel-variant-rhscl-7-rpms

    Install JMC with the following command:

    $ yum install rh-jmc

    We have now installed JMC. You can launch it by typing JMC or heading off to the applications menu.

    If you are running multiple versions of Java, as I do, and want to launch JMC from the command line, use the following options to launch JMC with the path to the Red Hat Build of OpenJDK.

    $ scl enable rh-jmc bash
    $ jmc -vm /usr/lib/jvm/java-11-openjdk-11.0.2.7-0.el7_6.i386/bin

    Real-time Monitoring

    JMC allows you to perform real-time monitoring of JVMs. To do this, create a new connection from the File Menu, choose your JVM, and start JMX console. The result should give you an overview page with Processors, Memory consumption, Java heap use, JVM CPU usage, etc.

    Now that we have JMC set up, let's try to run an example and see how it works.

    The following is a simple example of reading a couple of files. Indeed, there can be issues that we have not taken into consideration. In the example below, I have two files: a simple HTML file and a text file, which is about 1 GB.

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    
    
    public class TextFileReader {
    
    private File textFilePath = null;
    
    
    public TextFileReader(String textFilePath) {
        if (textFilePath == null)
            throw new IllegalArgumentException();
        this.textFilePath = new File(textFilePath);
    }
    
    public void readFile() throws IOException {
        FileReader fileReader = new FileReader(textFilePath);
        BufferedReader bufferedreader = new BufferedReader(fileReader);
        StringBuffer sb = new StringBuffer();
        String strLine;
        while ((strLine = bufferedreader.readLine()) != null) {
            sb.append(strLine);
            sb.append("\n");
        }
        
        fileReader.close();
        System.out.println(sb.toString());
    }
    
    public static void main(String[] args) throws IOException{
    
        new TextFileReader("index.html").readFile();
        new TextFileReader("test.txt").readFile();
    
    }
    
    }

    Let’s execute the following commands to compile and run this example.

    $ javac TextFileReader.java
    
    $ java -XX:+FlightRecorder -XX:StartFlightRecording=dumponexit=true,filename=filereader.jfr TextFileReader

    In the above Java command, the parameter -XX:StartFlightRecording will dump the results into filereader.jfr.

    Let's look at the results by opening this file in JMC.

    JMC reports in-depth details on the entire run; for example, JVM internals shows that GC is Stalling. Moreover, with a large file with not much memory, that is a problem, so we can fix the issue either by lowering the value of -XX:InitiatingHeapOccupancyPercent and even more so ensuring that there is enough memory (e.g., Xms1024m -Xmx4096m).

    Another great example can be found here by Jie Kang, Software Engineer at Red Hat, where he shows how the method profiling works, aiding in optimization of the original code.

    JMC is very useful for understanding application behavior such as memory leaks, deadlock, and much more. Give it a try with the Red Hat Build of OpenJDK 11

    Last updated: November 1, 2023

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI