b-goyal commented on PR #213:
URL: https://github.com/apache/kafka/pull/213#issuecomment-1997289295

   This is a followup ticket from KAFKA-2084 to improve the windowSize 
calculation in Quotas. I've made the following changes:
   1. Added a windowSize function on Rate
   2. Calling Rate.windowSize in ClientQuotaManager to return the exact window 
size to use when computing the delay time.
   3. Changed the window size calculation subtly. The current calculation had a 
bug wherein, it used the number of elapsed seconds from the "lastWindowSeconds" 
of the most recent Sample object. However, the lastWindowSeconds is the time 
when the sample is created.. this causes an issue because it implies that the 
current window elapsed time is always "0" when the sample is created. This is 
incorrect as demonstrated in a testcase I added in MetricsTest. I've fixed the 
calculation to count the elapsed time from the "oldest" sample in the set since 
that gives us an accurate value of the exact amount of time elapsed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to