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
Modifier and TypeClassDescriptionprivate static class
private class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final long
static final String
private final long
log INFO if we detect a pause longer than this thresholdprivate static final org.slf4j.Logger
private JvmPauseMonitorSource
private Thread
private boolean
private static final long
The target sleep timeprivate static final long
static final String
private final long
log WARN if we detect a pause longer than this threshold -
Constructor Summary
ConstructorDescriptionJvmPauseMonitor
(org.apache.hadoop.conf.Configuration conf) JvmPauseMonitor
(org.apache.hadoop.conf.Configuration conf, JvmPauseMonitorSource metricsSource) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
formatMessage
(long extraSleepTime, List<String> gcDiffs) private Map<String,
JvmPauseMonitor.GcTimes> static void
Simple 'main' to facilitate manual testing of the pause monitor.void
setMetricsSource
(JvmPauseMonitorSource metricsSource) void
start()
void
stop()
void
updateMetrics
(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
-