ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-9383 Configs: Ambari support for HBase bucketcache (dsen)
Date Thu, 05 Mar 2015 15:45:52 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4a54f0304 -> 64648d034


AMBARI-9383 Configs: Ambari support for HBase bucketcache (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64648d03
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64648d03
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64648d03

Branch: refs/heads/trunk
Commit: 64648d034cc1cb69f83ed60912a339290a86be40
Parents: 4a54f03
Author: Dmytro Sen <dsen@apache.org>
Authored: Thu Mar 5 17:45:39 2015 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Thu Mar 5 17:45:39 2015 +0200

----------------------------------------------------------------------
 .../HBASE/0.96.0.2.0/package/scripts/params.py  |  3 +
 .../services/HBASE/configuration/hbase-env.xml  |  9 ++-
 .../services/HBASE/configuration/hbase-site.xml | 26 +++++-
 .../stacks/HDP/2.2/services/stack_advisor.py    | 84 +++++++++++++++++++-
 ambari-web/app/data/HDP2.2/site_properties.js   | 47 +++++++++++
 5 files changed, 165 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/64648d03/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params.py
index ca8a48e..fecc2c5 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params.py
@@ -78,6 +78,9 @@ regionserver_xmn_max = config['configurations']['hbase-env']['hbase_regionserver
 regionserver_xmn_percent = config['configurations']['hbase-env']['hbase_regionserver_xmn_ratio']
 regionserver_xmn_size = calc_xmn_from_xms(regionserver_heapsize, regionserver_xmn_percent,
regionserver_xmn_max)
 
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+  hbase_max_direct_memory_size  = config['configurations']['hbase-env']['hbase_max_direct_memory_size']
+
 pid_dir = status_params.pid_dir
 tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
 # TODO UPGRADE default, update site during upgrade

http://git-wip-us.apache.org/repos/asf/ambari/blob/64648d03/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
index f9c5885..a1725e4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
@@ -57,6 +57,11 @@
     <property-type>USER</property-type>
     <description>HBase User Name.</description>
   </property>
+  <property>
+    <name>hbase_max_direct_memory_size</name>
+    <value></value>
+    <description>If not empty, adds '-XX:MaxDirectMemorySize={{hbase_max_direct_memory_size}}m'
to HBASE_REGIONSERVER_OPTS.</description>
+  </property>
 
   <!-- hbase-env.sh -->
   <property>
@@ -124,11 +129,11 @@ export HBASE_MANAGES_ZK=false
 {% if security_enabled %}
 export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC -XX:ErrorFile={{log_dir}}/hs_err_pid%p.log
-Djava.security.auth.login.config={{client_jaas_config_file}}"
 export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xmx{{master_heapsize}} -Djava.security.auth.login.config={{master_jaas_config_file}}"
-export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xmn{{regionserver_xmn_size}} -XX:CMSInitiatingOccupancyFraction=70
 -Xms{{regionserver_heapsize}} -Xmx{{regionserver_heapsize}} -Djava.security.auth.login.config={{regionserver_jaas_config_file}}"
+export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xmn{{regionserver_xmn_size}} -XX:CMSInitiatingOccupancyFraction=70
 -Xms{{regionserver_heapsize}} -Xmx{{regionserver_heapsize}} {% if hbase_max_direct_memory_size
%} -XX:MaxDirectMemorySize={{hbase_max_direct_memory_size}}m {% endif %} -Djava.security.auth.login.config={{regionserver_jaas_config_file}}"
 {% else %}
 export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC -XX:ErrorFile={{log_dir}}/hs_err_pid%p.log"
 export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xmx{{master_heapsize}}"
-export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xmn{{regionserver_xmn_size}} -XX:CMSInitiatingOccupancyFraction=70
 -Xms{{regionserver_heapsize}} -Xmx{{regionserver_heapsize}}"
+export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xmn{{regionserver_xmn_size}} -XX:CMSInitiatingOccupancyFraction=70
 -Xms{{regionserver_heapsize}} -Xmx{{regionserver_heapsize}} {% if hbase_max_direct_memory_size
%} -XX:MaxDirectMemorySize={{hbase_max_direct_memory_size}}m {% endif %}"
 {% endif %}
     </value>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/64648d03/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
index e5b893f..e3f9219 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
@@ -61,5 +61,29 @@
     worse, we OOME.
     </description>
   </property>
-
+  <property>
+    <name>hbase.bucketcache.ioengine</name>
+    <value></value>
+    <description>Where to store the contents of the bucketcache. One of: onheap,
+      offheap, or file. If a file, set it to file:PATH_TO_FILE.</description>
+  </property>
+  <property>
+    <name>hbase.bucketcache.size</name>
+    <value></value>
+    <description>The size of the buckets for the bucketcache if you only use a single
size.</description>
+  </property>
+  <property>
+    <name>hbase.bucketcache.percentage.in.combinedcache</name>
+    <value></value>
+    <description>Value to be set between 0.0 and 1.0</description>
+  </property>
+  <property>
+    <name>hbase.regionserver.global.memstore.size</name>
+    <value>${hbase.regionserver.global.memstore.upperLimit}</value>
+    <description>Maximum size of all memstores in a region server before new
+      updates are blocked and flushes are forced. Defaults to 40% of heap.
+      Updates are blocked and flushes are forced until size of all memstores
+      in a region server hits hbase.regionserver.global.memstore.size.lower.limit.
+    </description>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/64648d03/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index f24d0b9..a7eb98c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -17,6 +17,9 @@ See the License for the specific language governing permissions and
 limitations under the License.
 """
 
+import math
+
+
 class HDP22StackAdvisor(HDP21StackAdvisor):
 
   def getServiceConfigurationRecommenderDict(self):
@@ -81,6 +84,46 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
         putHbaseSiteProperty("hbase.coprocessor.master.classes", 'com.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor')
         putHbaseSiteProperty("hbase.coprocessor.region.classes", 'com.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor')
 
+    # Recommend configs for bucket cache
+    threshold = 23 # 2 Gb is reserved for other offheap memory
+    mb = 1024
+    if (int(clusterData["hbaseRam"]) > threshold):
+      # To enable cache - calculate values
+      regionserver_total_ram = int(clusterData["hbaseRam"]) * mb
+      regionserver_heap_size = 20480
+      regionserver_max_direct_memory_size = regionserver_total_ram - regionserver_heap_size
+      hfile_block_cache_size = '0.4'
+      block_cache_heap = 8192 # int(regionserver_heap_size * hfile_block_cache_size)
+      hbase_regionserver_global_memstore_size = '0.4'
+      reserved_offheap_memory = 2048
+      bucketcache_offheap_memory = regionserver_max_direct_memory_size - reserved_offheap_memory
+      hbase_bucketcache_size = block_cache_heap + bucketcache_offheap_memory
+      hbase_bucketcache_percentage_in_combinedcache = float(bucketcache_offheap_memory) /
hbase_bucketcache_size
+      hbase_bucketcache_percentage_in_combinedcache_str = "{0:.4f}".format(math.ceil(hbase_bucketcache_percentage_in_combinedcache
* 10000) / 10000.0)
+
+      # Set values in hbase-site
+      putHbaseProperty = self.putProperty(configurations, "hbase-site")
+      putHbaseProperty('hfile.block.cache.size', hfile_block_cache_size)
+      putHbaseProperty('hbase.regionserver.global.memstore.upperLimit', hbase_regionserver_global_memstore_size)
+      putHbaseProperty('hbase.bucketcache.ioengine', 'offheap')
+      putHbaseProperty('hbase.bucketcache.size', hbase_bucketcache_size)
+      putHbaseProperty('hbase.bucketcache.percentage.in.combinedcache', hbase_bucketcache_percentage_in_combinedcache_str)
+
+      # Enable in hbase-env
+      putHbaseEnvProperty = self.putProperty(configurations, "hbase-env")
+      putHbaseEnvProperty('hbase_max_direct_memory_size', regionserver_max_direct_memory_size)
+      putHbaseEnvProperty('hbase_regionserver_heapsize', regionserver_heap_size)
+    else:
+      # Disable
+      putHbaseProperty = self.putProperty(configurations, "hbase-site")
+      putHbaseProperty('hbase.bucketcache.ioengine', '')
+      putHbaseProperty('hbase.bucketcache.size', '')
+      putHbaseProperty('hbase.bucketcache.percentage.in.combinedcache', '')
+
+      putHbaseEnvProperty = self.putProperty(configurations, "hbase-env")
+      putHbaseEnvProperty('hbase_max_direct_memory_size', '')
+
+
   def recommendTezConfigurations(self, configurations, clusterData, services, hosts):
     putTezProperty = self.putProperty(configurations, "tez-site")
     putTezProperty("tez.am.resource.memory.mb", int(clusterData['amMemory']) * 2 if int(clusterData['amMemory'])
< 3072 else int(clusterData['amMemory']))
@@ -97,7 +140,8 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
       "HDFS": {"hdfs-site": self.validateHDFSConfigurations,
                "hadoop-env": self.validateHDFSConfigurationsEnv},
       "HIVE": {"hiveserver2-site": self.validateHiveServer2Configurations, "hive-site": self.validateHiveConfigurations},
-      "HBASE": {"hbase-site": self.validateHBASEConfigurations},
+      "HBASE": {"hbase-site": self.validateHBASEConfigurations,
+                "hbase-env": self.validateHBASEEnvConfigurations},
       "MAPREDUCE2": {"mapred-site": self.validateMapReduce2Configurations},
       "TEZ": {"tez-site": self.validateTezConfigurations}
     }
@@ -386,8 +430,46 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
                                 "item": self.getWarnItem(
                                 "If Ranger HBase Plugin is enabled."\
                                 " {0} needs to contain {1} instead of {2}".format(prop_name,prop_val,exclude_val))})
+
+    # Validate bucket cache correct config
+    prop_name = "hbase.bucketcache.ioengine"
+    prop_val = "offheap"
+    if not (not hbase_site[prop_name] or hbase_site[prop_name] == prop_val):
+      validationItems.append({"config-name": prop_name,
+                              "item": self.getWarnItem(
+                                "Recommended values of " \
+                                " {0} is empty or '{1}'".format(prop_name,prop_val))})
+
+    prop_name1 = "hbase.bucketcache.ioengine"
+    prop_name2 = "hbase.bucketcache.size"
+    prop_name3 = "hbase.bucketcache.percentage.in.combinedcache"
+
+    if hbase_site[prop_name1] and not hbase_site[prop_name2]:
+      validationItems.append({"config-name": prop_name2,
+                              "item": self.getWarnItem(
+                                "If bucketcache ioengine is enabled, {0} should be set".format(prop_name2))})
+    if hbase_site[prop_name1] and not hbase_site[prop_name3]:
+      validationItems.append({"config-name": prop_name3,
+                              "item": self.getWarnItem(
+                                "If bucketcache ioengine is enabled, {0} should be set".format(prop_name3))})
+
     return self.toConfigurationValidationProblems(validationItems, "hbase-site")
 
+  def validateHBASEEnvConfigurations(self, properties, recommendedDefaults, configurations,
services, hosts):
+    hbase_env = properties
+    validationItems = [ {"config-name": 'hbase_regionserver_heapsize', "item": self.validatorLessThenDefaultValue(properties,
recommendedDefaults, 'hbase_regionserver_heapsize')},
+                        {"config-name": 'hbase_master_heapsize', "item": self.validatorLessThenDefaultValue(properties,
recommendedDefaults, 'hbase_master_heapsize')} ]
+    prop_name = "hbase_max_direct_memory_size"
+    hbase_site_properties = getSiteProperties(configurations, "hbase-site")
+    prop_name1 = "hbase.bucketcache.ioengine"
+
+    if hbase_site_properties[prop_name1] and hbase_site_properties[prop_name1] == "offheap"
and not hbase_env[prop_name]:
+      validationItems.append({"config-name": prop_name,
+                              "item": self.getWarnItem(
+                                "If bucketcache ioengine is enabled, {0} should be set".format(prop_name))})
+
+    return self.toConfigurationValidationProblems(validationItems, "hbase-env")
+
   def getMastersWithMultipleInstances(self):
     result = super(HDP22StackAdvisor, self).getMastersWithMultipleInstances()
     result.extend(['METRICS_COLLECTOR'])

http://git-wip-us.apache.org/repos/asf/ambari/blob/64648d03/ambari-web/app/data/HDP2.2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/site_properties.js b/ambari-web/app/data/HDP2.2/site_properties.js
index e34c289..a698b60 100644
--- a/ambari-web/app/data/HDP2.2/site_properties.js
+++ b/ambari-web/app/data/HDP2.2/site_properties.js
@@ -787,6 +787,53 @@ hdp22properties.push(
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "ADSettings"
+  },
+  {
+    "id": "site property",
+    "name": "hbase.bucketcache.ioengine",
+    "displayName": "hbase.bucketcache.ioengine",
+    "isRequired": false,
+    "serviceName": "HBASE",
+    "filename": "hbase-site.xml",
+    "category": "Advanced hbase-site"
+  },
+  {
+    "id": "site property",
+    "name": "hbase.bucketcache.size",
+    "displayName": "hbase.bucketcache.size",
+    "displayType": "int",
+    "isRequired": false,
+    "serviceName": "HBASE",
+    "filename": "hbase-site.xml",
+    "category": "Advanced hbase-site"
+  },
+  {
+    "id": "site property",
+    "name": "hbase.bucketcache.percentage.in.combinedcache",
+    "displayName": "hbase.bucketcache.percentage.in.combinedcache",
+    "displayType": "float",
+    "isRequired": false,
+    "serviceName": "HBASE",
+    "filename": "hbase-site.xml",
+    "category": "Advanced hbase-site"
+  },
+  {
+    "id": "site property",
+    "name": "hbase_max_direct_memory_size",
+    "displayName": "HBase off-heap MaxDirectMemorySize",
+    "displayType": "int",
+    "isRequired": false,
+    "serviceName": "HBASE",
+    "filename": "hbase-env.xml",
+    "category": "Advanced hbase-env"
+  },
+  {
+    "id": "site property",
+    "name": "hbase.regionserver.global.memstore.size",
+    "displayName": "hbase.regionserver.global.memstore.size",
+    "category": "Advanced hbase-site",
+    "serviceName": "HBASE",
+    "filename": "hbase-site.xml"
   }
 );
 


Mime
View raw message