Microservices consulting and training

Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action and the creator of the original CloudFoundry.com. His latest startup is eventuate.io, a microservices application platform.

He offers a comprehensive set of resources for learning about microservices including articles, an O'Reilly training video, consulting, workshops and hands on training classes.

Learn More

Need on-site, microservices training in New York or London?

Chris will be in New York the week of June 13th and London the week of June 27th and is available to teach on-site, microservices classes.

Example microservices applications

Want to see an example? Check out Chris Richardson's example applications

The patterns


Signup for the newsletter

A new microservices application platform that solves distributed data management problems.

Join the microservices google group

Pattern: Service registry

Context

Clients of a service use either Client-side discovery or Server-side discovery to determine the location of a service instance to which to send requests.

Problem

How do clients of a service (in the case of Client-side discovery) and/or routers (in the case of Server-side discovery) know about the available instances of a service?

Forces

  • Each instance of a service exposes a remote API such as HTTP/REST, or Thrift etc. at a particular location (host and port)
  • The number of services instances and their locations changes dynamically. Virtual machines and containers are usually assigned a dynamic IP address. An EC2 Autoscaling Group, for example, adjusts the number of instances based on load.

Solution

Implement a service registry, which is a database of services, their instances and their locations. Service instances are registered with the service registry on startup and deregistered on shutdown. Client of the service and/or routers query the service registry to find the available instances of a service.

Examples

Examples of service registries (or technologies that are commonly used as service registries) include:

Some systems such as Kubernetes, Marathon and AWS ELB have an implicit service registry.

Resulting context

The benefits of the Service Registry pattern include:

  • Client of the service and/or routers can discover the location of service instances.

There are also some drawbacks:

  • Unless the service registry is built in to the infrastructure, it is yet another infrastructure component that must be setup, configured and managed. Moreover, the Service Registry is a critical system component. Although clients should cache data provided by the service registry, if the service registry fails that data will eventually become out of date. Consequently, the service registry must be highly available.

You need to decide how service instances are registered with the service registry. There are two options:

The clients of the service registry need to know the location(s) of the service registry instances. Service registry instances must be deployed on fixed and well known IP addresses. Clients are configured with those IP addresses.

For example, Netflix Eureka service instances are typically deployed using elastic IP addresses. The available pool of Elastic IP addresses is configured using either a properties file or via DNS. When a Eureka instance starts up it consults the configuration to determine which available Elastic IP address to use. A Eureka client is also configured with the pool of Elastic IP addresses.


Copyright © 2014 Chris Richardson • All rights reserved • Supported by Kong.