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 the deployment to reliable
- You must deploy the application as cost-effectively as possible
Solution
One way to deploy your microservices is to use the Multiple Service Instances per Host pattern. When using this pattern, you provide one or more physical or virtual hosts and run multiple service instances on each one.
In many ways, this is the traditional approach to application deployment. Each service instance runs at a well-known port on one or more hosts. The host machines are commonly treated like pets.
The following diagram shows the structure of this pattern.
There are a couple of variants of this pattern. One variant is for each service instance to be a process or a process group. For example, you might deploy a Java service instance as a web application on an Apache Tomcat server. A Node.js service instance might consist of a parent process and one or more child processes.