accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ibe...@apache.org
Subject [1/3] accumulo git commit: ACCUMULO-4655 Added a Response Time column to the monitor
Date Sun, 23 Jul 2017 16:57:55 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.8 1ab2431c9 -> ef78423e2
  refs/heads/master 1910e25be -> 66d8956bf


ACCUMULO-4655 Added a Response Time column to the monitor

Added a Response Time column to the monitor which shows how long it took to get status from
that tserver.
This is useful in determining whether long Last Contact times are dues to one or more tservers
or whether
this is due to churn in the master.

Closes #271


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

Branch: refs/heads/1.8
Commit: ef78423e23a800d9b9371ba46408d95145d46bd6
Parents: 1ab2431
Author: Ivan Bella <ivan@bella.name>
Authored: Mon Jun 19 12:55:01 2017 -0400
Committer: Ivan Bella <ivan@bella.name>
Committed: Sun Jul 23 11:42:18 2017 -0400

----------------------------------------------------------------------
 .../core/master/thrift/TabletServerStatus.java  | 107 ++++++++++++++++++-
 core/src/main/thrift/master.thrift              |   1 +
 .../accumulo/server/master/LiveTServerSet.java  |   8 +-
 .../monitor/servlets/TServersServlet.java       |  15 ++-
 .../apache/accumulo/tserver/TabletServer.java   |   2 +
 5 files changed, 126 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ef78423e/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
b/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
index 07444b5..c00558c 100644
--- a/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
+++ b/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
@@ -68,6 +68,7 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
   private static final org.apache.thrift.protocol.TField FLUSHS_FIELD_DESC = new org.apache.thrift.protocol.TField("flushs",
org.apache.thrift.protocol.TType.I64, (short)15);
   private static final org.apache.thrift.protocol.TField SYNCS_FIELD_DESC = new org.apache.thrift.protocol.TField("syncs",
org.apache.thrift.protocol.TType.I64, (short)16);
   private static final org.apache.thrift.protocol.TField BULK_IMPORTS_FIELD_DESC = new org.apache.thrift.protocol.TField("bulkImports",
org.apache.thrift.protocol.TType.LIST, (short)17);
+  private static final org.apache.thrift.protocol.TField RESPONSE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("responseTime",
org.apache.thrift.protocol.TType.I64, (short)18);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -89,6 +90,7 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
   public long flushs; // required
   public long syncs; // required
   public List<BulkImportStatus> bulkImports; // required
+  public long responseTime; // required
 
   /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -105,7 +107,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     LOG_SORTS((short)14, "logSorts"),
     FLUSHS((short)15, "flushs"),
     SYNCS((short)16, "syncs"),
-    BULK_IMPORTS((short)17, "bulkImports");
+    BULK_IMPORTS((short)17, "bulkImports"),
+    RESPONSE_TIME((short)18, "responseTime");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -148,6 +151,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
           return SYNCS;
         case 17: // BULK_IMPORTS
           return BULK_IMPORTS;
+        case 18: // RESPONSE_TIME
+          return RESPONSE_TIME;
         default:
           return null;
       }
@@ -198,6 +203,7 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
   private static final int __DATACACHEREQUEST_ISSET_ID = 7;
   private static final int __FLUSHS_ISSET_ID = 8;
   private static final int __SYNCS_ISSET_ID = 9;
+  private static final int __RESPONSETIME_ISSET_ID = 10;
   private short __isset_bitfield = 0;
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
@@ -234,6 +240,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     tmpMap.put(_Fields.BULK_IMPORTS, new org.apache.thrift.meta_data.FieldMetaData("bulkImports",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,

             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
BulkImportStatus.class))));
+    tmpMap.put(_Fields.RESPONSE_TIME, new org.apache.thrift.meta_data.FieldMetaData("responseTime",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TabletServerStatus.class,
metaDataMap);
   }
@@ -255,7 +263,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     List<RecoveryStatus> logSorts,
     long flushs,
     long syncs,
