Scaling E‐Commerce ‐ How We Transformed The Root's Plant Sales with Azure Application Gateway - git-muhammad-sadique-i987/projects GitHub Wiki
The Challenge: Handling Seasonal Traffic Spikes
The Root, an online plant retailer, faced website crashes during peak sales (e.g., Mother’s Day). Their two web servers (vm1
and vm2
) needed intelligent traffic routing to handle surges. We replaced manual load balancing with Azure Application Gateway for seamless scalability.

- Layer 7 Routing: Distribute traffic based on URLs, hostnames, or paths.
- Zero Downtime Updates: Swap routing rules without disrupting users.
- Cost Efficiency: Pay only for consumed capacity (Standard v2 tier).
Evenly distribute traffic across servers.
Steps:
-
Create Gateway:
- Name:
acg-app-gw
- Tier: Standard V2 (cost-optimized)
- Subnet: Dedicated
appgateway-subnet
- Frontend IP: New public IP (
acg-app-gw-pip
)
- Name:
-
Configure Backend Pool:
- Pool:
vmbepool
- Targets:
vm1
+vm2
- Pool:
-
Routing Rule:
- Listener:
basiclistener
(HTTP:80) - Backend Settings:
basichttpsettings
(HTTP:80)
- Listener:
📸 Screenshot : Gateway’s "Backend pools" tab with both VMs.
Testing:
- Access the gateway’s public IP → Traffic alternates between
vm1
/vm2
on refresh.
Route traffic by hostname (e.g., vm1.theroot.com
).
Steps:
-
Create Dedicated Pools:
-
vm1bepool
(onlyvm1
) -
vm2bepool
(onlyvm2
)
-
-
Add Listeners:
-
vm1listener
: Port 8080, Hostvm1.theroot.com
-
vm2listener
: Port 8081, Hostvm2.theroot.com
-
-
Link Rules:
-
vm1multirouterule
: Routesvm1.theroot.com:8080
→vm1bepool
-
vm2multirouterule
: Routesvm2.theroot.com:8081
→vm2bepool
-
Testing:
- On
user-vm
, editC:\Windows\System32\drivers\etc\hosts
:<Gateway_IP> vm1.theroot.com <Gateway_IP> vm2.theroot.com
- Access:
-
http://vm1.theroot.com:8080
→ Alwaysvm1
-
http://vm2.theroot.com:8081
→ Alwaysvm2
-
📸 Screenshot: Show the hosts file and browser results for both URLs.
Send /images/
requests to vm2
.
Steps:
-
Delete Old Rule: Remove
basicroutingrule
. -
Create Path Rule:
- Rule:
urlrouterule
- Listener:
basiclistener
(HTTP:80) - Default target:
vm1bepool
- Path
/images/*
: Route tovm2bepool
- Rule:
Testing:
-
http://<Gateway_IP>
→vm1
-
http://<Gateway_IP>/images/
→vm2
- 99.95% Uptime: During holiday sales.
- 40% Faster Deployments: New routing rules in <5 mins.
- Unified Management: One gateway for all routing scenarios.
- Isolate Subnets: Always use dedicated subnets for gateways (security + performance).
- Start with V2 Tier: Autoscaling handles traffic spikes effortlessly.
- Test with Hosts File: Simulate DNS changes before go-live.
👉 Facing similar scaling challenges? Ask how in the comments!
Hashtags: #Azure #CloudArchitecture #EcommerceTech #DevOps #ApplicationGateway