You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2016/02/11 02:47:17 UTC
[3/3] hbase git commit: HBASE-15246 Backport branch-1
HBasePerformanceEvaluation to 0.98
HBASE-15246 Backport branch-1 HBasePerformanceEvaluation to 0.98
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/38ce707b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/38ce707b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/38ce707b
Branch: refs/heads/0.98
Commit: 38ce707b2706c1c48b4f2386cc679f14081fc523
Parents: 6417754
Author: Andrew Purtell <ap...@apache.org>
Authored: Wed Feb 10 00:51:47 2016 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Wed Feb 10 17:44:50 2016 -0800
----------------------------------------------------------------------
.../hadoop/hbase/util/YammerHistogramUtils.java | 80 +
.../hadoop/hbase/PerformanceEvaluation.java | 1660 +++++++++++++-----
.../hbase/mapreduce/TestHFileOutputFormat.java | 2 +-
.../hbase/mapreduce/TestHFileOutputFormat2.java | 2 +-
4 files changed, 1307 insertions(+), 437 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/38ce707b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/YammerHistogramUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/YammerHistogramUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/YammerHistogramUtils.java
new file mode 100644
index 0000000..120f170
--- /dev/null
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/YammerHistogramUtils.java
@@ -0,0 +1,80 @@
+/**
+ *
+ * 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.util;
+
+import com.yammer.metrics.core.Histogram;
+import com.yammer.metrics.stats.Sample;
+import com.yammer.metrics.stats.Snapshot;
+
+import java.lang.reflect.Constructor;
+import java.text.DecimalFormat;
+
+/** Utility functions for working with Yammer Metrics. */
+public final class YammerHistogramUtils {
+
+ // not for public consumption
+ private YammerHistogramUtils() {}
+
+ /**
+ * Used formatting doubles so only two places after decimal point.
+ */
+ private static DecimalFormat DOUBLE_FORMAT = new DecimalFormat("#0.00");
+
+ /**
+ * Create a new {@link com.yammer.metrics.core.Histogram} instance. These constructors are
+ * not public in 2.2.0, so we use reflection to find them.
+ */
+ public static Histogram newHistogram(Sample sample) {
+ try {
+ Constructor<?> ctor =
+ Histogram.class.getDeclaredConstructor(Sample.class);
+ ctor.setAccessible(true);
+ return (Histogram) ctor.newInstance(sample);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /** @return an abbreviated summary of {@code hist}. */
+ public static String getShortHistogramReport(final Histogram hist) {
+ Snapshot sn = hist.getSnapshot();
+ return "mean=" + DOUBLE_FORMAT.format(hist.mean()) +
+ ", min=" + DOUBLE_FORMAT.format(hist.min()) +
+ ", max=" + DOUBLE_FORMAT.format(hist.max()) +
+ ", stdDev=" + DOUBLE_FORMAT.format(hist.stdDev()) +
+ ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
+ ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile());
+ }
+
+ /** @return a summary of {@code hist}. */
+ public static String getHistogramReport(final Histogram hist) {
+ Snapshot sn = hist.getSnapshot();
+ return ", mean=" + DOUBLE_FORMAT.format(hist.mean()) +
+ ", min=" + DOUBLE_FORMAT.format(hist.min()) +
+ ", max=" + DOUBLE_FORMAT.format(hist.max()) +
+ ", stdDev=" + DOUBLE_FORMAT.format(hist.stdDev()) +
+ ", 50th=" + DOUBLE_FORMAT.format(sn.getMedian()) +
+ ", 75th=" + DOUBLE_FORMAT.format(sn.get75thPercentile()) +
+ ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
+ ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()) +
+ ", 99.9th=" + DOUBLE_FORMAT.format(sn.get999thPercentile()) +
+ ", 99.99th=" + DOUBLE_FORMAT.format(sn.getValue(0.9999)) +
+ ", 99.999th=" + DOUBLE_FORMAT.format(sn.getValue(0.99999));
+ }
+}