dajac opened a new pull request #8977: URL: https://github.com/apache/kafka/pull/8977
This PR does two things: 1. It introduces `QuotaEnforcementType` which allows to choose when the quota enforcement is done within the `Sensor`. The default `Permissive` mode works as previously. It enforces the quota after having accounted the new value. The new `Strict` mode enforces the quota before and thus does not account the value if the quota is violated. 2. It introduces a new `SampledStat` names `TokenBucket`. Our current quota enforcement mechanism does not cope well with bursty workloads, especially when the burst is significantly larger than the quota. The reason is that a large recorded burst remains in the samples until it gets pasted the window. During this time, the computed rate remains the same until it gets dropped. The `TokenBucket` sampled stat alleviate this issue by decreasing each sample by Quota * the time between itself and the previous sample. This mimics the token bucket algorithm which gives back credits at every second. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- 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: [email protected]
