Zuul proxy slowowness - RibbonLoadBalancingHttpClient

Firstly, I only have basic knowledge in java. I have some microservices and am currently using zuul / eureka to provide services.

It is noted that with a direct call to the microservice, the throughput is 3 times higher than with a call through zuul. Therefore, I am wondering the wrong zuul configuration.

ab:

Direct microservice call:

Concurrency Level: 10 Time taken for tests: 5.938 seconds Complete requests: 10000 Failed requests: 0 Total transferred: 37750000 bytes HTML transferred: 36190000 bytes Requests per second: 1684.20 [#/sec] (mean) Time per request: 5.938 [ms] (mean) Time per request: 0.594 [ms] (mean, across all concurrent requests) Transfer rate: 6208.84 [Kbytes/sec] received 

Call via zuul:

 Concurrency Level: 10 Time taken for tests: 15.049 seconds Complete requests: 10000 Failed requests: 0 Total transferred: 37990000 bytes HTML transferred: 36190000 bytes Requests per second: 664.52 [#/sec] (mean) Time per request: 15.049 [ms] (mean) Time per request: 1.505 [ms] (mean, across all concurrent 

Zuul configuration:

 server: port: 7001 zuul: #Services will be mapped under the /api URI prefix: /api sslHostnameValidationEnabled: false host: maxTotalConnections: 800 maxPerRouteConnections: 200 endpoints: restart: enabled: true shutdown: enabled: true health: sensitive: false eureka: instance: hostname: localhost client: serviceUrl: defaultZone: http://localhost:8761/eureka/ ribbon: eureka: enabled: true spring: application: name: zuul-server id: zuul-server 

It is noted that zuul takes up a lot of CPU compared to the microservice itself. So took the stream dump. And my suspicion is that RibbonLoadBalancingHttpClient seems to continue to instantiate.


Stream dump: https://1drv.ms/t/s!Atq1lsqOLA98mHjh0lSJHPJj5J_I

+5
source share
1 answer

The properties you specified for zuul.host. * are only for zuul routes with "url" which are specified directly and do not apply to serviceIds routes received from Eureka. See here . You might want to increase the total number of HTTP and tape connections on each host and repeat the test. The following is an example config -

 ribbon: ReadTimeout: 30000 ConnectTimeout: 1000 MaxTotalHttpConnections: 1600 MaxConnectionsPerHost: 800 

In my Zuul tests, I remember how the max response times of some of the requests were much higher than the direct requests to the target requested by zuul, but the 95th and 99th percentiles were always comparable with about ~ 200ms difference with direct requests to destination server.

0
source

Source: https://habr.com/ru/post/1260758/


All Articles