Hasty Briefsbeta

Bilingual

One Method Was Using 71% of CPU. Here's the Flame Graph

7 hours ago
  • #JFR Profiling
  • #Java Performance
  • #Optimization Workflow
  • Java Flight Recording (JFR) and JDK Mission Control (JMC) are used to identify performance issues in a demo app, showing improvements from 1,198ms to 239ms, heap reduction from 1GB to 139MB, and fewer GC pauses.
  • Key performance fixes include replacing O(n²) streams in loops with single-pass accumulations, using StringBuilder for string concatenation, and caching regex patterns to avoid recompilation.
  • Profiling revealed hidden bottlenecks like String.format() in hot paths and thread contention at high concurrency, emphasizing the need to fix issues incrementally and re-profile after each change.
  • The workflow involves starting with JFR overview, analyzing heap/CPU/contention, applying targeted fixes, and re-running tests to uncover new issues, leading to compound performance gains at scale.