Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-14246 Update threading model for Consumer
  3. KAFKA-15534

Propagate client response time when timeout to the request handler

    XMLWordPrintableJSON

Details

    Description

      Currently, we don't have a good way to propagate the response time to the handler when timeout is thrown.

      unsent.handler.onFailure(new TimeoutException(
          "Failed to send request after " + unsent.timer.timeoutMs() + " ms.")); 

      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:

      unsentRequest.future().whenComplete((clientResponse, throwable) -> {
          long responseTimeMs = time.milliseconds();
          if (clientResponse != null) {
              FindCoordinatorResponse response = (FindCoordinatorResponse) clientResponse.responseBody();
              onResponse(responseTimeMs, response);
          } else {
              onFailedResponse(responseTimeMs, throwable);
          }
      }); 

      But in the networkClientDelegate, we should utilize the currentTimeMs in the trySend to avoid calling time.milliseconds():

      private void trySend(final long currentTimeMs) {
      ...
      unsent.handler.onFailure(new TimeoutException(
              "Failed to send request after " + unsent.timer.timeoutMs() + " ms."));
          continue;
      }
      } 

      Attachments

        Issue Links

          Activity

            People

              pnee Philip Nee
              pnee Philip Nee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: