accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1295691 - in /incubator/accumulo/branches/1.4/src/server/src/main: java/org/apache/accumulo/server/monitor/ java/org/apache/accumulo/server/monitor/servlets/ resources/web/
Date Thu, 01 Mar 2012 17:36:08 GMT
Author: billie
Date: Thu Mar  1 17:36:07 2012
New Revision: 1295691

URL: http://svn.apache.org/viewvc?rev=1295691&view=rev
Log:
ACCUMULO-431 added several stats, made max adjustment optional

Modified:
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
    incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java?rev=1295691&r1=1295690&r2=1295691&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
Thu Mar  1 17:36:07 2012
@@ -587,6 +587,10 @@ public class Monitor {
     }
   }
   
+  public static double getLookupRate() {
+    return lookupRateTracker.calculateRate();
+  }
+  
   public static List<Pair<Long,Integer>> getQueryRateOverTime() {
     synchronized (queryRateOverTime) {
       return new ArrayList<Pair<Long,Integer>>(queryRateOverTime);

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java?rev=1295691&r1=1295690&r2=1295691&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
Thu Mar  1 17:36:07 2012
@@ -24,10 +24,14 @@ import java.util.ArrayList;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
+import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.monitor.Monitor;
 
 public class VisServlet extends BasicServlet {
+  private static final int concurrentScans = ServerConfiguration.getSystemConfiguration().getCount(Property.TSERV_READ_AHEAD_MAXCONCURRENT);
+  
   private static final long serialVersionUID = 1L;
   boolean useCircles;
   StatType motion;
@@ -36,7 +40,52 @@ public class VisServlet extends BasicSer
   String url;
   
   public enum StatType {
-    osload, ingest, query
+    osload(ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors(), true, 100,
"OS Load"),
+    ingest(1000, true, 1, "Ingest Entries"),
+    query(10000, true, 1, "Scan Entries"),
+    ingestMB(10, true, 10, "Ingest MB"),
+    queryMB(5, true, 10, "Scan MB"),
+    scans(concurrentScans * 2, false, 1, "Running Scans"),
+    scansessions(50, true, 10, "Scan Sessions"),
+    holdtime(60000, false, 1, "Hold Time");
+    
+    private int max;
+    private boolean adjustMax;
+    private float significance;
+    private String description;
+    
+    /**
+     * @param max
+     *          initial estimate of largest possible value for this stat
+     * @param adjustMax
+     *          indicates whether max should be adjusted based on observed values
+     * @param significance
+     *          values will be converted by floor(significance*value)/significance
+     * @param description
+     *          as appears in selection box
+     */
+    private StatType(int max, boolean adjustMax, float significance, String description)
{
+      this.max = max;
+      this.adjustMax = adjustMax;
+      this.significance = significance;
+      this.description = description;
+    }
+    
+    public int getMax() {
+      return max;
+    }
+    
+    public boolean getAdjustMax() {
+      return adjustMax;
+    }
+    
+    public float getSignificance() {
+      return significance;
+    }
+    
+    public String getDescription() {
+      return description;
+    }
   }
   
   @Override
@@ -127,13 +176,34 @@ public class VisServlet extends BasicSer
     sb.append("var numCores = " + ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
+ ";\n");
     sb.append("var xmlurl = '" + url + "xml';\n");
     sb.append("var visurl = '" + url + "vis';\n");
-    sb.append("var serverurl = '" + url + "tservers?s=';\n");
+    sb.append("var serverurl = '" + url + "tservers?s=';\n\n");
+    sb.append("// observable stats that can be connected to motion or color\n");
+    sb.append("var statName = [");
+    for (StatType st : StatType.values())
+      sb.append("'").append(st).append("',");
+    sb.setLength(sb.length() - 1);
+    sb.append("];\n");
+    sb.append("var maxStatValue = [");
+    for (StatType st : StatType.values())
+      sb.append(st.getMax()).append(",");
+    sb.setLength(sb.length() - 1);
+    sb.append("]; // initial values that are system-dependent may increase based on observed
values\n");
+    sb.append("var adjustMax = [");
+    for (StatType st : StatType.values())
+      sb.append(st.getAdjustMax()).append(",");
+    sb.setLength(sb.length() - 1);
+    sb.append("]; // whether to allow increases in the max based on observed values\n");
+    sb.append("var significance = [");
+    for (StatType st : StatType.values())
+      sb.append(st.getSignificance()).append(",");
+    sb.setLength(sb.length() - 1);
+    sb.append("]; // values will be converted by floor(this*value)/this\n");
     sb.append("</script>\n");
   }
   
   private void addOptions(StringBuilder sb, StatType selectedStatType) {
     for (StatType st : StatType.values()) {
-      sb.append("<option").append(st.equals(selectedStatType) ? " selected='true'>"
: ">").append(st).append("</option>");
+      sb.append("<option").append(st.equals(selectedStatType) ? " selected='true'>"
: ">").append(st.getDescription()).append("</option>");
     }
   }
   

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java?rev=1295691&r1=1295690&r2=1295691&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
Thu Mar  1 17:36:07 2012
@@ -87,6 +87,11 @@ public class XMLServlet extends BasicSer
       
       sb.append("<ingest>").append(summary.ingestRate).append("</ingest>\n");
       sb.append("<query>").append(summary.queryRate).append("</query>\n");
+      sb.append("<ingestMB>").append(summary.ingestByteRate / 1000000.0).append("</ingestMB>\n");
+      sb.append("<queryMB>").append(summary.queryByteRate / 1000000.0).append("</queryMB>\n");
+      sb.append("<scans>").append(summary.scans.running + summary.scans.queued).append("</scans>");
+      sb.append("<scansessions>").append(Monitor.getLookupRate()).append("</scansessions>\n");
+      sb.append("<holdtime>").append(status.holdTime).append("</holdtime>\n");
       totalIngest += summary.ingestRate;
       totalQuery += summary.queryRate;
       totalEntries += summary.recs;

Modified: incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml?rev=1295691&r1=1295690&r2=1295691&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml (original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml Thu Mar  1 17:36:07
2012
@@ -16,12 +16,8 @@
 -->
 
 <script type='text/javascript'>
-// observable stats that can be connected to motion or color
-var statName = ['osload','ingest','query'];
 var speedStatType = 1; // index into statName
 var colorStatType = 0; // index into statName
-var maxStatValue = [numCores, 1000, 10000]; // initial values that are system-dependent will
increase based on observed values
-var significance = [100,1,1]; // values will be converted by floor(this*value)/this
 
 // size and spacing variables
 var numDots = 0; // number of dots to draw
@@ -98,8 +94,8 @@ function handleNewData() {
     var extra = '<br>';
     for (j=0; j < statinfo.length; j++) {
       statValues[j] = Math.floor(significance[j]*parseFloat(statinfo[j][i].childNodes[0].nodeValue))/significance[j];
-      if (maxStatValue[j] < statValues[j])
-        maxStatValue[j] = statValues[j];
+      if (statValues[j] < 0)
+        statValues[j] = 0;
       extra = extra + ' ' + statName[j] + ': ' + statValues[j];
     }
     setStats(statValues,i);
@@ -122,8 +118,11 @@ function handleNewData() {
 function setStats(statValues,index) {
   if (index >= allStats.length)
     allStats.push(new Array(statValues.length));
-  for (j=0; j < statValues.length; j++)
+  for (j=0; j < statValues.length; j++) {
+    if (adjustMax[j] && maxStatValue[j] < statValues[j])
+      maxStatValue[j] = statValues[j];
     allStats[index][j] = statValues[j];
+  }
 }
 
 function setDotInfo(id,extra,index) {
@@ -166,6 +165,8 @@ function drawDots(){
         dotSize[i] = maxDotRadius;
     } else {
       sizeChange = allStats[i][speedStatType]/maxStatValue[speedStatType];
+      if (sizeChange > 1)
+        sizeChange = 1;
       if (dotSizeGrowing[i]) {
         dotSize[i] = dotSize[i] + sizeChange;
         if (dotSize[i] + sizeChange > maxDotRadius) {
@@ -184,7 +185,7 @@ function drawDots(){
     if (i >= numLive)
       strokeDot(x,y,maxDotRadius-1,deadColor);
     else
-      drawDot(x,y,Math.floor(dotSize[i]),getColor(allStats[i][colorStatType],maxStatValue[colorStatType]));
+      drawDot(x,y,Math.floor(dotSize[i]),getColor(allStats[i][colorStatType]/maxStatValue[colorStatType]));
   }
   if (mousedDot < numDots)
     document.getElementById('vishoverinfo').innerHTML=ids[mousedDot]+extras[mousedDot];
@@ -223,8 +224,10 @@ function strokeDot(i,j,r,c) {
 }
 
 // translate color between 0 and maxObservedColor into an html color code
-function getColor(c,maxc) {
-  return colorPalette[Math.round((colorPalette.length-1)*c/maxc)];
+function getColor(normColor) {
+  if (normColor > 1)
+    normColor = 1;
+  return colorPalette[Math.round((colorPalette.length-1)*normColor)];
 }
 
 function strokeCircle(x,y,r,c) {



Mime
View raw message