How Scale increases by adding new container in host?

12/23/2018

Hie, I have recently come across virtualization called containers. this is regarding auto-scaling. I have read that when current container is out of resources then it will add a new container to the host. How does adding new container saves in resources?

can any explain the scale of

scenario 1: container running all of the resources (leaving resources for host os)

vs

Scenario 2: the scale of running two containers running in the same host (where the container is using half of the resources consumed in the previous case)

if the scale is more in scenario 2 then can anyone explain how scale has increased by having two containers even through total resources are same?

-- Akhil Surapuram
docker
kubernetes
linux-containers
operating-system
virtualization

2 Answers

12/23/2018

Consider following scenario regarding workload of an application (Only CPU and memory are considered here for example) -

Normal Workload It requires 4 Cores , 16 GB memory.

Maximum Workload It requires 8 Cores, 32 GB Memory. Assuming that the burst of activities (max workload) happens only 2 hours per day.

Case 1 - When application is not containerized The application has to reserve 8 Cores and 32 GB of memory for it's working so that it could handle max workload with expected performance. But the 4 Cores and 16 GB of memory is going to be wasted for 22 hours in a day.

Case 2 - When application is containerized Lets assume that a container of 4 Cores and 16 GB memory is spawned. Then remaining resources, 4 Cores and 16 GB memory are available for other applications in cluster and another container of same configuration will be spawned for this application only for 2 hours in a day when max workload is required.

Therefore the resources in cluster are used optimally when applications are containerized.

What if single machine does not have all the resources required for the application ? In such cases, if application is containerized then containers/resources can be allocated from multiple machines in the cluster.

Increase fault tolerance If application is running on single machine and the machine goes down then the whole application become unavailable. But in case of containerized application running on different machines in cluster. If a machine fails then only few containers will not be available.

Regarding your question, if the application's workload is going to be uniform throughout the lifetime then there is no benefit in breaking the application in smaller containers in terms of scale. But you may still consider containerizing applications for other benefits. In terms of scale, an application is containerized only when there is varying workload or more workload is anticipated in future.

-- Ajay Srivastava
Source: StackOverflow

12/25/2018

how scale has increased by having two containers even through total resources are same?

It usually doesn't. If you have a single threaded application, and you have a multi core host, then scaling multiple instances of the container in the same host will give you access to more cores by that application. This could also help with a multi threaded application if it's limited by internal resource contention and not using all of the cores. But for most multi threaded processes, scaling the application up on a single host will not improve performance.

What scaling does help with in an multi node environment is allowing the application to run in other hosts in the cluster that are not fully utilized. This is the horizontal scaling that most target with 12 factor apps. It allows apps deployed to cloud environments to scale out with more replicas/shards by adding more nodes rather than trying to find more resources for a single large node.

-- BMitch
Source: StackOverflow