<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Brice Dutheil on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/brice-dutheil/</link><description>Articles written by Brice Dutheil on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 13 Sep 2021 08:53:47 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/brice-dutheil/index.xml" rel="self" type="application/rss+xml"/><item><title>Project Panama for Newbies (Part 3)</title><link>https://foojayio.github.io/website/today/project-panama-for-newbies-part-3/</link><pubDate>Mon, 13 Sep 2021 08:53:47 +0000</pubDate><guid>https://foojayio.github.io/website/today/project-panama-for-newbies-part-3/</guid><description>&lt;p&gt;&lt;strong&gt;Updated December 31, 2025:&lt;/strong&gt; This article now features Java 25 and the Foreign Function &amp;amp; Memory (FFM) API, which has been a standard feature since JDK 22 (&lt;a href="https://openjdk.java.net/jeps/454" target="_blank" rel="noopener noreferrer"&gt;JEP-454&lt;/a&gt;
).&lt;/p&gt;
&lt;figure class="wp-block-image size-full is-resized is-style-default"&gt;
 &lt;img fetchpriority="high" decoding="async" width="218" height="407" src="panama_part3.png" alt="Panama for newbies Part 3" class="wp-image-46521" style="width:140px;height:230px"&gt;
 &lt;figcaption class="wp-element-caption"&gt;
 Panama for newbies Part 3
 &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="h2-0-introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome to the third part of the series on Java&amp;rsquo;s Project Panama for newbies. Before jumping into this article, I want to congratulate you for getting this far, you deserve a virtual pat on the back!&lt;/p&gt;</description></item><item><title>Embracing JVM unified logging (JEP-158 / JEP-271)</title><link>https://foojayio.github.io/website/today/embracing-jvm-unified-logging/</link><pubDate>Wed, 10 Mar 2021 18:20:13 +0000</pubDate><guid>https://foojayio.github.io/website/today/embracing-jvm-unified-logging/</guid><description>&lt;p&gt;In the previous &lt;a href="https://foojayio.github.io/website/today/introduction-to-jvm-unified-logging-jep-158-jep-271/"&gt;blog post&lt;/a&gt;
, I briefly introduced unified logging and a simple GC configuration. However for the savvy GC tuners, there are many more options. And there are other logging options that transitionned to unified logging infrastructure as well.&lt;/p&gt;
&lt;p&gt;I wasn&amp;rsquo;t satisfied with the official documentation and other blog posts as they usually present only a fragmented picture of the previous options. This led me to dig in.&lt;/p&gt;
&lt;h2 id="_migrating_the_gc_logging_continued"&gt;Migrating the GC logging (continued)&lt;/h2&gt;
&lt;p&gt;|&amp;mdash;&amp;mdash;|&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;ndash;|
| Note | These log are based on JDK11u. |&lt;/p&gt;</description></item><item><title>Introduction to JVM Unified Logging (JEP-158 / JEP-271)</title><link>https://foojayio.github.io/website/today/introduction-to-jvm-unified-logging-jep-158-jep-271/</link><pubDate>Mon, 01 Mar 2021 17:58:06 +0000</pubDate><guid>https://foojayio.github.io/website/today/introduction-to-jvm-unified-logging-jep-158-jep-271/</guid><description>&lt;p&gt;Unified logging was introduced in JDK 9, and is available for us all, in the JDK 11 LTS. Like other great serviceability feature (&lt;code&gt;jcmd&lt;/code&gt; or JFR) this was inspired by JRockit.&lt;/p&gt;
&lt;p&gt;As a pre-jdk9 user I had my way using the explicit GC logging options. On several occasions it was also useful to toggle other options like tracing class un/loading.&lt;/p&gt;
&lt;p&gt;Starting from JDK 9, the JVM maintainers chose to overhaul the way JVM logs things. I believe that unified logging is great, but after using it I believe its purpose targets more JDK maintainers, eventually library maintainers, than end users. Meanwhile it&amp;rsquo;s likely that one may need to activate GC logs.&lt;/p&gt;</description></item><item><title>How &amp; When to Use JDK Flight Recorder in Production</title><link>https://foojayio.github.io/website/today/how-when-to-use-jdk-flight-recorder-in-production/</link><pubDate>Tue, 15 Dec 2020 12:44:28 +0000</pubDate><guid>https://foojayio.github.io/website/today/how-when-to-use-jdk-flight-recorder-in-production/</guid><description>&lt;p&gt;While it would certainly be useful to record the whole lifetime, this is unpractical, even airplane Flight Data Recorders (and Cockpit Voice Recorders) only keep recent history. Instead, it&amp;rsquo;s possible to aim at specific time frames where a recording could be useful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;At &lt;strong&gt;startup&lt;/strong&gt;, the JVM does a lot of things, so does the application, it generally initializes a lot of long lived objects, generally services, threads, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Continuously&lt;/strong&gt; at &lt;strong&gt;runtime&lt;/strong&gt; , this is likely a sliding time window in which one can access what&amp;rsquo;s happened in last &lt;em&gt;X &amp;lt;time unit&amp;gt;&lt;/em&gt;(this is either limited by age or by size). It this case the dump could be done when required.&lt;/li&gt;
&lt;li&gt;At &lt;strong&gt;shutdown&lt;/strong&gt; whether the JVM was &lt;strong&gt;killed&lt;/strong&gt; or &lt;strong&gt;crashed&lt;/strong&gt;. It this case the JFR files are an alternative to heap dumps for the autopsy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more details on this topic, see &lt;a href="https://foojayio.github.io/website/today/continuous-production-profiling-and-diagnostics/"&gt;Continuous Production Profiling and Diagnostics&lt;/a&gt;
, by Marcus Hirt.&lt;/p&gt;</description></item><item><title>Using Java Flight Recorder and Mission Control (Part 3)</title><link>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-3/</link><pubDate>Thu, 19 Nov 2020 09:13:02 +0000</pubDate><guid>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-3/</guid><description>&lt;p&gt;Continuing from &lt;a href="https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-1/"&gt;part 1&lt;/a&gt;
 and &lt;a href="https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-2/"&gt;part 2&lt;/a&gt;
