Skip to content

Instantly share code, notes, and snippets.

@gitschaub
Created November 26, 2018 22:28
Show Gist options
  • Save gitschaub/656f609e6e3b421a2e2abb86970df0ae to your computer and use it in GitHub Desktop.
Save gitschaub/656f609e6e3b421a2e2abb86970df0ae to your computer and use it in GitHub Desktop.

Service Discovery

GCE

No great service discovery story that I can find. The best approximation is their GCE compute instance metadata service, which can be used as a pseudo-Consul or etcd for discovering active services. This metadata can be used to construct FQDN's for Google's internal DNS service: https://cloud.google.com/compute/docs/internal-dns

AWS

Strategies: https://docs.aws.amazon.com/aws-technical-content/latest/microservices-on-aws/service-discovery.html

Load Balancer

As in typical load balancing story. Reroute clients based on DNS or path. Use router specific hooks to check for service health and to manage load across services.

DNS

https://aws.amazon.com/blogs/aws/amazon-ecs-service-discovery/

ECS integrated DNS-based service discovery. Route 53 is a cloud DNS web services. Provides health and load handles to allow dynamic DNS resolution. DNS resolution is done locally within a closed-off AWS VPC.

Route 53 can be coupled with an external load balancer to provide (restricted) public subnet access to VPCs.

Event Stream

CloudWatch monitors container health (using ECS event stream) and fires a Lambda function to update Route 53 DNS entries.

Configuration Management

Have microservices register with some CM system (Chef, Puppet) on start up. Requesting microservices then retrieve information about active receiving microservices via the CM.

Key-Value Store

New services register with DynamoDB. DynamoDB Streams propagates status changes to other services via Kinesis. Similar to Consul's or etcd's service discovery model.

This method avoids some of the issues with DNS-reliant strategies, like DNS caching, but requires applications to be intelligent enough to interpret the status of peer apps.

Using Message Queues

https://docs.aws.amazon.com/aws-technical-content/latest/microservices-on-aws/asynchronous-communication-and-lightweight-messaging.html

Some discovery is still needed for the "topic" to publish to, but that is usually considered well known information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment