[ https://issues.apache.org/jira/browse/HDFS-11907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16032274#comment-16032274 ]
Arpit Agarwal edited comment on HDFS-11907 at 6/1/17 12:48 AM: --------------------------------------------------------------- Thanks for updating the patch [~vagarychen]. A few minor comments: # Typo: availabeSpaceTimeStamp --> availableSpaceTimeStamp (also the getter). # Typo: DF_STALE_THREASHOLD_MS --> DF_STALE_THRESHOLD_MS # Looks like the two threshold values were swapped from v2 to v3 patch. I think the v2 values were better. # getAvailabeSpaceTimeStamp can be package private. Also the new constructor. # in the test case, can you add an assert for the {{// first call guarantees an update}} e.g. {code} // first call guarantees an update long val0 = nb.getAvailabeSpaceTimeStamp(); volume.isResourceAvailable(); long val1 = nb.getAvailabeSpaceTimeStamp(); assertEquals(val0 + 5000, val1); timer.advance(2000); {code} Looks good otherwise! was (Author: arpitagarwal): Thanks for updating the patch [~vagarychen]. A few minor comments: # Typo: availabeSpaceTimeStamp --> availableSpaceTimeStamp # Typo: DF_STALE_THREASHOLD_MS --> DF_STALE_THRESHOLD_MS # Looks like the two threshold values were swapped from v2 to v3 patch. I think the v2 values were better. # getAvailabeSpaceTimeStamp can be package private. Also the new constructor. # in the test case, can you add an assert for the {{// first call guarantees an update}} e.g. {code} // first call guarantees an update long val0 = nb.getAvailabeSpaceTimeStamp(); volume.isResourceAvailable(); long val1 = nb.getAvailabeSpaceTimeStamp(); assertEquals(val0 + 5000, val1); timer.advance(2000); {code} Looks good otherwise! > NameNodeResourceChecker should avoid calling df.getAvailable too frequently > --------------------------------------------------------------------------- > > Key: HDFS-11907 > URL: https://issues.apache.org/jira/browse/HDFS-11907 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Chen Liang > Assignee: Chen Liang > Attachments: HDFS-11907.001.patch, HDFS-11907.002.patch, > HDFS-11907.003.patch > > > Currently, {{HealthMonitor#doHealthChecks}} invokes > {{NameNode#monitorHealth}} which ends up invoking > {{NameNodeResourceChecker#isResourceAvailable}}, at the frequency of once per > second by default. And NameNodeResourceChecker#isResourceAvailable invokes > {{df.getAvailable();}} every time it is called. > Since available space information should rarely be changing dramatically at > the pace of per second. A cached value should be sufficient. i.e. only try to > get the updated value when the cached value is too old. otherwise simply > return the cached value. This way df.getAvailable() gets invoked less. > Thanks [~arpitagarwal] for the offline discussion. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org