Permalink
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (20 sloc) 2.61 KB
---
title: Application Container Lifecycle
owner: Diego
---
<strong><%= modified_date %></strong>
This topic describes the lifecycle of an application container for Cloud Foundry (CF) deployments running on the Diego architecture.
##<a id="deployment"></a> Deployment
The application deployment process involves uploading, staging, and starting the app in a container. Your app must successfully complete each of these phases within certain time limits. The default time limits for the phases are as follows:
* Upload: 15 minutes
* Stage: 15 minutes
* Start: 60 seconds
<p class="note"><strong>Note</strong>: Your administrator can change these defaults. Check with your administrator for the actual time limits set for app deployment.</p>
Developers can change the time limit for starting apps through an application manifest or on the command line. For more information, see [The timeout attribute](manifest.html#timeout) section of the Deploying with Application Manifests topic and [Using Application Health Checks](./healthchecks.html).
##<a id="crash-events"></a>Crash Events
If an app instance crashes, CF automatically restarts it by rescheduling the instance on another container three times. After three failed restarts, CF waits thirty seconds before attempting another restart. The wait time doubles each restart until the ninth restart, and remains at that duration until the 200th restart. After the 200th restart, CF stops trying to restart the app instance.
##<a id="evacuation"></a> Evacuation
Certain operator actions require restarting VMs with containers hosting app instances. For example, an operator who updates stemcells or installs a new version of CF must restart all the VMs in a deployment. CF automatically relocates the instances on VMs that are shutting down through a process called evacuation. CF recreates the app instances on another VM, waits until they are healthy, and then shuts down the old instances. During an evacuation, developers may see their app instances in a duplicated state for a brief period.
##<a id="shutdown"></a> Shutdown
When <%=vars.product_name%> requests a shutdown of your app instance, either in response to the command `cf scale APPNAME -i NUMBER-OF-INSTANCES` or because of a system event, CF sends the app process in the container a SIGTERM. The process has ten seconds to shut down gracefully. If the process has not exited after ten seconds, CF sends a SIGKILL.
Apps must finish their in-flight jobs within ten seconds of receiving the SIGTERM before CF terminates the app with a SIGKILL. For instance, a web app must finish processing existing requests and stop accepting new requests.