Shady Ragab
Shady Ragab

Reputation: 725

spring cloud zuul server : very high latency value

I have an edge zuul server service which route requests to downstream services.

I load test this architecture with 400 thread concurrently

in the downstream service the total latency is only one second. using a pre and post zuul filters on edge server, I managed to calculate latency to be about 7.5 seconds on average which is approximately the same figure I get from hystrix.stream endpoint enabled on my edge zuul server

{      "type":"HystrixCommand",    "name":"authenticate",    "group":"RibbonCommand",    "currentTime":1492879164747,    "isCircuitBreakerOpen":false,    "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":false,    "propertyValue_circuitBreakerForceClosed":false,    "propertyValue_circuitBreakerEnabled":true,    "propertyValue_executionIsolationStrategy":"SEMAPHORE",    "propertyValue_executionIsolationThreadTimeoutInMilliseconds":200000,    "propertyValue_executionTimeoutInMilliseconds":200000,    "propertyValue_executionIsolationThreadInterruptOnTimeout":true,    "propertyValue_executionIsolationThreadPoolKeyOverride":null,    "propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":5000,    "propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,    "propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,    "propertyValue_requestCacheEnabled":true,    "propertyValue_requestLogEnabled":true,    "reportingHosts":1,    "threadPool":"RibbonCommand" }

given that both the edge server and the downstream service is on the same internal network and given those properties values

server.tomcat.max-threads=5000

zuul.host.max-per-route-connections=5000

zuul.host.max-total-connections=10000

downstream service name : authenticate

zuul.eureka.authenticate.semaphore.maxSemaphores=5000

I set the property server.tomcat.max-threads=5000 in both the edge server and the downstream service

Why the latency is so high like that in the edge server? how can eliminate it or how can I trace where the latency occurs?

I use spring boot version 1.4.0.RELEASE to build both the edge server and the downstream service

Upvotes: 2

Views: 1796

Answers (1)

yongsung.yoon
yongsung.yoon

Reputation: 5589

I guess that your problem could be caused by maxTotalConnection and maxPerRoutConnections. If you are using zuul with ribbonRoutingFilter, please try to define the below properties.

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

The current releases (brixton, camden, dalston) seem to have small bug about these properties. Unlike the documentation, zuul.host.max-per-route-connections, zuul.host.max-total-connections don't affect the actual configuration. Instead, we should define ribbon configuration directlt like above.

Upvotes: 0

Related Questions