在阅读了Spring cloud Zuul的文档后,我了解到,通过信号量隔离和大约2的最大并发请求,Zuul服务器可以轻松处理大约5000 rps。值约为 2000,当我尝试从 Jmeter 调用服务时,它会抛出以下异常并显示错误率 100%。
com.netflix.hystrix.exception.HystrixRuntimeException:
Service1 could not acquire a semaphore for execution and no fallback available.
然后我将最大并发请求数增加到 200000,但它仍然抛出异常,但错误率已降至 10%。你能告诉我原因吗?这是因为微服务缓慢还是Spring Cloud Zuul中的任何配置问题?以下是配置:
ribbon:
ConnectTimeout: 20000000
ReadTimeout: 20000000
MaxTotalHttpConnections: 5000
MaxHttpConnectionsPerHost: 5000
ActiveConnectionsLimit: 4000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 20000000
zuul.hystrix.command.default.execution.isolation.strategy: SEMAPHORE
zuul.hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests: 2000
zuul.hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests: 2000
zuul.eureka.default.semaphore.maxSemaphores: 30000
经过一些测试,我发现它应该是:
zuul.semaphore.maxSemaphores: 30000
它与 github 中的问题不同。也许它与版本有关。