2

Both Zuul and Ribbon can be used for load balancing. But in which case should we prefer Zuul over Ribbon and vice versa?

g00glen00b
  • 41,995
  • 13
  • 95
  • 133
Vishnu
  • 176
  • 1
  • 2
  • 19

2 Answers2

2

By default Zuul load balancer using the ZoneAwareLoadBalancer from Ribbon. So there is nothing like choosing between Zuul and Ribbon for Load-Balancing, it's basically Ribbon who is involved in Load-Balancing. check out Zuul load-balancing

As Ribbon is a client-side load balancer module and is integrated to many http client modules. As an example, Feign and Load-balanced RestTemplate support Ribbon. do check Ribbon's working with load balancer

Regarding Zuul, there is a RibbonRoutingFilter that routes your request to an actual service instance. RibbonRoutingFilter is using Ribbon to choose a server from the list that is given from your configuration or from Eureka. So if you want to use Zuul as a load-balanced reverse proxy, Zuul needs Ribbon.

Yogendra Mishra
  • 2,399
  • 2
  • 13
  • 20
  • 1
    You should give the original poster the credits while copying his answer as your own. [link]https://stackoverflow.com/questions/43538030/zuul-and-ribbon-integration[/link] – Sid Nov 27 '18 at 10:08
1

Zuul provides only the routing part of the Gateway pattern. But If you are using replicated micro-services the Ribbon come to the action. Ribbon default use round robin method to distribute the message to each replica.

EX: Suppose there is 3 clients come make requests. According to the figure, client's requests come to zuul and ribbon distribute 1st client to replica1 and 2nd to replica 2nd and 3rd to replica 3rd likewise. That mean Load balancing the request.

enter image description here

Yogendra Mishra
  • 2,399
  • 2
  • 13
  • 20
wthamira
  • 2,032
  • 2
  • 21
  • 40