I have 2 processes P1 and P2 in my System that communicate very frequently with each other over TCP. For this reason they are both hosted on the same VM. I am thinking of eliminating the VM and instead hosting my System in containers on the physical machine. If I dockerize my System, I have 2 options:
- Container 1 contains P1, Container 2 contains P2. The 2 containers will be linked. The communication between P1 and P2 will be across container boundary.
- One single Container will contain P1 and P2. The communication will remain within the container.
Kindly guide me on the merits and demerits of the above 2 approaches. What is the overhead involved in terms of communication latency in approach 1?