[ 
https://issues.apache.org/jira/browse/KAFKA-15534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yi Ding updated KAFKA-15534:
----------------------------
    Labels: consumer-threading-refactor kip-848 kip-848-client-support 
kip-848-e2e kip-848-preview  (was: consumer-threading-refactor)

> 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: Sub-task
>            Reporter: Philip Nee
>            Assignee: Philip Nee
>            Priority: Major
>              Labels: consumer-threading-refactor, kip-848, 
> kip-848-client-support, kip-848-e2e, kip-848-preview
>
> 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