[core][monitoring][fus] JVM responsiveness reporting #3

+ adjust sampling params: sample less often, but make single sample heavier, collect more samples for reporting for more precision of high %-tiles
+ reduce reporting precision: double->float

GitOrigin-RevId: e42c422b6ca7d55019a44b220ae0d8633866f05f
This commit is contained in:
Ruslan Cheremin
2024-03-22 17:35:21 +00:00
committed by intellij-monorepo-bot
parent 5f4f444f69
commit 22790fbb78
2 changed files with 15 additions and 15 deletions
@@ -139,14 +139,14 @@ internal object UILatencyLogger : CounterUsagesCollector() {
/** number of samples in this set of measurements */
private val SAMPLES_COUNT: IntEventField = IntEventField("samples")
/** mean task running time, in nanoseconds */
private val AVG_NS: DoubleEventField = DoubleEventField("avg_ns")
private val AVG_NS: FloatEventField = FloatEventField("avg_ns")
/** 50%-tile of task running time, in nanoseconds */
private val P50_NS: LongEventField = LongEventField("p50_ns")
//below fields values are _relative to median_: 99%/50%, 99.9%/50%, max/50%
private val P99_TO_P50: DoubleEventField = DoubleEventField("p99_to_p50")
private val P999_TO_P50: DoubleEventField = DoubleEventField("p999_to_p50")
private val MAX_TO_P50: DoubleEventField = DoubleEventField("max_to_p50")
private val P99_TO_P50: FloatEventField = FloatEventField("p99_to_p50")
private val P999_TO_P50: FloatEventField = FloatEventField("p999_to_p50")
private val MAX_TO_P50: FloatEventField = FloatEventField("max_to_p50")
private val RESPONSIVENESS_EVENT: VarargEventId = GROUP.registerVarargEvent(
"responsiveness",
@@ -160,12 +160,12 @@ internal object UILatencyLogger : CounterUsagesCollector() {
RESPONSIVENESS_EVENT.log(
SAMPLES_COUNT.with(samplesCount),
AVG_NS.with(avg_ns),
AVG_NS.with(avg_ns.toFloat()),
P50_NS.with(p50_ns),
P99_TO_P50.with(p99_ns * 1.0 / p50_ns),
P999_TO_P50.with(p999_ns * 1.0 / p50_ns),
MAX_TO_P50.with(max_ns * 1.0 / p50_ns)
P99_TO_P50.with((p99_ns * 1.0 / p50_ns).toFloat()),
P999_TO_P50.with((p999_ns * 1.0 / p50_ns).toFloat()),
MAX_TO_P50.with((max_ns * 1.0 / p50_ns).toFloat())
)
}
@@ -16,7 +16,7 @@ import static com.intellij.util.SystemProperties.getIntProperty;
* Follows an idea of <a href="https://github.com/giltene/jHiccup">jhiccup</a> tool: monitors
* general JVM responsiveness by periodically run a sample CPU/memory-bound task and measure
* its run time.
* Creates a histogram over task run distribution, and reports a few chosen statistics
* Creates a histogram over task run duration distribution, and reports a few chosen statistics
* (avg, max, 50-99-99.9%-tile...) to FUS, as 'performance:responsiveness' event
* <p>
* The goal is to estimate how many 'hiccups' -- tail-delays in ordinary CPU/memory-bound
@@ -45,15 +45,15 @@ public final class JVMResponsivenessMonitor implements Disposable, AutoCloseable
// 3. GC pauses: probably, the most important for JVM threads, and a something we have at least
// some means to deal with
private static final int SAMPLING_PERIOD_MS = getIntProperty("JVMResponsivenessMonitor.SAMPLING_PERIOD_MS", 500);
/** Should be >1000 for 99.9% to make any sense */
private static final int REPORTING_EACH_N_SAMPLES = getIntProperty("JVMResponsivenessMonitor.REPORTING_EACH_N_SAMPLES", 2000);
private static final int SAMPLING_PERIOD_MS = getIntProperty("JVMResponsivenessMonitor.SAMPLING_PERIOD_MS", 1_000);
/** Should be >1000 for 99.9%-ile to make any sense */
private static final int REPORTING_EACH_N_SAMPLES = getIntProperty("JVMResponsivenessMonitor.REPORTING_EACH_N_SAMPLES", 3600);
private static final int MEMORY_BUFFER_SIZE = getIntProperty("JVMResponsivenessMonitor.MEMORY_BUFFER_SIZE", 512 * 1024);
/**
* Should be tuned so that task duration is somewhere ~ 10s us. Not too long so it won't affect
* overall app's performance, not too short so it's duration could be measured with enough precision
* Should be tuned so that task duration ~ 10-50 us. Not too long so it won't affect overall app's performance, not too
* short -- so it's duration could be measured with enough precision
*/
private static final int MEMORY_OPS_PER_RUN = getIntProperty("JVMResponsivenessMonitor.MEMORY_OPS_PER_RUN", 50);
private static final int MEMORY_OPS_PER_RUN = getIntProperty("JVMResponsivenessMonitor.MEMORY_OPS_PER_RUN", 100);
public static final String MONITOR_THREAD_NAME = "JVMResponsivenessMonitor";