Load Balancing Microservices using Zuul and Consul

Ankit Verma
Latest posts by Ankit Verma (see all)

Zuul

 Zuul is an edge service that provides dynamic routing, monitoring, resiliency, security, and more. Please view the wiki for usage, information.

Consul

Consul is a distributed service mesh to connect, secure, and configure services across any runtime platform and public or private cloud.

https://www.consul.io/

Load balancing of microservices is one of the major aspects in microservices world. Our problem statement was that we must load balance our applications and if any services are down than we need to deregister that service that’s why we have used consul as we are already using consul as for dynamic property management.

See also  ASP.NET Core: The MVC Request Life Cycle

Integrating Consul with Zuul

Prerequisites:

  1. Eclipse or any other dev tool
  2. Maven
  3. Consul

Set Up of Services

Launch Consul:

               We have set up consul running at localhost:8500

We have developed a student service which is running on server 9870, 9871, 9872 port and all these services are registered on consul with service name as student services

Lets start out zuul application

Zuul app is registered on consul

Provide the following configuration in application.yml file of your zuul application

Let’s test our application

We test our app with actual port services are working fine.

Code is available here –

https://bitbucket.org/vermaankit84/zuul-webapp/src/master/

Please share your feedback.