springcloud调优(Dalston.RELEASE版本)

zuul

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 适用于ApacheHttpClient,如果是okhttp无效。每个服务的http客户端连接池最大连接,默认是200.
zuul.host.maxTotalConnections=2000
# 适用于ApacheHttpClient,如果是okhttp无效。每个route可用的最大连接数,默认值是20。
zuul.host.maxPerRouteConnections=2000

ribbon.MaxConnectionsPerHost=2000
ribbon.MaxTotalConnections=20000
# 转发后台服务的最大连接时间
ribbon.ConnectTimeout=30000
# 转发后台服务的最大读取时间
ribbon.ReadTimeout=30000
ribbon.PoolMaxThreads=2000
server.tomcat.max-threads=2000
server.tomcat.max-connections=2000
server.tomcat.accept-count=1000
zuul.semaphore.maxSemaphores=2000
zuul.host.socket-timeout-millis=60000
zuul.host.connect-timeout-millis=10000
# 触发hystrix短路开启时间,该值需要小于ribbon.ReadTimeout才会生效,zuul的hystrix只会对应到service级别不能针对单个接口
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=20000
hystrix.command.default.execution.isolation.thread.semaphoreMaxConcurrentRequests=1000
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests=2000
hystrix.command.default.execution.isolation.strategy=THREAD

feign

1
2
3
4
5
6
7
8
9
10
11
12
# 注意Dalston.RELEASE版本的feign hystrix默认是开启状态的,如果有需要我们可以根据业务情况选择是否开启,开启后需要设置hystrix配置
feign.hystrix.enabled=false
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000
hystrix.command.default.execution.isolation.thread.semaphoreMaxConcurrentRequests=1000
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests=2000
hystrix.command.default.execution.isolation.strategy=THREAD

ribbon.MaxConnectionsPerHost=2000
ribbon.MaxTotalConnections=20000
ribbon.ConnectTimeout=30000
ribbon.ReadTimeout=30000
ribbon.PoolMaxThreads=2000
zhang dong wechat
关注我的微信来交流技术问题吧!