Bulkhead & Rate Limiter modules provided by Resilience4j sometimes might sound similar but their functioning is lot different than each other. Lets look at the differences between Bulkhead & Rate Limiter.
|Limit number of concurrent calls at a time.||Limit number total calls in given period of time|
|Ex: Allow 5 concurrent calls at a time||Ex: Allow 5 calls every 2 second.|
|In above example, first 5 calls will start processing in parallel while any further calls will keep waiting. As soon as one of those 5 in-process calls is finished, next waiting calls will be immediately eligible to be executed.||In above example, 2 second window starts & first 5 calls will start processing (may be parallel or not parallel). Those 5 calls might finish before 2 seconds, but next waiting calls will NOT be immediately eligible to be executed. After 2 seconds window is over, next 2 seconds window will start & then only next waiting calls will be eligible to be executed.|
|Code Example & runtime behavior||Code Example & runtime behavior|