[ 
https://issues.apache.org/jira/browse/HDFS-16155?focusedWorklogId=641621&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-641621
 ]

ASF GitHub Bot logged work on HDFS-16155:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Aug/21 11:31
            Start Date: 25/Aug/21 11:31
    Worklog Time Spent: 10m 
      Work Description: bbeaudreault commented on a change in pull request 
#3271:
URL: https://github.com/apache/hadoop/pull/3271#discussion_r695662268



##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml
##########
@@ -4440,8 +4440,29 @@
   <value>3000</value>
   <description>
     Base time window in ms for DFSClient retries.  For each retry attempt,
-    this value is extended linearly (e.g. 3000 ms for first attempt and
-    first retry, 6000 ms for second retry, 9000 ms for third retry, etc.).
+    this value is extended exponentially based on 
dfs.client.retry.window.multiplier.
+  </description>
+</property>
+
+<property>
+  <name>dfs.client.retry.window.multiplier</name>
+  <value>1</value>
+  <description>
+    Multiplier for extending the retry time window.  For each retry attempt,
+    the retry time window is extended by multiplying 
dfs.client.retry.window.base
+    by this multiplier raised to the power of the current failure count. The 
default
+    value of 1 means the window will expand linearly (e.g. 3000 ms for first 
attempt
+    and first retry, 6000 ms for second retry, 9000 ms for third retry, etc.).
+  </description>
+</property>
+
+<property>
+  <name>dfs.client.retry.window.max</name>
+  <value>2147483647</value>

Review comment:
       Thanks so much for the review @Hexiaoqiao. The reason I chose this value 
was that I wanted the changes in this PR to be totally transparent to existing 
users -- so the backoff should work exactly as it does today for anyone who 
upgrades. I don't know how people have tuned their backoffs today, so adding a 
lower max might affect their configured backoffs. The default case will be 
well-bounded by the default retries of 3. That said, I agree that there's very 
little utility in waiting many minutes on a backoff. What if I put this to 30s?
   
   Was this the only concern in terms of the default action? My test case 
[testDefaultRetryPolicy](https://github.com/apache/hadoop/pull/3271/files#diff-ce7234e2a352097945c5348774888466b48f9574d4764d9415559d975d380884R47)
 proves that the default case remains unchanged from trunk. The default case 
was determined based on the [comment in 
DFSInputStream](https://github.com/apache/hadoop/pull/3271/files#diff-f6cd7fbb9a909e1679c2d77df54b0b2fe661a66c8c89fb455fde313966d51a61L1018-L1026),
 the old implementation details, and my own testing of the backoff policy prior 
to this change.
   
   I also created this spreadsheet that helped me to determine how different 
multiplier values might affect the backoff: 
https://docs.google.com/spreadsheets/d/1I9ejqDtJ6-krSh-YBt0qHTf3JwZu5zRlrOhbzY0kJAg/edit?usp=sharing




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 641621)
    Time Spent: 1h 40m  (was: 1.5h)

> Allow configurable exponential backoff in DFSInputStream refetchLocations
> -------------------------------------------------------------------------
>
>                 Key: HDFS-16155
>                 URL: https://issues.apache.org/jira/browse/HDFS-16155
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: dfsclient
>            Reporter: Bryan Beaudreault
>            Assignee: Bryan Beaudreault
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> The retry policy in 
> [DFSInputStream#refetchLocations|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java#L1018-L1040]
>  was first written many years ago. It allows configuration of the base time 
> window, but subsequent retries double in an un-configurable way. This retry 
> strategy makes sense in some clusters as it's very conservative and will 
> avoid DDOSing the namenode in certain systemic failure modes – for example, 
> if a  file is being read by a large hadoop job and the underlying blocks are 
> moved by the balancer. In this case, enough datanodes would be added to the 
> deadNodes list and all hadoop tasks would simultaneously try to refetch the 
> blocks. The 3s doubling with random factor helps break up that stampeding 
> herd.
> However, not all cluster use-cases are created equal, so there are other 
> cases where a more aggressive initial backoff is preferred. For example in a 
> low-latency single reader scenario. In this case, if the balancer moves 
> enough blocks, the reader hits this 3s backoff which is way too long for a 
> low latency use-case.
> One could configure the the window very low (10ms), but then you can hit 
> other systemic failure modes which would result in readers DDOSing the 
> namenode again. For example, if blocks went missing due to truly dead 
> datanodes. In this case, many readers might be refetching locations for 
> different files with retry backoffs like 10ms, 20ms, 40ms, etc. It takes a 
> while to backoff enough to avoid impacting the namenode with that strategy.
> I suggest adding a configurable multiplier to the backoff strategy so that 
> operators can tune this as they see fit for their use-case. In the above low 
> latency case, one could set the base very low (say 2ms) and the multiplier 
> very high (say 50). This gives an aggressive first retry that very quickly 
> backs off.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to