Factors such as user load, or the number and nature of tasks performed by an app, can change the disk space and memory the app uses. This article describes how to scale an app using the Cloud Foundry Command Line Interface (cf CLI). For many apps, increasing the available disk space or memory can improve overall performance. Similarly, running additional instances of an app can allow the app to handle increases in user load and concurrent requests. These adjustments are called scaling an app.
Use cf scale to scale your app up or down to meet changes in traffic or demand.
Note: You can configure your app to scale automatically based on rules that you set. For more information, see Scaling an App Using Autoscaler and Using the App Autoscaler CLI.
Horizontally scaling an app creates or destroys instances of your app.
Incoming requests to your app are automatically load balanced across all instances of your app, and each instance handles tasks in parallel with every other instance. Adding more instances allows your app to handle increased traffic and demand.
cf scale APP -i INSTANCES to horizontally scale your app. Cloud Foundry will increase or decrease the number of instances of your app to match
$ cf scale myApp -i 5
Note: In cf CLI v7, you can also use
cf scale to scale specific processes of your app.
Vertically scaling an app changes the disk space limit or memory limit that Cloud Foundry applies to all instances of the app.
cf scale APP -k DISK to change the disk space limit applied to all instances of your app.
DISK must be an integer followed by either an M, for megabytes, or G, for gigabytes.
$ cf scale myApp -k 512M
cf scale APP -m MEMORY to change the memory limit applied to all instances of your app.
MEMORY must be an integer followed by either an M, for megabytes, or G, for gigabytes.
$ cf scale myApp -m 1G