Spring Cloud Gateway Load Balancing type - spring-boot

Which kind of load balancing (client side or server side) is implemented when we use lb as a prefix for a url/service? How is it different from zuul? Afaik, zuul is used for server side load balancing.

Related

Spring boot microservices understanding concept question

I've read some articles online and saw one tutorial regarding microservices. I'm confused with one thing that the tutorial said. Lets say we have simple architecture with eureka as disovery server and feign client. The tutorial said that this architecture uses server side load balancing and uses client side load balancing at the same time. First it get's services addresses and saves them in cache and then using that does client side load balancing. But I think its wrong. For me using feign client uses only client side load balancing. Server side is off the chart. There is no saving in cache, but the feign client is using eureka rather than cache memory. I could use server side load balancing with zuul, but then I wouldn't be using client load balancing am I right?
Second question is. Spring boot api gateway is also has built in load balancer and it also is using client side load balancing right?
I think the tutorial made some assumptions that weren't correct and now I'm left confused.

Multiple Spring Cloud Gateways. Can this configured as cluster?

One option to make Spring Cloud Gateway highly available is to have multiple instances backed by load balancer.
Is there a option to make cluster of multiple API gateway instances?
How will the load balancing works perfectly in case if API Gateways are not aware of each other , instead just do load balancing at each API gateway instance level

Multiple Zuul Gate-gateway to reduce traffic

Is it possible to have multiple instance of Zuul api gateway to run in a single application and manage the traffic using round-Robbin?
Yes, it is possible to have multiple instances of the API Gateway but these instances should be behind an internet-facing load balancer. This load balancer would be responsible for routing requests to an appropriate instance of the API gateway (based on a round-robin or any other routing strategy).

Can we use netflix-eureka as external load balancer

Can Eureka be used by outside world to discover my service? Below is the flow:
Public client( developed in any technology and not using Eureka) --> Eureka server (hosted on my organization server, exposed to outside world) --> My Eureka aware services.
I am trying to understand how Netfilx Eureka works from overall architecture point of view.
Basically Load Balancer and discovery service are two completely different things.
Discovery service = a registry of currently available services
Load Balancer = a routing of requests based on various rules
So, Eureka, as a discovery service, cannot be used a Load Balancer by itself.
However Eureka, being an application by itself, exposes an HTTP REST API
So if you want to build a load balancer by yourself based on the information provided by eureka, you can call rest APIs like this.
For example, Ribbon, being a client side load balancer, calls these APIs internally.
Having said that, its not unclear why to use the tool for the purpose for which is not intended to be...

Use case for Zuul and Netflix Ribbon

Both Zuul and Ribbon can be used for load balancing. But in which case should we prefer Zuul over Ribbon and vice versa?
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.
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.

Resources