hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject svn commit: r1550871 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver: DefaultHeapMemoryTuner.java NoOpHeapMemoryTuner.java
Date Sat, 14 Dec 2013 03:01:12 GMT
Author: anoopsamjohn
Date: Sat Dec 14 03:01:11 2013
New Revision: 1550871

URL: http://svn.apache.org/r1550871
Log:
HBASE-10151 No-op HeapMemoryTuner

Added:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/NoOpHeapMemoryTuner.java
Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultHeapMemoryTuner.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultHeapMemoryTuner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultHeapMemoryTuner.java?rev=1550871&r1=1550870&r2=1550871&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultHeapMemoryTuner.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultHeapMemoryTuner.java
Sat Dec 14 03:01:11 2013
@@ -45,6 +45,9 @@ class DefaultHeapMemoryTuner implements 
   public static final String STEP_KEY = "hbase.regionserver.heapmemory.autotuner.step";
   public static final float DEFAULT_STEP_VALUE = 0.02f; // 2%
 
+  private static final TunerResult TUNER_RESULT = new TunerResult(true);
+  private static final TunerResult NO_OP_TUNER_RESULT = new TunerResult(false);
+
   private Configuration conf;
   private float step = DEFAULT_STEP_VALUE;
 
@@ -61,9 +64,8 @@ class DefaultHeapMemoryTuner implements 
     boolean memstoreSufficient = blockedFlushCount == 0 && unblockedFlushCount ==
0;
     boolean blockCacheSufficient = evictCount == 0;
     if (memstoreSufficient && blockCacheSufficient) {
-      return new TunerResult(false);
+      return NO_OP_TUNER_RESULT;
     }
-    TunerResult result = new TunerResult(true);
     float newMemstoreSize;
     float newBlockCacheSize;
     if (memstoreSufficient) {
@@ -75,7 +77,7 @@ class DefaultHeapMemoryTuner implements 
       newBlockCacheSize = context.getCurBlockCacheSize() - step;
       newMemstoreSize = context.getCurMemStoreSize() + step;
     } else {
-      return new TunerResult(false);
+      return NO_OP_TUNER_RESULT;
       // As of now not making any tuning in write/read heavy scenario.
     }
     if (newMemstoreSize > globalMemStorePercentMaxRange) {
@@ -88,9 +90,9 @@ class DefaultHeapMemoryTuner implements 
     } else if (newBlockCacheSize < blockCachePercentMinRange) {
       newBlockCacheSize = blockCachePercentMinRange;
     }
-    result.setBlockCacheSize(newBlockCacheSize);
-    result.setMemstoreSize(newMemstoreSize);
-    return result;
+    TUNER_RESULT.setBlockCacheSize(newBlockCacheSize);
+    TUNER_RESULT.setMemstoreSize(newMemstoreSize);
+    return TUNER_RESULT;
   }
 
   @Override

Added: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/NoOpHeapMemoryTuner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/NoOpHeapMemoryTuner.java?rev=1550871&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/NoOpHeapMemoryTuner.java
(added)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/NoOpHeapMemoryTuner.java
Sat Dec 14 03:01:11 2013
@@ -0,0 +1,48 @@
+/**
+ * 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.regionserver;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.regionserver.HeapMemoryManager.TunerContext;
+import org.apache.hadoop.hbase.regionserver.HeapMemoryManager.TunerResult;
+
+/**
+ * An implementation of HeapMemoryTuner which is not doing any tuning activity but just allows
to
+ * continue with old style fixed proportions.
+ */
+@InterfaceAudience.Private
+public class NoOpHeapMemoryTuner implements HeapMemoryTuner {
+  
+  private static final TunerResult NO_OP_TUNER_RESULT = new TunerResult(false);
+
+  @Override
+  public Configuration getConf() {
+    return null;
+  }
+
+  @Override
+  public void setConf(Configuration conf) {
+
+  }
+
+  @Override
+  public TunerResult tune(TunerContext context) {
+    return NO_OP_TUNER_RESULT;
+  }
+}



Mime
View raw message