In this section, you will add application capacity to the Cloud Foundry platform, then scale your application.
Scaling the Platform Out
Scaling out with BOSH is simple. We simply need to change the manifest, add instances, and deploy. In our case, the number of Diego cells in our deployment is set by an ‘operations’ file, which modifies the main deployment manifest (you included this as an option when you originally ran
- Find the relevant ops file at ~/workspace/cf-deployment/operations/bosh-lite.yml
- Find the section of the file which changes the number of diego-cell instances and set the value from 1 to 2.
# In terminal 1 $ cd ~/workspace/cf-deployment $ bosh -d cf deploy ~/workspace/cf-deployment/cf-deployment.yml \ -o ~/workspace/cf-deployment/operations/bosh-lite.yml \ -o ~/workspace/cf-deployment/operations/use-compiled-releases.yml \ --vars-store deployment-vars.yml \ -v system_domain=$SYSTEM_DOMAIN ... instance_groups: - name: diego-cell - instances: 1 + instances: 2 Continue? [yN]:
# In terminal 2 (before hitting y) cf top # <-- switch to the "Cell Stats" display by hitting 'd'
- What happened?
Checking Your Work
Once your deployment completes, you can run the following to see your additional instances:
Scaling your Application
- Use the cf CLI to scale your application vertically (add memory).
# In terminal 1 # Use cf CLI to scale app vertically # In terminal 2 cf top # <-- switch to the App Stats display
What happens? Why? How long does it take? Is this a good idea in production systems?
Use the cf CLI to scale your application horizontally to 2 instances.
# In terminal 1 # Use cf CLI to scale app horizontally # In terminal 2 cf top # <-- switch to the App Stats display
What happens? How long does it take?
This is the preferred approach to scaling after allocating an appropriate level of resources to your app.
Checking Your Work
You can see the amount of memory and number of instances using:
cf app <your-app>
Beyond the Class
- Canaries & max-in-flight
- Drain scripts
- Availability Zones