HBASE-4310 SlabCache metrics bugfix (Li Pi)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1163620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9a66fe79df
commit
6fbc5260af
|
@ -228,6 +228,7 @@ Release 0.91.0 - Unreleased
|
||||||
non-distributed case (todd)
|
non-distributed case (todd)
|
||||||
HBASE-4303 HRegionInfo.toString has bad quoting (todd)
|
HBASE-4303 HRegionInfo.toString has bad quoting (todd)
|
||||||
HBASE-4307 race condition in CacheTestUtils (Li Pi)
|
HBASE-4307 race condition in CacheTestUtils (Li Pi)
|
||||||
|
HBASE-4310 SlabCache metrics bugfix (Li Pi)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
||||||
|
|
|
@ -64,7 +64,8 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize
|
||||||
|
|
||||||
long size;
|
long size;
|
||||||
private final CacheStats stats;
|
private final CacheStats stats;
|
||||||
final SlabStats slabstats;
|
final SlabStats requestStats;
|
||||||
|
final SlabStats successfullyCachedStats;
|
||||||
private final long avgBlockSize;
|
private final long avgBlockSize;
|
||||||
private static final long CACHE_FIXED_OVERHEAD = ClassSize.estimateBase(
|
private static final long CACHE_FIXED_OVERHEAD = ClassSize.estimateBase(
|
||||||
SlabCache.class, false);
|
SlabCache.class, false);
|
||||||
|
@ -80,7 +81,9 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize
|
||||||
this.avgBlockSize = avgBlockSize;
|
this.avgBlockSize = avgBlockSize;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.stats = new CacheStats();
|
this.stats = new CacheStats();
|
||||||
this.slabstats = new SlabStats();
|
this.requestStats = new SlabStats();
|
||||||
|
this.successfullyCachedStats = new SlabStats();
|
||||||
|
|
||||||
backingStore = new ConcurrentHashMap<String, SingleSizeCache>();
|
backingStore = new ConcurrentHashMap<String, SingleSizeCache>();
|
||||||
sizer = new TreeMap<Integer, SingleSizeCache>();
|
sizer = new TreeMap<Integer, SingleSizeCache>();
|
||||||
this.scheduleThreadPool.scheduleAtFixedRate(new StatisticsThread(this),
|
this.scheduleThreadPool.scheduleAtFixedRate(new StatisticsThread(this),
|
||||||
|
@ -191,12 +194,13 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize
|
||||||
Entry<Integer, SingleSizeCache> scacheEntry = getHigherBlock(cachedItem
|
Entry<Integer, SingleSizeCache> scacheEntry = getHigherBlock(cachedItem
|
||||||
.getSerializedLength());
|
.getSerializedLength());
|
||||||
|
|
||||||
this.slabstats.addin(cachedItem.getSerializedLength());
|
this.requestStats.addin(cachedItem.getSerializedLength());
|
||||||
|
|
||||||
if (scacheEntry == null) {
|
if (scacheEntry == null) {
|
||||||
return; // we can't cache, something too big.
|
return; // we can't cache, something too big.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.successfullyCachedStats.addin(cachedItem.getSerializedLength());
|
||||||
SingleSizeCache scache = scacheEntry.getValue();
|
SingleSizeCache scache = scacheEntry.getValue();
|
||||||
scache.cacheBlock(blockName, cachedItem); // if this
|
scache.cacheBlock(blockName, cachedItem); // if this
|
||||||
// fails, due to
|
// fails, due to
|
||||||
|
@ -312,7 +316,10 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ourcache.slabstats.logStats(ourcache);
|
LOG.info("Request Stats");
|
||||||
|
ourcache.requestStats.logStats(ourcache);
|
||||||
|
LOG.info("Successfully Cached Stats");
|
||||||
|
ourcache.successfullyCachedStats.logStats(ourcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -353,17 +360,19 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize
|
||||||
SlabCache.LOG.info("Current heap size is: "
|
SlabCache.LOG.info("Current heap size is: "
|
||||||
+ StringUtils.humanReadableInt(slabCache.heapSize()));
|
+ StringUtils.humanReadableInt(slabCache.heapSize()));
|
||||||
for (int i = 0; i < fineGrainedStats.length; i++) {
|
for (int i = 0; i < fineGrainedStats.length; i++) {
|
||||||
double lowerbound = Math.pow(Math.E, (double) i / (double) multiplier
|
double lowerbound = Math.pow(Math.E,
|
||||||
- 0.5);
|
((double) i / (double) multiplier) - 0.5);
|
||||||
double upperbound = Math.pow(Math.E, (double) i / (double) multiplier
|
double upperbound = Math.pow(Math.E,
|
||||||
+ 0.5);
|
((double) i / (double) multiplier) + 0.5);
|
||||||
|
|
||||||
SlabCache.LOG.info("From "
|
if (fineGrainedStats[i].get() > 0) {
|
||||||
+ StringUtils.humanReadableInt((long) lowerbound) + "- "
|
SlabCache.LOG.info("From "
|
||||||
+ StringUtils.humanReadableInt((long) upperbound) + ": "
|
+ StringUtils.humanReadableInt((long) lowerbound) + "- "
|
||||||
+ StringUtils.humanReadableInt(fineGrainedStats[i].get())
|
+ StringUtils.humanReadableInt((long) upperbound) + ": "
|
||||||
+ " requests");
|
+ StringUtils.humanReadableInt(fineGrainedStats[i].get())
|
||||||
|
+ " requests");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue