Understanding Kafka request rate quotas

Hi everyone!

I got some confused about request rate quotas and I would appreciate your help on that matter.

KIP 124 defines request rate quotas as “the percentage of time within a quota window that a client is allowed to use across all of the I/O and network threads”.

Trying to better explain this kind of quota, KIP 124 gives the following example scenario:

…with the default configuration of 1 second quota window size, if user alice has a request quota of 1%, the total time all clients of alice can spend in the request handler and network threads in any one second window is 10 milliseconds.

So, given that rate quotas are by definition “percentages” of time spend in request and I/O threads, what does it mean this another example given by KIP 124 showing how to set request rate quotas?

bin/kafka-configs  --zookeeper localhost:2181 --alter --add-config 'request_percentage=200' --entity-type users

How should I interpret the config request_percentage=200?

Following the same logic of the first-mentioned example with a request quota of 1%, I suppose the value of 200 means that the total time (i.e., the sum of all times in all threads) any user can spend in the request handler and network threads in any one second window is 2 seconds (i.e., 200% of a 1 second quota window size) before get throttled. Is that right?

Thanks!

2 Likes

Good question! I could also come up with another theory: 100% means the full usage of one thread within the configured timewindow and if you have for instance 3 threads configured you could set 200% which would allow the client to saturate 2 of the 3 threads.

Curious for the explanation!

1 Like