spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
329 stars 110 forks source link

BulkheadProvider - Executors.newSingleThreadScheduledExecutor() should be removed #96

Closed Ferioney closed 3 years ago

Ferioney commented 3 years ago

Critical defect

I have done small performance testing with using spring-cloud-circuitBreaker-resilience4j with Bulkhead implementation. And I found a performance issue. Each time when I decorate supplier by timeLimiter I created a new ScheduledExecutorService. But those executors were blocked and weren't removed from the application. After 30 min of application working, I had almost 8000 threads.

Solution: Executors.newSingleThreadScheduledExecutor() should be removed. TimeLimiter should be replaced by a decorator without scheduler.