Experience the transformative capabilities of Azure App Service’s state-of-the-art Automatic Scaling feature, redefining the landscape for developers seeking to elevate their web applications. Delve into a realm of unmatched cost efficiencies, heightened availability, and steadfast resiliency as this innovation smoothly adjusts to varying traffic demands. Bid farewell to the complexities of manual scaling and embrace effortless scalability that propels your web, mobile, and API applications towards unparalleled success. Leverage the agility of Azure Web Apps within Microsoft Azure’s robust platform-as-a-service (PaaS) environment, unlocking a realm of rapid deployment and exceptional performance.
Exploring the Frontiers: A Journey into the Unknown
Automatic Scaling vs. Rule-based Scaling
Explore the distinct advantages of Automatic Scaling over Rule-based Scaling, emphasising scenarios where it excels. Automatic Scaling dynamically responds to fluctuating traffic, offering superior adaptability and eliminating manual intervention. In contrast, Rule-based Scaling relies on predefined criteria, lacking the real-time responsiveness of Automatic Scaling.
Configuring Scaling Limits
Master the art of configuring scaling limits to optimise performance for diverse web applications sharing the same app service plan. Understanding the nuances of each application’s demand enables precise limit adjustments, ensuring optimal resource utilisation and cost-effectiveness within the app service environment.
Existing Scaling Options
Manual Scale
This option involves manually setting a fixed number of instances for executing code. It offers flexibility without the need to manage hardware resources dynamically.
Example: The user might set up the application to always run with three instances during regular business hours to handle expected traffic, and then manually scale it down to one instance during off-peak times to save costs.
Rule-based Auto Scale
Rule-based auto scaling involves setting predefined rules to automatically adjust the number of instances based on specific conditions or events.
Example: the user could configure the system to automatically add more instances if CPU usage exceeds 80% for more than 5 minutes, and remove instances if CPU usage drops below 50% for 10 minutes.
Schedule-based Scaling
This type of scaling adjusts instances based on predetermined schedules, such as time of day, week, or month.
Example: The user might schedule the application to scale up during weekdays from 9 AM to 5 PM to handle increased user activity and scale down during weekends when traffic is lower.
Metric-based Scaling
Metric-based scaling dynamically adjusts the number of instances based on real-time metrics like CPU utilisation, memory usage, or network traffic.
Example: The system can automatically add instances if CPU usage exceeds 70% for more than 5 minutes and remove instances if CPU usage drops below 30% for 10 minutes, ensuring optimal performance and cost-efficiency.
Challenges with Metric-based Scaling
Metric Selection
When considering scaling for message or event-based mechanisms, critical metrics like throughput, response time, and error rate should be prioritised. Additionally, for such systems, monitoring metrics such as message queue length, processing latency, and error counts is essential to ensure effective scaling aligned with business objectives.
Transient Spikes
To address short bursts of load, automated scaling strategies with dynamic thresholds and predictive algorithms are recommended. By leveraging time-based averaging and anomaly detection techniques, distinguishing between genuine load spikes and noise becomes feasible, enabling efficient resource allocation without unnecessary overprovisioning during transient spikes.
Balancing Scale-out and Scale-in
Optimal scaling strategies involve a balance between aggressive scale-out and controlled scale-in to optimise cost savings without sacrificing performance. Gradual scaling mechanisms like step scaling or predictive scaling, coupled with cooldown periods and hysteresis, help prevent rapid and costly scale-in decisions, ensuring cost-effectiveness while maintaining system responsiveness.
Oversight Prevention
Automation and monitoring tools play a crucial role in preventing oversight leading to unexpected billing and higher costs. Implementing alerts, notifications, and audit logs for scale-in rule changes or deviations. It ensures visibility and accountability, mitigating the risk of accidental oversights in scaling strategies.
Key Concepts of Automatic Scaling and Instance Management
Automatic Scaling Overview
The platform monitors HTTP traffic on app start, using /admin/host/ping and built-in health checks. Worker health is assessed regularly, with frequency adjusting to load. It adds instances during high load and scales in gradually after load eases, typically starting 5-10 mins later. Scaling happens gradually, ensuring controlled removal of instances.
Pre-warmed Instances
An additional buffer worker aids in immediate traffic handling. The default count of 1 improves scaling speed and can be modified through the CLI. However, costs are linked to pre-warmed instances, making it advisable to retain the default setting unless specifically when required for optimised performance.
Maximum Burst
The Maximum Burst defines the highest instance count for scaling out, requiring equality or superiority to current plan instances. It restricts independent app scaling within shared plans, managed through the “Maximum scale limit” setting.
Maximum Scale Limit
It sets the upper limit for a web app’s scaling instances, crucial for managing app scaling within shared plans. It becomes unnecessary when only one app is there in the plan, it can handle scalability across multiple apps within the plan.
Load Testing Comparison: Metric-Based Scaling vs. Automatic Scaling
Web App Configuration and Load Test Methodology
The Azure web app is configured as a Premium V3 P0V3 with one “Always Ready” instance. The codebase is sourced from the eShopOnWeb solution on GitHub.
In the load testing methodology, they are testing metric-based scaling against Automatic Scaling, carefully observing behaviour under varying loads through repeated runs to ensure consistency and accuracy in results.
Rule-Based Scaling
In a rule-based scaling scenario, the system is configured to automatically scale based on the CpuPercentage metric, with a set instance count of 1. For instance: The application’s rule-based scaling mechanism adjusts instance count based on CpuPercentage, consistently scaling in and out during load testing.
Automatic Scaling Setup
Automatic Scaling can be enabled with specific configurations. The team can actively monitor and document the behaviour of automatic scaling under uniform load conditions. For example, “The IT department can activate Automatic Scaling with tailored settings, for diligently observing and documenting performance under consistent load for analysis.
Observations and Analysis: Automatic & Metric-Based Scaling
The IT department has enabled Automatic Scaling with customised settings, for meticulously monitoring its performance under consistent loads. They have gathered data on automatic scaling behaviour, request rates, and HttpResponseTime. This effort aims to document and compare any distinctions or advantages between metric-based and Automatic Scaling approaches during load testing.
Key Observations on Automatic Scaling
Measurement of Automatic Scaling Instance Count
Automatic Scaling’s key metric focuses on measuring the maximum instance count, reflecting its ability to swiftly scale out in response to increased load. This rapid scaling, driven by frequent health checks, ensures low average response times, maintaining consistent performance even under varying workloads.
Variable Instance Management
Instances are added or removed based on load fluctuations, showcasing the dynamic nature of the scaling process. However, the scaling pace may vary, evident from graphs across multiple load test iterations, highlighting the non-uniformity in how instances are managed in response to changing workload demands.
Aggressive Scaling In for Cost Optimization
The system exhibits swift scaling in response to reduced load, surpassing the documented aggressiveness. This proactive approach aids in cost optimization by swiftly removing unnecessary instances, ensuring efficient resource utilisation and cost-effectiveness in the scaling process.
Efficiency and Functionality of Automatic Scaling
Automatic scaling proves to be more efficient in comparison to custom scaling with rules, displaying faster scaling operations with a reduced time frame of approximately 22 minutes compared to 35 minutes for custom scaling scenarios. This rapid response contributes to cost optimization by swiftly adjusting resources as needed. Automatic scaling offers capabilities similar to Azure Function App scaling. However, it uses a different setup that prevents sharing a plan with automatic scaling configurations.
Understanding Billing with Automatic Scaling
Variable Instance Activation and Billing
In terms of billing, users are solely charged for “always ready” instances actively processing traffic, with pre-warmed instances incurring charges upon traffic initiation. If multiple “always ready” instances are active, pre-warmed instance billing starts when all instances are handling traffic. Activation speed varies based on application load and startup time, emphasising the importance of monitoring the automatic scaling instance count metric for accurate billing tracking.
Billing Details
Billing with automatic scaling occurs on a per-second basis, providing precise cost calculations. To ensure accurate cost projections, it is advisable to utilise the “Max” aggregation method when monitoring metrics related to automatic scaling and billing.
Automatic Scaling with Multiple Web Apps
Deployment and Automatic Scaling
Both the simple Hello World and eShopOnWeb apps are deployed within the same app service plan, with automatic scaling enabled by default for both applications.
Resource Optimization and Scale Limit Consideration
Scaled limits are set to ensure efficient resource utilisation, with 2 instances allocated for Hello World and 3 for eShopOnWeb, and a maximum burst allowance of 5 instances for each. The consideration of setting the maximum scale limit as 5 for both applications presents an opportunity for competition for maximum burst instances, but failure to enforce this limit may lead to contention for available instances, potentially affecting performance.
Impact of No Limits on Scaling
Initial Resource Race
Without set limits, both web applications race to scale to the app service plan’s maximum burst limit. This initial resource competition can impact performance temporarily, highlighting the need for strategic resource allocation and scaling policies to ensure optimal performance and resource utilisation in the long run.
Optimised Scaling Over Time
Despite the initial race to scale, web applications can efficiently adjust instances over time to meet demand as needed. This adaptability reflects the effectiveness of dynamic scaling mechanisms, ensuring optimal resource allocation and performance stability despite temporary resource competition during peak load periods.
Effect on Response Time
Unlimited scaling results in significantly lower average response times due to unhindered resource allocation. Conversely, setting limits can increase response times, as observed with the eShopOnWeb app. This highlights the trade-off between resource availability and response time optimization in scaling strategies.
Resource Distribution and Lead Time
During simultaneous load testing, resources are evenly distributed among applications, despite a lead time for scaling. Notably, the initial scaling of the first web app can facilitate faster scaling for the second app, though this outcome may not be consistent across all scenarios due to the simplicity of the applications involved.
Conclusion
The exploration of Automatic Scaling within Azure App Service has unveiled a transformative paradigm for developers, offering unparalleled cost efficiencies, availability, and resilience. The comparison between Automatic and Rule-based Scaling elucidates the former’s real-time adaptability and superior responsiveness. Configuring scaling limits is essential for optimising resource utilisation and cost-effectiveness across diverse applications. Understanding billing intricacies ensures precise cost projections and efficient usage tracking. Leveraging Automatic Scaling’s dynamic capabilities, developers can navigate transient spikes and optimise scaling strategies for sustained performance. Embracing Azure’s robust PaaS environment propels applications towards enhanced functionality and agility, heralding a future of smooth scalability and optimal resource management.
Let's Drive Innovation Together
Unlock rapid scalability and unmatched performance with Azure App Service's Automatic Scaling feature, elevating your web apps effortlessly.
