HBASE-18737 Display configured max size of memstore and cache on RS UI

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Biju Nair 2017-08-31 17:47:12 -04:00 committed by tedyu
parent bd219c0fb8
commit 7e1517545c
12 changed files with 54 additions and 8 deletions

View File

@ -198,6 +198,11 @@ public class MemcachedBlockCache implements BlockCache {
return 0;
}
@Override
public long getMaxSize() {
return 0;
}
@Override
public long getFreeSize() {
return 0;

View File

@ -207,6 +207,7 @@ public interface MetricsRegionServerWrapper {
*/
int getFlushQueueSize();
public long getMemstoreLimit();
/**
* Get the size (in bytes) of the block cache that is free.
*/

View File

@ -326,25 +326,30 @@ are combined counts. Request count is sum of hits and misses.</p>
</tr>
</%if>
<tr>
<td>Count</td>
<td>Cache Size Limit</td>
<td><% TraditionalBinaryPrefix.long2String(bc.getMaxSize(), "B", 1) %></td>
<td>Max size of cache</td>
</tr>
<tr>
<td>Block Count</td>
<td><% String.format("%,d", bc.getBlockCount()) %></td>
<td>Count of Blocks</td>
</tr>
<%if !bucketCache %>
<tr>
<td>Count</td>
<td>Data Block Count</td>
<td><% String.format("%,d", bc.getDataBlockCount()) %></td>
<td>Count of DATA Blocks</td>
</tr>
</%if>
<tr>
<td>Size</td>
<td>Size of Blocks</td>
<td><% TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), "B", 1) %></td>
<td>Size of Blocks</td>
</tr>
<%if !bucketCache %>
<tr>
<td>Size</td>
<td>Size of Data Blocks</td>
<td><% TraditionalBinaryPrefix.long2String(bc.getCurrentDataSize(), "B", 1) %></td>
<td>Size of DATA Blocks</td>
</tr>

View File

@ -108,12 +108,12 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
</section>
<section>
<& ../common/TaskMonitorTmpl; filter = filter &>
<h2>Block Cache</h2>
<& BlockCacheTmpl; cacheConfig = regionServer.getCacheConfig(); config = regionServer.getConfiguration() &>
</section>
<section>
<h2>Block Cache</h2>
<& BlockCacheTmpl; cacheConfig = regionServer.getCacheConfig(); config = regionServer.getConfiguration() &>
<& ../common/TaskMonitorTmpl; filter = filter &>
</section>
<section>

View File

@ -112,6 +112,7 @@ MetricsRegionServerWrapper mWrap;
<th>Direct Memory Used</th>
<th>Direct Memory Configured</th>
<th>Memstore Size</th>
<th>Memstore Limit</th>
</tr>
</tr>
<tr>
@ -127,7 +128,12 @@ MetricsRegionServerWrapper mWrap;
<td>
<% TraditionalBinaryPrefix.long2String(DirectMemoryUtils.getDirectMemorySize(), "B", 1) %>
</td>
<td><% TraditionalBinaryPrefix.long2String(mWrap.getMemstoreSize(), "B", 1) %></td>
<td>
<% TraditionalBinaryPrefix.long2String(mWrap.getMemstoreSize(), "B", 1) %>
</td>
<td>
<% TraditionalBinaryPrefix.long2String(mWrap.getMemstoreLimit(), "B", 1) %>
</td>
</tr>
</table>
</%def>

View File

@ -90,6 +90,12 @@ public interface BlockCache extends Iterable<CachedBlock> {
*/
long size();
/**
* Returns the Max size of the block cache, in bytes.
* @return size of cache, in bytes
*/
long getMaxSize();
/**
* Returns the free size of the block cache, in bytes.
* @return free space in cache, in bytes

View File

@ -113,6 +113,11 @@ public class CombinedBlockCache implements ResizableBlockCache, HeapSize {
return lruCache.size() + l2Cache.size();
}
@Override
public long getMaxSize() {
return lruCache.getMaxSize() + l2Cache.getMaxSize();
}
@Override
public long getCurrentDataSize() {
return lruCache.getCurrentDataSize() + l2Cache.getCurrentDataSize();

View File

@ -840,6 +840,8 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
*
* @return max size in bytes
*/
@Override
public long getMaxSize() {
return this.maxSize;
}

View File

@ -353,6 +353,7 @@ public class BucketCache implements BlockCache, HeapSize {
return this.cacheEnabled;
}
@Override
public long getMaxSize() {
return this.cacheCapacity;
}

View File

@ -281,6 +281,11 @@ class MetricsRegionServerWrapperImpl
return this.blockCache.getBlockCount();
}
@Override
public long getMemstoreLimit() {
return this.regionServer.getRegionServerAccounting().getGlobalMemstoreLimit();
}
@Override
public long getBlockCacheSize() {
if (this.blockCache == null) {

View File

@ -205,6 +205,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
return 412;
}
@Override
public long getMemstoreLimit() {
return 419;
}
@Override
public long getBlockCacheFreeSize() {
return 413;

View File

@ -737,6 +737,11 @@ public class TestHeapMemoryManager {
return 0;
}
@Override
public long getMaxSize() {
return 0;
}
@Override
public long getFreeSize() {
return 0;