org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmplImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbase-server Show documentation
Show all versions of hbase-server Show documentation
Server functionality for HBase
// Autogenerated Jamon implementation
// /Users/sakthi/dev/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
package org.apache.hadoop.hbase.tmpl.regionserver;
// 37, 1
import java.util.Map;
// 38, 1
import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile;
// 39, 1
import org.apache.hadoop.hbase.io.hfile.AgeSnapshot;
// 40, 1
import org.apache.hadoop.hbase.io.hfile.CachedBlock;
// 41, 1
import org.apache.hadoop.conf.Configuration;
// 42, 1
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
// 43, 1
import org.apache.hadoop.hbase.io.hfile.BlockCache;
// 44, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats;
// 45, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache;
// 46, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator;
// 47, 1
import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket;
// 48, 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;
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();
}
@Override public void renderNoFlush(final java.io.Writer jamonWriter)
throws java.io.IOException
{
// 24, 1
BlockCache bc = cacheConfig == null? null: cacheConfig.getBlockCache();
String bcUrl = null;
String bcName = null;
if (bc != null) {
bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html";
bcName = bc.getClass().getSimpleName();
}
BlockCache [] bcs = cacheConfig == null? null: cacheConfig.getBlockCache() == null? null: cacheConfig.getBlockCache().getBlockCaches();
// If more than one bc, show evictions in each bc listing so can compare
boolean evictions = bcs != null && bcs.length > 1;
// 50, 1
jamonWriter.write("\n \n \n \n ");
// 60, 13
{
// 60, 13
__jamon_innerUnit__bc_baseInfo(jamonWriter, cacheConfig, bcUrl, bcName);
}
// 60, 91
jamonWriter.write("\n \n \n ");
// 63, 13
{
// 63, 13
__jamon_innerUnit__bc_config(jamonWriter, cacheConfig );
}
// 63, 55
jamonWriter.write("\n \n \n ");
// 66, 13
{
// 66, 13
__jamon_innerUnit__bc_stats(jamonWriter, cacheConfig );
}
// 66, 54
jamonWriter.write("\n \n \n ");
// 69, 13
{
// 69, 13
__jamon_innerUnit__bc_l(jamonWriter, bcs == null? bc: bcs[0], "L1", evictions);
}
// 69, 90
jamonWriter.write("\n \n \n ");
// 72, 13
{
// 72, 13
__jamon_innerUnit__bc_l(jamonWriter, bcs == null? null: bcs.length <= 1? null: bcs[1], "L2", evictions);
}
// 72, 115
jamonWriter.write("\n \n \n\n\n");
}
// 233, 1
private void __jamon_innerUnit__bc_stats(final java.io.Writer jamonWriter, final CacheConfig cacheConfig)
throws java.io.IOException
{
// 237, 1
if (cacheConfig == null || cacheConfig.getBlockCache() == null )
{
// 237, 67
jamonWriter.write("\nCacheConfig is null
\n");
}
// 239, 1
else
{
// 239, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Size \n ");
// 248, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getCurrentSize(),
"B", 1)), jamonWriter);
// 249, 23
jamonWriter.write(" \n Current size of block cache in use (bytes) \n \n \n Free \n ");
// 254, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getFreeSize(),
"B", 1)), jamonWriter);
// 255, 23
jamonWriter.write(" \n The total free memory currently available to store more cache entries (bytes) \n \n \n Count \n ");
// 260, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getBlockCount())), jamonWriter);
// 260, 84
jamonWriter.write(" \n Number of blocks in block cache \n \n ");
// 263, 5
{
// 263, 5
__jamon_innerUnit__evictions_tmpl(jamonWriter, cacheConfig.getBlockCache());
}
// 263, 60
jamonWriter.write("\n ");
// 264, 5
{
// 264, 5
__jamon_innerUnit__hits_tmpl(jamonWriter, cacheConfig.getBlockCache());
}
// 264, 55
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");
}
// 268, 7
jamonWriter.write("\n");
}
// 201, 1
private void __jamon_innerUnit__hits_tmpl(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 205, 5
jamonWriter.write("\n Hits \n ");
// 207, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCount())), jamonWriter);
// 207, 68
jamonWriter.write(" \n Number requests that were cache hits \n \n \n Hits Caching \n ");
// 212, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCachingCount())), jamonWriter);
// 212, 75
jamonWriter.write(" \n Cache hit block requests but only requests set to cache block if a miss \n \n \n Misses \n ");
// 217, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCount())), jamonWriter);
// 217, 69
jamonWriter.write(" \n Block requests that were cache misses but set to cache missed blocks \n \n \n Misses Caching \n ");
// 222, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCount())), jamonWriter);
// 222, 69
jamonWriter.write(" \n Block requests that were cache misses but only requests set to use block cache \n \n \n Hit Ratio \n ");
// 227, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,.2f", bc.getStats().getHitRatio() * 100)), jamonWriter);
// 227, 76
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf("%"), jamonWriter);
// 227, 85
jamonWriter.write(" \n Hit Count divided by total requests count \n \n\n");
}
// 119, 1
private void __jamon_innerUnit__bc_config(final java.io.Writer jamonWriter, final CacheConfig cacheConfig)
throws java.io.IOException
{
// 123, 1
if (cacheConfig == null )
{
// 123, 28
jamonWriter.write("\nCacheConfig is null
\n");
}
// 125, 1
else
{
// 125, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Cache DATA on Read \n ");
// 134, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataOnRead()), jamonWriter);
// 134, 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 ");
// 140, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataOnWrite()), jamonWriter);
// 140, 55
jamonWriter.write(" \n True if DATA blocks are cached on write. \n \n \n Cache INDEX on Write \n ");
// 145, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheIndexesOnWrite()), jamonWriter);
// 145, 58
jamonWriter.write(" \n True if INDEX blocks are cached on write \n \n \n Cache BLOOM on Write \n ");
// 150, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheBloomsOnWrite()), jamonWriter);
// 150, 57
jamonWriter.write(" \n True if BLOOM blocks are cached on write \n \n \n Evict blocks on Close \n ");
// 155, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldEvictOnClose()), jamonWriter);
// 155, 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 ");
// 161, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldCacheDataCompressed()), jamonWriter);
// 161, 58
jamonWriter.write(" \n True if DATA blocks are cached in their compressed form \n \n \n Prefetch on Open \n ");
// 166, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cacheConfig.shouldPrefetchOnOpen()), jamonWriter);
// 166, 53
jamonWriter.write(" \n True if blocks are prefetched into cache on open \n \n
\n");
}
// 170, 7
jamonWriter.write("\n");
}
// 77, 1
private void __jamon_innerUnit__bc_baseInfo(final java.io.Writer jamonWriter, final CacheConfig cacheConfig, final String bcUrl, final String bcName)
throws java.io.IOException
{
// 83, 1
BlockCache bc = cacheConfig == null? null: cacheConfig.getBlockCache();
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();
}
}
// 103, 1
jamonWriter.write("\n \n Attribute \n Value \n Description \n \n \n \n Implementation \n ");
// 112, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bcName), jamonWriter);
// 112, 47
jamonWriter.write(" \n Block cache implementing class \n \n
\nSee block cache in the HBase Reference Guide for help.
\n");
}
// 284, 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
{
// 290, 1
final long nanosPerSecond = 1000000000;
String bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html";
String bcName = bc.getClass().getSimpleName();
org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile cbsbf =
org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.getLoadedCachedBlocksByFile(config, bc);
AgeSnapshot cbsbfSnapshot = cbsbf.getAgeInCacheSnapshot();
boolean bucketCache = bc.getClass().getSimpleName().equals("BucketCache");
BucketCacheStats bucketCacheStats = null;
BucketAllocator bucketAllocator = null;
if (bucketCache) {
bucketCacheStats = (BucketCacheStats)bc.getStats();
bucketAllocator = ((BucketCache)bc).getAllocator();
}
// 307, 1
if (cbsbf.isFull() )
{
// 307, 23
jamonWriter.write("\n\n
\nThe stats below are incomplete! We ran into our accounting limit of ");
// 310, 86
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cbsbf.getCount()), jamonWriter);
// 310, 108
jamonWriter.write(" blocks. Up the configuration hbase.ui.blockcache.by.file.max.\n\n \n");
}
// 313, 7
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Implementation \n ");
// 322, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bc.getClass().getSimpleName()), jamonWriter);
// 322, 70
jamonWriter.write(" \n Class implementing this block cache Level \n \n");
// 325, 1
if (bucketCache )
{
// 325, 20
jamonWriter.write("\n \n Implementation \n ");
// 328, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(((BucketCache)bc).getIoEngine()), jamonWriter);
// 328, 50
jamonWriter.write(" \n IOEngine \n \n");
}
// 331, 7
jamonWriter.write("\n \n Count \n ");
// 334, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getCount())), jamonWriter);
// 334, 57
jamonWriter.write(" \n Count of Blocks \n \n");
// 337, 1
if (!bucketCache )
{
// 337, 21
jamonWriter.write("\n \n Count \n ");
// 340, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getDataCount())), jamonWriter);
// 340, 61
jamonWriter.write(" \n Count of DATA Blocks \n \n");
}
// 343, 7
jamonWriter.write("\n \n Size \n ");
// 346, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(cbsbf.getSize(), "B", 1)), jamonWriter);
// 346, 79
jamonWriter.write(" \n Size of Blocks \n \n");
// 349, 1
if (!bucketCache )
{
// 349, 21
jamonWriter.write("\n \n Size \n ");
// 352, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(cbsbf.getDataSize(), "B", 1)), jamonWriter);
// 352, 83
jamonWriter.write(" \n Size of DATA Blocks \n \n");
}
// 355, 7
jamonWriter.write(" \n");
// 356, 1
{
// 356, 1
__jamon_innerUnit__evictions_tmpl(jamonWriter, bc);
}
// 356, 31
jamonWriter.write("\n");
// 357, 1
{
// 357, 1
__jamon_innerUnit__hits_tmpl(jamonWriter, bc);
}
// 357, 26
jamonWriter.write("\n\n");
// 359, 1
if (bucketCache )
{
// 359, 20
jamonWriter.write("\n \n Hits per Second \n ");
// 362, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOHitsPerSecond()), jamonWriter);
// 362, 56
jamonWriter.write(" \n Block gets against this cache per second \n \n \n Time per Hit \n ");
// 367, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOTimePerHit()), jamonWriter);
// 367, 53
jamonWriter.write(" \n Time per cache hit \n \n");
}
// 370, 7
jamonWriter.write("\n
\nView block cache as JSON | Block cache as JSON by file
\n");
// 374, 1
cbsbf = null;
}
// 271, 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
{
// 277, 1
if (bc == null )
{
// 277, 19
jamonWriter.write("\nNo ");
// 278, 7
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(name), jamonWriter);
// 278, 17
jamonWriter.write(" deployed
\n");
}
// 279, 1
else
{
// 279, 8
jamonWriter.write("\n");
// 280, 1
{
// 280, 1
__jamon_innerUnit__block_cache(jamonWriter, bc, name, evictions);
}
// 280, 65
jamonWriter.write("\n");
}
// 281, 7
jamonWriter.write("\n");
}
// 173, 1
private void __jamon_innerUnit__evictions_tmpl(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 177, 1
AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot();
// Only show if non-zero mean and stddev as is the case in combinedblockcache
double mean = ageAtEvictionSnapshot.getMean();
// 182, 5
jamonWriter.write("\n Evicted \n ");
// 184, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictedCount())), jamonWriter);
// 184, 72
jamonWriter.write(" \n The total number of blocks evicted \n \n \n Evictions \n ");
// 189, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictionCount())), jamonWriter);
// 189, 73
jamonWriter.write(" \n The total number of times an eviction has occurred \n \n");
// 192, 1
if (mean > 0 )
{
// 192, 17
jamonWriter.write("\n \n Mean \n ");
// 195, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)(ageAtEvictionSnapshot.getMean()/(1000000 * 1000)))), jamonWriter);
// 195, 97
jamonWriter.write(" \n Mean age of Blocks at eviction time (seconds) \n \n");
}
// 198, 7
jamonWriter.write("\n");
}
}