MSDN Documentation

App Service Scaling

This document provides a comprehensive guide to scaling your Azure App Service to meet the demands of your applications.

Understanding Scaling in App Service

Azure App Service offers two primary methods for scaling:

  • Scale Up (Vertical Scaling): Increase the resources (CPU, memory, disk space) available to your App Service plan by moving to a higher pricing tier. This is ideal for handling increased load by providing more power to individual instances.
  • Scale Out (Horizontal Scaling): Increase the number of instances running your application. This is best for handling a larger number of concurrent users or requests by distributing the load across multiple machines.

Manual Scaling

Manual scaling allows you to directly control the number of instances or the App Service plan tier. This is useful for predictable traffic patterns or during specific events.

Scaling Out Manually:

To scale out manually, navigate to your App Service in the Azure portal, go to the "Scale out" blade, and set the desired number of instances.

Tip: You can configure manual scaling up to 30 instances for Standard, Premium, and Isolated tiers.

Scaling Up Manually:

To scale up, go to the "Scale up (App Service plan)" blade and choose a new pricing tier. This involves downtime while the plan is updated.

Automatic Scaling (Autoscaling)

Autoscaling allows your App Service to automatically adjust the number of instances based on predefined rules, metrics, or schedules. This ensures your application remains available and performant without manual intervention.

Metric-Based Autoscaling:

You can configure rules based on metrics such as:

  • CPU Percentage
  • Memory Percentage
  • Disk Queue Length
  • HTTP Queue Length
  • Data In/Out

For example, you can set a rule to scale out when CPU usage exceeds 70% for 10 minutes and scale in when it drops below 30% for 15 minutes.

Schedule-Based Autoscaling:

You can also set up schedules to scale your application based on the time of day or week. This is particularly useful for handling predictable traffic spikes, such as during business hours or promotional events.

Configuring Autoscaling:

  1. Navigate to your App Service in the Azure portal.
  2. Select the "Scale out (increase/decrease number of instances)" option under "Scale out".
  3. Choose "Custom rules" or "Default rules".
  4. Define your scaling rules (metric-based or schedule-based).
  5. Set the minimum and maximum number of instances.
  6. Configure the cooldown period to prevent rapid scaling actions.

Best Practices for Scaling

  • Monitor Performance: Regularly monitor your application's performance metrics in the Azure portal to understand its scaling needs.
  • Set Realistic Min/Max Instances: Configure your minimum instances to handle baseline load and your maximum instances to prevent unexpected costs.
  • Tune Autoscaling Rules: Experiment with different metric thresholds and cooldown periods to find the optimal configuration for your application.
  • Consider Warm-Up: For applications with a significant warm-up time, consider configuring instance warm-up in your autoscaling rules.
  • Test Your Scaling: Simulate load on your application to ensure your scaling rules are working as expected.

Scaling Considerations

The availability and configuration of scaling options depend on the pricing tier of your App Service plan. Higher tiers offer more advanced scaling capabilities and a greater number of instances.

Always review the latest Azure App Service pricing details for the most up-to-date information on scaling limits and features.