<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o" -->

---
title: The Power of JDK Flight Recorder: Efficient Profiling...
description: JDK Flight Recorder (JFR) is an event-based recording framework built into the JVM, designed to continuously collect diagnostic data with less than 1% overhead...
canonical: https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications | daily.dev
og:description: JDK Flight Recorder (JFR) is an event-based recording framework built into the JVM, designed to continuously collect diagnostic data with less than 1% overhead...
og:url: https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o
og:image: https://api.daily.dev/og/posts/mMAqnOM6o.png
og:image:alt: The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications

**[Java \(Official Oracle\)](https://daily.dev/sources/java-oracle)** · 50 min read · 0 upvotes · 0 comments

## Summary

JDK Flight Recorder (JFR) is an event-based recording framework built into the JVM, designed to continuously collect diagnostic data with less than 1% overhead in its default configuration — making it suitable for always-on use in production. Events capture timestamps, durations, thread info, stack traces, and event-specific fields (e.g., GC pause times). Built-in JDK events cover OS/CPU environment, JVM version, thread activity, file/socket I/O, TLS handshakes, certificates, GC, JIT compilation, class loading, and exceptions. Custom events can be added via API. Recordings are self-describing, binary-encoded, and compact. Analysis tools include the `jfr` CLI (with views for CPU load, hot methods, GC pauses, exceptions, memory leaks), JCMD for attaching to running processes, JMX for remote control, event streaming APIs (in-process, out-of-process, remote), and the JDK Mission Control GUI. A cooperative sampling fix for safepoint bias shipped in JDK 25. Practical demo scenarios covered CPU hotspots, GC pause diagnosis (Serial GC vs ZGC), memory leak detection via old object samples and heap reference chains, and exception-based failure diagnosis.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=vu0XEBplqpg>

## Questions this post answers

### How do I fix safepoint bias in JDK Flight Recorder thread sampling?

Cooperative sampling, introduced in JDK 25, addresses the safepoint bias problem in JFR. Previously, thread samples could only be captured at safepoints, skewing results toward code near safepoint checks. Cooperative sampling stops threads even outside safepoints, captures enough state to reconstruct the stack, and lets the thread continue, yielding representative samples with minimal added overhead.

_Developers tuning JFR-based profiling can track JVM sampling improvements like this one on daily.dev._

### What causes a HashMap-based memory leak when custom objects are used as keys?

Objects added to a HashMap without overriding hashCode and equals cannot be removed later using a newly created instance intended to match the original key, since default identity-based equality fails to find the entry. The map keeps growing unbounded, for example reaching millions of entries, because remove calls silently do nothing. Fixing it means implementing hashCode/equals, reusing the same object instance, or switching the class to a Java record.

_Java developers debugging heap growth from custom map keys can dig into diagnostics like this on daily.dev._

### How much overhead does JDK Flight Recorder add when running in production?

The default JFR configuration is designed to add less than 1% CPU overhead, with a small configurable memory overhead, making it safe to leave enabled continuously in production. The profile configuration collects more data (such as deeper stack traces) and costs somewhat more overhead than the default, though still far from noticeably degrading application performance.

_Teams weighing always-on profiling costs can compare JFR overhead trade-offs discussed on daily.dev._

## Similar posts on daily.dev

- [Intelligent JVM Monitoring: Combining JDK Flight Recorder with AI – Inside.java](https://daily.dev/posts/intelligent-jvm-monitoring-combining-jdk-flight-recorder-with-ai-inside-java-zlnf8gj5c) · Inside Java · 1 upvotes · 0 comments
- [Unbiased Java CPU profiling with JFR in JDK 25](https://daily.dev/posts/unbiased-java-cpu-profiling-with-jfr-in-jdk-25-q2jelifnz) · Datadog · 3 upvotes · 0 comments
- [Secure, Scalable JVM Diagnostics for Kubernetes with JMS – Inside.java](https://daily.dev/posts/secure-scalable-jvm-diagnostics-for-kubernetes-with-jms-inside-java-aphxyawca) · Inside Java · 0 upvotes · 0 comments
- [The Latest in OpenJDK and JCP Expert Group: Insights with Simon Ritter](https://daily.dev/posts/the-latest-in-openjdk-and-jcp-expert-group-insights-with-simon-ritter-z80yktd7j) · InfoQ · 0 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#jvm](https://daily.dev/tags/jvm)

[View this post on daily.dev](https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications","url":"https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o"},"datePublished":"2026-08-11T10:43:18.603Z","dateModified":"2026-09-14T06:04:41.107Z","description":"JDK Flight Recorder (JFR) is an event-based recording framework built into the JVM, designed to continuously collect diagnostic data with less than 1% overhead...","image":"https://i.ytimg.com/vi/vu0XEBplqpg/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/vu0XEBplqpg/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Java (Official Oracle)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Java (Official Oracle)","logo":"https://media.daily.dev/image/upload/s--SM9hIYUY--/f_auto,q_auto/v1773648791/logos/java-oracle?_a=BAMAMiiu0","url":"https://daily.dev/sources/java-oracle"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,jvm","timeRequired":"PT50M","video":{"@type":"VideoObject","name":"The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications","description":"JDK Flight Recorder (JFR) is an event-based recording framework built into the JVM, designed to continuously collect diagnostic data with less than 1% overhead...","thumbnailUrl":"https://i.ytimg.com/vi/vu0XEBplqpg/sddefault.jpg","uploadDate":"2026-08-11T10:43:18.603Z","duration":"PT50M","url":"https://api.daily.dev/r/mMAqnOM6o","embedUrl":"https://www.youtube.com/embed/vu0XEBplqpg"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Java (Official Oracle)","item":"https://daily.dev/sources/java-oracle"},{"@type":"ListItem","position":3,"name":"The Power of JDK Flight Recorder: Efficient Profiling and Troubleshooting for Java Applications"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/the-power-of-jdk-flight-recorder-efficient-profiling-and-troubleshooting-for-java-applications-mmaqnom6o#faq","mainEntity":[{"@type":"Question","name":"How do I fix safepoint bias in JDK Flight Recorder thread sampling?","acceptedAnswer":{"@type":"Answer","text":"Cooperative sampling, introduced in JDK 25, addresses the safepoint bias problem in JFR. Previously, thread samples could only be captured at safepoints, skewing results toward code near safepoint checks. Cooperative sampling stops threads even outside safepoints, captures enough state to reconstruct the stack, and lets the thread continue, yielding representative samples with minimal added overhead. Developers tuning JFR-based profiling can track JVM sampling improvements like this one on daily.dev."}},{"@type":"Question","name":"What causes a HashMap-based memory leak when custom objects are used as keys?","acceptedAnswer":{"@type":"Answer","text":"Objects added to a HashMap without overriding hashCode and equals cannot be removed later using a newly created instance intended to match the original key, since default identity-based equality fails to find the entry. The map keeps growing unbounded, for example reaching millions of entries, because remove calls silently do nothing. Fixing it means implementing hashCode/equals, reusing the same object instance, or switching the class to a Java record. Java developers debugging heap growth from custom map keys can dig into diagnostics like this on daily.dev."}},{"@type":"Question","name":"How much overhead does JDK Flight Recorder add when running in production?","acceptedAnswer":{"@type":"Answer","text":"The default JFR configuration is designed to add less than 1% CPU overhead, with a small configurable memory overhead, making it safe to leave enabled continuously in production. The profile configuration collects more data (such as deeper stack traces) and costs somewhat more overhead than the default, though still far from noticeably degrading application performance. Teams weighing always-on profiling costs can compare JFR overhead trade-offs discussed on daily.dev."}}]}
```

