cpburnz / minecraft-prometheus-exporter

Prometheus exporter for Minecraft.
MIT License
44 stars 8 forks source link

GC Yough Times Differ & Inconsistant Question #20

Closed Aiidoneus closed 4 months ago

Aiidoneus commented 4 months ago

Hello, We have been using this for a while for our own graphs on our network and wanted to know why the mod Spark is reporting different results than what prometheus might be showing? Any ideas why this might be?

From our graphs From Spark

cpburnz commented 4 months ago

The Prometheus library I'm using (simpleclient_hotspot) ultimately gets it's GC stats from Java's GarbageCollectorMXBean via ManagementFactory.

I created a test server, and it had 5 old generation GCs by the time I connected. Then that number only increased by 2 about 15 minutes later. It appears to be fairly rare.

jvm_gc_collection_seconds_count{gc="G1 Young Generation",} 402.0
jvm_gc_collection_seconds_sum{gc="G1 Young Generation",} 2.336
jvm_gc_collection_seconds_count{gc="G1 Old Generation",} 7.0
jvm_gc_collection_seconds_sum{gc="G1 Old Generation",} 2.639

It looks like you're using the Minecraft Server Stats dashboard. The "GC time" graph uses the query:

increase(jvm_gc_collection_seconds_sum{application="$application", instance="$instance"}[$__interval])

So it only reports the number of GC events over each interval (60s on my instance), and your window looks to be about 20m. Your Spark screenshot is probably reporting the average of all events, not just over 1 minute intervals. It also says the average frequency of an old generation is about 1 hour, so you might see a single blip for the old generation if you increase your window to 3 hours. For the young generation my guess is periods of no connected players is biasing the average to be too low compared to high activity. I get 1 young generation every few seconds in the nether with no other mods (except for the Prometheus Exporter).

Slind14 commented 4 months ago

Thank you. We realized that it reported the total GC time per minute not per GC run. This can be closed.