Quick revision
The short answer
Kafka offers byte-rate quotas (producer_byte_rate and consumer_byte_rate), a request_percentage quota on broker thread time, and controller_mutation_rate for topic and partition creations and deletions, set for users, client ids or both, with defaults. We limit report-loader with kafka-configs.sh --alter --add-config 'producer_byte_rate=52428800' --entity-type users --entity-name report-loader, and set a default for everyone else with --entity-default. Each broker enforces the quota on its own, and a throttled client is not rejected: the broker returns a throttle_time_ms delay and mutes the connection, so the client simply slows down and sees higher latency.
What to remember
In this answer, we saw that Kafka has byte-rate quotas for producing and consuming, a request_percentage quota for thread time and controller_mutation_rate for topic changes, set on users, client ids or both, with defaults. We limited report-loader to 52,428,800 bytes per second with a user quota and set a user default for everyone else. Quotas are enforced per broker, a throttled client is delayed and muted rather than rejected, and the most specific matching entry wins.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Kafka offers byte-rate quotas (producer_byte_rate and consumer_byte_rate), a request_percentage quota on broker thread time, and controller_mutation_rate for topic and partition creations and deletions, set for users, client ids or both, with defaults. We limit report-loader with kafka-configs.sh --alter --add-config 'producer_byte_rate=52428800' --entity-type users --entity-name report-loader, and set a default for everyone else with --entity-default. Each broker enforces the quota on its own, and a throttled client is not rejected: the broker returns a throttle_time_ms delay and mutes the connection, so the client simply slows down and sees higher latency.
Why this question is asked
On a shared cluster, one client's burst becomes everyone's latency. A batch job that writes 400 MB/s fills the network, request threads and page cache that other services need, and nothing in Kafka stops it unless we set quotas. Quotas are simple to configure but easy to misunderstand, especially the per-broker scope and what the client experiences. Interviewers ask this to see whether we can apply them correctly and predict their effect. In this answer, we will recap the quota types and entities, write the commands for report-loader and the default, see why the limit is per broker, follow what a throttled client experiences, and work out which quota applies when several match.
1A Quick Recap: Quota Types and Entities
A quota is a limit the broker enforces on a client. Kafka has four kinds. producer_byte_rate and consumer_byte_rate limit bytes per second produced and fetched. request_percentage limits the share of broker request handler and network thread time a client may use, which protects against clients that send many small or expensive requests rather than many bytes. controller_mutation_rate limits how fast a client may create or delete topics and partitions, which protects the controllers.
Quotas attach to entities: a user, the authenticated principal; a client id, the client.id string the client sends; or a combination of both. Each can also have a default that applies to every user or client without its own setting. Because the user comes from authentication and the client id is just a string any client can set, user quotas are the ones we can rely on in a secure cluster.
| Quota | Unit | Protects |
|---|---|---|
| producer_byte_rate | bytes per second | Network, disk, replication |
| consumer_byte_rate | bytes per second | Network, page cache |
| request_percentage | percent of thread time | Request and network threads |
| controller_mutation_rate | partitions created or deleted per second | Controllers |
2Limiting report-loader and Setting a Default
report-loader authenticates with SASL as user report-loader, so we set a user quota. 50 MB/s is 50 x 1024 x 1024 = 52,428,800 bytes per second. Then we set a default for every other user, so any new service is limited until someone gives it a larger quota.
The change applies within seconds on every broker; no restart is needed, because quotas are stored in the cluster metadata and pushed to brokers. Notice that report-loader's own setting does not include consumer_byte_rate, so for consuming it falls back to the default user quota. Quotas are looked up per type, which we come back to below.
3Why 50 MB/s Is per Broker
Each broker measures and enforces quotas on its own, for the traffic it receives. There is no cluster-wide counter. So a producer_byte_rate of 50 MB/s means report-loader may send up to 50 MB/s to each broker. If its topic has partitions led by all 9 brokers, it can still send up to 9 x 50 = 450 MB/s in total.
That is usually what we want, since the problem was the load on each broker. If we really need a cluster-wide cap of 50 MB/s, we divide by the number of brokers the client writes to, about 5.5 MB/s each here, accepting that an uneven spread of partitions makes it slightly stricter than intended. The trap is to assume the number is cluster-wide and be surprised that the job still sends 450 MB/s.
4What a Throttled Client Experiences
A throttled client is not rejected and gets no error. When a produce request pushes report-loader over its rate, the broker still processes it, then computes how long the client must wait to come back under the quota. It returns that delay as throttle_time_ms in the response and mutes the connection for that time, so no further requests from that client are read. Modern clients also respect throttle_time_ms themselves and hold back their next request.
6 messages in order. Play them, or step through them one at a time.
The client slows down; it is never refused for exceeding a quota.
From the client's side, sends take longer. The producer's metrics show it: produce-throttle-time-avg and produce-throttle-time-max rise, and so does request latency. Records pile up in the producer's buffer; if the buffer fills, send() blocks for up to max.block.ms, and records that cannot be delivered within delivery.timeout.ms fail with a timeout. So errors appear only when the client's own timeouts are exceeded, which for a batch job usually means it simply runs longer.
5Which Quota Wins When Several Match
Several quota configs can match one connection: one for the user, one for the user and client id, defaults for each. Kafka picks the most specific match, in a fixed order. A config for this user and this client id wins over one for this user alone, a specific user wins over the default user, and user-based entries come before client-id-only entries.
| Order | Entity matched | Example |
|---|---|---|
| 1 | This user and this client id | users report-loader, clients batch-1 |
| 2 | This user, default client id | users report-loader, clients default |
| 3 | This user | users report-loader |
| 4 | Default user, this client id | users default, clients batch-1 |
| 5 | Default user, default client id | users default, clients default |
| 6 | Default user | users default |
| 7 | This client id only | clients batch-1 |
| 8 | Default client id | clients default |
For report-loader, the most specific producer entry is its own user quota, 50 MB/s, so it overrides the default user quota of 20 MB/s. For every other user without its own entry, the default user quota applies. Each quota type is resolved this way, which is why report-loader still gets the default consumer_byte_rate.
6Follow-up questions
Should we use client-id quotas instead of user quotas?
Only together with users. A client id is a string the client chooses, so in a secure cluster anyone could pick another service's client id and use its budget. User quotas are tied to authentication, and user plus client-id quotas let us split one user's budget between its clients.
What does request_percentage add over byte rates?
It caps CPU-like work. A client sending thousands of tiny requests, or expensive ones, can exhaust request threads while moving few bytes. request_percentage limits the share of thread time the client uses on each broker, expressed as a percentage of one thread, so 200 means two threads' worth.
Does throttling ever lose data?
Not by itself. The broker processes the request and only delays the client. Data is lost only if the producer gives up, when delivery.timeout.ms expires, and the application does not retry.
7Conclusion
In this answer, we saw that Kafka has byte-rate quotas for producing and consuming, a request_percentage quota for thread time and controller_mutation_rate for topic changes, set on users, client ids or both, with defaults. We limited report-loader to 52,428,800 bytes per second with a user quota and set a user default for everyone else. Quotas are enforced per broker, a throttled client is delayed and muted rather than rejected, and the most specific matching entry wins.
Open with
Kafka has four quota types. producer_byte_rate and consumer_byte_rate limit bytes per second, request_percentage limits the share of request and network thread time, and controller_mutation_rate limits how fast topics and partitions are created or deleted.
Then, if they want more
They attach to users, client ids or both, and each can have a default. For report-loader I would set a user quota, since the user comes from SASL and cannot be faked: kafka-configs.sh alter, add-config producer_byte_rate=52428800, entity-type users, entity-name report-loader. For everyone else the same command with entity-default sets a default, for example 20 MB/s. Two things to explain.
First, each broker enforces the quota on its own, so 50 MB/s is per broker; if report-loader writes to nine brokers it can still send up to 450 MB/s in total. Second, throttling does not reject anything.
The broker processes the request, computes a delay, returns it as throttle_time_ms and mutes the connection for that long, so the client just slows down. It sees higher latency and rising produce-throttle-time-avg, and only gets errors if its own timeouts like delivery.timeout.ms run out.
Finally, the most specific entry wins: user plus client id, then user, then the defaults, so report-loader's own quota overrides the user default.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain the quota types Kafka offers and how a throttled client behaves, and write the...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/b940e0fe62/