Monitor apps in Azure App Service
In the Azure portal, you can review quotas and metrics for an app, review the App Service plan, and automatically set up alerts and scaling that are based on the metrics.
Apps that are hosted in App Service are subject to certain limits on the resources they can use. The limits are defined by the App Service plan that's associated with the app.
App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure virtual machines as other App Service apps. Some apps might belong to other customers. These tiers are intended to be used only for development and testing purposes.
If the app is hosted in a Free or Shared plan, the limits on the resources that the app can use are defined by quotas.
If the app is hosted in a Basic, Standard, or Premium plan, the limits on the resources that they can use are set by the size (Small, Medium, Large) and instance count (1, 2, 3, and so on) of the App Service plan.
Quotas for Free or Shared apps are:
|CPU (Short)||The amount of CPU allowed for this app in a 5-minute interval. This quota resets every five minutes.|
|CPU (Day)||The total amount of CPU allowed for this app in a day. This quota resets every 24 hours at midnight UTC.|
|Memory||The total amount of memory allowed for this app.|
|Bandwidth||The total amount of outgoing bandwidth allowed for this app in a day. This quota resets every 24 hours at midnight UTC.|
|Filesystem||The total amount of storage allowed.|
The only quota applicable to apps that are hosted in Basic, Standard, and Premium plans is Filesystem.
For more information about the specific quotas, limits, and features available to the various App Service SKUs, see Azure Subscription service limits.
If an app exceeds the CPU (short), CPU (Day), or bandwidth quota, the app is stopped until the quota resets. During this time, all incoming requests result in an HTTP 403 error.
If the app Memory quota is exceeded, the app is restarted.
If the Filesystem quota is exceeded, any write operation fails. Write operation failures include any writes to logs.
You can increase or remove quotas from your app by upgrading your App Service plan.
Metrics provide information about the app or the App Service plan's behavior.
For an app, the available metrics are:
|Average Response Time||The average time taken for the app to serve requests, in milliseconds.|
|Average memory working set||The average amount of memory used by the app, in megabytes (MiB).|
|Connections||The number of bound sockets existing in the sandbox (w3wp.exe and its child processes). A bound socket is created by calling bind()/connect() APIs and remains until said socket is closed with CloseHandle()/closesocket().|
|CPU Time||The amount of CPU consumed by the app, in seconds. For more information about this metric, see CPU time vs CPU percentage.|
|Current Assemblies||The current number of Assemblies loaded across all AppDomains in this application.|
|Data In||The amount of incoming bandwidth consumed by the app, in MiB.|
|Data Out||The amount of outgoing bandwidth consumed by the app, in MiB.|
|Gen 0 Garbage Collections||The number of times the generation 0 objects are garbage collected since the start of the app process. Higher generation GCs include all lower generation GCs.|
|Gen 1 Garbage Collections||The number of times the generation 1 objects are garbage collected since the start of the app process. Higher generation GCs include all lower generation GCs.|
|Gen 2 Garbage Collections||The number of times the generation 2 objects are garbage collected since the start of the app process.|
|Handle Count||The total number of handles currently open by the app process.|
|Http 2xx||The count of requests resulting in an HTTP status code ≥ 200 but < 300.|
|Http 3xx||The count of requests resulting in an HTTP status code ≥ 300 but < 400.|
|Http 401||The count of requests resulting in HTTP 401 status code.|
|Http 403||The count of requests resulting in HTTP 403 status code.|
|Http 404||The count of requests resulting in HTTP 404 status code.|
|Http 406||The count of requests resulting in HTTP 406 status code.|
|Http 4xx||The count of requests resulting in an HTTP status code ≥ 400 but < 500.|
|Http Server Errors||The count of requests resulting in an HTTP status code ≥ 500 but < 600.|
|IO Other Bytes Per Second||The rate at which the app process is issuing bytes to I/O operations that do not involve data, such as control operations.|
|IO Other Operations Per Second||The rate at which the app process is issuing I/O operations that are neither read nor write operations.|
|IO Read Bytes Per Second||The rate at which the app process is reading bytes from I/O operations.|
|IO Read Operations Per Second||The rate at which the app process is issuing read I/O operations.|
|IO Write Bytes Per Second||The rate at which the app process is writing bytes to I/O operations.|
|IO Write Operations Per Second||The rate at which the app process is issuing write I/O operations.|
|Memory working set||The current amount of memory used by the app, in MiB.|
|Private Bytes||Private Bytes is the current size, in bytes, of memory that the app process has allocated that cannot be shared with other processes.|
|Requests||The total number of requests regardless of their resulting HTTP status code.|
|Requests In Application Queue||The number of requests in the application request queue.|
|Thread Count||The number of threads currently active in the app process.|
|Total App Domains||The current number of AppDomains loaded in this application.|
|Total App Domains Unloaded||The total number of AppDomains unloaded since the start of the application.|
For an App Service plan, the available metrics are:
App Service plan metrics are available only for plans in Basic, Standard, and Premium tiers.
|CPU Percentage||The average CPU used across all instances of the plan.|
|Memory Percentage||The average memory used across all instances of the plan.|
|Data In||The average incoming bandwidth used across all instances of the plan.|
|Data Out||The average outgoing bandwidth used across all instances of the plan.|
|Disk Queue Length||The average number of both read and write requests that were queued on storage. A high disk queue length is an indication of an app that might be slowing down due to excessive disk I/O.|
|Http Queue Length||The average number of HTTP requests that had to sit on the queue before being fulfilled. A high or increasing HTTP Queue length is a symptom of a plan under heavy load.|
CPU time vs CPU percentage
There are two metrics that reflect CPU usage:
CPU Time: Useful for apps hosted in Free or Shared plans, because one of their quotas is defined in CPU minutes used by the app.
CPU percentage: Useful for apps hosted in Basic, Standard, and Premium plans, because they can be scaled out. CPU percentage is a good indication of the overall usage across all instances.
Metrics granularity and retention policy
Metrics for an app and app service plan are logged and aggregated by the service, with the following granularities and retention policies:
- Minute granularity metrics are retained for 30 hours.
- Hour granularity metrics are retained for 30 days.
- Day granularity metrics are retained for 30 days.
Monitoring quotas and metrics in the Azure portal
To review the status of the various quotas and metrics that affect an app, go to the Azure portal.
To find quotas, select Settings > Quotas. On the chart, you can review:
- The quota name.
- Its reset interval.
- Its current limit.
- Its current value.
You can access metrics directly from the Resource page. To customize the chart:
- Select the chart.
- Select Edit chart.
- Edit the Time Range.
- Edit the Chart type.
- Edit the metrics you want to display.
To learn more about metrics, see Monitor service metrics.
Alerts and autoscale
Metrics for an app or an App Service plan can be hooked up to alerts. For more information, see Receive alert notifications.
App Service apps hosted in Basic, Standard, or Premium App Service plans support autoscale. With autoscale, you can configure rules that monitor the App Service plan metrics. Rules can increase or decrease the instance count, which can provide additional resources as needed. Rules can also help you save money when the app is over-provisioned.