Our great sponsors
-
javaslang-circuitbreaker
Resilience4j is a fault tolerance library designed for Java8 and functional programming
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Many APIs deploys rate-limiting capabilities so that it does not become overwhelmed and in general it answers with a 429 TooManyRequests status code. When I first read about Ratelimiter I was a bit confused because most of the patterns above deploy on the caller side and protects it from calling service and get stuck, however when we are talking about Ratelimiter how can a caller decide how many requests is too much? Should not it the service being called is the one who decides how many call it can receive? While I search for an answer I found a GitHub discussion and the comment here https://github.com/resilience4j/resilience4j/issues/350#issuecomment-475868062 which suggests using resilience4j as a client-side rate limiter. In case one needs to implement a server-side rate limiter an API Gateway is a better alternative. I still have my doubts about how much a client-side rate limiter worth and who should dictate how much request is too much let's see how it works. Just like all the above pattern here too I create an endpoint, and I decorate the method as below -
Related posts
- Wednesday Links - Edition 2022-11-23
- Does anyone else find Spring overwhelming? It is so powerful that I find myself spending a lot of time figuring out how to do something the "Spring Way". How do you ensure you are using Spring to its full potential.
- Microsserviços com Spring Cloud: Introdução
- How do I catch an exception and loop it?
- Failsafe 3.2 is released, with new resilience policies