What exactly is service discovery?
A very short writeup, thoughts and introduction to service mesh.
If you are working in the software industry for some time you must have heard the term service discovery? Service discovery is a very important aspect of software engineering and is confused by people a lot of times.
Service discovery is basically a mechanism to allow your software or microservice to be able to discover the dependencies or other services that they need to talk to. So it’s a way to identify where your service has to connect to complete a certain task.
In most places, service discovery generally happens with help of DNS. You give a DNS name to your service and other services which want to connect to your service use that DNS to connect with it. A DNS resolver resolves the DNS for the requesting services to be able to connect to the required one. It can be an internal or external DNS resolver. There is generally one extra hop involved when we talk about DNS-based service discovery as your DNS will resolve to a set of IPs that belongs to a load balancer and behind that your actual service instance will run.
Another way of service discovery is one in which the client has the list of all the service instances that are there and then they can make a call to any of the one. Modern-day service mesh implements these are also known as client-side service discovery. You can read more about service mesh in below link
https://www.learnsteps.com/what-is-a-service-mesh-is-it-born-with-kubernetes/
The disadvantage of client-side service discovery is that client has to be intelligent enough to keep all the information of the service instances. This is one of the major problems solved by service mesh as these concerns are offloaded to the infrastructure layer with help of sidecar containers/proxies and the application developers don’t have to think about this problem and its implementation. All the requests coming in or going out will be passing through the sidecar containers and this container has all the information needed to connect with the requested services.
You can read more about sidecar and ambassador patterns here: https://www.learnsteps.com/sidecar-pattern-vs-ambassador-pattern/
We will talk more about service mesh in the upcoming post. If you like the post please share and subscribe.
You can also follow our Youtube for full-length tutorial videos on these topics.
You can follow Learnsteps for more articles in this domain.