Fedora - JDK Mission Control is now in Fedora 29 - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - JDK Mission Control is now in Fedora 29 (/thread-89137.html) |
Fedora - JDK Mission Control is now in Fedora 29 - xSicKxBot - 03-09-2019 JDK Mission Control is now in Fedora 29 <div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29.png" width="655" height="655" title="" alt="" /></div><div><p>JDK Mission Control (JMC) is now available as a module in Fedora 29. JDK Mission Control is a powerful profiling application for HotSpot JVMs. It has an advanced set of tools that enables efficient and detailed analysis of the extensive data collected by JDK Flight Recorder (JFR). JMC requires JDK 8 or later.</p> <p>JFR is part of the JVM, and is available in OpenJDK 11 or Oracle JDK 7u4 or later. Therefore, to generate a flight recording to be loaded into JMC for analysis, the target application needs to run on OpenJDK 11 or OracleJDK 7u4 or later.</p> <p>This article is a guide to install and run JMC on Fedora 29 Workstation. Then you’ll learn how to use it to solve a common problem with Java programs called <em>hot methods</em>.</p> <p> <span id="more-24753"></span> </p> <h2>Installing JMC on Fedora 29</h2> <p>Using Java 11 will allow JMC to record JFR data for itself. Install Java 11 via:</p> <pre class="wp-block-preformatted">$ sudo dnf install java-11-openjdk</pre> <p>Enable and install the JMC module with the default profile via:</p> <pre class="wp-block-preformatted">$ sudo dnf module install jmc:latest/default<br /></pre> <p>Run JMC targeting the Java 11 JRE via:</p> <pre class="wp-block-preformatted">$ jmc -vm /usr/lib/jvm/jre-11/bin<br /></pre> <h2>Using JMC and JFR to explore hot methods</h2> <p>JDK Mission Control can be used to deeply analyze Java applications. In this example, we will take a look at hot methods. Hot methods are methods where a high proportion of time is spent during execution. These are good places to start investigating when trying to reduce overall execution time.</p> <p>To demonstrate, here is a portion of code for a Java application.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29.png" alt="" class="wp-image-25010" /><figcaption>Initiator Sample Code</figcaption></figure> <p>In practice, there are multiple methods of analyzing Java applications in JDK Mission Control. As an example, you can run the application with Flight Recording enabled and set to dump on JVM exit. This generates a Flight Recording (.jfr) file when the application exits, which can be opened by JDK Mission Control. Note that Flight Recorder is available in OpenJDK 11+ and OracleJDK 7u4+.</p> <p>For example, for OpenJDK 11+ use this command to run the class with Flight Recorder:</p> <pre class="wp-block-preformatted">$ java -XX:+FlightRecorder -XX:StartFlightRecording=dumponexit=true,filename=initiator.jfr Initiator</pre> <p>After the application has completed execution, open the resulting Flight Recording with JMC. Below is the automated analysis results.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29-1.png" alt="" class="wp-image-25005" /><figcaption>Automated Analysis Results<br /></figcaption></figure> <p>The automated Method Profiling analysis already indicates a potential optimization area in the calls to <em>Integer.equals(Object)</em>. Going to the Method Profiling tab, select that method and check the Stack Trace for it as shown below.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29-2.png" alt="" class="wp-image-25006" /><figcaption>Method Profiling View</figcaption></figure> <p>In this Stack Trace, you can follow the calls to the method <em>Initiator.countIntersection(Initiator)</em>. Checking the <em>Initiator</em> class, shown below, note that counting intersections between two <em>Integer</em> collections would be better done using <em>HashSet</em> collections instead of <em>LinkedLists</em> collections.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29-3.png" alt="" class="wp-image-25007" /><figcaption>The Before and After Code</figcaption></figure> <p>After making this change, you can see the execution improve in the follow-up Flight Recording. </p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/02/jdk-mission-control-is-now-in-fedora-29-4.png" alt="" class="wp-image-25008" /><figcaption>Method Profiling View of ‘After’ Code</figcaption></figure> <p>JDK Mission Control and JDK Flight Recorder gives you a highly detailed view of your Java application behavior. You can use it to diagnose issues with hot methods, deadlocks, lock contention, memory leaks and more. Try it out via the JMC module in Fedora 29!</p> </div> RE: Fedora - JDK Mission Control is now in Fedora 29 - marlin4355 - 05-20-2019 I need urgent help regarding Fedora- JDK Mission Control that is now in Fedora 29. Need to know about sodobusinessassociation.org? I have heard about it a couple of times but know nothing about its basics and origin. Kindly do share significant info here now, or email at the official site of. |