RATIS-2176. Update doc for raft.server.log.appender.wait-time.min.#1181
RATIS-2176. Update doc for raft.server.log.appender.wait-time.min.#1181jojochuang wants to merge 164 commits intoapache:masterfrom
Conversation
…pcClientProtocolService. (apache#1026)
…he same peer as the current valid leader (apache#1024)
… released properly (apache#1023)
|
The failed test is unrelated. |
| | **Default** | 10ms | | ||
| | **Property** | `raft.server.log.appender.wait-time.min` | | ||
| |:----------------|:---------------------------------------------------------------------------| | ||
| | **Description** | wait time between two subsequent AppendEntries. Must be a positive number. | |
There was a problem hiding this comment.
@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. |
| sleep(waitForReady, isHeartBeat); | ||
| //sleep(waitForReady, isHeartBeat); | ||
| LockSupport.parkNanos(waitForReady.toLong(TimeUnit.NANOSECONDS)); |
There was a problem hiding this comment.
@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);
}
}
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.