hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r942863 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Date Mon, 10 May 2010 19:24:12 GMT
Author: dhruba
Date: Mon May 10 19:24:12 2010
New Revision: 942863

URL: http://svn.apache.org/viewvc?rev=942863&view=rev
Log:
HDFS-853. The HDFS webUI displays the balanced-ness of the cluster.
(Dmytro Molkov via dhruba)


Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=942863&r1=942862&r2=942863&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Mon May 10 19:24:12 2010
@@ -505,6 +505,9 @@ Release 0.21.0 - Unreleased
     HDFS-1109. HFTP supports filenames that contains the character "+".
     (Dmytro Molkov via dhruba)
 
+    HDFS-853. The HDFS webUI displays the balanced-ness of the cluster.
+    (Dmytro Molkov via dhruba)
+
   OPTIMIZATIONS
 
     HDFS-946. NameNode should not return full path name when lisitng a

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java?rev=942863&r1=942862&r2=942863&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Mon May 10 19:24:12 2010
@@ -25,6 +25,7 @@ import java.net.InetAddress;
 import java.net.URLEncoder;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -231,6 +232,30 @@ class NamenodeJspHelper {
           / (float) total;
       float percentRemaining = total <= 0 ? 100f : ((float) remaining * 100.0f)
           / (float) total;
+      float median = 0;
+      float max = 0;
+      float min = 0;
+      float dev = 0;
+      
+      if (live.size() > 0) {
+        float totalDfsUsed = 0;
+        float[] usages = new float[live.size()];
+        int i = 0;
+        for (DatanodeDescriptor dn : live) {
+          usages[i++] = dn.getDfsUsedPercent();
+          totalDfsUsed += dn.getDfsUsedPercent();
+        }
+        totalDfsUsed /= live.size();
+        Arrays.sort(usages);
+        median = usages[usages.length/2];
+        max = usages[usages.length - 1];
+        min = usages[0];
+        
+        for (i = 0; i < usages.length; i++) {
+          dev += (usages[i] - totalDfsUsed) * (usages[i] - totalDfsUsed);
+        }
+        dev = (float) Math.sqrt(dev/usages.length);
+      }
 
       out.print("<div id=\"dfstable\"> <table>\n" + rowTxt() + colTxt()
           + "Configured Capacity" + colTxt() + ":" + colTxt()
@@ -243,8 +268,15 @@ class NamenodeJspHelper {
           + colTxt() + ":" + colTxt()
           + StringUtils.limitDecimalTo2(percentUsed) + " %" + rowTxt()
           + colTxt() + "DFS Remaining%" + colTxt() + ":" + colTxt()
-          + StringUtils.limitDecimalTo2(percentRemaining) + " %" + rowTxt()
-          + colTxt()
+          + StringUtils.limitDecimalTo2(percentRemaining) + " %"
+          + rowTxt() + colTxt() + "DataNodes usages" + colTxt() + ":" + colTxt()
+          + "Min %" + colTxt() + "Median %" + colTxt() + "Max %" + colTxt()
+          + "stdev %" + rowTxt() + colTxt() + colTxt() + colTxt()
+          + StringUtils.limitDecimalTo2(min) + " %"
+          + colTxt() + StringUtils.limitDecimalTo2(median) + " %"
+          + colTxt() + StringUtils.limitDecimalTo2(max) + " %"
+          + colTxt() + StringUtils.limitDecimalTo2(dev) + " %"
+          + rowTxt() + colTxt()
           + "<a href=\"dfsnodelist.jsp?whatNodes=LIVE\">Live Nodes</a> "
           + colTxt() + ":" + colTxt() + live.size() + rowTxt() + colTxt()
           + "<a href=\"dfsnodelist.jsp?whatNodes=DEAD\">Dead Nodes</a> "



Mime
View raw message