[ 
https://issues.apache.org/jira/browse/HADOOP-16700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16971989#comment-16971989
 ] 

xuzq edited comment on HADOOP-16700 at 11/12/19 2:15 AM:
---------------------------------------------------------

Thanks [~xkrogen].
 
newCall(_timestamp1_)  ->   enQueue ->    inQueue  ->(_timestamp2_)  handle -> 
process -> response(_timestamp3_) -> updateMetric.

Like above, QueueTime is computed in _updateMetric_, and QueueTime = 
_timestamp2 - call.timestamp(timestamp1) - enQueueTime._  

But *_call.timestamp_ maybe changed in _sendResponse_*, so QueueTime = 
timestamp2 - call.timestamp(timestamp3) - enQueueTime, it will be negative.
{code:java}
// processResponse
//
// If we were unable to write the entire response out, then 
// insert in Selector queue. 
//
call.connection.responseQueue.addFirst(call);

if (inHandler) {
  // set the serve time when the response has to be sent later
  call.timestampNanos = Time.monotonicNowNanos();
  
  incPending();
  try {
    // Wakeup the thread blocked on select, only then can the call 
    // to channel.register() complete.
    writeSelector.wakeup();
    channel.register(writeSelector, SelectionKey.OP_WRITE, call);
  } catch (ClosedChannelException e) {
    //Its ok. channel might be closed else where.
    done = true;
  } finally {
    decPending();
  }
}
{code}
 

 


was (Author: xuzq_zander):
Thanks [~xkrogen].
 
newCall(_timestamp1_)  ->   enQueue ->    inQueue  ->(_timestamp2_)  handle -> 
process -> response(_timestamp3_) -> updateMetric.

Like above, QueueTime is computed in _updateMetric_, and QueueTime = 
_timestamp2 - call.timestamp(timestamp1) - enQueueTime._  

But *_call.timestamp_ maybe changed in _sendResponse_*, so QueueTime = 
timestamp2 - call.timestamp(timestamp3) - enQueueTime, it will be negative.
{code:java}
// processResponse
//
// If we were unable to write the entire response out, then 
// insert in Selector queue. 
//
call.connection.responseQueue.addFirst(call);

if (inHandler) {
  // set the serve time when the response has to be sent later
  call.timestampNanos = Time.monotonicNowNanos();
  
  incPending();
  try {
    // Wakeup the thread blocked on select, only then can the call 
    // to channel.register() complete.
    writeSelector.wakeup();
    channel.register(writeSelector, SelectionKey.OP_WRITE, call);
  } catch (ClosedChannelException e) {
    //Its ok. channel might be closed else where.
    done = true;
  } finally {
    decPending();
  }
}
{code}
 

 

> RpcQueueTime may be negative when the response has to be sent later
> -------------------------------------------------------------------
>
>                 Key: HADOOP-16700
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16700
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: xuzq
>            Priority: Minor
>         Attachments: HADOOP-16700-trunk-001.patch
>
>
> RpcQueueTime may be negative when the response has to be sent later.



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