Skip to content

JFR Support in Native Image #5410

Open
Open
@roberttoyonaga

Description

@roberttoyonaga

TL;DR

We want to maximize support for JFR in GraalVM Native Image.

Goals

We want to allow users to re-use their monitoring tools and other JFR-based tools for native deployments of their applications. For this reason, we plan to support as many JFR events and components as possible within Native Image. Not all of them may apply, for example, because native executables don't allow dynamic features and usually don't include a JIT1.
This issue outlines the current and in progress scope of JFR support in Native Image compared with JIT. This outline is a work in progress and should be kept up-to-date as tasks are identified/completed.

Non-Goals

  • Support for jvmstat, JMX, and other monitoring/observability APIs (handled in separate issues)
  • Maintain support for older versions of JFR

Events

The following built-in JFR events are supported in native images. Some of the events on this list may not be applicable to native images and are included for the sake of completion.

  • jdk.ActiveRecording (since 22.1)
  • jdk.ActiveSetting (since 22.1)
  • jdk.AllocationRequiringGC (since 24.0, GraalVM for JDK 22)
    jdk.BooleanFlag (N/A)
    jdk.BooleanFlagChanged (N/A)
  • jdk.ClassLoaderStatistics
  • jdk.ClassLoadingStatistics (since 22.1)
  • jdk.ClassDefine
    jdk.ClassLoad (N/A)
    jdk.ClassRedefinition (N/A)
    jdk.ClassUnload (N/A)
    jdk.CodeCacheConfiguration (N/A)
    jdk.CodeCacheFull (N/A)
    jdk.CodeCacheStatistics (N/A)
  • jdk.CodeSweeperConfiguration
  • jdk.CodeSweeperStatistics
    jdk.Compilation (N/A)
    jdk.CompilationFailure(N/A)
    jdk.CompilerConfiguration (N/A)
    jdk.CompilerInlining (N/A)
    jdk.CompilerPhase (N/A)
    jdk.CompilerStatistics(N/A)
  • jdk.ConcurrentModeFailure
  • jdk.ContainerCPUThrottling (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ContainerCPUUsage (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ContainerConfiguration (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ContainerIOUsage (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ContainerMemoryUsage (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.CPUInformation
  • jdk.CPULoad
  • jdk.CPUTimeStampCounter
  • jdk.DataLoss (since 22.1)
    jdk.Deoptimization (N/A)
  • jdk.Deserialization
  • jdk.DumpReason
  • jdk.DirectBufferStatistics
    jdk.DoubleFlag (N/A)
    jdk.DoubleFlagChanged (N/A)
  • jdk.EvacuationFailed
  • jdk.EvacuationInformation
  • jdk.ExceptionStatistics
  • jdk.ExecutionSample (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ExecuteVMOperation (since 22.1)
  • jdk.FileForce
  • jdk.FileRead
  • jdk.FileWrite
  • jdk.FinalizerStatistics
  • jdk.Flush
    jdk.G1AdaptiveIHOP (N/A)
    jdk.G1BasicIHOP (N/A)
    jdk.G1EvacuationOldStatistics (N/A)
    jdk.G1EvacuationYoungStatistics (N/A)
    jdk.G1GarbageCollection (N/A)
    jdk.G1HeapSummary (N/A)
    jdk.G1HeapRegionInformation (N/A)
    jdk.G1HeapRegionTypeChange (N/A)
    jdk.G1HeapSummary (N/A)
    jdk.G1MMU (N/A)
  • jdk.GarbageCollection (since 22.1)
  • jdk.GCConfiguration
  • jdk.GCHeapConfiguration
  • jdk.GCHeapSummary (since 23.1, GraalVM for JDK 21)
  • jdk.GCLocker
    jdk.GCPhaseConcurrent (N/A)
  • jdk.GCPhasePause (since 22.1)
  • jdk.GCPhasePauseLevel1 (since 22.1)
  • jdk.GCPhasePauseLevel2 (since 22.1)
  • jdk.GCPhasePauseLevel3 (since 22.1)
  • jdk.GCPhasePauseLevel4 (since 22.1)
  • jdk.GCPhaseParallel
  • jdk.GCReferenceStatistics
  • jdk.GCSurvivorConfiguration
  • jdk.GCTLABConfiguration
  • jdk.HeapDump
  • jdk.InitialEnvironmentVariable (since 22.1)
  • jdk.InitialSystemProperty (since 22.1)
    jdk.IntFlag (N/A)
    jdk.IntFlagChanged (N/A)
  • jdk.JavaErrorThrow
  • jdk.JavaExceptionThrow
  • jdk.JavaMonitorEnter (since 22.3)
  • jdk.JavaMonitorInflate (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.JavaMonitorWait (since 22.3)
  • jdk.JavaThreadStatistics (since 22.1)
  • jdk.JVMInformation (since 22.1)
  • jdk.LoaderConstraintsTableStatistics
    jdk.LongFlag (N/A)
    jdk.LongFlagChanged (N/A)
    jdk.MetaspaceAllocationFailure (N/A)
    jdk.MetaspaceChunkFreeListSummary (N/A)
    jdk.MetaspaceGCThreshold (N/A)
    jdk.MetaspaceOOM (N/A)
    jdk.MetaspaceSummary (N/A)
  • jdk.ModuleExport
  • jdk.ModuleRequire
  • jdk.NativeLibrary
  • jdk.NativeMethodSample
  • jdk.NativeMemoryUsage (since JDK 23)
  • jdk.NativeMemoryUsageTotal (since JDK 23)
  • jdk.NativeMemoryUsagePeak (since JDK 23)
  • jdk.NativeMemoryUsageTotalPeak (since JDK 23)
  • jdk.NetworkUtilization
  • jdk.ObjectAllocationInNewTLAB (since 23.0, GraalVM for JDK 17 / 20)
    jdk.ObjectAllocationOutsideTLAB (N/A)
  • jdk.ObjectAllocationSample (since JDK 23)
  • jdk.ObjectCount
  • jdk.ObjectCountAfterGC
  • jdk.OldGarbageCollection
  • jdk.OldObjectSample
  • jdk.OSInformation (since 22.1)
    jdk.ParallelOldGarbageCollection (N/A)
  • jdk.PhysicalMemory (since 22.1)
  • jdk.PlaceholderTableStatistics
  • jdk.ProcessStart
  • jdk.PromotionFailed
    jdk.PromoteObjectInNewPLAB (N/A)
    jdk.PromoteObjectOutsidePLAB (N/A)
  • jdk.ProtectionDomainCacheTableStatistics
    jdk.PSHeapSummary (N/A)
    jdk.RedefineClasses (N/A)
  • jdk.ReservedStackActivation
    jdk.RetransformClasses (N/A)
  • jdk.SafepointBegin
  • jdk.SafepointCleanup
  • jdk.SafepointCleanupTask
  • jdk.SafepointEnd (since 22.1)
  • jdk.SafepointStateSynchronization
  • jdk.SecurityPropertyModification
    jdk.ShenandoahHeapRegionInformation (N/A)
    jdk.ShenandoahHeapRegionStateChange (N/A)
  • jdk.Shutdown
  • jdk.SocketRead (since JDK 23)
  • jdk.SocketWrite(since JDK 23)
    jdk.StringFlag (N/A)
    jdk.StringFlagChanged (N/A)
  • jdk.StringTableStatistics
  • jdk.SymbolTableStatistics
  • jdk.SyncOnValueBasedClass
  • jdk.SystemGC (since 24.0, GraalVM for JDK 22)
  • jdk.SystemProcess
  • jdk.TenuringDistribution
  • jdk.ThreadAllocationStatistics (since 24.0, GraalVM for JDK 22)
  • jdk.ThreadContextSwitchRate
  • jdk.ThreadCPULoad (since 23.1, GraalVM for JDK 21)
  • jdk.ThreadEnd (since 22.1)
  • jdk.ThreadDump
  • jdk.ThreadPark (since 23.0, GraalVM for JDK 17 / 20)
  • jdk.ThreadSleep (since 22.3)
  • jdk.ThreadStart (since 22.1)
  • jdk.TLSHandshake
    jdk.UnsignedIntFlag (N/A)
    jdk.UnsignedIntFlagChanged (N/A)
    jdk.UnsignedLongFlag (N/A)
    jdk.UnsignedLongFlagChanged (N/A)
  • jdk.VirtualizationInformation
  • jdk.VirtualThreadEnd (since 23.1, GraalVM for JDK 21)
  • jdk.VirtualThreadPinned (since 23.1, GraalVM for JDK 21)
  • jdk.VirtualThreadStart (since 23.1, GraalVM for JDK 21)
  • jdk.VirtualThreadSubmitFailed
  • jdk.X509Certificate
  • jdk.X509Validation
  • jdk.YoungGarbageCollection
  • jdk.YoungGenerationConfiguration
    jdk.ZAllocationStall (N/A)
    jdk.ZPageAllocation (N/A)
    jdk.ZRelocationSet (N/A)
    jdk.ZRelocationSetGroup (N/A)
    jdk.ZStatisticsCounter (N/A)
    jdk.ZStatisticsSampler (N/A)
    jdk.ZThreadPhase (N/A)
    jdk.ZUncommit (N/A)
    jdk.ZUnmap (N/A)

Features

Feature Native Image JIT Description
Event Streaming Supported (experimental) (since 23.0, GraalVM for JDK 17 / 20) Supported
Leak profiling In progress Supported Via old object sampling
Remote JMX Supported (experimental) (since 23.0, GraalVM for JDK 17 / 20) Supported Manage beans over JMX connection
Stacktrace data for events Supported (since 23.0, GraalVM for JDK 17 / 20) Supported
In-memory chunk rotation Not Supported Supported
Custom Events API Supported (since 22.3) Supported Create and emit custom events using the Events API
Control JFR via jcmd Supported in JDK24 EA Supported
Tuning via -XX:FlightRecorderOptions Supported (since JDK 23) Supported
Emergency Dumping on OOM Not Supported Supported Generated a JFR dump on out of memory error

Optimizations

Optimization Native Image JIT Description
String pool Not implemented Implemented Constant pool to deduplicate strings
Event Throttling Supported (since JDK 23) Implemented Subsample frequent events to have deterministic overhead.

Footnotes

  1. The only exception to this are GraalVM languages, which do contain the Graal compiler for guest language-level jitting.

Metadata

Metadata

Type

No type

Projects

Status

In Progress

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions