Scaling Up and Scaling Out in Azure
Scaling is how Azure applications handle increased load, and it generally happens in two directions: scaling up (vertical scaling) and scaling out (horizontal scaling).
Scaling Up (Vertical Scaling)
- Increases the resources of an existing instance — more CPU, memory, or disk
- Example: moving an Azure SQL Database from a Standard to a Premium tier
- Simple to implement but has an upper limit based on the largest available size
Scaling Out (Horizontal Scaling)
- Adds more instances of a resource to share the load
- Example: increasing the instance count of an App Service plan or VM Scale Set
- Improves both capacity and fault tolerance, since load is spread across instances
Where Each Applies in Azure
- App Service — supports both scaling up (larger App Service Plan tier) and scaling out (more instances)
- VM Scale Sets — designed specifically for automatic scaling out based on demand
- Azure SQL Database — primarily scales up/down through service tiers, with read scale-out for read replicas
Choosing the Right Approach
- Use scale-up when an application isn't designed to run across multiple instances
- Use scale-out for stateless applications that need high availability and elasticity
- Combine both with autoscale rules for cost-efficient, demand-driven scaling
Ready to master Microsoft Azure?
Join Microsoft Azure Training Course at Uncodemy and learn with hands-on projects and mentor support.
Worked Scenario: Preparing a Web App for a Sale Weekend
Picture an online store running on App Service that expects a big rise in visitors during a festival sale. A sensible plan uses both directions of scaling:
- Right-size each instance first. Look at memory and CPU charts from normal days. If a single instance already runs close to its memory limit, scale up to a larger plan tier so each instance has headroom.
- Set a safe minimum count. Keep at least two instances at all times, so one can fail or restart without taking the site down.
- Add autoscale rules. Scale out when average CPU stays high for several minutes, and scale in when it stays low.
- Set a maximum count that protects your budget and the downstream database.
- Load test before the event to confirm the rules trigger as expected and the app stays healthy with more instances.
The Azure CLI can apply the same plan in a repeatable way:
# Scale up: move the plan to a larger tier
az appservice plan update --name shop-plan --resource-group rg-shop --sku P1V3
# Scale out manually to three instances
az appservice plan update --name shop-plan --resource-group rg-shop --number-of-workers 3
# Autoscale between 2 and 6 instances
az monitor autoscale create --resource-group rg-shop --name shop-autoscale \
--resource shop-plan --resource-type Microsoft.Web/serverfarms \
--min-count 2 --max-count 6 --count 2
az monitor autoscale rule create --resource-group rg-shop --autoscale-name shop-autoscale \
--condition "CpuPercentage > 70 avg 10m" --scale out 1
az monitor autoscale rule create --resource-group rg-shop --autoscale-name shop-autoscale \
--condition "CpuPercentage < 30 avg 10m" --scale in 1
For a VM Scale Set, az vmss scale --name web-vmss --resource-group rg-shop --new-capacity 4 changes the instance count directly. Available tiers and sizes differ by region and subscription, so check what is offered before planning.
Designing an Application That Scales Out Cleanly
Adding instances only helps if any instance can handle any request. That usually means making the app stateless:
- Store session data in a shared cache such as Azure Cache for Redis, not in the memory of one server.
- Save uploaded files to Blob Storage rather than the local disk.
- Make background jobs safe to run on several instances, for example by pulling work from a queue.
- Avoid relying on sticky sessions (ARR affinity) unless the app truly needs them, because they spread load unevenly.
Scaling Mistakes That Waste Money or Cause Outages
- Only a scale-out rule. Without a matching scale-in rule, instances pile up after the peak and keep costing money.
- Thresholds too close together. Scaling out at 60% and in at 55% makes the app flap between counts. Leave a clear gap and use averaging windows.
- Forgetting the database. Ten web instances can overwhelm a database sized for two. Scale the data tier, add caching or use read replicas alongside the web tier.
- Scaling up during busy hours. Changing tiers can restart instances. Plan vertical changes for quiet periods.
- Not watching the results. Review the autoscale run history and set alerts when the maximum instance count is reached, since that means the ceiling may be too low.
Quick decision guide
- Single-instance software or a licence tied to one machine: scale up.
- Stateless web or API tier with changing traffic: scale out with autoscale.
- Predictable peaks, such as office hours: add a schedule-based autoscale profile.