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可以在不使用线程池的情况下减少负载,但是它不允许超时并离开。如果您信任客户端,并且您只想要卸载,您可以使用这种方法。
)