-    List<BulkImportStatus> bulkImports)
+    List<BulkImportStatus> bulkImports,
+    long responseTime)
   {
     this();
     this.tableMap = tableMap;
@@ -282,6 +291,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     this.syncs = syncs;
     setSyncsIsSet(true);
     this.bulkImports = bulkImports;
+    this.responseTime = responseTime;
+    setResponseTimeIsSet(true);
   }
 
   /**
@@ -331,6 +342,7 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
       }
       this.bulkImports = __this__bulkImports;
     }
+    this.responseTime = other.responseTime;
   }
 
   public TabletServerStatus deepCopy() {
@@ -363,6 +375,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     setSyncsIsSet(false);
     this.syncs = 0;
     this.bulkImports = null;
+    setResponseTimeIsSet(false);
+    this.responseTime = 0;
   }
 
   public int getTableMapSize() {
@@ -732,6 +746,29 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     }
   }
 
+  public long getResponseTime() {
+    return this.responseTime;
+  }
+
+  public TabletServerStatus setResponseTime(long responseTime) {
+    this.responseTime = responseTime;
+    setResponseTimeIsSet(true);
+    return this;
+  }
+
+  public void unsetResponseTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RESPONSETIME_ISSET_ID);
+  }
+
+  /** Returns true if field responseTime is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetResponseTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __RESPONSETIME_ISSET_ID);
+  }
+
+  public void setResponseTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RESPONSETIME_ISSET_ID, value);
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case TABLE_MAP:
@@ -846,6 +883,14 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
       }
       break;
 
+    case RESPONSE_TIME:
+      if (value == null) {
+        unsetResponseTime();
+      } else {
+        setResponseTime((Long)value);
+      }
+      break;
+
     }
   }
 
@@ -893,6 +938,9 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     case BULK_IMPORTS:
       return getBulkImports();
 
+    case RESPONSE_TIME:
+      return getResponseTime();
+
     }
     throw new IllegalStateException();
   }
@@ -932,6 +980,8 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
       return isSetSyncs();
     case BULK_IMPORTS:
       return isSetBulkImports();
+    case RESPONSE_TIME:
+      return isSetResponseTime();
     }
     throw new IllegalStateException();
   }
@@ -1075,6 +1125,15 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
         return false;
     }
 
+    boolean this_present_responseTime = true;
+    boolean that_present_responseTime = true;
+    if (this_present_responseTime || that_present_responseTime) {
+      if (!(this_present_responseTime && that_present_responseTime))
+        return false;
+      if (this.responseTime != that.responseTime)
+        return false;
+    }
+
     return true;
   }
 
@@ -1152,6 +1211,11 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
     if (present_bulkImports)
       list.add(bulkImports);
 
+    boolean present_responseTime = true;
+    list.add(present_responseTime);
+    if (present_responseTime)
+      list.add(responseTime);
+
     return list.hashCode();
   }
 
@@ -1303,6 +1367,16 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetResponseTime()).compareTo(other.isSetResponseTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetResponseTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.responseTime, other.responseTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -1394,6 +1468,10 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
       sb.append(this.bulkImports);
     }
     first = false;
+    if (!first) sb.append(", ");
+    sb.append("responseTime:");
+    sb.append(this.responseTime);
+    first = false;
     sb.append(")");
     return sb.toString();
   }
@@ -1586,6 +1664,14 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 18: // RESPONSE_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.responseTime = iprot.readI64();
+              struct.setResponseTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -1673,6 +1759,9 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
         }
         oprot.writeFieldEnd();
       }
+      oprot.writeFieldBegin(RESPONSE_TIME_FIELD_DESC);
+      oprot.writeI64(struct.responseTime);
+      oprot.writeFieldEnd();
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -1733,7 +1822,10 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
       if (struct.isSetBulkImports()) {
         optionals.set(13);
       }
-      oprot.writeBitSet(optionals, 14);
+      if (struct.isSetResponseTime()) {
+        optionals.set(14);
+      }
+      oprot.writeBitSet(optionals, 15);
       if (struct.isSetTableMap()) {
         {
           oprot.writeI32(struct.tableMap.size());
@@ -1795,12 +1887,15 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
           }
         }
       }
+      if (struct.isSetResponseTime()) {
+        oprot.writeI64(struct.responseTime);
+      }
     }
 
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, TabletServerStatus struct)
throws org.apache.thrift.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(14);
+      BitSet incoming = iprot.readBitSet(15);
       if (incoming.get(0)) {
         {
           org.apache.thrift.protocol.TMap _map16 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING,
org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
@@ -1889,6 +1984,10 @@ public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerS
         }
         struct.setBulkImportsIsSet(true);
       }
+      if (incoming.get(14)) {
+        struct.responseTime = iprot.readI64();
+        struct.setResponseTimeIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ef78423e/core/src/main/thrift/master.thrift
----------------------------------------------------------------------
diff --git a/core/src/main/thrift/master.thrift b/core/src/main/thrift/master.thrift
index 6104fea..b959074 100644
--- a/core/src/main/thrift/master.thrift
+++ b/core/src/main/thrift/master.thrift
@@ -85,6 +85,7 @@ struct TabletServerStatus {
   15:i64 flushs
   16:i64 syncs
   17:list<BulkImportStatus> bulkImports
+  18:i64 responseTime
 }
 
 enum MasterState {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ef78423e/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index 7d1d6e1..df135d6 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -120,11 +120,17 @@ public class LiveTServerSet implements Watcher {
       if (usePooledConnection == true)
         throw new UnsupportedOperationException();
 
+      long start = System.currentTimeMillis();
+
       TTransport transport = ThriftUtil.createTransport(address, context);
 
       try {
         TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(),
transport);
-        return client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds());
+        TabletServerStatus status = client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds());
+        if (status != null) {
+          status.setResponseTime(System.currentTimeMillis() - start);
+        }
+        return status;
       } finally {
         if (transport != null)
           transport.close();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ef78423e/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
index 858192b..04a6511 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java
@@ -309,18 +309,28 @@ public class TServersServlet extends BasicServlet {
     }
   }
 
+  static final long SECOND = 1000;
+  static final long RESPONSE_TIME_MAX_ERR = 3 * SECOND;
+  static final long MINUTE = 60 * SECOND;
+  static final long LAST_CONTEXT_MAX_ERR = 3 * MINUTE;
+
   static void doTserverList(HttpServletRequest req, StringBuilder sb, List<TabletServerStatus>
tservers, String tableId, Table tServerList) {
     int guessHighLoad = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
     long now = System.currentTimeMillis();
 
     double avgLastContact = 0.;
+    double avgResponseTime = 0.;
+    int count = 0;
     for (TabletServerStatus status : tservers) {
+      count++;
       avgLastContact += (now - status.lastContact);
+      avgResponseTime += status.responseTime;
     }
-    final long MINUTES = 3 * 60 * 1000;
+    avgResponseTime /= count;
     tServerList.addSortableColumn("Server", new TServerLinkType(), null);
     tServerList.addSortableColumn("Hosted&nbsp;Tablets", new NumberType<>(0, Integer.MAX_VALUE),
null);
-    tServerList.addSortableColumn("Last&nbsp;Contact", new DurationType(0l, (long) Math.min(avgLastContact
* 4, MINUTES)), null);
+    tServerList.addSortableColumn("Last&nbsp;Contact", new DurationType(0l, (long) Math.min(avgLastContact
* 4, LAST_CONTEXT_MAX_ERR)), null);
+    tServerList.addSortableColumn("Response&nbsp;Time", new DurationType(0l, (long) Math.min(avgResponseTime
* 4, RESPONSE_TIME_MAX_ERR)), null);
     tServerList.addSortableColumn("Entries", new NumberType<Long>(), "The number of
key/value pairs.");
     tServerList.addSortableColumn("Ingest", new NumberType<Long>(), "The number of
key/value pairs inserted. (Note that deletes are also 'inserted')");
     tServerList.addSortableColumn("Query", new NumberType<Long>(), "The number of key/value
pairs returned to clients. (Not the number of scans)");
@@ -352,6 +362,7 @@ public class TServersServlet extends BasicServlet {
       row.add(status); // add for server name
       row.add(summary.tablets);
       row.add(now - status.lastContact);
+      row.add(status.responseTime);
       row.add(summary.recs);
       row.add(summary.ingestRate);
       row.add(summary.queryRate);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ef78423e/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 6ead6b8..9c2d3e3 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -2856,6 +2856,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
   }
 
   public TabletServerStatus getStats(Map<String,MapCounter<ScanRunState>> scanCounts)
{
+    long start = System.currentTimeMillis();
     TabletServerStatus result = new TabletServerStatus();
 
     Map<KeyExtent,Tablet> onlineTabletsCopy;
@@ -2943,6 +2944,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
     result.bulkImports = new ArrayList<>();
     result.bulkImports.addAll(clientHandler.getBulkLoadStatus());
     result.bulkImports.addAll(bulkImportStatus.getBulkLoadStatus());
+    result.responseTime = System.currentTimeMillis() - start;
     return result;
   }
 


Mime
View raw message