Permalink
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (43 sloc) 2.03 KB
---
title: Scaling an Application Using cf scale
owner: CAPI
---
<strong><%= modified_date %></strong>
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](http://cli.cloudfoundry.org/en-US/cf/scale.html) to scale your application up or down to meet changes in traffic
or demand.
<%=vars.autoscaler_note_dev_guide%>
## <a id="horizontal"></a>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`.
<pre class='terminal'>
$ cf scale myApp -i 5
</pre>
## <a id="vertical"></a>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.
<pre class='terminal'>
$ cf scale myApp -k 512M
</pre>
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.
<pre class='terminal'>
$ cf scale myApp -m 1G
</pre>