Add options for RibbonCommand to use separate thread pools for hystrix (#2074)

* Add options for RibbonCommand to use separate thread pools for hystrix

* Remove lombok annotation and Add getter/setter for ZuulProperties$HystrixThreadPool

* Add doc about how to configure hystrix thread pools in Zuul Developer Guide

* Add testcases for HystrixThreadPoolKey of RibbonCommand

* Tiny change about if block in AbstractRibbonCommand
This commit is contained in:
Yongsung Yoon
2017-07-01 09:03:52 +09:00
committed by Spencer Gibb
parent 89cb5573d9
commit 8e11514e7c
5 changed files with 175 additions and 5 deletions

View File

@@ -886,6 +886,28 @@ ribbon:
clients: client1, client2, client3
----
[[how-to-configure-hystrix-thread-pools]]
=== How to Configure Hystrix thread pools
If you change `zuul.ribbonIsolationStrategy` to THREAD, the thread isolation strategy for Hystrix will be used for all routes. In this case, the HystrixThreadPoolKey is set to "RibbonCommand" as default. It means that HystrixCommands for all routes will be executed in the same Hystrix thread pool. This behavior can be changed using the following configuration and it will result in HystrixCommands being executed in the Hystrix thread pool for each route.
.application.yml
----
zuul:
threadPool:
useSeparateThreadPools: true
----
The default HystrixThreadPoolKey in this case is same with service ID for each route. To add a prefix to HystrixThreadPoolKey, set `zuul.threadPool.threadPoolKeyPrefix` to a value that you want to add. For example:
.application.yml
----
zuul:
threadPool:
useSeparateThreadPools: true
threadPoolKeyPrefix: zuulgw
----
[[spring-cloud-feign]]
== Declarative REST Client: Feign