Scaling an Application Using cf scale
Page last updated: June 20, 2014
Factors such as user load, or the number and nature of tasks performed by an application, can change the disk space and memory the application uses. For many applications, increasing the available disk space or memory can improve overall performance. Similarly, running additional instances of an application can allow the application to handle increases in user load and concurrent requests. These adjustments are called scaling an application.
Use cf scale
to scale your application up or down to meet changes in traffic
or demand.
Scaling Horizontally
Horizontally scaling an application creates or destroys instances of your application.
Incoming requests to your application are automatically load balanced across all instances of your application, and each instance handles tasks in parallel with every other instance. Adding more instances allows your application to handle increased traffic and demand.
Use cf scale APP -i INSTANCES
to horizontally scale your application.
Cloud Foundry will increase or decrease the number of instances of your application to match INSTANCES
.
$ cf scale myApp -i 5
Scaling Vertically
Vertically scaling an application changes the disk space limit or memory limit that Cloud Foundry applies to all instances of the application.
Use cf scale APP -k DISK
to change the disk space limit applied to all
instances of your application.
DISK
must be an integer followed by either an M, for megabytes, or G,
for gigabytes.
$ cf scale myApp -k 512M
Use cf 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.
$ cf scale myApp -m 1G