I’m taking a Node.js microservices course to stay up-to-date. This course is going through the process of building a service registry before going into microservices.
It occurs to me, why are we re-building a service registry for every app? Why is there not a Server Registry as a Service? I.E. Why not a “domain name service” for [micro]services so I can simply query the DNS for a given key/identifier to get the IP/port/args for the microservice.
Am I missing something? Has this been done before and I’m simply unaware of it?
Bottom line, imagine this:
- Microservice when started up, registers itself with the central registry service.
- On a regular basis (10 seconds, 30 seconds, 5 mins, etc) the microservices sends a heartbeat.
- Other microservices and components can query services by API key and service name.
- On top of that it might be worth allowing additional arguments, like environment (dev/staging/prod) so it becomes even easier to have microservices/data mirrored for dev and production.
I certainly feel like a service/SaaS like this would handle some initial setup and make it easier to share microservices between many developers.
OK! Although it’s extremely hard to find, there is existing services filling this need: https://learn.hashicorp.com/collections/consul/microservices