hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohithsharm...@apache.org
Subject hadoop git commit: YARN-4609. RM Nodes list page takes too much time to load. Contributed by Bibin A Chundatt
Date Tue, 05 Apr 2016 09:22:07 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 552237d4a -> 776b549e2


YARN-4609. RM Nodes list page takes too much time to load. Contributed by Bibin A Chundatt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/776b549e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/776b549e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/776b549e

Branch: refs/heads/trunk
Commit: 776b549e2ac20a68a5513cbcaac0edc33233dc03
Parents: 552237d
Author: Rohith Sharma K S <rohithsharmaks@apache.org>
Authored: Tue Apr 5 14:47:25 2016 +0530
Committer: Rohith Sharma K S <rohithsharmaks@apache.org>
Committed: Tue Apr 5 14:47:25 2016 +0530

----------------------------------------------------------------------
 .../resourcemanager/webapp/NodesPage.java       | 53 +++++++++++++-------
 .../resourcemanager/webapp/TestNodesPage.java   | 37 ++++----------
 2 files changed, 45 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/776b549e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
index 9603468..7063421 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
-import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_STATE;
 import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_LABEL;
+import static org.apache.hadoop.yarn.webapp.YarnWebParams.NODE_STATE;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
@@ -40,7 +40,6 @@ import org.apache.hadoop.yarn.webapp.SubView;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 
 import com.google.inject.Inject;
@@ -101,6 +100,7 @@ class NodesPage extends RmView {
           LOG.debug("Unexpected state filter for inactive RM node");
         }
       }
+      StringBuilder nodeTableData = new StringBuilder("[\n");
       for (RMNode ni : rmNodes) {
         if (stateFilter != null) {
           NodeState state = ni.getState();
@@ -129,27 +129,40 @@ class NodesPage extends RmView {
         NodeInfo info = new NodeInfo(ni, sched);
         int usedMemory = (int) info.getUsedMemory();
         int availableMemory = (int) info.getAvailableMemory();
-        TR<TBODY<TABLE<Hamlet>>> row =
-            tbody.tr().td(StringUtils.join(",", info.getNodeLabels()))
-                .td(info.getRack()).td(info.getState()).td(info.getNodeId());
+        nodeTableData.append("[\"")
+            .append(StringUtils.join(",", info.getNodeLabels())).append("\",\"")
+            .append(info.getRack()).append("\",\"").append(info.getState())
+            .append("\",\"").append(info.getNodeId());
         if (isInactive) {
-          row.td()._("N/A")._();
+          nodeTableData.append("\",\"").append("N/A").append("\",\"");
         } else {
           String httpAddress = info.getNodeHTTPAddress();
-          row.td().a("//" + httpAddress, httpAddress)._();
+          nodeTableData.append("\",\"<a ").append("href='" + "//" + httpAddress)
+              .append("'>").append(httpAddress).append("</a>\",").append("\"");
         }
-        row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._()
-            ._(Times.format(info.getLastHealthUpdate()))._()
-            .td(info.getHealthReport())
-            .td(String.valueOf(info.getNumContainers())).td().br()
-            .$title(String.valueOf(usedMemory))._()
-            ._(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().td().br()
-            .$title(String.valueOf(availableMemory))._()
-            ._(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._()
-            .td(String.valueOf(info.getUsedVirtualCores()))
-            .td(String.valueOf(info.getAvailableVirtualCores()))
-            .td(ni.getNodeManagerVersion())._();
+        nodeTableData.append("<br title='")
+            .append(String.valueOf(info.getLastHealthUpdate())).append("'>")
+            .append(Times.format(info.getLastHealthUpdate())).append("\",\"")
+            .append(info.getHealthReport()).append("\",\"")
+            .append(String.valueOf(info.getNumContainers())).append("\",\"")
+            .append("<br title='").append(String.valueOf(usedMemory))
+            .append("'>").append(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))
+            .append("\",\"").append("<br title='")
+            .append(String.valueOf(availableMemory)).append("'>")
+            .append(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))
+            .append("\",\"").append(String.valueOf(info.getUsedVirtualCores()))
+            .append("\",\"")
+            .append(String.valueOf(info.getAvailableVirtualCores()))
+            .append("\",\"").append(ni.getNodeManagerVersion())
+            .append("\"],\n");
+      }
+      if (nodeTableData.charAt(nodeTableData.length() - 2) == ',') {
+        nodeTableData.delete(nodeTableData.length() - 2,
+            nodeTableData.length() - 1);
       }
+      nodeTableData.append("]");
+      html.script().$type("text/javascript")
+          ._("var nodeTableData=" + nodeTableData)._();
       tbody._()._();
     }
   }
