Our message processing system needed to deal with backpressure gracefully — without dropping critical messages or overloading downstream systems.
Techniques used:
- Consumer rate limiting using pause/resume
- Monitoring
lag
and adjusting consumer thread pools
- Integrating circuit breakers for downstream APIsSample code:
if (tooMuchLag()) { consumer.pause(partitions); }
Backpressure isn’t failure — it’s feedback. Design for it.