Why is ZUUL forcing a SEMAPHORE isolation to execute its Hystrix commands?

后端 未结 2 1731
萌比男神i
萌比男神i 2020-12-29 11:58

I noticed Spring-Cloud ZUUL forces the execution isolation to SEMAPHORE instead of the THREAD defaults (as recommended by Netflix).

A comment in org.springfram

2条回答
  •  自闭症患者
    2020-12-29 12:42

    The Hystrix documentation has a good example of why semaphore isolation is appropriate when wrapping commands that are thread isolated. Specifically, it says:

    The façade HystrixCommand can use semaphore-isolation since all of the work it is doing is going through two other HystrixCommands that are already thread-isolated. It is unnecessary to have yet another layer of threading as long as the run() method of the façade is not doing any other network calls, retry logic, or other “error prone” things.

    Update: The question mentions that thread isolation has to be configured for each service, but I found out that you can control the isolation of all Hystrix commands (including RibbonCommands) by setting the following property:

    hystrix.command.default.execution.isolation.strategy = THREAD
    

提交回复
热议问题