In this article I will try to explain about Service Discovery in the Microservices Architecture.
As we all know that, in MS Architecture all the services may have n number of instances running. In this type of architecture, services might be scaled up or down which make the changes in number of instances particular services. As a result, all of the instances of the services are running on different port. Then how can an application handle request and find the suitable or desirable service among these ports ? That's where we need Service Discovery mechanism in order to serve request according to need of application.
What is Service Discovery ?
It is an infrastructure which keep tracks of all the services instances and route the request to it.
There are 2 Ways to Implement such infrastructure.
1.Service Mesh
- This is used in mostly containerized infrastructure, where container keeps tracks of services.
2.Service Registry
When application does not have any control over network and there can be lot of inclusion of services then this pattern is more useful as it is working at application level.
Here, whenever a new service gets a life it will register it self to this service registry. So now if application wants to know about this service it will query to this service registry and service registry will provide metadata about requested services.
In addition to these, if one service has more than one instances running and registered @ service registry then service registry will provide port of request service to the application in such a way that load can be balanced in more efficient way.
Top comments (0)