[ 
https://issues.apache.org/jira/browse/HBASE-11516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14073614#comment-14073614
 ] 

Andrew Purtell commented on HBASE-11516:
----------------------------------------

v3 patch looks pretty good. UI updates look great. 

{code}
@@ -2357,4 +2523,19 @@ public class RegionCoprocessorHost
     }
     return tracker;
   }
+
+  public Map<String, Long> getCoprocessorExecutionTimes() {
+    Map<String, Long> results = new HashMap<String, Long>();
+    for (RegionEnvironment env : coprocessors) {
+      if (env.getInstance() instanceof RegionObserver) {
+        long total = 0;
+        for (Long time : env.getExecutionLatenciesNanos()) {
+          total += time;
+        }
+        total /= 1000;
+        results.put(env.getInstance().getClass().getSimpleName(), total);
+      }
+    }
+    return results;
+  }
{code}

This only sums the sampled execution times. I think this will be misleading 
because the measure won't be the real total time executing in the coprocessor 
over the reporting period if we ran out of space in the sample queue. We can 
report useful statistics using the samples though. Consider 
DescriptiveStatistics from commons-math, we are using it elsewhere. It's not 
threadsafe so shouldn't be used in place of the sample buffer, but can be used 
in getCoprocessorExecutionTimes when iterating through the samples. With 
DescriptiveStatistics we can get min, max, avg, various percentiles, e.g. 95th, 
99th.

It might make more sense to rename getCoprocessorExecutionTimes to 
getCoprocessorExecutionStatistics or similar. 


> Track time spent in executing coprocessors in each region.
> ----------------------------------------------------------
>
>                 Key: HBASE-11516
>                 URL: https://issues.apache.org/jira/browse/HBASE-11516
>             Project: HBase
>          Issue Type: Improvement
>          Components: Coprocessors
>    Affects Versions: 0.98.4
>            Reporter: Srikanth Srungarapu
>            Assignee: Srikanth Srungarapu
>            Priority: Minor
>             Fix For: 0.98.5
>
>         Attachments: HBASE-11516.patch, HBASE-11516_v2.patch, 
> HBASE-11516_v3.patch, region_server_webui.png
>
>
> Currently, the time spent in executing coprocessors is not yet being tracked. 
> This feature can be handy for debugging coprocessors in case of any trouble.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to