Service Discovery and Service Registries - Modern Application Development on AWS

Service Discovery and Service Registries

When a system includes multiple microservices, services must be able to find the location of the other services that they depend on. Microservices must be scalable and elastic, and if components fail, new instances or containers must be brought online to ensure constant availability. This means that the IP addresses of the instances or containers in a microservice can be constantly changing. Each instance of a service also must be continually monitored for availability. You can use load balancers to provide stable, available endpoints, which are usually the best choice for public-facing web endpoints. However, load balancers require additional compute resources and introduce latency. If the client is under your control, as are the calls between microservices, it can be more efficient to use a service discovery pattern, which you can also think of as client-side load balancing.

In the service discovery pattern, information about the services to be discovered must be registered somewhere. A service registry is a central location where services to be called can store information about themselves as each individual container or instance starts up.

Figure 4 – Example of a service registry pattern

Figure 5 – Example of a service discovery pattern

You can use AWS Cloud Map to implement a service registry and service discovery pattern in the AWS Cloud. AWS Cloud Mapis a fully managed service that allows clients to look up IP address and port combinations of service instances using DNS, and to dynamically retrieve abstract endpoints, such as URLs or Amazon Resource Names (ARNs) over the HTTP-based service discovery API.

Figure 6 – Example of a service registry and service discovery pattern using AWS Cloud Map