Load balancing in microservices

What you will learn here about microservices

  • Load balancing in microservices

microservices

prerequisite:
1)Please Start Naming server Before starting the Find Book service. Please visit following link for knowing how to implement naming server in microservice

Eureka naming server in microservices

2)Please Start Book Exchange service Before starting the Find Book service. Please visit following link for Book exchange service

Microservice – Book Exchange Service using Spring Boot

3)Please visit following link to know how to start virtual instance of Book exchange service

How to run virtual instances of spring boot in eclipse

Load balancing in microservices

Please follow the following steps to know how to implement load balancing in microservices using feign load balancer
1)Please click on following link to download Find Book service project

Download Find Book Service project (11 downloads)

2)Please unzip project and open with eclipse IDE

3)Now please go to ProxyService.java

4)it is very easy to implement load balancer in using feign client. We just have to specify microservice name in feign client thats it which is shown below.
load balancing in microservices

5)Now please start your find book service

6)Now please visit your eureka client server url localhost:8761 which is shown below
Eureka server client registration

7)Now wait for 10 – 15 seconds for loading server

8)Now please visit find book service urlhttp://localhost:8100/book/id/1000. if you visit 2-3 times you will see different environment port which is shown below
load balancing load distribution

9)if you are able to see different environment port means load balancer is implemented successfully.

You may also like...