HBASE-2068 MetricsRate is missing "registry" parameter (Lars George via JD)
HBASE-2078 Add JMX settings as commented out lines to hbase-env.sh (Lars George via JD) git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@894689 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
58039a7bc2
commit
dfd0303cd7
|
@ -144,6 +144,8 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-2075 Master requires HDFS superuser privileges due to waitOnSafeMode
|
HBASE-2075 Master requires HDFS superuser privileges due to waitOnSafeMode
|
||||||
HBASE-2077 NullPointerException with an open scanner that expired causing
|
HBASE-2077 NullPointerException with an open scanner that expired causing
|
||||||
an immediate region server shutdown (Sam Pullara via JD)
|
an immediate region server shutdown (Sam Pullara via JD)
|
||||||
|
HBASE-2078 Add JMX settings as commented out lines to hbase-env.sh
|
||||||
|
(Lars George via JD)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-1760 Cleanup TODOs in HTable
|
HBASE-1760 Cleanup TODOs in HTable
|
||||||
|
@ -262,6 +264,7 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-2045 Update trunk and branch zk to just-release 3.2.2.
|
HBASE-2045 Update trunk and branch zk to just-release 3.2.2.
|
||||||
HBASE-2074 Improvements to the hadoop-config script (Bassam Tabbara via Stack)
|
HBASE-2074 Improvements to the hadoop-config script (Bassam Tabbara via Stack)
|
||||||
HBASE-2076 Many javadoc warnings
|
HBASE-2076 Many javadoc warnings
|
||||||
|
HBASE-2068 MetricsRate is missing "registry" parameter (Lars George via JD)
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write
|
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write
|
||||||
|
|
|
@ -37,7 +37,16 @@
|
||||||
export HBASE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"
|
export HBASE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"
|
||||||
|
|
||||||
# Uncomment below to enable java garbage collection logging.
|
# Uncomment below to enable java garbage collection logging.
|
||||||
#export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log"
|
# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log"
|
||||||
|
|
||||||
|
# Uncomment and adjust/create "jmxremote.*" to enable JMX exporting
|
||||||
|
# export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false"
|
||||||
|
# export HBASE_JMX_BASE="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.password"
|
||||||
|
# export HBASE_JMX_BASE="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access"
|
||||||
|
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101"
|
||||||
|
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102"
|
||||||
|
# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"
|
||||||
|
# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"
|
||||||
|
|
||||||
# File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default.
|
# File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default.
|
||||||
# export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers
|
# export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers
|
||||||
|
|
|
@ -19,12 +19,12 @@ package org.apache.hadoop.hbase.master.metrics;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.hbase.metrics.MetricsRate;
|
||||||
import org.apache.hadoop.metrics.MetricsContext;
|
import org.apache.hadoop.metrics.MetricsContext;
|
||||||
import org.apache.hadoop.metrics.MetricsRecord;
|
import org.apache.hadoop.metrics.MetricsRecord;
|
||||||
import org.apache.hadoop.metrics.MetricsUtil;
|
import org.apache.hadoop.metrics.MetricsUtil;
|
||||||
import org.apache.hadoop.metrics.Updater;
|
import org.apache.hadoop.metrics.Updater;
|
||||||
import org.apache.hadoop.metrics.jvm.JvmMetrics;
|
import org.apache.hadoop.metrics.jvm.JvmMetrics;
|
||||||
import org.apache.hadoop.metrics.util.MetricsIntValue;
|
|
||||||
import org.apache.hadoop.metrics.util.MetricsRegistry;
|
import org.apache.hadoop.metrics.util.MetricsRegistry;
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ public class MasterMetrics implements Updater {
|
||||||
/*
|
/*
|
||||||
* Count of requests to the cluster since last call to metrics update
|
* Count of requests to the cluster since last call to metrics update
|
||||||
*/
|
*/
|
||||||
private final MetricsIntValue cluster_requests =
|
private final MetricsRate cluster_requests =
|
||||||
new MetricsIntValue("cluster_requests", registry);
|
new MetricsRate("cluster_requests", registry);
|
||||||
|
|
||||||
public MasterMetrics(final String name) {
|
public MasterMetrics(final String name) {
|
||||||
MetricsContext context = MetricsUtil.getContext("hbase");
|
MetricsContext context = MetricsUtil.getContext("hbase");
|
||||||
|
@ -71,11 +71,7 @@ public class MasterMetrics implements Updater {
|
||||||
*/
|
*/
|
||||||
public void doUpdates(MetricsContext unused) {
|
public void doUpdates(MetricsContext unused) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
synchronized(this.cluster_requests) {
|
this.cluster_requests.pushMetric(metricsRecord);
|
||||||
this.cluster_requests.pushMetric(metricsRecord);
|
|
||||||
// Set requests down to zero again.
|
|
||||||
this.cluster_requests.set(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.metricsRecord.update();
|
this.metricsRecord.update();
|
||||||
}
|
}
|
||||||
|
@ -87,16 +83,14 @@ public class MasterMetrics implements Updater {
|
||||||
/**
|
/**
|
||||||
* @return Count of requests.
|
* @return Count of requests.
|
||||||
*/
|
*/
|
||||||
public int getRequests() {
|
public float getRequests() {
|
||||||
return this.cluster_requests.get();
|
return this.cluster_requests.getPreviousIntervalValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param inc How much to add to requests.
|
* @param inc How much to add to requests.
|
||||||
*/
|
*/
|
||||||
public void incrementRequests(final int inc) {
|
public void incrementRequests(final int inc) {
|
||||||
synchronized(this.cluster_requests) {
|
this.cluster_requests.inc(inc);
|
||||||
this.cluster_requests.set(this.cluster_requests.get() + inc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,25 +20,32 @@ package org.apache.hadoop.hbase.metrics;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.metrics.MetricsRecord;
|
import org.apache.hadoop.metrics.MetricsRecord;
|
||||||
|
import org.apache.hadoop.metrics.util.MetricsBase;
|
||||||
|
import org.apache.hadoop.metrics.util.MetricsRegistry;
|
||||||
import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publishes a rate based on a counter - you increment the counter each
|
* Publishes a rate based on a counter - you increment the counter each
|
||||||
* time an event occurs (eg: an RPC call) and this publishes a rate.
|
* time an event occurs (eg: an RPC call) and this publishes a rate.
|
||||||
*/
|
*/
|
||||||
public class MetricsRate {
|
public class MetricsRate extends MetricsBase {
|
||||||
private static final Log LOG = LogFactory.getLog("org.apache.hadoop.hbase.metrics");
|
private static final Log LOG = LogFactory.getLog("org.apache.hadoop.hbase.metrics");
|
||||||
|
|
||||||
private String name;
|
|
||||||
private int value;
|
private int value;
|
||||||
private float prevRate;
|
private float prevRate;
|
||||||
private long ts;
|
private long ts;
|
||||||
|
|
||||||
public MetricsRate(final String name) {
|
public MetricsRate(final String name, final MetricsRegistry registry,
|
||||||
this.name = name;
|
final String description) {
|
||||||
|
super(name, description);
|
||||||
this.value = 0;
|
this.value = 0;
|
||||||
this.prevRate = 0;
|
this.prevRate = 0;
|
||||||
this.ts = System.currentTimeMillis();
|
this.ts = System.currentTimeMillis();
|
||||||
|
registry.add(name, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetricsRate(final String name, final MetricsRegistry registry) {
|
||||||
|
this(name, registry, NO_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void inc(final int incr) {
|
public synchronized void inc(final int incr) {
|
||||||
|
@ -58,15 +65,17 @@ public class MetricsRate {
|
||||||
this.ts = now;
|
this.ts = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized void pushMetric(final MetricsRecord mr) {
|
public synchronized void pushMetric(final MetricsRecord mr) {
|
||||||
intervalHeartBeat();
|
intervalHeartBeat();
|
||||||
try {
|
try {
|
||||||
mr.setMetric(name, getPreviousIntervalValue());
|
mr.setMetric(getName(), getPreviousIntervalValue());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.info("pushMetric failed for " + name + "\n" +
|
LOG.info("pushMetric failed for " + getName() + "\n" +
|
||||||
StringUtils.stringifyException(e));
|
StringUtils.stringifyException(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized float getPreviousIntervalValue() {
|
public synchronized float getPreviousIntervalValue() {
|
||||||
return this.prevRate;
|
return this.prevRate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RegionServerMetrics implements Updater {
|
||||||
/*
|
/*
|
||||||
* Count of requests to the regionservers since last call to metrics update
|
* Count of requests to the regionservers since last call to metrics update
|
||||||
*/
|
*/
|
||||||
private final MetricsRate requests = new MetricsRate("requests");
|
private final MetricsRate requests = new MetricsRate("requests", registry);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count of stores open on the regionserver.
|
* Count of stores open on the regionserver.
|
||||||
|
|
Loading…
Reference in New Issue