[
https://issues.apache.org/jira/browse/KAFKA-15534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777966#comment-17777966
]
Philip Nee commented on KAFKA-15534:
------------------------------------
Hi - one more follow up: https://github.com/apache/kafka/pull/14598
> 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
> Components: clients, consumer
> Reporter: Philip Nee
> Assignee: Philip Nee
> Priority: Minor
> Labels: consumer-threading-refactor, kip-848, 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)