Single or multiple containers

I have 2 processes P1 and P2 in my system that very often communicate with each other over TCP. For this reason, they are both located on the same virtual machine. I am thinking about eliminating a virtual machine and instead place my system in containers on a physical machine. If I close my system, I have 2 options:

  • Container 1 contains P1, container 2 contains P2. 2 containers will be connected. The connection between P1 and P2 will go through the border of the container.
  • One container contains P1 and P2. The message will remain in the container.

Please advise me on the advantages and disadvantages of the above two approaches.
What are the overhead associated with communication latency in approach 1?

+4
source share
2 answers

The main problem with multiple processes in one container is signal management: how do you (cleanly) stop all your processes?

This is a zombie reaping " PID 1 problem , so when you need to manage multiple processes, a basic image, for example, can help. phusion/baseimage-docker

A more general problem is the decoupling of the microservice: if both P1 and P2 are states and depend on each other, their storage in the same container makes sense.

What are the overhead associated with latency communications

It depends on the type of process involved, but the overhead is minimal, since both processes work on the same docker node (even if they are in separate containers).

+2
source

. P1, P1 (, ) , P2, .

, , ().

Latency, . , , , , , 2 AWS, .

+1

All Articles