1

Spring Cloudアプリケーションに対して負荷テストを行っています。同時ユーザー数が一定数に達すると、転送エラーが発生するようになりました

{"timestamp":1450916058678,"status":500,"error":"Internal Server Error","exception":"com.netflix.zuul.exception.ZuulException","message":"Forwarding error"} 

以下は、zuul からのログです。根本的な原因は「実行用のセマフォを取得できませんでした」

2015-12-24 08:14:18.673  WARN 16262 --- [o-8081-exec-109] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering

com.netflix.zuul.exception.ZuulException: Forwarding error
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:131) ~[zuul-server.jar!/:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:73) ~[zuul-server.jar!/:1.1.0.M3]
    at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:119) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:84) ~[zuul-core-1.1.0-rc.1.jar!/:1.1.0-rc.1]
    at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43) [spring-cloud-netflix-core-1.1.0.M3.jar!/:1.1.0.M3]
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:242) [spring-boot-actuator-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:111) [spring-boot-actuator-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) [spring-boot-actuator-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: user-service could not acquire a semaphore for execution and no fallback available.
    at com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:801) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:785) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:77) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-1.0.11.jar!/:1.0.11]
    at com.netflix.hystrix.AbstractCommand$DeprecatedOnFallbackHookApplication$1.onError(AbstractCommand.java:1514) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.AbstractCommand$FallbackHookApplication$1.onError(AbstractCommand.java:1404) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:314) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:306) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable.unsafeSubscribe(Observable.java:7531) ~[rxjava-1.0.11.jar!/:1.0.11]
    at com.netflix.hystrix.AbstractCommand$1.call(AbstractCommand.java:403) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.AbstractCommand$1.call(AbstractCommand.java:363) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable.unsafeSubscribe(Observable.java:7531) ~[rxjava-1.0.11.jar!/:1.0.11]
    at com.netflix.hystrix.AbstractCommand$ObservableCommand$1.call(AbstractCommand.java:1133) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.AbstractCommand$ObservableCommand$1.call(AbstractCommand.java:1129) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at rx.Observable$1.call(Observable.java:144) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable$1.call(Observable.java:136) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.Observable.subscribe(Observable.java:7621) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:57) ~[rxjava-1.0.11.jar!/:1.0.11]
    at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:410) ~[rxjava-1.0.11.jar!/:1.0.11]
    at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:379) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:335) ~[hystrix-core-1.4.20.jar!/:1.4.20]
    at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:115) ~[zuul-server.jar!/:1.1.0.M3]
    ... 68 common frames omitted
Caused by: java.lang.RuntimeException: could not acquire a semaphore for execution
    ... 87 common frames omitted

私の質問は、この転送エラーを回避するために zuul を構成する方法です。あなたの助けは非常に高く評価されています。

4

2 に答える 2

3

バージョン 1.1.x にはデフォルトの hystrix 構成 maxConcurrentRequests=100 があり、1.2.2.release に更新して構成を使用します

zuul:
  host:
    maxTotalConnections: 100000
    maxPerRouteConnections: 10000
  semaphore:
    maxSemaphores: 1000
于 2016-11-04T08:51:18.573 に答える
2

Hystrix のmaxConcurrentRequestsプロパティを増やしてみてください。デフォルト値は 10 です。

hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests

構成情報

于 2015-12-28T10:49:42.450 に答える