Package org.apache.hadoop.hbase.util
Class JvmPauseMonitor
java.lang.Object
org.apache.hadoop.hbase.util.JvmPauseMonitor
Class which sets up a simple thread which runs in a loop sleeping for a short interval of time.
If the sleep takes significantly longer than its target time, it implies that the JVM or host
machine has paused processing, which may cause other problems. If such a pause is detected, the
thread logs a message. The original JvmPauseMonitor is:
${hadoop-common-project}/hadoop-common/src/main/java/org/apache/hadoop/util/ JvmPauseMonitor.java
r1503806 | cmccabe | 2013-07-17 01:48:24 +0800 (Wed, 17 Jul 2013) | 1 line HADOOP-9618. thread
which detects GC pauses(Todd Lipcon)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longstatic final Stringprivate final longlog INFO if we detect a pause longer than this thresholdprivate static final org.slf4j.Loggerprivate JvmPauseMonitorSourceprivate Threadprivate booleanprivate static final longThe target sleep timeprivate static final longstatic final Stringprivate final longlog WARN if we detect a pause longer than this threshold -
Constructor Summary
ConstructorsConstructorDescriptionJvmPauseMonitor(org.apache.hadoop.conf.Configuration conf) JvmPauseMonitor(org.apache.hadoop.conf.Configuration conf, JvmPauseMonitorSource metricsSource) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringformatMessage(long extraSleepTime, List<String> gcDiffs) private Map<String,JvmPauseMonitor.GcTimes> static voidSimple 'main' to facilitate manual testing of the pause monitor.voidsetMetricsSource(JvmPauseMonitorSource metricsSource) voidstart()voidstop()voidupdateMetrics(long sleepTime, boolean gcDetected)
-
Field Details
-
LOG
-
SLEEP_INTERVAL_MS
The target sleep time- See Also:
-
warnThresholdMs
log WARN if we detect a pause longer than this threshold -
WARN_THRESHOLD_KEY
- See Also:
-
WARN_THRESHOLD_DEFAULT
- See Also:
-
infoThresholdMs
log INFO if we detect a pause longer than this threshold -
INFO_THRESHOLD_KEY
- See Also:
-
INFO_THRESHOLD_DEFAULT
- See Also:
-
monitorThread
-
shouldRun
-
metricsSource
-
-
Constructor Details
-
JvmPauseMonitor
-
JvmPauseMonitor
public JvmPauseMonitor(org.apache.hadoop.conf.Configuration conf, JvmPauseMonitorSource metricsSource)
-
-
Method Details
-
start
-
stop
-
formatMessage
-
getGcTimes
-
updateMetrics
-
getMetricsSource
-
setMetricsSource
-
main
Simple 'main' to facilitate manual testing of the pause monitor. This main function just leaks memory into a list. Running this class with a 1GB heap will very quickly go into "GC hell" and result in log messages about the GC pauses.- Throws:
Exception
-