RFR: 8216283: Allow shorter method sampling interval than 10 ms

Erik Gahlin erik.gahlin at oracle.com
Mon May 20 17:46:57 UTC 2019


Could I please have a review of a fix that allows method sampling to 
happen at a higher rate. The current limit of 10 ms exists because 
method sampling used to occur in the VM period task. Method sampling now 
happens in a separate thread. This was changed in JDK 9.

The minimum accepted interval is lowered from 10 ms to 1 ms for both 
native and Java samples, but configuration files have been changed so 
native sampling interval can not be set lower than 20 ms using JMC 
Recording Wizard controls. Manual edit of the event setting allows 1 ms.

The reason for this is to avoid excessive number native sample events. 
Purpose of native sampling is to detect "stuck threads". That is, 
threads that have called into native, but not returned. Most of the 
native samples will however be threads waiting in native, for example on 
a socket. Going below 20 ms adds little value, since a stuck thread is 
typically in native for a longer period of time.

Method sampling in Java on the other hand can be set to 1 ms in a new 
"mode" called "Extreme". To avoid confusion, I didn't want to use 
"Maximum" since it means 10 ms in earlier releases.



Tried to set the interval in the JMC Recording Wizard and verified that 
the correct interval was set in JVM using:
$ jcmd <pid> JFR.check verbose=true


More information about the jmc-dev mailing list