print the memory pools on GC logging
This commit is contained in:
parent
acc9783386
commit
d2bf87c89c
|
@ -206,19 +206,35 @@ public class JvmMonitorService extends AbstractLifecycleComponent<JvmMonitorServ
|
||||||
long avgCollectionTime = collectionTime / collections;
|
long avgCollectionTime = collectionTime / collections;
|
||||||
|
|
||||||
if (avgCollectionTime > gcThreshold.warnThreshold) {
|
if (avgCollectionTime > gcThreshold.warnThreshold) {
|
||||||
logger.warn("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}]",
|
logger.warn("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}], all_pools {}",
|
||||||
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax());
|
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax(), buildPools(lastJvmStats, currentJvmStats));
|
||||||
} else if (avgCollectionTime > gcThreshold.infoThreshold) {
|
} else if (avgCollectionTime > gcThreshold.infoThreshold) {
|
||||||
logger.info("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}]",
|
logger.info("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}], all_pools {}",
|
||||||
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax());
|
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax(), buildPools(lastJvmStats, currentJvmStats));
|
||||||
} else if (avgCollectionTime > gcThreshold.debugThreshold && logger.isDebugEnabled()) {
|
} else if (avgCollectionTime > gcThreshold.debugThreshold && logger.isDebugEnabled()) {
|
||||||
logger.debug("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}]",
|
logger.debug("[gc][{}][{}][{}] duration [{}], collections [{}]/[{}], total [{}]/[{}], memory [{}]->[{}]/[{}], all_pools {}",
|
||||||
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax());
|
gc.name(), seq, gc.collectionCount(), TimeValue.timeValueMillis(collectionTime), collections, TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()), TimeValue.timeValueMillis(collectionTime), gc.collectionTime(), lastJvmStats.mem().heapUsed(), currentJvmStats.mem().heapUsed(), JvmInfo.jvmInfo().mem().heapMax(), buildPools(lastJvmStats, currentJvmStats));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastJvmStats = currentJvmStats;
|
lastJvmStats = currentJvmStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildPools(JvmStats prev, JvmStats current) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (JvmStats.MemoryPool currentPool : current.mem()) {
|
||||||
|
JvmStats.MemoryPool prevPool = null;
|
||||||
|
for (JvmStats.MemoryPool pool : prev.mem()) {
|
||||||
|
if (pool.getName().equals(currentPool.getName())) {
|
||||||
|
prevPool = pool;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("{[").append(currentPool.name())
|
||||||
|
.append("] [").append(prevPool == null ? "?" : prevPool.used()).append("]->[").append(currentPool.used()).append("]/[").append(currentPool.getMax()).append("]}");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private void monitorDeadlock() {
|
private void monitorDeadlock() {
|
||||||
DeadlockAnalyzer.Deadlock[] deadlocks = deadlockAnalyzer().findDeadlocks();
|
DeadlockAnalyzer.Deadlock[] deadlocks = deadlockAnalyzer().findDeadlocks();
|
||||||
if (deadlocks != null && deadlocks.length > 0) {
|
if (deadlocks != null && deadlocks.length > 0) {
|
||||||
|
|
Loading…
Reference in New Issue