How to apply back pressure to kafka producer?

1k views Asked by At

Back pressure can help by limiting the queue size, thereby maintaining a high throughput rate and good response times for jobs already in the queue.

In RabbitMQ it can be applied setting Queue length limit.

How can it be done with Kafka ?

Can this be done by keeping Rate Limiter(TokenBucket) between kafka producer and broker, where the current bucket size and refill rate be set dynamically with values of rate of consumption ? Like a rest api in producer receiving from consumer the rate at which consumer is processing messages.

1

There are 1 answers

0
OneCricketeer On

Load is typically distributed amongst brokers, so back-pressure from the producer client-side may not be necessary.

But you can add quotas per client to throttle their requests.