What if your services could find each other instantly, no matter where they move?
Why Service discovery concept in Microservices? - Purpose & Use Cases
Imagine you have many friends in a big city, and you want to call them. But you don't have their phone numbers saved anywhere. You have to ask around every time to find their current number before calling.
This manual way is slow and frustrating. Friends change numbers often, and asking around wastes time. Sometimes you get wrong numbers or no answer, making communication unreliable and error-prone.
Service discovery acts like a smart phonebook that always knows the latest numbers of your friends. It automatically keeps track of where each service lives and how to reach it, so you can connect instantly without searching.
callService('user-service', 'ask around for address', request)
callService('user-service', serviceDiscovery.getAddress('user-service'), request)
It enables seamless, automatic connection between services that can move or change, making your system flexible and reliable.
In a food delivery app, the order service needs to find the current location of the payment service to process payments. Service discovery helps the order service find the payment service instantly, even if it moves to a new server.
Manual tracking of service locations is slow and error-prone.
Service discovery automates finding and connecting services.
This makes microservices communication reliable and scalable.