RATIS-2176. Update doc for raft.server.log.appender.wait-time.min. by jojochuang · Pull Request #1181 · apache/ratis
What changes were proposed in this pull request?
RATIS-1886 updated the default value of raft.server.log.appender.wait-time.min but didn't update the doc.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2176
How was this patch tested?
User doc change. No production code change.
| | **Default** | 10ms | | ||
| | **Property** | `raft.server.log.appender.wait-time.min` | | ||
| |:----------------|:---------------------------------------------------------------------------| | ||
| | **Description** | wait time between two subsequent AppendEntries. Must be a positive number. | |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojochuang , thanks a lot for working on this!
This conf has two purposes:
- wait time between two subsequent AppendEntries, and
- set to waitForReady in
GrpcLogAppender(for the sleep waiting a gRPC stream to ready).
For (1), zero is allowed. For (2), zero becomes 1ms.
Do you think that the usage in (2) is problematic? If yes, we may use a different conf.
Actually, just updating the doc is not sufficient.
GrpcLogAppender.StreamObservers.onNext() calls sleep for waitForReady, but internally it uses Thread.sleep() so it is never going to be less than one millisecond.
I'm looking at an Ozone cluster where follower DataNode completes the append follower_append_entry_latency just 0.66ms, but the leader's log_appender_latency is 1.36ms. Clearly, the one millisecond sleep granulaity is the problem for the append latency.
Comment on lines -356 to +358
| sleep(waitForReady, isHeartBeat); | ||
| //sleep(waitForReady, isHeartBeat); | ||
| LockSupport.parkNanos(waitForReady.toLong(TimeUnit.NANOSECONDS)); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojochuang , thanks for the update! Sorry that I missed the new change earlier.
How about changing it in the sleep(..) method?
@@ -408,12 +409,9 @@ public class GrpcLogAppender extends LogAppenderBase { private static void sleep(TimeDuration waitTime, boolean heartbeat) throws InterruptedIOException { - try { - waitTime.sleep(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw IOUtils.toInterruptedIOException( - "Interrupted appendLog, heartbeat? " + heartbeat, e); + LockSupport.parkNanos(waitTime.toLong(TimeUnit.NANOSECONDS)); + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedIOException("Interrupted appendLog, heartbeat? " + heartbeat); } }
This PR has been marked as stale due to 60 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in ~30 days.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters