hystrix不会占用容器的线程(tomcat等)

hystrix不会占用Tomcat线程池

参考文章:


一下是官网的说法和翻译

Clients (libraries, network calls, etc) execute on separate threads. This isolates them from the calling thread (Tomcat thread pool) so that the caller may “walk away” from a dependency call that is taking too long.

Hystrix uses separate, per-dependency thread pools as a way of constraining any given dependency so latency on the underlying executions will saturate the available threads only in that pool.


需要注意的是
Note: Despite the isolation a separate thread provides, your underlying client code should also have timeouts and/or respond to Thread interrupts so it can not block indefinitely and saturate the Hystrix thread pool.

尽管有熔断机制,但是在底层的代码中,还是应该有超时和中断异常.


试用线程池方式还是信号量方式
这是官网在信号量方式的解释
You can use semaphores (or counters) to limit the number of concurrent calls to any given dependency, instead of using thread pool/queue sizes. This allows Hystrix to shed load without using thread pools but it does not allow for timing out and walking away. If you trust the client and you only want load shedding, you could use this approach.
( 您可以使用信号量(或计数器)来限制对任何给定依赖项的并发调用的数量,而不是使用线程池/队列大小。这使得Hystrix可以在不使用线程池的情况下减少负载,但是它不允许超时并离开。如果您信任客户端,并且您只想要卸载,您可以使用这种方法。 )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值