2017-06-14 133 views
1

我想为zuul version 1.1.2做负载测试。配置maxSemaphores zuul服务器

但是,在运行负载测试后,我几分钟后不断收到以下问题。

Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: book could not acquire a semaphore for execution and no fallback available. 
    at com.netflix.hystrix.AbstractCommand$21.call(AbstractCommand.java:783) ~[hystrix-core-1.5.3.jar:1.5.3] 

我的问题是我该如何通过配合来增加maxSemaphores

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds= 20000000 
zuul.hystrix.command.default.execution.isolation.strategy= SEMAPHORE 
zuul.hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests= 10 
zuul.hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests= 10 
zuul.semaphore.maxSemaphores=3000 

zuul.eureka.book.semaphore.maxSemaphore = 30000

我曾尝试在搜索的Intenet很多的选择,但这些作品之一,我

请告知

回答

1

我能够配置maxSemaphores的特定server_id'本书'如下:

zuul.eureka.book.semaphore.maxSemaphores=30000 

但是我想设置的默认值所有色带客户路由到后端微服务,类似如下一个

zuul.eureka.default.semaphore.maxSemaphores=30000 

但它不会采取任何影响。

我还检查了RestClientRibbonCommand类的代码,有趣的是它只支持server_id基础。

代码片段

protected static HystrixCommand.Setter getSetter(String commandKey) { 
     // we want to default to semaphore-isolation since this wraps 
     // 2 others commands that are already thread isolated 
     String name = ZuulConstants.ZUUL_EUREKA + commandKey + ".semaphore.maxSemaphores"; 
     DynamicIntProperty value = DynamicPropertyFactory.getInstance().getIntProperty(
       name, 100); 
     HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() 
       .withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE) 
       .withExecutionIsolationSemaphoreMaxConcurrentRequests(value.get()); 
     return Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RibbonCommand")) 
       .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)) 
       .andCommandPropertiesDefaults(setter); 
    } 

这是很奇怪的Zuul意味着对动态路由,所以我不希望配置为每一个服务。

请指教?

0

原来我使用旧版本。对于后来的版本,我们可以在Zuul级别设置信号量。下面是设置maxSemaphores 3000为默认路由到每个代理的业务

zuul.semaphore.maxSemaphores = 3000

0

的实际属性是MAX-信号量(这将是与YAML配置)的一个例子:

zuul: 
    semaphore: 
    #com.netflix.hystrix.exception.HystrixRuntimeException: "microservice" could not acquire a semaphore for execution and no fallback available. 
    max-semaphores: 2000