So request-latency-avg is the time after drain? Can you try to share a elaborated explanation of this metric calculation that is being done.
On Tue, 8 Nov 2022 at 1:30 AM, Philip Nee <philip...@gmail.com> wrote: > Hey Amrit, > > Actually, I think the confluent guide is correct because it seems like the > request is created here > <https://github.com/apache/kafka/blob/f7db6031b84a136ad0e257df722b20faa7c37b8a/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java#L847> > . > and the queue time > <https://github.com/apache/kafka/blob/89933f21f204abf75336464d3ac24a4fdd254628/clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java#L394> > is actually the time difference between the batch creation and drain - each > runOnce() in the sender loop first drains, then invoke sendProduceRequest. > Sorry about the previous misleading reply. > > P > > On Mon, Nov 7, 2022 at 11:39 AM Amrit Gupta <guptamrit...@gmail.com> > wrote: > >> Bumping >> >> On Mon, 7 Nov 2022 at 12:45 PM, Amrit Gupta <guptamrit...@gmail.com> >> wrote: >> >>> Hi Philip, >>> >>> >> the latency measures the time difference between the *time the >>> request was created* and the response received >>> >> I believe it is *between the time send() was called*, and the time >>> the producer receives the response from the broker. >>> >>> I believe this is not right as if we see >>> <https://developer.confluent.io/learn-kafka/architecture/producer-hands-on/?_ga=2.143024061.907256740.1667543050-19124442.1666163656&_gac=1.54193882.1667550950.CjwKCAjw8JKbBhBYEiwAs3sxN21FphL9sHjqJWmlOYnVw9d474r-z9r8Hs1b3B5YbyYdxBOgrBxIORoCY-AQAvD_BwE#:~:text=1406.273-,request%2Dlatency%2Davg,-43.292> >>> : >>> [image: image.png] >>> >>> >> the producer doesn't immediately transmit the sends when send() is >>> called, the requests can be batched depending on your configuration. >>> >>> if it was like the way you mentioned, then it implies it includes the >>> producer buffer time also as you mentioned then *request-latency-avg* >>> should be *always greater* than *request-queue-time-avg. *But as per >>> the results above we can see in multiple cases, it is actually vice-versa. >>> >>> >>> Please add more thoughts to this and let me know what you think. >>> >>> Thanks, >>> T >>> >>