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

Bryan Beaudreault commented on HBASE-27617:
-------------------------------------------

Currently Table metrics use a HashMap lookup when updating each histogram. I've 
been wanting to improve this, because sometimes we see these hash lookups in 
profiling. All of the data in these metrics come from requests against regions 
of the table. It seems like we could do the HashMap lookup once when region 
opens, and stash the metrics object onto the HRegion. This would remove a hash 
lookup from the hot request path.

If we made that change, we could do RefCnt tracking like we do for other 
objects. When a region opens, the RefCnt for the TableLatencies increments. 
When region closes, it decrements. When RefCnt for a TableLatencies object 
reaches 0, it gets removed.

This would solve your problem and my problem. It's probably more complicated 
than what you have here, but has multiple benefits as well.

> Make metrics from MetricsTableLatenciesImpl removable
> -----------------------------------------------------
>
>                 Key: HBASE-27617
>                 URL: https://issues.apache.org/jira/browse/HBASE-27617
>             Project: HBase
>          Issue Type: Bug
>            Reporter: tianhang tang
>            Assignee: tianhang tang
>            Priority: Major
>
> Now the table latency metrics will last forever on a RS.
> Could reproduce this issue easily:
> 1. Create a test table and the region opened on RS_A;
> 2. Do a query;
> 3. Move the table to another group;
> 4. See JMX on RS_A, table latency metrics still exists and will not deleted.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to