@@ -175,7 +188,9 @@ class NodesPage extends RmView {
   }
 
   private String nodesTableInit() {
-    StringBuilder b = tableInit().append(", aoColumnDefs: [");
+    StringBuilder b = tableInit().append(", 'aaData': nodeTableData")
+        .append(", bDeferRender: true").append(", bProcessing: true")
+        .append(", aoColumnDefs: [");
     b.append("{'bSearchable': false, 'aTargets': [ 7 ]}");
     b.append(", {'sType': 'title-numeric', 'bSearchable': false, "
         + "'aTargets': [ 8, 9 ] }");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/776b549e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
index 0699c0e..71d077b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
@@ -81,11 +81,8 @@ public class TestNodesPage {
     Mockito.verify(writer,
         Mockito.times(numberOfActualTableHeaders + numberOfThInMetricsTable))
         .print("<th");
-    Mockito.verify(
-        writer,
-        Mockito.times(numberOfRacks * numberOfNodesPerRack
-            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
-        "<td");
+    Mockito.verify(writer, Mockito.times(numberOfThInMetricsTable))
+        .print("<td");
   }
   
   @Test
@@ -99,11 +96,8 @@ public class TestNodesPage {
     Mockito.verify(writer,
         Mockito.times(numberOfActualTableHeaders + numberOfThInMetricsTable))
         .print("<th");
-    Mockito.verify(
-        writer,
-        Mockito.times(numberOfRacks * numberOfLostNodesPerRack
-            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
-        "<td");
+    Mockito.verify(writer, Mockito.times(numberOfThInMetricsTable))
+        .print("<td");
   }
   
   @Test
@@ -113,12 +107,9 @@ public class TestNodesPage {
     nodesBlock.render();
     PrintWriter writer = injector.getInstance(PrintWriter.class);
     WebAppTests.flushOutput(injector);
-
-    Mockito.verify(
-        writer,
-        Mockito.times(numberOfRacks
-            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
-        "<td");
+    Mockito.verify(writer, Mockito.times(numberOfThInMetricsTable))
+        .print("<td");
+    Mockito.verify(writer, Mockito.times(1)).print("<script");
   }
   
   @Test
@@ -129,11 +120,8 @@ public class TestNodesPage {
     PrintWriter writer = injector.getInstance(PrintWriter.class);
     WebAppTests.flushOutput(injector);
 
-    Mockito.verify(
-        writer,
-        Mockito.times(numberOfRacks * (numberOfNodesPerRack - 1)
-            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
-        "<td");
+    Mockito.verify(writer, Mockito.times(numberOfThInMetricsTable))
+        .print("<td");
   }
   
   @Test
@@ -144,10 +132,7 @@ public class TestNodesPage {
     PrintWriter writer = injector.getInstance(PrintWriter.class);
     WebAppTests.flushOutput(injector);
 
-    Mockito.verify(
-        writer,
-        Mockito.times(numberOfRacks * numberOfNodesPerRack
-            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
-        "<td");
+    Mockito.verify(writer, Mockito.times(numberOfThInMetricsTable))
+        .print("<td");
   }
 }


Mime
View raw message