Availability

In this lab, we will use purposefully crash app instances and see how Cloud Foundry works to maintain availability.

Push a Crashable App

What happens when an app crashes?

Change to the 05-resilience/imperfect-app directory and push the crashable app.

Note the random URL for your app, and visit it in a browser.

Click the ‘crash’ link

Use cf app imperfect-app to see the state of your app.

Can you see it in the “crashed” state before Cloud Foundry restarts it?

Access Your App Amid Failures

Scale your app to 3 instances.

Use cf apps to ensure you have 3 instances requested.

Visit your app and click the ‘crash’ link.

Refresh the page, and Cloud Foundry will send your request to one of the healthy instances.

Can you crash instances quicker than Cloud Foundry can restart them?

If you have watch available on your system, use it to watch app instances restart.

$ watch cf apps # Watch app instances restart

If not, you can re-run cf app multiple times.

$ cf app imperfect-app

     state     since       cpu    memory         disk
#0   running   2015-11-02  0.0%   25.3M of 32M   66.9M of 128M
#1   down      2015-11-02  0.0%   0 of 0         0 of 0
#2   down      2015-11-02  0.0%   0 of 0         0 of 0

What happens if you make a request whilst they are all down?

Delete your app to free up space.

Beyond the Class

© 2018 Copyright Cloud Foundry Foundation. All Rights Reserved.