You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/06/07 15:52:47 UTC
[GitHub] [accumulo] alerman commented on a change in pull request #1187: Log
busy tablets by ingest and query at a configurable time duration
alerman 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_r291653204
##########
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:
doh!
----------------------------------------------------------------
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