Back pressure in Kafka

sirigiri sai kumar picture sirigiri sai kumar · Apr 5, 2018 · Viewed 11.3k times · Source

I have a situation in Kafka where the producer publishes the messages at a very higher rate than the consumer consumption rate. I have to implement the back pressure implementation in kafka for further consumption and processing.

Please let me know how can I implement in spark and also in normal java api.

Answer

Robin Moffatt picture Robin Moffatt · Apr 5, 2018

Kafka acts as the regulator here. You produce at whatever rate you want to into Kafka, scaling the brokers out to accommodate the ingest rate. You then consume as you want to; Kafka persists the data and tracks the offset of the consumers as they work their way through the data they read.