HBASE-11229 Change block cache percentage metrics to be doubles rather than ints

In HBASE-8370 "Report data block cache hit rates apart from aggregate cache hit rates"
discussion highlights small changes in caching percentage can make for large
changes in cache contents; e.g. lots of data blocks may be getting evicited
but because meta blocks -- index and blooms -- are staying in cache with
high hit rates, a large data block eviction may show as a small change in
overall cache percentage (e.g. from 99.99 to 99.11).

Changes the getBlockCacheHitPercent from an int to a double.
Also changes name of the jmx metric blockCountHitPercent to be
blockCacheCountHitPercent instead.

May be incompatible change.
This commit is contained in:
Michael Stack 2014-05-22 11:37:50 -07:00
parent 98de4b04ff
commit 46e53b089a
5 changed files with 4 additions and 29 deletions

View File

@ -179,7 +179,7 @@ public interface MetricsRegionServerSource extends BaseSource {
String BLOCK_CACHE_EVICTION_COUNT = "blockCacheEvictionCount";
String BLOCK_CACHE_EVICTION_COUNT_DESC =
"Count of the number of blocks evicted from the block cache.";
String BLOCK_CACHE_HIT_PERCENT = "blockCountHitPercent";
String BLOCK_CACHE_HIT_PERCENT = "blockCacheCountHitPercent";
String BLOCK_CACHE_HIT_PERCENT_DESC =
"Percent of block cache requests that are hits";
String BLOCK_CACHE_EXPRESS_HIT_PERCENT = "blockCacheExpressHitPercent";

View File

@ -200,7 +200,7 @@ public interface MetricsRegionServerWrapper {
/**
* Get the percent of all requests that hit the block cache.
*/
int getBlockCacheHitPercent();
double getBlockCacheHitPercent();
/**
* Get the percent of requests with the block cache turned on that hit the block cache.

View File

@ -242,7 +242,7 @@ class MetricsRegionServerWrapperImpl
}
@Override
public int getBlockCacheHitPercent() {
public double getBlockCacheHitPercent() {
if (this.cacheStats == null) {
return 0;
}

View File

@ -1,25 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<!--
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.
-->
<head />
<body bgcolor="white">
Provides the hbase data+index+metadata file.
</body>
</html>

View File

@ -181,7 +181,7 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
}
@Override
public int getBlockCacheHitPercent() {
public double getBlockCacheHitPercent() {
return 98;
}