org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmplImpl Maven / Gradle / Ivy
Show all versions of hbase-server Show documentation
// Autogenerated Jamon implementation
// /home/apurtell/tmp/RM/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
package org.apache.hadoop.hbase.tmpl.regionserver;
// 32, 1
import java.util.Map;
// 33, 1
import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil;
// 34, 1
import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile;
// 35, 1
import org.apache.hadoop.hbase.io.hfile.AgeSnapshot;
// 36, 1
import org.apache.hadoop.hbase.io.hfile.CachedBlock;
// 37, 1
import org.apache.hadoop.conf.Configuration;
// 38, 1
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
// 39, 1
import org.apache.hadoop.hbase.io.hfile.BlockCache;
// 40, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats;
// 41, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache;
// 42, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator;
// 43, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket;
// 44, 1
import org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
public class BlockCacheTmplImpl
extends org.jamon.AbstractTemplateImpl
implements org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl.Intf
{
private final CacheConfig cacheConfig;
private final Configuration config;
private final BlockCache bc;
protected static org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl.ImplData p_implData)
{
return p_implData;
}
public BlockCacheTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl.ImplData p_implData)
{
super(p_templateManager, __jamon_setOptionalArguments(p_implData));
cacheConfig = p_implData.getCacheConfig();
config = p_implData.getConfig();
bc = p_implData.getBc();
}
@Override public void renderNoFlush(final java.io.Writer jamonWriter)
throws java.io.IOException
{
// 25, 1
String bcUrl = bc == null ? null : "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html";
String bcName = bc == null ? null : bc.getClass().getSimpleName();
BlockCache [] bcs = bc == null ? null : bc.getBlockCaches();
boolean evictions = bcs != null && bcs.length > 1;
// 46, 1
jamonWriter.write("\n \n \n \n ");
// 56, 13
{
// 56, 13
__jamon_innerUnit__bc_baseInfo(jamonWriter, bc, bcUrl, bcName);
}
// 56, 73
jamonWriter.write("\n \n \n ");
// 59, 13
{
// 59, 13
__jamon_innerUnit__bc_config(jamonWriter, cacheConfig );
}
// 59, 55
jamonWriter.write("\n \n \n ");
// 62, 13
{
// 62, 13
__jamon_innerUnit__bc_stats(jamonWriter, bc );
}
// 62, 36
jamonWriter.write("\n \n \n ");
// 65, 13
{
// 65, 13
__jamon_innerUnit__bc_l(jamonWriter, bcs == null? bc: bcs[0], "L1", evictions);
}
// 65, 90
jamonWriter.write("\n \n \n ");
// 68, 13
{
// 68, 13
__jamon_innerUnit__bc_l(jamonWriter, bcs == null? null: bcs.length <= 1? null: bcs[1], "L2", evictions);
}
// 68, 115
jamonWriter.write("\n \n \n\n\n");
}
// 73, 1
private void __jamon_innerUnit__bc_baseInfo(final java.io.Writer jamonWriter, final BlockCache bc, final String bcUrl, final String bcName)
throws java.io.IOException
{
// 79, 1
BlockCache [] bcs = bc == null? null: bc.getBlockCaches();
String bcl1Url = null;
String bcl1Name = null;
String bcl2Url = null;
String bcl2Name = null;
if (bcs != null) {
BlockCache bcl1 = bcs[0];
if (bcl1 != null) {
bcl1Url = "http://hbase.apache.org/devapidocs/" + bcl1.getClass().getName().replaceAll("\\.", "/") + ".html";
bcl1Name = bcl1.getClass().getSimpleName();
}
if (bcs.length == 2) {
BlockCache bcl2 = bcs[1];
bcl2Url = "http://hbase.apache.org/devapidocs/" + bcl2.getClass().getName().replaceAll("\\.", "/") + ".html";
bcl2Name = bcl2.getClass().getSimpleName();
}
}
// 98, 1
jamonWriter.write("\n \n Attribute \n Value \n Description \n \n \n \n Implementation \n ");
// 107, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bcName), jamonWriter);
// 107, 47
jamonWriter.write(" \n Block cache implementing class \n \n
\nSee block cache in the HBase Reference Guide for help.
\n");
}
// 114, 1
private void __jamon_innerUnit__bc_config(final java.io.Writer jamonWriter, final CacheConfig cacheConfig)
throws java.io.IOException
{
// 118, 1
if (cacheConfig == null )
{
// 118, 28
jamonWriter.write("\nCacheConfig is null
\n");
}
// 120, 1
else
{
// 120, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Cache DATA on Read \n ");
// 129, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataOnRead()), jamonWriter);
// 129, 54
jamonWriter.write(" \n True if DATA blocks are cached on read\n (INDEX & BLOOM blocks are always cached) \n \n \n Cache DATA on Write \n ");
// 135, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataOnWrite()), jamonWriter);
// 135, 55
jamonWriter.write(" \n True if DATA blocks are cached on write. \n \n \n Cache INDEX on Write \n ");
// 140, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheIndexesOnWrite()), jamonWriter);
// 140, 58
jamonWriter.write(" \n True if INDEX blocks are cached on write \n \n \n Cache BLOOM on Write \n ");
// 145, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheBloomsOnWrite()), jamonWriter);
// 145, 57
jamonWriter.write(" \n True if BLOOM blocks are cached on write \n \n \n Evict blocks on Close \n ");
// 150, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldEvictOnClose()), jamonWriter);
// 150, 51
jamonWriter.write(" \n True if blocks are evicted from cache when an HFile\n reader is closed \n \n \n Cache DATA in compressed format \n ");
// 156, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataCompressed()), jamonWriter);
// 156, 58
jamonWriter.write(" \n True if DATA blocks are cached in their compressed form \n \n \n Prefetch on Open \n ");
// 161, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldPrefetchOnOpen()), jamonWriter);
// 161, 53
jamonWriter.write(" \n True if blocks are prefetched into cache on open \n \n
\n");
}
// 165, 7
jamonWriter.write("\n");
}
// 263, 1
private void __jamon_innerUnit__bc_l(final java.io.Writer jamonWriter, final BlockCache bc, final String name, final boolean evictions)
throws java.io.IOException
{
// 269, 1
if (bc == null )
{
// 269, 19
jamonWriter.write("\nNo ");
// 270, 7
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(name), jamonWriter);
// 270, 17
jamonWriter.write(" deployed
\n");
}
// 271, 1
else
{
// 271, 8
jamonWriter.write("\n");
// 272, 1
{
// 272, 1
__jamon_innerUnit__block_cache(jamonWriter, bc, name, evictions);
}
// 272, 65
jamonWriter.write("\n");
}
// 273, 7
jamonWriter.write("\n");
}
// 225, 1
private void __jamon_innerUnit__bc_stats(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 229, 1
if (bc == null )
{
// 229, 19
jamonWriter.write("\nBlockCache is null
\n");
}
// 231, 1
else
{
// 231, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Size \n ");
// 240, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(bc.getCurrentSize(),
"B", 1)), jamonWriter);
// 241, 23
jamonWriter.write(" \n Current size of block cache in use \n \n \n Free \n ");
// 246, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(bc.getFreeSize(),
"B", 1)), jamonWriter);
// 247, 23
jamonWriter.write(" \n The total free memory currently available to store more cache entries \n \n \n Count \n ");
// 252, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getBlockCount())), jamonWriter);
// 252, 59
jamonWriter.write(" \n Number of blocks in block cache \n \n ");
// 255, 5
{
// 255, 5
__jamon_innerUnit__evictions_tmpl(jamonWriter, bc);
}
// 255, 35
jamonWriter.write("\n ");
// 256, 5
{
// 256, 5
__jamon_innerUnit__hits_tmpl(jamonWriter, bc);
}
// 256, 30
jamonWriter.write("\n
\nIf block cache is made up of more than one cache -- i.e. a L1 and a L2 -- then the above\nare combined counts. Request count is sum of hits and misses.
\n");
}
// 260, 7
jamonWriter.write("\n");
}
// 276, 1
private void __jamon_innerUnit__block_cache(final java.io.Writer jamonWriter, final BlockCache bc, final String name, final boolean evictions)
throws java.io.IOException
{
// 282, 1
String bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html";
String bcName = bc.getClass().getSimpleName();
int maxCachedBlocksByFile = BlockCacheUtil.getMaxCachedBlocksByFile(config);
boolean bucketCache = bc.getClass().getSimpleName().equals("BucketCache");
BucketCacheStats bucketCacheStats = null;
BucketAllocator bucketAllocator = null;
if (bucketCache) {
bucketCacheStats = (BucketCacheStats)bc.getStats();
bucketAllocator = ((BucketCache)bc).getAllocator();
}
// 296, 1
jamonWriter.write("\n \n Attribute \n Value \n Description \n \n \n Implementation \n ");
// 304, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bc.getClass().getSimpleName()), jamonWriter);
// 304, 70
jamonWriter.write(" \n Class implementing this block cache Level \n \n");
// 307, 1
if (bucketCache )
{
// 307, 20
jamonWriter.write("\n \n Implementation \n ");
// 310, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(((BucketCache)bc).getIoEngine()), jamonWriter);
// 310, 50
jamonWriter.write(" \n IOEngine \n \n");
}
// 313, 7
jamonWriter.write("\n \n Cache Size Limit \n ");
// 316, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(bc.getMaxSize(), "B", 1)), jamonWriter);
// 316, 79
jamonWriter.write(" \n Max size of cache \n \n \n Block Count \n ");
// 321, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getBlockCount())), jamonWriter);
// 321, 59
jamonWriter.write(" \n Count of Blocks \n \n");
// 324, 1
if (!bucketCache )
{
// 324, 21
jamonWriter.write("\n \n Data Block Count \n ");
// 327, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getDataBlockCount())), jamonWriter);
// 327, 63
jamonWriter.write(" \n Count of DATA Blocks \n \n");
}
// 330, 7
jamonWriter.write("\n \n Size of Blocks \n ");
// 333, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), "B", 1)), jamonWriter);
// 333, 83
jamonWriter.write(" \n Size of Blocks \n \n");
// 336, 1
if (!bucketCache )
{
// 336, 21
jamonWriter.write("\n \n Size of Data Blocks \n ");
// 339, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(bc.getCurrentDataSize(), "B", 1)), jamonWriter);
// 339, 87
jamonWriter.write(" \n Size of DATA Blocks \n \n");
}
// 342, 7
jamonWriter.write(" \n");
// 343, 1
{
// 343, 1
__jamon_innerUnit__evictions_tmpl(jamonWriter, bc);
}
// 343, 31
jamonWriter.write("\n");
// 344, 1
{
// 344, 1
__jamon_innerUnit__hits_tmpl(jamonWriter, bc);
}
// 344, 26
jamonWriter.write("\n\n");
// 346, 1
if (bucketCache )
{
// 346, 20
jamonWriter.write("\n \n Hits per Second \n ");
// 349, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOHitsPerSecond()), jamonWriter);
// 349, 56
jamonWriter.write(" \n Block gets against this cache per second \n \n \n Time per Hit \n ");
// 354, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOTimePerHit()), jamonWriter);
// 354, 53
jamonWriter.write(" \n Time per cache hit \n \n");
}
// 357, 7
jamonWriter.write("\n
\n\nView block cache as JSON | Block cache as JSON by file\n");
// 362, 1
if (bc.getBlockCount() > maxCachedBlocksByFile )
{
// 362, 51
jamonWriter.write("\n
\nNote: JSON view of block cache will be incomplete, because block count ");
// 364, 79
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bc.getBlockCount()), jamonWriter);
// 364, 103
jamonWriter.write(" is greater than hbase.ui.blockcache.by.file.max value of ");
// 364, 168
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(maxCachedBlocksByFile), jamonWriter);
// 364, 195
jamonWriter.write(".\nIncrease that value to get a complete picture.\n");
}
// 366, 7
jamonWriter.write("\n
\n");
}
// 168, 1
private void __jamon_innerUnit__evictions_tmpl(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 172, 1
AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot();
// Only show if non-zero mean and stddev as is the case in combinedblockcache
// 176, 5
jamonWriter.write("\n Evicted \n ");
// 178, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictedCount())), jamonWriter);
// 178, 72
jamonWriter.write(" \n The total number of blocks evicted \n \n \n Evictions \n ");
// 183, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictionCount())), jamonWriter);
// 183, 73
jamonWriter.write(" \n The total number of times an eviction has occurred \n \n \n Mean \n ");
// 188, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)ageAtEvictionSnapshot.getMean())), jamonWriter);
// 188, 78
jamonWriter.write(" \n Mean age of Blocks at eviction time (seconds) \n \n");
}
// 193, 1
private void __jamon_innerUnit__hits_tmpl(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 197, 5
jamonWriter.write("\n Hits \n ");
// 199, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCount())), jamonWriter);
// 199, 68
jamonWriter.write(" \n Number requests that were cache hits \n \n \n Hits Caching \n ");
// 204, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCachingCount())), jamonWriter);
// 204, 75
jamonWriter.write(" \n Cache hit block requests but only requests set to cache block if a miss \n \n \n Misses \n ");
// 209, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCount())), jamonWriter);
// 209, 69
jamonWriter.write(" \n Block requests that were cache misses but set to cache missed blocks \n \n \n Misses Caching \n ");
// 214, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCachingCount())), jamonWriter);
// 214, 76
jamonWriter.write(" \n Block requests that were cache misses but only requests set to use block cache \n \n \n Hit Ratio \n ");
// 219, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,.2f", bc.getStats().getHitRatio() * 100)), jamonWriter);
// 219, 76
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf("%"), jamonWriter);
// 219, 85
jamonWriter.write(" \n Hit Count divided by total requests count \n \n\n");
}
}