accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [accumulo] keith-turner commented on a change in pull request #1187: Log busy tablets by ingest and query at a configurable time duration
Date Fri, 07 Jun 2019 15:33:36 GMT
keith-turner commented on a change in pull request #1187: Log busy tablets by ingest and query
at a configurable time duration
URL: https://github.com/apache/accumulo/pull/1187#discussion_r291642289
 
 

 ##########
 File path: server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
 ##########
 @@ -358,6 +359,60 @@ public TabletServer(ServerConfigurationFactory confFactory, VolumeManager
fs) th
     this.logSorter = new LogSorter(instance, fs, aconf);
     this.replWorker = new ReplicationWorker(this, fs);
     this.statsKeeper = new TabletStatsKeeper();
+    final int numBusyTabletsToLog = aconf.getCount(Property.TSERV_LOG_BUSY_TABLETS_COUNT);
+    final long logBusyTabletsDelay =
+        aconf.getTimeInMillis(Property.TSERV_LOG_BUSY_TABLETS_INTERVAL);
+
+    // This thread will calculate and log out the busiest tablets based on ingest count and
+    // query count every #{logBusiestTabletsDelay}
+    if (numBusyTabletsToLog > 0) {
+      SimpleTimer.getInstance(aconf).schedule(new Runnable() {
+        @Override
+        public void run() {
+          Comparator<Pair<String,Long>> busiestTabletComparator =
+              new Comparator<Pair<String,Long>>() {
+                @Override
+                public int compare(Pair<String,Long> first, Pair<String,Long>
second) {
+                  return second.getSecond().compareTo(first.getSecond());
+                }
+              };
+          PriorityQueue<Pair<String,Long>> busiestTabletsByIngestCount =
+              new PriorityQueue<>(numBusyTabletsToLog, busiestTabletComparator);
+          PriorityQueue<Pair<String,Long>> busiestTabletsByQueryCount =
+              new PriorityQueue<>(numBusyTabletsToLog, busiestTabletComparator);
+          synchronized (onlineTablets) {
+            for (Tablet tablet : onlineTablets.values()) {
+              addToBusiestTablets(tablet.totalIngest(), busiestTabletsByIngestCount,
+                  numBusyTabletsToLog);
+              addToBusiestTablets(tablet.totalQueries(), busiestTabletsByQueryCount,
+                  numBusyTabletsToLog);
+            }
+            logBusyTablets(busiestTabletsByIngestCount, "QUERY", numBusyTabletsToLog);
+            logBusyTablets(busiestTabletsByQueryCount, "INGEST", numBusyTabletsToLog);
+          }
+        }
+
+        private void addToBusiestTablets(long count,
+            PriorityQueue<Pair<String,Long>> busiestTabletsQueue, int numBusiestTabletsToLog)
{
+          if (busiestTabletsQueue.size() < numBusiestTabletsToLog
+              || busiestTabletsQueue.peek().getSecond() < count) {
 
 Review comment:
   I think this priority queue has the minimum count at the top, it that correct?
   
   When is something ever added to busiestTabletsQueue?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message