diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon index fa83fc3..702122a 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon @@ -30,11 +30,13 @@ Configuration config; 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; %java> <%import> java.util.Map; org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile; -org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.AgeSnapshot; +org.apache.hadoop.hbase.io.hfile.AgeSnapshot; org.apache.hadoop.hbase.io.hfile.CachedBlock; org.apache.hadoop.conf.Configuration; org.apache.hadoop.hbase.io.hfile.CacheConfig; @@ -64,10 +66,10 @@ org.apache.hadoop.util.StringUtils; <& bc_stats; cacheConfig = cacheConfig &>
No <% name %> deployed
<%else> -<& block_cache; bc = bc; name = name; &> +<& block_cache; bc = bc; name = name; evictions = evictions; &> %if> %def> @@ -253,6 +283,7 @@ are combined counts. Request count is sum of hits and misses. <%args> BlockCache bc; String name; + boolean evictions; %args> <%java> final long nanosPerSecond = 1000000000; @@ -260,7 +291,7 @@ are combined counts. Request count is sum of hits and misses. 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 snapshot = cbsbf.getAgeSnapshot(); + AgeSnapshot cbsbfSnapshot = cbsbf.getAgeInCacheSnapshot(); boolean bucketCache = bc.getClass().getSimpleName().equals("BucketCache"); BucketCacheStats bucketCacheStats = null; @@ -274,7 +305,7 @@ are combined counts. Request count is sum of hits and misses. } %java> <%if cbsbf.isFull() %> -Too many blocks! Listing out the first <% snapshot.getMax() %> only (hbase.ui.blockcache.by.file.max)
+Too many blocks! Listing out the first <% cbsbfSnapshot.getMax() %> only (hbase.ui.blockcache.by.file.max)
%if>| <% StringUtils.humanReadableInt(cbsbf.getDataSize()) %> | Size of DATA Blocks | |
| Evicted | -<% String.format("%,d", bc.getStats().getEvictedCount()) %> | -The total number of blocks evicted | -
| Evictions | -<% String.format("%,d", bc.getStats().getEvictionCount()) %> | -The total number of times an eviction has occurred | -
| Mean | -<% String.format("%,d", (long)(snapshot.getMean()/nanosPerSecond)) %> | -Mean age of Blocks in cache (seconds) | -
| StdDev | -<% String.format("%,d", (long)(snapshot.getStdDev()/nanosPerSecond)) %> | -Age standard deviation of Blocks in cache | -
| Min | -<% String.format("%,d", (long)(snapshot.getMin()/nanosPerSecond)) %> | -Min age of Blocks in cache (seconds) | -
| Max | -<% String.format("%,d", (long)(snapshot.getMax()/nanosPerSecond)) %> | -Max age of Blocks in cache (seconds) | -
| 95th Percentile | -<% String.format("%,d", (long)(snapshot.get95thPercentile()/nanosPerSecond)) %> | -95th percentile of age of Blocks in cache (seconds) | -
| 99th Percentile | -<% String.format("%,d", (long)(snapshot.get99thPercentile()/nanosPerSecond)) %> | -99th percentile of age of Blocks in cache (seconds) | -
| Hits per Second | diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon index 184076e..c5002b5 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon @@ -53,7 +53,7 @@ com.yammer.metrics.stats.Snapshot; } CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc); %java> -<%if bcv.equals("file") %><& bc_by_file; cbsbf = cbsbf; &><%else>{<% BlockCacheUtil.toJSON(bc) %>, <% cbsbf %> }%if> +<%if bcv.equals("file") %><& bc_by_file; cbsbf = cbsbf; &><%else>[ <% BlockCacheUtil.toJSON(bc) %>, <% BlockCacheUtil.toJSON(cbsbf) %> ]%if> <%java> cbsbf = null; %java> diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/DataInputInputStream.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/DataInputInputStream.java index b54c3ad..1422bb8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/DataInputInputStream.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/DataInputInputStream.java @@ -26,7 +26,6 @@ import org.apache.hadoop.classification.InterfaceAudience; /** * An InputStream that wraps a DataInput. - * @see DataOutputOutputStream */ @InterfaceAudience.Private public class DataInputInputStream extends InputStream { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/AgeSnapshot.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/AgeSnapshot.java new file mode 100644 index 0000000..24a4e32 --- /dev/null +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/AgeSnapshot.java @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.io.hfile; + +import org.codehaus.jackson.annotate.JsonIgnoreProperties; + +import com.yammer.metrics.core.Histogram; +import com.yammer.metrics.stats.Snapshot; + +/** + * Snapshot of block cache age in cache. + * This object is preferred because we can control how it is serialized out when JSON'ing. + */ +@JsonIgnoreProperties({"ageHistogram", "snapshot"}) +public class AgeSnapshot { + private final Histogram ageHistogram; + private final Snapshot snapshot; + + AgeSnapshot(final Histogram ageHistogram) { + this.ageHistogram = ageHistogram; + this.snapshot = ageHistogram.getSnapshot(); + } + + public double get75thPercentile() { + return snapshot.get75thPercentile(); + } + + public double get95thPercentile() { + return snapshot.get95thPercentile(); + } + + public double get98thPercentile() { + return snapshot.get98thPercentile(); + } + + public double get999thPercentile() { + return snapshot.get999thPercentile(); + } + + public double get99thPercentile() { + return snapshot.get99thPercentile(); + } + + public double getMean() { + return this.ageHistogram.mean(); + } + + public double getMax() { + return ageHistogram.max(); + } + + public double getMin() { + return ageHistogram.min(); + } + + public double getStdDev() { + return ageHistogram.stdDev(); + } +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java index d146084..f793d4b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java @@ -160,57 +160,6 @@ public class BlockCacheUtil { } /** - * Snapshot of block cache age in cache. - * This object is preferred because we can control how it is serialized out when JSON'ing. - */ - @JsonIgnoreProperties({"ageHistogram", "snapshot"}) - public static class AgeSnapshot { - private final Histogram ageHistogram; - private final Snapshot snapshot; - - AgeSnapshot(final Histogram ageHistogram) { - this.ageHistogram = ageHistogram; - this.snapshot = ageHistogram.getSnapshot(); - } - - public double get75thPercentile() { - return snapshot.get75thPercentile(); - } - - public double get95thPercentile() { - return snapshot.get95thPercentile(); - } - - public double get98thPercentile() { - return snapshot.get98thPercentile(); - } - - public double get999thPercentile() { - return snapshot.get999thPercentile(); - } - - public double get99thPercentile() { - return snapshot.get99thPercentile(); - } - - public double getMean() { - return this.ageHistogram.mean(); - } - - public double getMax() { - return ageHistogram.max(); - } - - public double getMin() { - return ageHistogram.min(); - } - - public double getStdDev() { - return ageHistogram.stdDev(); - } - } - - /** * Get a {@link CachedBlocksByFile} instance and load it up by iterating content in * {@link BlockCache}. * @param conf Used to read configurations @@ -319,7 +268,7 @@ public class BlockCacheUtil { return dataSize; } - public AgeSnapshot getAgeSnapshot() { + public AgeSnapshot getAgeInCacheSnapshot() { return new AgeSnapshot(this.age); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java index afaf7e9..25f9727 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java @@ -90,11 +90,6 @@ public class CacheConfig { /** * When using bucket cache, this is a float that EITHER represents a percentage of total heap * memory size to give to the cache (if < 1.0) OR, it is the capacity in megabytes of the cache. - * - *