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

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Biju Nair 2017-09-06 12:16:05 -04:00 committed by tedyu
parent 13da97d85e
commit 5de4a7d898
9 changed files with 39 additions and 8 deletions

View File

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

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

@ -109,12 +109,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

@ -127,7 +127,9 @@ 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>
</tr>
</table>
</%def>

View File

@ -89,6 +89,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

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

View File

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

View File

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

View File

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