Several factors, such as user load and the number and nature of tasks, can change the disk space, memory, and log rate limit that an 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. Making these adjustments is called scaling an app.

You can use the cf scale command to scale an app up or down to meet changes in traffic or demand. For more information, see the Cloud Foundry CLI Reference Guide

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.

Scaling Horizontally

Horizontally scaling an app creates or destroys instances of the app.

Incoming requests to an app are automatically load-balanced across all instances of the app, and each instance handles tasks in parallel with every other instance. Adding more instances allows the app to handle increased traffic and demand.

Horizontally Scale an App

To horizontally scale an app:

  1. In a terminal window, run:

    cf scale APP-NAME -i NUMBER-OF-INSTANCES
    

    Where:

    • APP-NAME is the name of the app you want to scale.
    • NUMBER-OF-INSTANCES is the number of instances you want the app to have.

    For example:

    cf scale example-app -i 5
    

Important If you are using cf CLI v7, you can include the --process flag to scale specific processes of an app.

Scaling vertically

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 topic 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.

Scale the Disk Space Limit of an App

To scale the disk space limit applied to all instances of an app:

Scaling horizontally

```
cf scale APP-NAME -k DISK-LIMIT
```

Where:
<ul>
  <li><code>APP-NAME</code> is the name of the app you want to scale.</li>
  <li><code>DISK-LIMIT</code> is the maximum amount of disk space in megabytes or gigabytes that you want each app instance to use. This value must be an integer followed by either <code>M</code> or <code>G</code>.</li>
</ul>

For example:

<pre class="terminal">
cf scale example-app -k 512M
</pre>

Scale the Memory Limit of an App

To scale the memory limit applied to all instances of an app:

  1. In a terminal window, run:

    cf scale APP-NAME -m MEMORY-LIMIT
    

    Where:

    • APP-NAME is the name of the app you want to scale.
    • MEMORY-LIMIT is the maximum amount of memory in megabytes or gigabytes that you want each app instance to use. This value must be an integer followed by either M or G.

    For example:

    cf scale example-app -m 1G
    

Scale the Log Rate Limit of an App

To scale the log rate limit applied to all instances of an app:

  1. In a terminal window, run:

    cf scale APP-NAME -l LOG-RATE-LIMIT
    

    Where:

    • APP-NAME is the name of the app you want to scale.
    • LOG-RATE-LIMIT is the maximum number of logs in bytes, kilobytes, megabytes, or gigabytes that you want each app instance to send to Loggregator. This value must be an integer followed by either B, K, M, or G. To configure each app instance to send an unlimited number of logs to Loggregator, specify -1.

    For example:

    cf scale example-app -l 12K
    
check-circle-line exclamation-circle-line close-line
Scroll to top icon