Zuul学习笔记

  Zuul采用了类似SpringMVC的DispacherServlet的ZuulServlet来实现的,采用的是异步阻塞模型,性能比nginx差,但横向扩展能力很好,方便构建集群。
在实际的集群架构中,通常是通过Nginx和Zuul相互结合来做负载均衡,暴露在最外面的是Nginx主从双热备进行Keepalive,Nginx经过某种路由策略,将请求路由转发到Zuul集群,Zuul最终将请求分发到具体的服务

zuul 内置参数

  • zuul.host.maxTotalConnections

  适用于ApacheHttpClient,如果是okhttp无效。每个服务的http客户端连接池最大连接,默认是200 

  • zuul.host.maxPerRouteConnections

  适用于ApacheHttpClient,如果是okhttp无效。每个route可用的最大连接数,默认值是20 

  • zuul.semaphore.max-semaphores

  Hystrix最大的并发请求execution.isolation.semaphore.maxConcurrentRequests,这个值并非TPSQPSRPS等都是相对值,指的是1秒时间窗口内的事务/查询/请求,semaphore.maxConcurrentRequests是一个绝对值,无时间窗口,相当于亚毫秒级的。当请求达到或超过该设置值后,其其余就会被拒绝。默认值是100。

这个参数本来直接可以通过Hystrix的命名规则来设置,但被zuul重新设计了,使得在zuul中semaphores的最大并发请求有4个方法的参数可以设置,如果4个参数都存在优先级(1~4)由高到低:

  • [优先级1]zuul.eureka.api.semaphore.maxSemaphores
  • [优先级2]zuul.semaphore.max-semaphores
  • [优先级3]hystrix.command.api.execution.isolation.semaphore.maxConcurrentRequests
  • [优先级4]hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests

引用:

https://blog.csdn.net/c99463904/article/details/89476333 

https://blog.csdn.net/icangfeng/article/details/81203517#

https://www.jianshu.com/p/740784a3c4fc

猜你喜欢

转载自www.cnblogs.com/killerqi/p/10906392.html
今日推荐