Service instance per container

When we use the service instance per container pattern, each microservice instance runs in a container unique to the instance. Containers are a virtualization engine operating at the system level. A good example of a container is Docker, which we are already using in our project for local development.

To use this pattern, we need a container image of a microservice. After the container is created, we release one or more containers. Multiple containers are usually run on each physical or virtual host. You are advised to use a cluster manager such as Kubernetes to manage the containers.

The service instance per container pattern has benefits and drawbacks. The benefits of the containers are similar to those of virtual machines. They isolate their instances of microservices from one another. Containers are easily monitored. In addition, similar to the VMs, the containers encapsulate the technology used to implement microservices. Unlike the virtual machines, the containers are lighter. The container images are usually very fast to build and initialize.

There are some disadvantages to using containers. Containers are not as secure as VMs because they share the host operating system kernel with each other.

Another disadvantage of the containers is the complexity of the infrastructure if they are not using any cloud platform that offers interesting mechanisms to manipulate the containers.

The following is a diagram illustrating how the pattern uses containers:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.74.199