Once a microservice system begins to grow past a few services we typically run into the challenge of service discovery.
By this we mean:
- How a consumer of a service determines the connection parameters to allow it to consume a downstream service. Typically this means the IP address and port number to connect to.
- How a service registers itself with the system and advertises that it is available to be consumed.
- When multiple instances of a service start up how the system will handle load balancing and state between them.
- How we discover services in development and in production without having to run production infrastructure locally.
So far in this chapter we have been using environment variables to connect our services together, these variables have been generated for us by the Fuge tool. The astute reader may have wondered as to the format of the variables...