Setup Client Side Load Balancing With Ribbon
in prvious video we have imvoked the currencyExchangeService From our CurrencyCalculationService to calculate the Currency by the quentry and there currnecy exchange
in last step we added Feign to make calling the currencyExchangeService from currencyExchangeService very easily
So in given Above you can see in Currncy Conversion service we have only 1 Prod instance while Currency Exchange Service we have 4 instances so now hile Conversion service trying to call the Exchange service than we have to load balance means we would need to distribute the load between all these instance
We were using Feing to call Currency Exchange Service
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
now we have Ribbon
STEP 2: Add Given below annotation at CurrencyExchangeServiceProxy Interface
@RibbonClient(name="currency-exchange-service")
Also Fiegn not need the URL for now
@FeignClient(name="currency-exchange-service")
@RibbonClient(name="currency-exchange-service")
becasuse the URL we would configure it in a different way, as now we dont want to talk to only
single instance or specific one instance
but we would want to distributed the load between multiple instances of the Currency
Exchange Service
So for that we will do the configuration in the application properties
STEP 3:
add properties in application.properties
currency-conversion-service.ribbon.listOfServers=http://localhost:8000,http://localhost:8001
Comments
Post a Comment