org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmplImpl Maven / Gradle / Ivy
Show all versions of hbase-server Show documentation
// Autogenerated Jamon implementation
// /Users/enis/projects/git-repos/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();
}
public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) 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");
}
// 209, 1
private void __jamon_innerUnit__bc_stats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final CacheConfig cacheConfig)
throws java.io.IOException
{
// 213, 1
if (cacheConfig == null || cacheConfig.getBlockCache() == null )
{
// 213, 67
jamonWriter.write("\nCacheConfig is null
\n");
}
// 215, 1
else
{
// 215, 8
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Size \n ");
// 224, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cacheConfig.getBlockCache().getCurrentSize())), jamonWriter);
// 224, 93
jamonWriter.write(" \n Current size of block cache in use (bytes) \n \n \n Free \n ");
// 229, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cacheConfig.getBlockCache().getFreeSize())), jamonWriter);
// 229, 90
jamonWriter.write(" \n The total free memory currently available to store more cache entries (bytes) \n \n \n Count \n ");
// 234, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getBlockCount())), jamonWriter);
// 234, 84
jamonWriter.write(" \n Number of blocks in block cache \n \n ");
// 237, 5
{
// 237, 5
__jamon_innerUnit__evictions_tmpl(jamonWriter, cacheConfig.getBlockCache());
}
// 237, 60
jamonWriter.write("\n \n Hits \n ");
// 240, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getStats().getHitCount())), jamonWriter);
// 240, 93
jamonWriter.write(" \n Number requests that were cache hits \n \n \n Hits Caching \n ");
// 245, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getStats().getHitCachingCount())), jamonWriter);
// 245, 100
jamonWriter.write(" \n Cache hit block requests but only requests set to cache block if a miss \n \n \n Misses \n ");
// 250, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getStats().getMissCount())), jamonWriter);
// 250, 94
jamonWriter.write(" \n Block requests that were cache misses but set to cache missed blocks \n \n \n Misses Caching \n ");
// 255, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cacheConfig.getBlockCache().getStats().getMissCount())), jamonWriter);
// 255, 94
jamonWriter.write(" \n Block requests that were cache misses but only requests set to use block cache \n \n \n Hit Ratio \n ");
// 260, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,.2f", cacheConfig.getBlockCache().getStats().getHitRatio() * 100)), jamonWriter);
// 260, 101
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf("%"), jamonWriter);
// 260, 110
jamonWriter.write(" \n Hit Count divided by total requests count \n \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");
}
// 266, 7
jamonWriter.write("\n");
}
// 119, 1
private void __jamon_innerUnit__bc_config(@SuppressWarnings({"unused","hiding"}) 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(@SuppressWarnings({"unused","hiding"}) 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");
}
// 282, 1
private void __jamon_innerUnit__block_cache(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final BlockCache bc, final String name, final boolean evictions)
throws java.io.IOException
{
// 288, 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;
Bucket [] buckets = null;
if (bucketCache) {
bucketCacheStats = (BucketCacheStats)bc.getStats();
bucketAllocator = ((BucketCache)bc).getAllocator();
buckets = bucketAllocator.getBuckets();
}
// 307, 1
if (cbsbf.isFull() )
{
// 307, 23
jamonWriter.write("\nStatistics below is based on sampling first ");
// 308, 51
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(cbsbfSnapshot.getMax()), jamonWriter);
// 308, 79
jamonWriter.write(" blocks only (hbase.ui.blockcache.by.file.max)
\n");
}
// 309, 7
jamonWriter.write("\n\n \n Attribute \n Value \n Description \n \n \n Implementation \n ");
// 318, 35
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bc.getClass().getSimpleName()), jamonWriter);
// 318, 70
jamonWriter.write(" \n Class implementing this block cache Level \n \n");
// 321, 1
if (bucketCache )
{
// 321, 20
jamonWriter.write("\n \n Implementation \n ");
// 324, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(((BucketCache)bc).getIoEngine()), jamonWriter);
// 324, 50
jamonWriter.write(" \n IOEngine \n \n");
}
// 327, 7
jamonWriter.write("\n \n Count \n ");
// 330, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getCount())), jamonWriter);
// 330, 57
jamonWriter.write(" \n Count of Blocks \n \n");
// 333, 1
if (!bucketCache )
{
// 333, 21
jamonWriter.write("\n \n Count \n ");
// 336, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", cbsbf.getDataCount())), jamonWriter);
// 336, 61
jamonWriter.write(" \n Count of DATA Blocks \n \n");
}
// 339, 7
jamonWriter.write("\n \n Size \n ");
// 342, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cbsbf.getSize())), jamonWriter);
// 342, 64
jamonWriter.write(" \n Size of Blocks \n \n");
// 345, 1
if (!bucketCache )
{
// 345, 21
jamonWriter.write("\n \n Size \n ");
// 348, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanReadableInt(cbsbf.getDataSize())), jamonWriter);
// 348, 68
jamonWriter.write(" \n Size of DATA Blocks \n \n");
}
// 351, 7
jamonWriter.write(" \n");
// 352, 1
if (evictions )
{
// 352, 18
{
// 352, 18
__jamon_innerUnit__evictions_tmpl(jamonWriter, bc);
}
}
// 352, 54
jamonWriter.write(" \n");
// 353, 1
if (bucketCache )
{
// 353, 20
jamonWriter.write("\n \n Hits per Second \n ");
// 356, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOHitsPerSecond()), jamonWriter);
// 356, 56
jamonWriter.write(" \n Block gets against this cache per second \n \n \n Time per Hit \n ");
// 361, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucketCacheStats.getIOTimePerHit()), jamonWriter);
// 361, 53
jamonWriter.write(" \n Time per cache hit \n \n");
}
// 364, 7
jamonWriter.write("\n
\nView block cache as JSON | Block cache as JSON by file
\n");
// 368, 1
if (bucketCache )
{
// 368, 20
jamonWriter.write("\nBucketCache does not discern between DATA and META blocks so we do not show DATA counts (If deploy is using CombinedBlockCache, BucketCache is only DATA blocks
\nBucketCache Buckets
\n\n \n Bucket Offset \n Allocation Size \n Free Bytes \n Used Bytes \n \n");
// 378, 1
for (Bucket bucket: buckets )
{
// 378, 32
jamonWriter.write("\n \n ");
// 380, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucket.getBaseOffset()), jamonWriter);
// 380, 41
jamonWriter.write(" \n ");
// 381, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucket.getItemAllocationSize()), jamonWriter);
// 381, 49
jamonWriter.write(" \n ");
// 382, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucket.getFreeBytes()), jamonWriter);
// 382, 40
jamonWriter.write(" \n ");
// 383, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(bucket.getUsedBytes()), jamonWriter);
// 383, 40
jamonWriter.write(" \n \n");
}
// 385, 8
jamonWriter.write("\n
\n");
}
// 387, 7
jamonWriter.write("\n");
// 388, 1
cbsbf = null;
}
// 269, 1
private void __jamon_innerUnit__bc_l(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final BlockCache bc, final String name, final boolean evictions)
throws java.io.IOException
{
// 275, 1
if (bc == null )
{
// 275, 19
jamonWriter.write("\nNo ");
// 276, 7
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(name), jamonWriter);
// 276, 17
jamonWriter.write(" deployed
\n");
}
// 277, 1
else
{
// 277, 8
jamonWriter.write("\n");
// 278, 1
{
// 278, 1
__jamon_innerUnit__block_cache(jamonWriter, bc, name, evictions);
}
// 278, 65
jamonWriter.write("\n");
}
// 279, 7
jamonWriter.write("\n");
}
// 173, 1
private void __jamon_innerUnit__evictions_tmpl(@SuppressWarnings({"unused","hiding"}) 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();
double stddev = ageAtEvictionSnapshot.getStdDev();
// 183, 5
jamonWriter.write("\n Evicted \n ");
// 185, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictedCount())), jamonWriter);
// 185, 72
jamonWriter.write(" \n The total number of blocks evicted \n \n \n Evictions \n ");
// 190, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", bc.getStats().getEvictionCount())), jamonWriter);
// 190, 73
jamonWriter.write(" \n The total number of times an eviction has occurred \n \n");
// 193, 1
if (mean > 0 )
{
// 193, 17
jamonWriter.write("\n \n Mean \n ");
// 196, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)(ageAtEvictionSnapshot.getMean()/(1000000 * 1000)))), jamonWriter);
// 196, 97
jamonWriter.write(" \n Mean age of Blocks at eviction time (seconds) \n \n");
}
// 199, 7
jamonWriter.write("\n");
// 200, 1
if (stddev > 0 )
{
// 200, 19
jamonWriter.write("\n \n StdDev \n ");
// 203, 13
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%,d", (long)(ageAtEvictionSnapshot.getStdDev()/1000000))), jamonWriter);
// 203, 90
jamonWriter.write(" \n Standard Deviation for age of Blocks at eviction time \n \n");
}
// 206, 7
jamonWriter.write("\n");
}
}