HADOOP-16700. Track response time separately in Server.Call to avoid negative RpcQueueTime values. Contributed by xuzq.
This commit is contained in:
parent
1415ad3800
commit
be77231452
@ -751,8 +751,8 @@ public static class Call implements Schedulable,
|
|||||||
private volatile String detailedMetricsName = "";
|
private volatile String detailedMetricsName = "";
|
||||||
final int callId; // the client's call id
|
final int callId; // the client's call id
|
||||||
final int retryCount; // the retry count of the call
|
final int retryCount; // the retry count of the call
|
||||||
long timestampNanos; // time received when response is null
|
long timestampNanos; // time the call was received
|
||||||
// time served when response is not null
|
long responseTimestampNanos; // time the call was served
|
||||||
private AtomicInteger responseWaitCount = new AtomicInteger(1);
|
private AtomicInteger responseWaitCount = new AtomicInteger(1);
|
||||||
final RPC.RpcKind rpcKind;
|
final RPC.RpcKind rpcKind;
|
||||||
final byte[] clientId;
|
final byte[] clientId;
|
||||||
@ -789,6 +789,7 @@ public Call(int id, int retryCount, Void ignore1, Void ignore2,
|
|||||||
this.callId = id;
|
this.callId = id;
|
||||||
this.retryCount = retryCount;
|
this.retryCount = retryCount;
|
||||||
this.timestampNanos = Time.monotonicNowNanos();
|
this.timestampNanos = Time.monotonicNowNanos();
|
||||||
|
this.responseTimestampNanos = timestampNanos;
|
||||||
this.rpcKind = kind;
|
this.rpcKind = kind;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
this.traceScope = traceScope;
|
this.traceScope = traceScope;
|
||||||
@ -1591,7 +1592,7 @@ private void doPurge(RpcCall call, long now) {
|
|||||||
Iterator<RpcCall> iter = responseQueue.listIterator(0);
|
Iterator<RpcCall> iter = responseQueue.listIterator(0);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
call = iter.next();
|
call = iter.next();
|
||||||
if (now > call.timestampNanos + PURGE_INTERVAL_NANOS) {
|
if (now > call.responseTimestampNanos + PURGE_INTERVAL_NANOS) {
|
||||||
closeConnection(call.connection);
|
closeConnection(call.connection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1655,7 +1656,7 @@ private boolean processResponse(LinkedList<RpcCall> responseQueue,
|
|||||||
|
|
||||||
if (inHandler) {
|
if (inHandler) {
|
||||||
// set the serve time when the response has to be sent later
|
// set the serve time when the response has to be sent later
|
||||||
call.timestampNanos = Time.monotonicNowNanos();
|
call.responseTimestampNanos = Time.monotonicNowNanos();
|
||||||
|
|
||||||
incPending();
|
incPending();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user