This content is copyright of CloudCredo. © CloudCredo 2015. All rights reserved.
As a CF hero
I want my app to be resilient
So that random failures won't take it offline
# From the training home directory:
$ cd 05-resilience/imperfect-app
$ cf push
...
urls: imperfect-app-votive-seeress.cfapps.io
...
The static website is handling the traffic wonderfully
Everyone wants to use your new app, but…
Version 1 Sucks, But Ship It Anyway
Embrace failure & run many instances of the same app
$ cf scale imperfect-app -i 3
$ cf apps
name state instances memory disk urls
imperfect-app started 2/3 64M 256M imperfect..
$ 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
$ watch cf apps # Watch app instances restart in real-time
Health Manager in DEA v2 (a.k.a. HM9K)
Health Check in Diego v3
$ cf events imperfect-app
description
index: 1, reason: CRASHED... Exited with status 255 (out of memory)
$ cf scale imperfect-app -m 256M
Do not use the app’s disk for persistence
$ cf app imperfect-app
state since cpu memory disk
#0 running 2015-11-02 0.0% 24.4M of 256M 95.2M of 256M
#1 running 2015-11-02 0.0% 112.4M of 256M 224.2M of 256M
#0 running 2015-11-02 0.0% 24.3M of 256M 95.2M of 256M
$ cf logs imperfect-app --recent
Errno::EDQUOT - Disk quota exceeded @ io_write - infinite-file:
$ cf scale imperfect-app -k 1G
Combine multiple options in a single command
$ cf help scale
NAME:
scale - Change or view the instance count, disk space limit...
USAGE:
cf scale APP_NAME [-i INSTANCES] [-k DISK] [-m MEMORY] [-f]
OPTIONS:
-i Number of instances
-k Disk limit (e.g. 256M, 1024M, 1G)
-m Memory limit (e.g. 256M, 1024M, 1G)
-f Force restart of app without prompt
As a CF hero
I want my app to be resilient
So that random failures won't take it offline
Questions cannot be stupid. Answers can.
This content is copyright of CloudCredo. © CloudCredo 2015. All rights reserved.