Dynamic Scaling of VMs (both RAM and CPU) has been introduced in Apache CloudStack 4.2.0 onwards. You can read more about its features and limitations from the Apache CloudStack Dynamic scaling of CPU and RAM Wiki. In particular, pay attention to the section on how memory settings are calculated and applied (dynamic max) to a VM based on memory overprovisioning.
I have been able to create VMs with the dynamic scaling features enabled with the following steps…
- Update the global setting enable.dynamic.scale.vm to true
$ cloudmonkey api updateConfiguration name=enable.dynamic.scale.vm value=true
- Increase the global setting mem.overprovisioning.factor to something greater than 1. I have used 2 in my tests.
$ cloudmonkey api updateConfiguration name=mem.overprovisioning.factor value=2
- Create new service offerings as applicable. Since I have 2x over provisioning enabled, I have created new offerings as below:
1vCPU::128MB 1vCPU::256MB 1vCPU::512MB 2vCPU::512MB 1vCPU::1024MB 2vCPU::1024MB 1vCPU::2048MB 2vCPU::2048MB 1vCPU::4096MB 2vCPU::4096MB ...
- Create/update OS template(s) with “Dynamically Scalable” option as enabled. The template itself needs to have XenServer guest tools installed and running.
- Launch a new instance from a dynamic scaling enabled template
- Finally, change the service offering for the instance. So if your memory over provisioning is 2x and you are running a 128MB instance, you can dynamically change to an offering which provides 256MB of memory.
- So far, I have tested dynamic scaling of CentOS 6.5 64bit and FreeBSD 10 RC2 64bit templates. While dyanamic scaling worked for the CentOS 6.5 64bit template, it failed for the FreeBSD template. XenCentre correctly shows Static maximum as 2x of Maximum memory
- Guest OS support is required for dynamic scaling to work. Perhaps thats the reason why FreeBSD failed in my tests. For FreeBSD, the static maximum and maximum memory is equal (instead of being 2x).
- Only scaling up of the the instance is possible at this time. Attempting to scale down a VM will result in the following error:
- While the Wiki mentions that the feature is supported on VMware also, I don’t have an environment to test dynamic scaling on VMware.
- All my service offerings have the same CPU speed with CPU cap disabled. Dynamic scaling of CPU was not tested
Also see Dynamic Scaling Of CPU and RAM not working discussion started by Iliyas Shirol on the Apache CloudStack mailing list.