Prev Next

Spring / Resilience4j Interview questions

What is a RateLimiter in Resilience4j?

A RateLimiter caps how many calls are allowed to proceed within a fixed time window, rejecting or delaying calls beyond that limit rather than letting demand spike freely against a dependency.

It's configured with limitForPeriod (how many calls are permitted per window), limitRefreshPeriod (how long each window lasts), and timeoutDuration (how long a call waits for a permit before failing with a RequestNotPermitted exception).

It's typically used to respect a third-party API's rate limits, or to protect an internal service from being overwhelmed by a sudden burst of traffic.

What does limitRefreshPeriod configure?
A call exceeding the rate limit and its timeout raises:

More Related questions...

What is Resilience4j? What are the core modules of Resilience4j? What is a Circuit Breaker in Resilience4j? What are the states of a CircuitBreaker? What is the Retry module used for? What is a RateLimiter in Resilience4j? What is the Bulkhead pattern in Resilience4j? What is a TimeLimiter in Resilience4j? What is the Cache module in Resilience4j? How do you add Resilience4j to a Spring Boot project? What is the purpose of the Decorators class? Define fallback method in Resilience4j? What are the types of Bulkhead implementations? List the key configuration properties of a CircuitBreaker? How do you apply @CircuitBreaker in a Spring Boot service? Why is Resilience4j often preferred over Hystrix? How does the sliding window work in CircuitBreaker? What is the difference between COUNT_BASED and TIME_BASED sliding windows? How is failure rate calculated in a CircuitBreaker? What is the difference between CircuitBreaker and Bulkhead? How does the half-open state behave in a CircuitBreaker? Why do we use recordExceptions versus ignoreExceptions? When should you use RateLimiter instead of Bulkhead? What happens when a CircuitBreaker transitions to OPEN? How is Resilience4j's Retry different from a plain retry loop? Explain the execution flow of a call decorated with CircuitBreaker, Retry, and Bulkhead together? How do you combine multiple Resilience4j decorators using the Decorators class? Which is better and why: SemaphoreBulkhead or ThreadPoolBulkhead? How can you optimize CircuitBreaker configuration for a high-throughput service? How do you troubleshoot a CircuitBreaker that never opens despite failures? Explain the lifecycle of a CircuitBreaker instance? What is the difference between TimeLimiter and a plain timeout? How does RegistryEventConsumer work in Resilience4j? Why does Resilience4j rely on functional interfaces like Supplier and Function? How do you monitor Resilience4j metrics with Micrometer? What is the difference between waitDurationInOpenState and permittedNumberOfCallsInHalfOpenState? How do you write a unit test for a CircuitBreaker-protected method? Explain the internal working of exponential backoff in the Retry module? What is the difference between CallNotPermittedException and other Resilience4j exceptions? How do you use event publishers to log CircuitBreaker state transitions? When would you choose a RateLimiter over a Bulkhead for protecting a downstream call? How does Resilience4j integrate with reactive streams in WebFlux? What is the difference between recordException and recordResult predicates? Explain the internal working of automaticTransitionFromOpenToHalfOpenEnabled? How do you configure Resilience4j using application.yml in Spring Boot? What is the difference between the Resilience4j Cache module and a plain in-memory cache like Guava? How can you optimize retry strategies to avoid retry storms? Explain the execution flow when a fallback method itself throws an exception? How do you troubleshoot memory growth caused by an unbounded ThreadPoolBulkhead queue? Explain how Resilience4j's modular design influences microservice resilience architecture at scale?
Show more question and Answers...


Comments & Discussions