Philip Nee created KAFKA-15534:
----------------------------------

             Summary: Propagate client response time when timeout to the 
request handler
                 Key: KAFKA-15534
                 URL: https://issues.apache.org/jira/browse/KAFKA-15534
             Project: Kafka
          Issue Type: Bug
            Reporter: Philip Nee
            Assignee: Philip Nee


Currently, we don't have a good way to propagate the response time to the 
handler when timeout is thrown.
{code:java}
unsent.handler.onFailure(new TimeoutException(
    "Failed to send request after " + unsent.timer.timeoutMs() + " ms.")); 
{code}
The current request manager invoke a system call to retrieve the response time, 
which is not idea because it is already available at network client

This is an example of the coordinator request manager:
{code:java}
unsentRequest.future().whenComplete((clientResponse, throwable) -> {
    long responseTimeMs = time.milliseconds();
    if (clientResponse != null) {
        FindCoordinatorResponse response = (FindCoordinatorResponse) 
clientResponse.responseBody();
        onResponse(responseTimeMs, response);
    } else {
        onFailedResponse(responseTimeMs, throwable);
    }
}); {code}
But in the networkClientDelegate, we should utilize the currentTimeMs in the 
trySend to avoid calling time.milliseconds():
{code:java}
private void trySend(final long currentTimeMs) {
...
unsent.handler.onFailure(new TimeoutException(
        "Failed to send request after " + unsent.timer.timeoutMs() + " ms."));
    continue;
}
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to