, while from JDK 14 events can be consumed on the fly, previous JDK versions (from JDK 11) offer a public API useful enough to control Flight Recorder programmatically or to read events from a JFR file.&lt;/p&gt;
&lt;pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""&gt;Configuration c = Configuration.getConfiguration("profile"); [1]
Recording r = new Recording(c);
r.setName("monitor jvm");
r.enable("jdk.*"); [2]
r.setMaxAge(java.time.Duration.ofMinutes(4)); [3]
r.start(); [4]

// to be profiled

r.stop(); [5]
r.dump(Files.createFile("/var/log/jfr/app-initiated.jfr")); [6]&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;As shown above, choose the JFR configuration.&lt;/li&gt;
&lt;li&gt;Choose which events the recording should be interested in. Another signature accepts classes, it&amp;rsquo;s unlikely to be helpful for JDK events, but it may get interesting for custom events, your classes.&lt;/li&gt;
&lt;li&gt;Eventually set recording constraints, like the maximum age of the records.&lt;/li&gt;
&lt;li&gt;Hit record.&lt;/li&gt;
&lt;li&gt;When the recording session is over, stop JFR.&lt;/li&gt;
&lt;li&gt;Then store the results in the location of your choosing.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The above snippet creates a continuous profiling session with a 4 minute window.&lt;/p&gt;</description></item><item><title>Using Java Flight Recorder and Mission Control (Part 2)</title><link>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-2/</link><pubDate>Thu, 05 Nov 2020 16:50:59 +0000</pubDate><guid>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-2/</guid><description>&lt;p&gt;Now, &lt;a href="https://foojayio.github.io/website/blog/using-java-flight-recorder-and-mission-control-part-1/"&gt;continuing from part 1&lt;/a&gt;
, to exploit the recording by analyzing it, we have a tool named &lt;code&gt;jfr&lt;/code&gt; that ships with the JDK. On Linux the &lt;em&gt;alternative&lt;/em&gt; jdk management may not be aware of &lt;code&gt;jfr&lt;/code&gt;, which means you may need to use the full path to this executable.&lt;/p&gt;
&lt;p&gt;The first interesting thing to do is to get an overview of the recording, the &lt;code&gt;summary&lt;/code&gt; sub-command displays an histogram of the events, shown below.&lt;/p&gt;</description></item><item><title>Using Java Flight Recorder and Mission Control (Part 1)</title><link>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-1/</link><pubDate>Mon, 02 Nov 2020 09:49:11 +0000</pubDate><guid>https://foojayio.github.io/website/today/using-java-flight-recorder-and-mission-control-part-1/</guid><description>&lt;p&gt;Java Flight Recorder is the profiler you can use in production, continuously. Flight Recorder has been available before in the JDK, e.g., it shipped as part of the JDK 8, but to use it, it required that you set specific commercial VM flags to unlock Flight Recorder, this is not anymore necessary from Java 11 onwards.&lt;/p&gt;
&lt;p&gt;|&amp;mdash;|&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;-|
| | This page assumes JDK 11, that means there is no need to set &lt;code&gt;-XX:+UnlockCommercialFeatures&lt;/code&gt;, &lt;code&gt;-XX:+FlightRecorder&lt;/code&gt; flags. Or, more particular to JFR, the use of &lt;code&gt;-XX:+UnlockDiagnosticVMOptions&lt;/code&gt; and &lt;code&gt;-XX:+DebugNonSafepoints&lt;/code&gt; &lt;a href="https://github.com/openjdk/jmc/blob/bacb448fd4ed1a9a5d887c50aebff4e854d3512a/core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/version/JavaVersionSupport.java#L59-L60" target="_blank" rel="noopener noreferrer"&gt;source&lt;/a&gt;
 |&lt;/p&gt;</description></item></channel></rss>