Browse Source

AMBARI-11541. Default configuration for NameNode threads produces warning on large machine (srimanth)

Srimanth Gunturi 10 years ago
parent
commit
6a9620ab4a

+ 4 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py

@@ -88,6 +88,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
 
   def recommendHDFSConfigurations(self, configurations, clusterData, services, hosts):
     putHdfsSiteProperty = self.putProperty(configurations, "hdfs-site", services)
+    putHdfsSitePropertyAttribute = self.putPropertyAttribute(configurations, "hdfs-site")
     putHdfsSiteProperty("dfs.datanode.max.transfer.threads", 16384 if clusterData["hBaseInstalled"] else 4096)
 
     dataDirsCount = 1
@@ -110,7 +111,9 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     nameNodeCores = 4
     if namenodeHosts is not None and len(namenodeHosts):
       nameNodeCores = int(namenodeHosts[0]['Hosts']['cpu_count'])
-    putHdfsSiteProperty("dfs.namenode.handler.count", 25*nameNodeCores)
+    putHdfsSiteProperty("dfs.namenode.handler.count", 25 * nameNodeCores)
+    if 25 * nameNodeCores > 200:
+      putHdfsSitePropertyAttribute("dfs.namenode.handler.count", "maximum", 25 * nameNodeCores)
 
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
     if ('ranger-hdfs-plugin-properties' in services['configurations']) and ('ranger-hdfs-plugin-enabled' in services['configurations']['ranger-hdfs-plugin-properties']['properties']):

+ 3 - 1
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py

@@ -87,7 +87,9 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
     nameNodeCores = 4
     if namenodeHosts is not None and len(namenodeHosts):
       nameNodeCores = int(namenodeHosts[0]['Hosts']['cpu_count'])
-    putHdfsSiteProperty("dfs.namenode.handler.count", 25*nameNodeCores)
+    putHdfsSiteProperty("dfs.namenode.handler.count", 25 * nameNodeCores)
+    if 25 * nameNodeCores > 200:
+      putHdfsSitePropertyAttribute("dfs.namenode.handler.count", "maximum", 25 * nameNodeCores)
 
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
     if ('ranger-hdfs-plugin-properties' in services['configurations']) and ('ranger-hdfs-plugin-enabled' in services['configurations']['ranger-hdfs-plugin-properties']['properties']):

+ 11 - 0
ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py

@@ -2199,6 +2199,17 @@ class TestHDP22StackAdvisor(TestCase):
     self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
     self.assertEqual("kms://http@myhost1:2222/kms", configurations["hdfs-site"]["properties"]["dfs.encryption.key.provider.uri"])
 
+    # Test 8 - Dynamic maximum for 'dfs.namenode.handler.count'
+    hosts['items'][1]['Hosts']['cpu_count'] = 9
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
+    self.assertEqual(str(9 * 25), configurations["hdfs-site"]["property_attributes"]["dfs.namenode.handler.count"]['maximum'])
+
+    # Test 9 - Dynamic maximum for 'dfs.namenode.handler.count'
+    configurations["hdfs-site"]["property_attributes"].pop("dfs.namenode.handler.count", None)
+    hosts['items'][1]['Hosts']['cpu_count'] = 4
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
+    self.assertTrue("dfs.namenode.handler.count" not in configurations["hdfs-site"]["property_attributes"])
+
   def test_validateTezConfigurationsEnv(self):
     configurations = {
         "yarn-site": {