Service Discovery
Service discovery is a process of detecting services within network clusters. It works on Service Discovery Protocol (SDP) — a networking standard for detecting network service by identifying resources. Usually, we see services invoke each other via language-level methods or procedure calls in the monolithic application. But modern microservices have virtualized or containerized environments where there are instances of a service and their locations that change dynamically. Also, we have mechanisms that enable clients of the service to make requests to the dynamically changing set of temporary service instances.
Some of the common examples of service discovery tools are etcd, Consul, Apache Thrift, Apache Zookeeper, etc.
Implementations of service discovery
Client-side Discovery
On the Client-side service discovery, the client looks for the service location of another service by querying a service registry that handles the network locations of all the service instances.
Server-side Discovery
Likewise, we have an intermediate element like a load balancer where a client requests the service via the load balancer which will be consequently forwarded to the available service in an instant.
What is Service Registry?
Service Registry is a database with the network locations of service instances for the clients to reach out to when required. To note, a service registry is highly available and up to date at any time.
Service Registration
There are some ways of getting the service information known as service registration.
Self-Registration
Self-registration registers and de-registers service instances itself in the service registry. It even encourages the service instances to send a heartbeat request to keep its registration alive.
Third-Party Registration
Further, we have third-party registration that keeps the track of changes in the running instances by polling the deployment environment or subscribing to events. It also records a new service instance in the database while the service registry also de-registers terminated service instances.
Service Mesh
When you have distributed communication, service-to-service communication is necessary but routing this communication, all the application clusters within and across the system gets complex. Then, comes Service Mesh to the rescue by managing and securing the communications between the individual services. In addition, communication is also made observable. The SDP works on full standards for service detection in the mesh. Some of the common examples of service mesh are Istio and Envoy.
I hope this article was helpful to you.
Please remember to applaud this article and follow me!!!
Any kind of feedback or comment is welcome!!!
You can also subscribe to my stories via email to get notified whenever I bring out an article on a new subject.
Thank you for your time and support!!!!
Keep Reading!! Keep Learning!!!