jvm监控的思路:通过定时拉取jvm的信息,然后收集起来,图表展示数据。
jvm指标的获取:
获取线程数 | ManagementFactory.getThreadMXBean().getThreadCount() |
非堆内存使用 | ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed() |
非堆内存初始化 | ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getInit() |
非堆内存已提交 | ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getCommitted() |
非堆内存最大值 | ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getMax() |
堆内存使用 | ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() |
堆内存初始化 | ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit() |
堆内存已提交 | ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getCommitted() |
堆内存最大值 | ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getMax() |
获取GC对象列表 | ManagementFactory.getGarbageCollectorMXBeans() |
YoungGC | ManagementFactory.getGarbageCollectorMXBeans().get(0) |
FullGC | ManagementFactory.getGarbageCollectorMXBeans().get(1) |
FullGC次数 | ManagementFactory.getGarbageCollectorMXBeans().get(1).getCollectionCount() |