
Working with throttled dependencies is something unavoidable in distributed systems. In these cases, relying retry on error is not only wasting resources but also potentially creating bigger pressure to those dependencies.
We have a detailed article about how rate limiting pattern for these use cases could be practical:
Rate Limiting pattern – Azure Architecture Center | Microsoft Learn
I’m excited to share this new Azure sample implementing the pattern in Java leveraging Redis, k8s and some other usual suspects from Cloud Native ecosystem.
It also showcases how to implement distributed locking and leasing in a simple way to control the rate of the messages flowing through your service.
Azure-Samples/java-rate-limiting-pattern-sample: An implementation of Rate Limiting Pattern in Java using Distributed Lock for Lease Management in k8s. (github.com)

What do you think?