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
// /home/busbey/projects/hbase/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;
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");
}
// 234, 1
private void __jamon_innerUnit__bc_stats(final java.io.Writer jamonWriter, final CacheConfig cacheConfig)
throws java.io.IOException
{
// 238, 1
if (cacheConfig == null || cacheConfig.getBlockCache() == null )
{
// 238, 67
jamonWriter.write("\nCacheConfig is null
\n");
}
// 240, 1
else
{
// 240, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Size \n ");
// 249, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cacheConfig.getBlockCache().getCurrentSize())), jamonWriter);
// 249, 93
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(StringUtils.humanReadableInt(cacheConfig.getBlockCache().getFreeSize())), jamonWriter);
// 254, 90
jamonWriter.write(" \n The total free memory currently available to store more cache entries (bytes) \n \n \n Count \n ");
// 259, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getBlockCount())), jamonWriter);
// 259, 84
jamonWriter.write(" \n Number of blocks in block cache \n \n ");
// 262, 5
{
// 262, 5
__jamon_innerUnit__evictions_tmpl(jamonWriter, cacheConfig.getBlockCache());
}
// 262, 60
jamonWriter.write("\n ");
// 263, 5
{
// 263, 5
__jamon_innerUnit__hits_tmpl(jamonWriter, cacheConfig.getBlockCache());
}
// 263, 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");
}
// 267, 7
jamonWriter.write("\n");
}
// 202, 1
private void __jamon_innerUnit__hits_tmpl(final java.io.Writer jamonWriter, final BlockCache bc)
throws java.io.IOException
{
// 206, 5
jamonWriter.write("\n Hits \n ");
// 208, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCount())), jamonWriter);
// 208, 68
jamonWriter.write(" \n Number requests that were cache hits \n \n \n Hits Caching \n ");
// 213, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getHitCachingCount())), jamonWriter);
// 213, 75
jamonWriter.write(" \n Cache hit block requests but only requests set to cache block if a miss \n \n \n Misses \n ");
// 218, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCount())), jamonWriter);
// 218, 69
jamonWriter.write(" \n Block requests that were cache misses but set to cache missed blocks \n \n \n Misses Caching \n ");
// 223, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getMissCount())), jamonWriter);
// 223, 69
jamonWriter.write(" \n Block requests that were cache misses but only requests set to use block cache \n \n \n Hit Ratio \n ");
// 228, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,.2f", bc.getStats().getHitRatio() * 100)), jamonWriter);
// 228, 76
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf("%"), jamonWriter);
// 228, 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");
}
// 283, 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
{
// 289, 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();
}
// 306, 1
if (cbsbf.isFull() )
{
// 306, 23
jamonWriter.write("\n\n
\nThe stats below are incomplete! We ran into our accounting limit of ");
// 309, 86
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cbsbf.getCount()), jamonWriter);
// 309, 108
jamonWriter.write(" blocks. Up the configuration hbase.ui.blockcache.by.file.max.\n\n \n");
}
// 312, 7
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Implementation \n ");
// 321, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bc.getClass().getSimpleName()), jamonWriter);
// 321, 70
jamonWriter.write(" \n Class implementing this block cache Level \n \n");
// 324, 1
if (bucketCache )
{
// 324, 20
jamonWriter.write("\n \n Implementation \n ");
// 327, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(((BucketCache)bc).getIoEngine()), jamonWriter);
// 327, 50
jamonWriter.write(" \n IOEngine \n \n");
}
// 330, 7
jamonWriter.write("\n \n Count \n ");
// 333, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getCount())), jamonWriter);
// 333, 57
jamonWriter.write(" \n Count of Blocks \n \n");
// 336, 1
if (!bucketCache )
{
// 336, 21
jamonWriter.write("\n \n Count \n ");
// 339, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getDataCount())), jamonWriter);
// 339, 61
jamonWriter.write(" \n Count of DATA Blocks \n \n");
}
// 342, 7
jamonWriter.write("\n \n Size \n ");
// 345, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cbsbf.getSize())), jamonWriter);
// 345, 64
jamonWriter.write(" \n Size of Blocks \n \n");
// 348, 1
if (!bucketCache )
{
// 348, 21
jamonWriter.write("\n \n Size \n ");
// 351, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cbsbf.getDataSize())), jamonWriter);
// 351, 68
jamonWriter.write(" \n Size of DATA Blocks \n \n");
}
// 354, 7
jamonWriter.write(" \n");
// 355, 1
{
// 355, 1
__jamon_innerUnit__evictions_tmpl(jamonWriter, bc);
}
// 355, 31
jamonWriter.write("\n");
// 356, 1
{
// 356, 1
__jamon_innerUnit__hits_tmpl(jamonWriter, bc);
}
// 356, 26
jamonWriter.write("\n\n");
// 358, 1
if (bucketCache )
{
// 358, 20
jamonWriter.write("\n \n Hits per Second \n ");
// 361, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOHitsPerSecond()), jamonWriter);
// 361, 56
jamonWriter.write(" \n Block gets against this cache per second \n \n \n Time per Hit \n ");
// 366, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOTimePerHit()), jamonWriter);
// 366, 53
jamonWriter.write(" \n Time per cache hit \n \n");
}
// 369, 7
jamonWriter.write("\n
\nView block cache as JSON | Block cache as JSON by file
\n");
// 373, 1
cbsbf = null;
}
// 270, 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
{
// 276, 1
if (bc == null )
{
// 276, 19
jamonWriter.write("\nNo ");
// 277, 7
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(name), jamonWriter);
// 277, 17
jamonWriter.write(" deployed
\n");
}
// 278, 1
else
{
// 278, 8
jamonWriter.write("\n");
// 279, 1
{
// 279, 1
__jamon_innerUnit__block_cache(jamonWriter, bc, name, evictions);
}
// 279, 65
jamonWriter.write("\n");
}
// 280, 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();
// 180, 5
jamonWriter.write("\n Evicted \n ");
// 182, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictedCount())), jamonWriter);
// 182, 72
jamonWriter.write(" \n The total number of blocks evicted \n \n \n Evictions \n ");
// 187, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictionCount())), jamonWriter);
// 187, 73
jamonWriter.write(" \n The total number of times an eviction has occurred \n \n \n Mean \n ");
// 192, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)(ageAtEvictionSnapshot.getMean()))), jamonWriter);
// 192, 80
jamonWriter.write(" \n Mean age of Blocks at eviction time (seconds) \n \n \n StdDev \n ");
// 197, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)(ageAtEvictionSnapshot.getStdDev()))), jamonWriter);
// 197, 82
jamonWriter.write(" \n Standard Deviation for age of Blocks at eviction time \n \n");
}
}