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

ASF GitHub Bot commented on HDFS-16882:
---------------------------------------

hfutatzhanghb commented on code in PR #5276:
URL: https://github.com/apache/hadoop/pull/5276#discussion_r1093968053


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MountTableResolver.java:
##########
@@ -441,9 +448,12 @@ public PathLocation getDestinationForPath(final String 
path)
       if (this.locationCache == null) {
         res = lookupLocation(processTrashPath(path));
       } else {
-        Callable<? extends PathLocation> meh = (Callable<PathLocation>) () ->
-            lookupLocation(processTrashPath(path));
+        Callable<? extends PathLocation> meh = (Callable<PathLocation>) () -> {
+          LOC_CACHE_MISS.increment();
+          return lookupLocation(processTrashPath(path));
+        };
         res = this.locationCache.get(processTrashPath(path), meh);
+        LOC_CACHE_ACCESS.increment();

Review Comment:
   hi, @goiri @tomscut , sorry for responding so late.  i have add an unit test 
to test the cache access. could you please help me to review the code? thanks.





> RBF: Add cache hit rate metric in MountTableResolver#getDestinationForPath
> --------------------------------------------------------------------------
>
>                 Key: HDFS-16882
>                 URL: https://issues.apache.org/jira/browse/HDFS-16882
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: rbf
>    Affects Versions: 3.3.4
>            Reporter: ZhangHB
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: locationCache.png
>
>
> Currently, the default value of 
> "dfs.federation.router.mount-table.cache.enable" is true and the default 
> value of "dfs.federation.router.mount-table.max-cache-size" is 10000.
> But there is no metric that display cache hit rate, I think we can add a hit 
> rate metric to watch the Cache performance and better tuning the parameters.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to