An Introduction To Service Discovery In Microservices

Posted By : Gaurav Prakash Ranjan | 27-Aug-2020

 

This blog post provides a brief overview about the use and significance of service discovery in microservices. 

 

If we developed a multiple microservice in a project. then we call the all microservice directly it means we write the URLs hard code for access to the microservices. If we are work on larset project then it is maintain very difficult to manage the all microservice URLs manually, it mines write all URLs in our code is manula (static). And after some time we need to change some microservice URLs, then we can be required for update this URL in our project this is so difficult.

 

 

Why are hard coded URLs bad?

There are some reason for hard code URLs use in our services-

  1. Changes require code update: If we need to update any micro service URL in our project, we use hard coded URLs then it is very difficult to change that URL because we need to write the all location which uses that URL in our project manually.
  2. Dynamic URLs in the cloud: In this technology, we can not use dynamic URLs in the cloud server.
  3. Load balancing: In hard coded URLs load balancing is very High.
  4. Multiple environments: Now, we use multiple environments in our projects. For example - development and production. Then we need to load dynamic environments used in access URLs in our project. In hard coded URLs, it is very difficult to manage it.

 

If we use the service discovery, then the hardcoded URLs no need to be written in our projects. In service discovery technology it manages the microservice URLs. And clients need to call any microservice to ask the URL of that microservice from service discovery.

 

There are mainly two type of service discovery technologies-

  • Client side service discovery
  • Server side service discovery

Client side service discovery: In this technology firstly clients send the request to service discovery and get the URL of microservice which needs to use it and then call which URL and get data.

For example: The user needs to purchase some products. The user searches in google and finds that location of the shop and then goes to that location and purchases his/her products. Here, a user is a client, google is a service discovery and a shop is a microservice.

 

Server side service discovery: In this technology users call the service discovery for the specified URL and then service discovery calls which URL specific that microservice and get the data and send data to the user.

 

For example: The user needs to contact the marketing manager of any big company for any query. Then he can not contact directly firstly contact the receptionist of that company then he/she contact the marketing manager. Here, the user is a client, receptionist is a service discovery and marketing manager is a microservice.

 

We are a seasoned ERP development company that provides full-scale ERP consulting and software development services to clients. Our development team is skilled at using advanced tools and technologies to build user-centric ERP software solutions for clients. We also specialize in microservice-based application development and containerized deployment on the cloud. For project-related queries, reach us out at [email protected].

 

 


Please remove URL from text

Comment is required

Sending message..
Connect with us