2

并发测试失败,日志显示:

com.netflix.hystrix.exception.HystrixRuntimeException:community-serviceRibbonCommand 无法获取用于执行的信号量并且没有可用的回退。

我阅读了源代码。似乎是由 executionIsolationSemaphoreMaxConcurrentRequests 控制的。

我的问题是如何增加 executionIsolationSemaphoreMaxConcurrentRequests?

4

2 回答 2

1

如果您使用的是 Setter,则可以

    public class HystrixCommandInstance extends HystrixCommand<>        
      public HystrixCommandInstance() {
          super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("SomeGroupName"))
          .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
                 .withExecutionIsolationSemaphoreMaxConcurrentRequests(200)));
      }
   }
于 2016-07-07T01:01:53.517 回答
0

如果使用@HystrixCommand注解,可以指定commandProperties()配置命令。

@HystrixCommand(fallbackMethod = "fallbackMethod",
            commandProperties = {
                    @HystrixProperty(name = "execution.isolation.semaphore.maxConcurrentRequests", value = "15")
             })
于 2015-10-15T07:52:31.313 回答