Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Quotas are currently configured as the rate limits for producers and consumers based on their client-id. Default rate limits can be configured for clients without a config override.The same set of limits will be configurable each quota-id.

Quota configuration for a client with client-id clientX and user principal userN is determined by the following sequence (this example is for producer, similar sequence is applied to consumer):

  1. If client-id sub-quota override is defined for clientX of userN, this sub-quota is allocated for the sole use of (userN, clientX).
  2. If user quota override is defined for userN, clientX shares this quota with other clients of userN
  3. If quota.user.producer.default is not unlimited, clientX shares this default quota with other clients of userN
  4. If client-id quota override is defined for clientX, this quota is allocated for the sole use of (userN, clientX)
  5. If quota.producer.default is configured, this default quota is allocated for the sole use of (userN, clientX)
  6. Client is not throttled

Use cases:

  • Simple client-id based quotas are configured using client-id quota override and quota.producer.default : (steps 4, 5, 6)
  • Simple user-principal based quotas are configured using user quota override and quota.user.producer.default : (steps 2, 3, 6)
  • Hierarchical quotas can be set using sub-quotas and combinations of user/client-id quotas and defaults : (steps 1 - 6)

 

Code Block
languagejava
titleSample Quota configuration in JSON
// Quotas for user1 (without sub-quotas).
// Zookeeper persistence path /users/<encoded-user1>
{
    "version":1,
    "config": {
        "total" : {"producer_byte_rate":"1024","consumer_byte_rate":"2048"}
    }
}
// Quotas for user2 with sub-quotas for clients.
// Zookeeper persistence path /users/<encoded-user2>
{
    "version":1,
    "config": {
    "total" : {"producer_byte_rate":"4096","consumer_byte_rate":"8192"},
    "clients": {
       "clientA" : {"producer_byte_rate":"10","consumer_byte_rate":"20"},
       "clientB" : {"producer_byte_rate":"30","consumer_byte_rate":"40"}
    }
} 
// Quotas for client-id clientA of users without config override if default user quota is unlimited. 
// Zookeeper persistence path /clients/clientA
{
    "version":1,
    "config": {
        "producer_byte_rate":"100",
        "consumer_byte_rate":"200"
    }
}

...