舱壁模式
配置
resilience4j.bulkhead:
instances:
licenseService:
maxWaitDuration: 10ms # The maximum amount of time to block a thread
maxConcurrentCalls: 20 # The maximum number of concurrent calls
resilience4j.thread-pool-bulkhead:
configs:
shared:
maxThreadPoolSize: 4 # The maximum number of threads in the thread pool
coreThreadPoolSize: 2 # The core thread pool size
queueCapacity: 2 # The queue’s capacity
# The maximum time that idle threads wait for new tasks before terminating
keepAliveDuration: 20ms
instances:
organizationService:
baseConfig: shared
一个自定义线程池的适当大小可以通过以下公式确定:
使用
@Bulkhead 注解
CircuitBreakerFactory
circuitBreakerFactory 自动注入了与 circuitbreaker 同名的 bulkhead。
Actuator 端点查看
Last updated