我有一个边缘zuul服务器服务,它将请求路由到下游服务。
我用400线程同时加载测试这个架构
在下游服务中,总延迟仅为一秒。 在边缘服务器上使用前置和后置zuul过滤器,我设法平均计算延迟大约 7.5秒,这与我从hystrix.stream端点获得的大致相同在我的 edge zuul服务器
上启用{ “类型”:“HystrixCommand” “名”:“认证”, “群”:“RibbonCommand” “currentTime的”:1492879164747, “isCircuitBreakerOpen”:假的, “errorPercentage”:0, “ERRORCOUNT”:0, “requestCount”:500, “rollingCountBadRequests”:0, “rollingCountCollapsedRequests”:0, “rollingCountEmit”:0, “rollingCountExceptionsThrown”:0, “rollingCountFailure”:0, “rollingCountFallbackEmit”:0, “rollingCountFallbackFailure”:0, “rollingCountFallbackMissing”:0, “rollingCountFallbackRejection”:0, “rollingCountFallbackSuccess”:0, “rollingCountResponsesFromCache”:0, “rollingCountSemaphoreRejected”:0, “rollingCountShortCircuited”:0, “rollingCountSuccess”:492, “rollingCountThreadPoolRejected”:0, “rollingCountTimeout”:0, “currentConcurrentExecutionCount”:397, “rollingMaxConcurrentExecutionCount”:399, “latencyExecute_mean”:7552, “latencyExecute”:{ “0”:1003年, “25”:8131, “50”:8359, “75”:8543, “90后”:9095, “95”:10495, “99”:12311, “99.5”:12311, “100”:19551 }, 的 “latencyTotal_mean”:7552 下, “latencyTotal”:{ “0”:1003年, “25”:8131, “50”:8359, “75”:8543, “90后”:9095, “95”:10495, “99”:12311, “99.5”:12311, “100”:19551 }, “propertyValue_circuitBreakerRequestVolumeThreshold”:20, “propertyValue_circuitBreakerSleepWindowInMilliseconds”:5000, “propertyValue_circuitBreakerErrorThresholdPercentage”:50, “propertyValue_circuitBreakerForceOpen”:假的, “propertyValue_circuitBreakerForceClosed”:假的, “propertyValue_circuitBreakerEnabled”:真实, “propertyValue_executionIsolationStrategy”: “信号量”, “propertyValue_executionIsolationThreadTimeoutInMilliseconds”:200000, “propertyValue_executionTimeoutInMilliseconds”:200000, “propertyValue_executionIsolationThreadInterruptOnTimeout”:真实, “propertyValue_executionIsolationThreadPoolKeyOverride”:空, “propertyValue_executionIsolationSemaphoreMaxConcurrentRequests”:5000, “propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests”:10, “propertyValue_metricsRollingStatisticalWindowInMilliseconds”:10000, “propertyValue_requestCacheEnabled”:真实, “propertyValue_requestLogEnabled”:真实, “reportingHosts”:1, “线程池”: “RibbonCommand” }
鉴于边缘服务器和下游服务位于同一内部网络上并且具有这些属性值
server.tomcat.max线程= 5000
zuul.host.max每路由连接= 5000
zuul.host.max与总连接= 10000
下游服务名称:authenticate
zuul.eureka.authenticate.semaphore.maxSemaphores = 5000
我在边缘服务器和下游服务中设置了属性server.tomcat.max-threads = 5000
为什么延迟如此高边缘服务器?如何消除它或如何追踪延迟发生的位置?
我使用spring boot版本1.4.0.RELEASE来构建边缘服务器和下游服务
答案 0 :(得分:0)
我猜你的问题可能是由maxTotalConnection和maxPerRoutConnections引起的。如果您使用带有ribbonRoutingFilter的zuul,请尝试定义以下属性。
authenticate:
ribbon:
MaxTotalHttpConnections: 5000
MaxHttpConnectionsPerHost: 10000
MaxTotalConnections: 5000 # just for using apache http client in camden
MaxConnectionsPerHost: 10000 # just for using apache http client in camden
目前的版本(brixton,camden,dalston)似乎有关于这些属性的小错误。与文档不同,zuul.host.max-per-route-connections,zuul.host.max-total-connections不会影响实际配置。相反,我们应该像上面那样直接定义功能区配置。