[
https://issues.apache.org/jira/browse/HDDS-17329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154765#comment-18154765
]
Stephen O'Donnell commented on HDDS-17329:
------------------------------------------
I uploaded Claude's suggested patch, but I'm really up to speed on this area to
evaluate if its a good fix or not:
The fix (XceiverClientRatis, +44/−1)
- Write requests now go through withTimeout(getClient().async().send(message),
writeRequestTimeout), using the existing
hdds.ratis.client.request.write.timeout (70s by default).
- withTimeout is a Java 8 version of orTimeout that works on a new future:
- If the write hasn't finished by the deadline, the new future fails with
java.util.concurrent.TimeoutException.
- Ratis's own future is left alone, so its ordered request window keeps
working as before.
- It uses one shared daemon timer thread for the whole client process, created
on first use. When a write finishes in time, its timer task is cancelled and
removed. Without that, at high write rates up to 70 seconds' worth of tasks,
each holding its reply, would stay queued.
- KeyOutputStream already handles TimeoutException the same way as Ratis's own
give-up: it excludes the pipeline, allocates a new block and retries straight
away. The only difference is that the cached client for the excluded pipeline
isn't invalidated, so it stays until it's evicted.
- Reads and watches are unchanged.
Tests (TestXceiverClientRatis, +53)
- writeFailsAfterWriteTimeout: with write.timeout=1s, a write whose Ratis
future never completes fails with TimeoutException, and the Ratis future is
left untouched. Without the fix, the write is still waiting when the test's 10s
limit ends.
- withTimeoutPassesCompletionThrough: a result or error that arrives before the
deadline is passed through unchanged.
> Ratis client write can take about 2 minutes although
> hdds.ratis.client.request.write.timeout is 70s
> ---------------------------------------------------------------------------------------------------
>
> Key: HDDS-17329
> URL: https://issues.apache.org/jira/browse/HDDS-17329
> Project: Apache Ozone
> Issue Type: Bug
> Components: Ozone Client
> Reporter: Siyao Meng
> Priority: Major
> Attachments: HDDS-17329.patch
>
>
> The Ratis client retry policy ({{RequestTypeDependentRetryPolicyCreator}})
> checks {{hdds.ratis.client.request.write.timeout}} (70s) only when an attempt
> fails, and each attempt is bounded by
> {{hdds.ratis.raft.client.rpc.request.timeout}} (60s). On a timeout it retries
> with exponential backoff (base 1s, max 5s). So if the leader does not answer,
> the first attempt fails at 60s, which is within 70s; the client sleeps 1 to
> 3s and tries again, and the second attempt fails at about 121 to 123s (by
> calculation). In general a write can take up to about the write timeout plus
> the request timeout.
> Proposed fix: bound each request by the remaining write timeout in
> {{XceiverClientRatis.sendRequestAsync}}, or keep the default RPC request
> timeout at most half of the write timeout.
> Related: HDDS-15444
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]