Senior LevelREST APIs & Web Services
How do API Gateways execute Canary Deployments with weighted percentage traffic splitting?
❓ Interview Prompt: Explain Canary Deployments, API Gateway weighted routing, header-based routing, real-time error rate telemetry monitoring, and automated rollbacks.
Canary Deployments minimize release risk by routing a small fraction of live production traffic to a new version ('v2') while monitoring error rates before rolling out globally:
Execution Strategy:
1
Weighted Routing: API Gateway routes 95% of traffic to 'v1' and 5% to 'v2'.
2
Header-Based Targeting: Internal QA testers pass header 'X-Canary-Target: true' to force routing to 'v2'.
3
Automated Rollback: Telemetry monitors '5xx' error rates and latency on 'v2'. If errors exceed 0.5%, gateway automatically shifts 100% traffic back to 'v1' instantly!
Code Implementation Example
yaml
# Istio VirtualService Weighted Canary Routing
spec:
hosts:
- api.example.com
http:
- route:
- destination:
host: user-service-v1
weight: 95
- destination:
host: user-service-v2
weight: 5💡Istio VirtualService weighted canary routing configuration (95% v1 / 5% v2).
🎯 Interview Key Takeaway
Execute canary deployments using API Gateway weighted traffic splitting coupled with automated telemetry error rollback.
#Canary Deployments#API Gateway#Istio#Senior
Back to all REST APIs & Web Services Questions→