HBASE-12496 A blockedRequestsCount metric (Yi Deng)
This commit is contained in:
parent
d3c9425c9b
commit
eb34c956a1
|
@ -246,6 +246,10 @@ public interface MetricsRegionServerSource extends BaseSource {
|
||||||
String MAJOR_COMPACTED_CELLS_SIZE_DESC =
|
String MAJOR_COMPACTED_CELLS_SIZE_DESC =
|
||||||
"The total amount of data processed during major compactions, in bytes";
|
"The total amount of data processed during major compactions, in bytes";
|
||||||
|
|
||||||
|
String BLOCKED_REQUESTS_COUNT = "blockedRequestCount";
|
||||||
|
String BLOCKED_REQUESTS_COUNT_DESC = "The number of blocked requests because of memstore size is "
|
||||||
|
+ "larger than blockingMemStoreSize";
|
||||||
|
|
||||||
String SPLIT_KEY = "splitTime";
|
String SPLIT_KEY = "splitTime";
|
||||||
String FLUSH_KEY = "flushTime";
|
String FLUSH_KEY = "flushTime";
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,4 +246,9 @@ public interface MetricsRegionServerWrapper {
|
||||||
* Get the total amount of data processed during major compactions, in bytes.
|
* Get the total amount of data processed during major compactions, in bytes.
|
||||||
*/
|
*/
|
||||||
long getMajorCompactedCellsSize();
|
long getMajorCompactedCellsSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Count of requests blocked because the memstore size is larger than blockingMemStoreSize
|
||||||
|
*/
|
||||||
|
public long getBlockedRequestsCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,10 @@ public class MetricsRegionServerSourceImpl
|
||||||
rsWrap.getCompactedCellsSize())
|
rsWrap.getCompactedCellsSize())
|
||||||
.addCounter(Interns.info(MAJOR_COMPACTED_CELLS_SIZE, MAJOR_COMPACTED_CELLS_SIZE_DESC),
|
.addCounter(Interns.info(MAJOR_COMPACTED_CELLS_SIZE, MAJOR_COMPACTED_CELLS_SIZE_DESC),
|
||||||
rsWrap.getMajorCompactedCellsSize())
|
rsWrap.getMajorCompactedCellsSize())
|
||||||
|
|
||||||
|
.addCounter(Interns.info(BLOCKED_REQUESTS_COUNT, BLOCKED_REQUESTS_COUNT_DESC),
|
||||||
|
rsWrap.getBlockedRequestsCount())
|
||||||
|
|
||||||
.tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC),
|
.tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC),
|
||||||
rsWrap.getZookeeperQuorum())
|
rsWrap.getZookeeperQuorum())
|
||||||
.tag(Interns.info(SERVER_NAME_NAME, SERVER_NAME_DESC), rsWrap.getServerName())
|
.tag(Interns.info(SERVER_NAME_NAME, SERVER_NAME_DESC), rsWrap.getServerName())
|
||||||
|
|
|
@ -282,6 +282,16 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
final Counter readRequestsCount = new Counter();
|
final Counter readRequestsCount = new Counter();
|
||||||
final Counter writeRequestsCount = new Counter();
|
final Counter writeRequestsCount = new Counter();
|
||||||
|
|
||||||
|
// Number of requests blocked by memstore size.
|
||||||
|
private final Counter blockedRequestsCount = new Counter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the number of blocked requests count.
|
||||||
|
*/
|
||||||
|
public long getBlockedRequestsCount() {
|
||||||
|
return this.blockedRequestsCount.get();
|
||||||
|
}
|
||||||
|
|
||||||
// Compaction counters
|
// Compaction counters
|
||||||
final AtomicLong compactionsFinished = new AtomicLong(0L);
|
final AtomicLong compactionsFinished = new AtomicLong(0L);
|
||||||
final AtomicLong compactionNumFilesCompacted = new AtomicLong(0L);
|
final AtomicLong compactionNumFilesCompacted = new AtomicLong(0L);
|
||||||
|
@ -3123,6 +3133,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
if (this.getRegionInfo().isMetaRegion()) return;
|
if (this.getRegionInfo().isMetaRegion()) return;
|
||||||
|
|
||||||
if (this.memstoreSize.get() > this.blockingMemStoreSize) {
|
if (this.memstoreSize.get() > this.blockingMemStoreSize) {
|
||||||
|
blockedRequestsCount.increment();
|
||||||
requestFlush();
|
requestFlush();
|
||||||
throw new RegionTooBusyException("Above memstore limit, " +
|
throw new RegionTooBusyException("Above memstore limit, " +
|
||||||
"regionName=" + (this.getRegionInfo() == null ? "unknown" :
|
"regionName=" + (this.getRegionInfo() == null ? "unknown" :
|
||||||
|
@ -5766,7 +5777,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
public static final long FIXED_OVERHEAD = ClassSize.align(
|
public static final long FIXED_OVERHEAD = ClassSize.align(
|
||||||
ClassSize.OBJECT +
|
ClassSize.OBJECT +
|
||||||
ClassSize.ARRAY +
|
ClassSize.ARRAY +
|
||||||
41 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
|
42 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
|
||||||
(12 * Bytes.SIZEOF_LONG) +
|
(12 * Bytes.SIZEOF_LONG) +
|
||||||
4 * Bytes.SIZEOF_BOOLEAN);
|
4 * Bytes.SIZEOF_BOOLEAN);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ class MetricsRegionServerWrapperImpl
|
||||||
private volatile long flushedCellsSize = 0;
|
private volatile long flushedCellsSize = 0;
|
||||||
private volatile long compactedCellsSize = 0;
|
private volatile long compactedCellsSize = 0;
|
||||||
private volatile long majorCompactedCellsSize = 0;
|
private volatile long majorCompactedCellsSize = 0;
|
||||||
|
private volatile long blockedRequestsCount = 0L;
|
||||||
|
|
||||||
private CacheStats cacheStats;
|
private CacheStats cacheStats;
|
||||||
private ScheduledExecutorService executor;
|
private ScheduledExecutorService executor;
|
||||||
|
@ -427,6 +428,7 @@ class MetricsRegionServerWrapperImpl
|
||||||
long tempFlushedCellsSize = 0;
|
long tempFlushedCellsSize = 0;
|
||||||
long tempCompactedCellsSize = 0;
|
long tempCompactedCellsSize = 0;
|
||||||
long tempMajorCompactedCellsSize = 0;
|
long tempMajorCompactedCellsSize = 0;
|
||||||
|
long tempBlockedRequestsCount = 0L;
|
||||||
|
|
||||||
for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {
|
for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {
|
||||||
tempNumMutationsWithoutWAL += r.numMutationsWithoutWAL.get();
|
tempNumMutationsWithoutWAL += r.numMutationsWithoutWAL.get();
|
||||||
|
@ -435,6 +437,7 @@ class MetricsRegionServerWrapperImpl
|
||||||
tempWriteRequestsCount += r.writeRequestsCount.get();
|
tempWriteRequestsCount += r.writeRequestsCount.get();
|
||||||
tempCheckAndMutateChecksFailed += r.checkAndMutateChecksFailed.get();
|
tempCheckAndMutateChecksFailed += r.checkAndMutateChecksFailed.get();
|
||||||
tempCheckAndMutateChecksPassed += r.checkAndMutateChecksPassed.get();
|
tempCheckAndMutateChecksPassed += r.checkAndMutateChecksPassed.get();
|
||||||
|
tempBlockedRequestsCount += r.getBlockedRequestsCount();
|
||||||
tempNumStores += r.stores.size();
|
tempNumStores += r.stores.size();
|
||||||
for (Store store : r.stores.values()) {
|
for (Store store : r.stores.values()) {
|
||||||
tempNumStoreFiles += store.getStorefilesCount();
|
tempNumStoreFiles += store.getStorefilesCount();
|
||||||
|
@ -511,6 +514,12 @@ class MetricsRegionServerWrapperImpl
|
||||||
flushedCellsSize = tempFlushedCellsSize;
|
flushedCellsSize = tempFlushedCellsSize;
|
||||||
compactedCellsSize = tempCompactedCellsSize;
|
compactedCellsSize = tempCompactedCellsSize;
|
||||||
majorCompactedCellsSize = tempMajorCompactedCellsSize;
|
majorCompactedCellsSize = tempMajorCompactedCellsSize;
|
||||||
|
blockedRequestsCount = tempBlockedRequestsCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getBlockedRequestsCount() {
|
||||||
|
return blockedRequestsCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,4 +241,8 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
||||||
return 10240000;
|
return 10240000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getBlockedRequestsCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue