About microservices.io

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.

Learn more about microservices

Chris offers a comprehensive set of resources for learning about microservices including articles, an O'Reilly training video, and example code. Learn more

Microservices consulting and training

Chris offers a comprehensive consulting services, workshops and hands on training classes to help you use microservices effectively. Get advice

Need training in London?

I'll be there in May! Contact me

Example microservices applications

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

The patterns

How to apply the patterns

Core patterns

Decomposition

Deployment patterns

Cross cutting concerns

Communication style

External API

Service discovery

Reliability

Data management

Security

Testing

Observability

UI patterns


Signup for the newsletter

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

Join the microservices google group

Pattern: Multiple service instances per host

Context

You have applied the Microservice architecture pattern and architected your system as a set of services. Each service is deployed as a set of service instances for throughput and availability.

Problem

How are services packaged and deployed?

Forces

  • Services are written using a variety of languages, frameworks, and framework versions
  • Each service consists of multiple service instances for throughput and availability
  • Service must be independently deployable and scalable
  • Service instances need to be isolated from one another
  • You need to be able to quickly build and deploy a service
  • You need to be able to constrain the resources (CPU and memory) consumed by a service
  • You need to monitor the behavior of each service instance
  • You want deployment to reliable
  • You must deploy the application as cost-effectively as possible

Solution

Run multiple instances of different services on a host (Physical or Virtual machine).

There are various ways of deploying a service instance on a shared host including:

  • Deploy each service instance as a JVM process. For example, a Tomcat or Jetty instances per service instance.
  • Deploy multiple service instances in the same JVM. For example, as web applications or OSGI bundles.

Examples

Resulting context

The benefits of this pattern include:

The drawbacks of this approach include:

  • Risk of conflicting resource requirements
  • Risk of conflicting dependency versions
  • Difficult to limit the resources consumed by a service instance
  • If multiple services instances are deployed in the same process then its difficult to monitor the resource consumption of each service instance. Its also impossible to isolate each instance

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