mcvsubbu commented on a change in pull request #4472: Use hit counter to track 
max QPS per minute for broker
URL: https://github.com/apache/incubator-pinot/pull/4472#discussion_r307974522
 
 

 ##########
 File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HitCounter.java
 ##########
 @@ -77,11 +90,154 @@ public int getHitCount() {
   int getHitCount(long timestamp) {
     long numTimeUnits = timestamp / _timeBucketWidthMs;
     int count = 0;
-    for (int i = 0; i < BUCKET_COUNT; i++) {
-      if (numTimeUnits - _bucketStartTime.get(i) < BUCKET_COUNT) {
+    for (int i = 0; i < _bucketCount; i++) {
+      if (numTimeUnits - _bucketStartTime.get(i) < _bucketCount) {
         count += _bucketHitCount.get(i);
       }
     }
     return count;
   }
+
+  /*
+   * Explanation of algorithm to keep track of
+   * max QPS per minute:
+   *
+   * Hit counter is configured with fixed number buckets
+   * and each bucket covers a fixed time window to
+   * cover an overall range of 60secs.
+   *
+   * Each bucket stores two values -- start time
 
 Review comment:
   it seems that we only need to store the start time for the first bucket, 
right? the others can be derived. Not sure if we implement it that way, just 
making a note here.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to