<p>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?</p>

<p>can any explain the scale of </p>

<blockquote>
  <p>scenario 1: container running all of the resources (leaving resources for host os)</p>
</blockquote>

<p>vs</p>

<blockquote>
  <p>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)</p>
</blockquote>

<p>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?</p>

Akhil Surapuram
<p>Consider following scenario regarding workload of an application (Only CPU and memory are considered here for example) - </p>

<p><strong>Normal Workload</strong>
It requires 4 Cores , 16 GB memory.</p>

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

<p><strong>Case 1 - When application is not containerized</strong>
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.</p>

<p><strong>Case 2 - When application is containerized</strong>
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.</p>

<p><strong>Therefore the resources in cluster are used optimally when applications are containerized.</strong> </p>

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

<p><strong>Increase fault tolerance</strong>
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.</p>

<p>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. </p>
