Vertical Scaling
Vertically scaling an application changes the memory limit that container platform such as Docker, VMware Tanzu, Kubernetes applies to all instances of the application. We can deploy multiple applications with one cf
push command by describing them in a single manifest. For doing this, we need to look into the directory structure and path lines in the manifest. We can also define the number of instances and memory allocation parameters in the manifest file, which is used while deploying the application.
Docker:
For Docker, the vertical scaling is achieved by increasing the memory allocated for the container as well as increasing the number of CPUs defined for the container.
Use docker run -m MEMORY to change the memory limit applied to the container of your application. Memory must be an integer followed by either an M, for megabytes, or G, for gigabytes.
Use docker run -cpus 2.00 to change the number of CPUs allocated for that container. Number is a fractional number. 0.000 means no limit. If you do not specify this parameter, it uses all the CPUs available on that host or instance where the container is running.
Below snapshot shows how to set the CPU and memory for the container:
docker run -m 1024M -cpus 2.0 -p
<Host_ApplicationPortToExpose>:<Container_ApplicationPort> <ApplicationImageName>
Kubernetes:
For this platform vertical scaling can be done by increasing the resource limits that are CPU and Memory allocated for the container. One can achieve this by specifying the limits in the manifest.yml file. Below is the snapshot of the manifest.yml file.
containers: resources: limits: cpu: 0.5 memory: 512Mi requests: cpu: 0.5 memory: 512Mi
Kubernetes schedules a Pod to run on a Node only if the Node has enough CPU and RAM available to satisfy the total CPU and RAM requested by all of the containers in the Pod. Also, as a container runs on a Node, Kubernetes does not allow the CPU and RAM consumed by the container to exceed the limits you specify for the container. If a Container exceeds its RAM limit, it shut downs from an out-of-memory condition. If a container exceeds its CPU limit, it becomes a candidate for having its CPU use throttled.
You can improve reliability by specifying a value that is a little higher than what you expect to use. If you specify a request, a Pod is guaranteed to be able to use that much of the resource.
If you do not specify a RAM limit, Kubernetes places no upper bound on the amount of RAM a Container can use. A Container could use the entire RAM available on the Node where the Container is running. Similarly, if you do not specify a CPU limit, Kubernetes places no upper bound on CPU resources, and a Container could use all of the CPU resources available on the Node. In this, you do not need to do the vertical auto scaling.
VMware Tanzu:
For the cloud foundry, you can do the vertical scaling by increasing the container resources that are memory, and disk. You can do this through the cloud foundry command line and the cloud foundry UI.
Usecf scale APP -m MEMORY to change the memory limit applied to all instances of your application. MEMORY must be an integer followed by either an M, for megabytes, or G, for gigabytes.
The below snapshot shows how vertical scaling can be done through VMware Tanzu UI.