ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject git commit: AMBARI-6300. Configurations UI takes 1.5minutes to load on a 2k node cluster. (srimanth)
Date Fri, 27 Jun 2014 02:37:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a2918a8d7 -> 9ae132d5c


AMBARI-6300. Configurations UI takes 1.5minutes to load on a 2k node cluster. (srimanth)


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

Branch: refs/heads/trunk
Commit: 9ae132d5c952475fa7b09321fa747c57b22101dc
Parents: a2918a8
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Thu Jun 26 18:14:49 2014 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Thu Jun 26 19:37:22 2014 -0700

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 73 +++++++++++++++++---
 ambari-web/app/utils/ajax/ajax.js               | 12 ++++
 2 files changed, 76 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9ae132d5/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 5d583e8..cd8e35b 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -430,9 +430,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * @returns {{masterComponentHosts: Array, slaveComponentHosts: Array, hosts: {}}}
    */
   getInfoForDefaults: function() {
-
     App.ajax.send({
-      name: 'hosts.config_groups',
+      name: 'hosts.basic_info',
       sender: this,
       data: {
         clusterName: App.get('clusterName')
@@ -442,10 +441,55 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   },
 
   configGroupsHostsSuccessCallback: function(response) {
-    this.set('defaultsInfo', {
-      masterComponentHosts: this.getMasterComponents(response),
-      slaveComponentHosts: this.getSlaveComponents(response),
-      hosts: this.getHostsInfo(response)
+    // We load only basic host information. We do not load all host-components.
+    // Since some default providers need certain host-components, we load them
+    // very specifically on a need basis, and merge into 'response' parameter.
+    var mergeComponentResponse = function(componentResponse){
+      if(response && response.items && componentResponse &&
+          componentResponse.items && componentResponse.items.length > 0) {
+        componentResponse.items.forEach(function(nmHost){
+          var nmHostName = nmHost.Hosts.host_name;
+          response.items.forEach(function(host) {
+            if (nmHostName == host.Hosts.host_name) {
+              host.host_components = nmHost.host_components;
+            }
+          });
+        });
+      }
+    }
+    var self = this;
+    var oneComponentCallback = {
+      success: function(oneComponentResponse) {
+        mergeComponentResponse(oneComponentResponse);
+        var allComponentCallback = {
+          success: function(allComponentResponse) {
+            mergeComponentResponse(allComponentResponse);
+            self.set('defaultsInfo', {
+              masterComponentHosts: self.getMasterComponents(response),
+              slaveComponentHosts: self.getSlaveComponents(response),
+              hosts: self.getHostsInfo(response)
+            });
+          }
+        }
+        App.ajax.send({
+          name: 'hosts.all_components_of_type',
+          sender: allComponentCallback,
+          data: {
+            clusterName: App.get('clusterName'),
+            componentNames: ['HBASE_MASTER', 'FALCON_SERVER'].join(',')
+          },
+          success: 'success'
+        });
+      }
+    }
+    App.ajax.send({
+      name: 'hosts.one_component_of_type',
+      sender: oneComponentCallback,
+      data: {
+        clusterName: App.get('clusterName'),
+        componentNames: ['NODEMANAGER'].join(',')
+      },
+      success: 'success'
     });
   },
 
@@ -454,6 +498,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         slaves = [];
     response.items.forEach(function(item) {
       var hostName = item.Hosts.host_name;
+      if (!item.host_components) {
+        return;
+      }
       var _slaves = item.host_components.mapProperty('HostRoles.component_name').filter(function(componentName)
{
         return App.StackServiceComponent.find().findProperty('componentName', componentName).get('isSlave');
       }).map(function(componentName) {
@@ -480,13 +527,21 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   },
 
   getMasterComponents: function (response) {
-    var serviceMasterComponents = this.get('content.hostComponents').filterProperty('isMaster',
true).mapProperty('componentName').uniq(),
-        masterComponentHosts = [],
+    var masterComponentNames = App.StackServiceComponent.find().filterProperty('isMaster',
true).mapProperty('componentName');
+    // For default config value calculation and validation, a service
+    // might need the master from another service. For example, YARN
+    // default configurations depend on HBASE_MASTER component being
+    // installed. So we need to provide all masters that are required
+    // for config default/validation calculations.
+    var masterComponentHosts = [],
         _this = this;
     response.items.forEach(function(item) {
       var hostName = item.Hosts.host_name;
+      if (!item.host_components) {
+        return;
+      }
       item.host_components.mapProperty('HostRoles.component_name').forEach(function(componentName)
{
-        if (serviceMasterComponents.contains(componentName)) {
+        if (masterComponentNames.contains(componentName)) {
           masterComponentHosts.push({
             component: componentName,
             serviceId: _this.get('content.serviceName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ae132d5/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 6e5bb67..6289b20 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2150,6 +2150,18 @@ var urls = {
       }
     }
   },
+  'hosts.basic_info': {
+    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name&minimal_response=true',
+    'mock': ''
+  },
+  'hosts.one_component_of_type': {
+    'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({componentNames})&fields=host_components&page_size=1&minimal_response=true',
+    'mock': ''
+  },
+  'hosts.all_components_of_type': {
+    'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({componentNames})&fields=host_components&minimal_response=true',
+    'mock': ''
+  },
   'hosts.config_groups': {
     'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name,host_components&minimal_response=true',
     'mock': ''


Mime
View raw message