Azure API Limits and Throttling Overview
The Azure Resource Manager throttles management API requests at the following levels:
Azure Virtual Desktop and Nerdio Manager both leverage the underlying Azure Resource Manager via Graph API and are subject to API limits and throttling. Many different types of API limits could theoretically apply, but this topic focuses specifically on those limits more relevant to AVD.
API limits are scoped to the security principal (user or application) making the requests and the subscription ID. Some VM API limits are also scoped to a specific Azure region. Therefore, increasing subscriptions, regions, and security principals increases the aggregate API limit.
To learn more about API limits, refer to following Microsoft resources:
How Nerdio Manager Consumes API
During normal operation, Nerdio Manager makes API calls to Azure to perform various actions.
Interactive use of the UI: Nerdio Manager refreshes VM and AVD values via API when users navigate around the various pages and refresh their browser. Interactive UI-driven API consumption is relatively low.
Auto-scaling: When auto-scaling is enabled, Nerdio Manager uses API to check on the status of VMs and session hosts within a host pool every 5 (by default) minutes. This operation happens in the background on a per host pool basis. The more host pools, and the more VMs there are in each host pool, the more API calls are used to gather the current state of the environment to decide if any auto-scaling action is necessary.
Auto-deallocate stopped VMs: If a user shuts down Windows on their desktop, the VM is in a stopped, but not deallocated, state. This means the compute cost meter is still running even though the VM is not accessible. Nerdio Manager automatically detects such hosts and deallocates them to save on costs. The VM Deallocator service runs in the background every 10 (by default) minutes and scans for VMs to deallocate.
Metrics collection: During each host pool auto-scale operation, Nerdio Manager automatically collects CPU, RAM, and AVD session usage information to generate useful auto-scale history graphs.
Scheduled tasks: Most tasks in Nerdio Manager can be scheduled to run on a schedule rather than interactively. For example, re-imaging a host pool can be scheduled for the middle of the night. While VMs are being re-imaged, Nerdio Manager consumes API calls during the operation.
Others: The following actions consume small amounts of API calls:
Azure Files and Azure NetApp Files auto-scaling
Recommendations to Optimize API Usage
Tip: API usage optimizations become a relevant topic if your AVD environment has more than 500 session host VMs. In addition, it is important to architect the Azure environment for scale if your AVD deployment is in the thousands of VMs.
Use multiple Azure subscriptions
If there are more than 1000 VMs in your deployment, split the deployment across multiple Azure subscriptions with up to 1000 VMs in each subscription.
Use hub-spoke architecture and connect them via virtual network peering.
Create FSLogix storage within the subscription where the VMs are deployed to avoid excessive network traffic traversing VNet peering links.
Avoid having a single host pool span multiple subscriptions (VMs in the same host pools in two subscriptions).
Nerdio Manager can manage AVD deployments that span multiple subscriptions.
Use different Azure regions
Azure API limits on VM operations are region specific. More regions mean higher API limits.
Deploy VMs in different regions if using the more than 1000 VMs in a single subscription.
Use built-in Active/Active host pool DR to split VMs across two subscriptions. See Host Pool Disaster Recovery for details.
Increase SQL DB size: SeeScale Up Nerdio Manager for Large Deployments for details.
Apply UI API optimizations: SeeScale Up Nerdio Manager for Large Deployments for details.
Increase App Service Plan size: SeeScale Up Nerdio Manager for Large Deployments for details.
Adjust VM Deallocator service: Select one of the following options to reduce the number of API calls used by the VM Deallocator service:
Disable the VM Deallocator globally if you're not concerned with users shutting down Windows (for example, they do not have local admin rights). Set the App Service setting VmDeallocator:Enabled to False. See Advanced App Service Configurations for details.
Reduce the frequency of the VM deallocator service. Set the App Service setting VmDeallocator:RepeatIntervalInMinutes to 60 or 240 minutes (default is 10 minutes). VM Deallocator then runs less frequently and uses fewer API calls. See Advanced App Service Configurations for details.
Disable VM Deallocator on a per-host pool basis if you want it to be available for some host pools but not others. In Nerdio Manager, navigate to Host Pool > Properties > VM Deployment and unselect Deallocate powered off but not deallocated VMs.
Align resource groups to host pools: Avoid having host pools that contain VMs in multiple resource groups. Try to align one resource group to one host pool for optimal API usage.
Adjust auto-scale interval: By default, the auto-scale process runs every 5 minutes for each host pool. Reduce the frequency at which the auto-scale background service runs. Set the App Service setting AutoScale:RepeatIntervalInMinutes to 10 or 15 minutes. See Advanced App Service Configurations for details.
Adjust auto-scale concurrency: By default, 10 host pools are processed by auto-scale at the same time. Adjust the AutoScale:MaxAutoScaleProcesses App Service setting. See Advanced App Service Configurations for details.
Adjust concurrency of new VM creation: By default, when new VMs are added to host pools, the maximum number of concurrent jobs is 100. In busy Azure subscriptions, this can put pressure on other background tasks. Adjust the Provision:MaxAddNewVMJobsCount App Service setting to 25 or 50 to avoid consuming too many APIs during VM creation process. See Advanced App Service Configurations for details.
Consider batch size when re-imaging: When re-imaging a host pool, you can specify the number of hosts to process at the same time. Consider all background tasks that may be running during the re-image window and set your batch size accordingly.
Adjust "Restart" attempts for auto-scale and new VM provisioning: If Nerdio Manager hits an Azure error during auto-scale or VM creation operation, the job pauses and then retries after a few minutes. The default number of retries is 2. In a large environment, with API throttling kicking in due to hitting API limits, consider increasing the number of retries to 4 or 5. Adjust the App Service setting AutoScale:RestartAttempts and Provision:MaxRestartAttempts. See Advanced App Service Configurations for details.