Use App Service Always On#
Performance Efficiency · App Service · 2020_12
Configure Always On for App Service apps.
Description#
Azure App Service apps are automatically unloaded when there's no traffic. Unloading apps reduces resource consumption when apps share a single App Services Plan. After an app have been unloaded, the next web request will trigger a cold start of the app.
A cold start of the app can cause a noticeable performance issues and request timeouts.
Continuous WebJobs or WebJobs triggered with a CRON expression must use always on to start.
The Always On feature is implemented by the App Service load balancer, periodically sending requests to the application root.
Recommendation#
Consider enabling Always On for each App Services app.
Examples#
Configure with Azure template#
To deploy App Services that pass this rule:
- Set
properties.siteConfig.alwaysOn
totrue
.
For example:
{
"type": "Microsoft.Web/sites",
"apiVersion": "2021-02-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"kind": "web",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('planName'))]",
"httpsOnly": true,
"siteConfig": {
"alwaysOn": true,
"minTlsVersion": "1.2",
"ftpsState": "FtpsOnly",
"remoteDebuggingEnabled": false,
"http20Enabled": true
}
},
"tags": "[parameters('tags')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('planName'))]"
]
}
Configure with Bicep#
To deploy App Services that pass this rule:
- Set
properties.siteConfig.alwaysOn
totrue
.
For example:
resource webApp 'Microsoft.Web/sites@2021-02-01' = {
name: name
location: location
kind: 'web'
properties: {
serverFarmId: appPlan.id
httpsOnly: true
siteConfig: {
alwaysOn: true
minTlsVersion: '1.2'
ftpsState: 'FtpsOnly'
remoteDebuggingEnabled: false
http20Enabled: true
}
}
tags: tags
}