Global Applications Architecture
Global Applications Architecture
Multi-Region patterns, DR strategies, CloudFront vs Global Accelerator
Tổng quan
Global Applications Architecture là kiến trúc thiết kế ứng dụng phục vụ users trên toàn cầu với:
- Low Latency: Giảm độ trễ cho users ở mọi nơi
- High Availability: Ứng dụng luôn sẵn sàng
- Disaster Recovery: Khôi phục nhanh khi có sự cố
- AWS Services cho Global Architecture
- AWS Global Accelerator
- CloudFront vs Global Accelerator
- Disaster Recovery Patterns
1. AWS Services cho Global Architecture
1.1 Bảng tổng hợp Services
| Service | Layer | Chức năng chính | Use Case |
|---|---|---|---|
| Route 53 | DNS | Global DNS routing, health checks | Domain routing, failover |
| CloudFront | CDN | Cache content tại Edge | Static/dynamic content delivery |
| Global Accelerator | Network | Tối ưu network path | Low-latency applications |
| S3 Cross-Region Replication | Storage | Replicate objects | Data redundancy |
| DynamoDB Global Tables | Database | Multi-Region NoSQL | Global read/write |
| Aurora Global Database | Database | Multi-Region SQL | Cross-region failover |
| S3 Transfer Acceleration | Transfer | Tăng tốc upload/download | Large file transfers |
1.2 Route 53 - Global DNS
Routing Policies cho Global Apps:
| Policy | Mô tả | Use Case |
|---|---|---|
| Latency | Route đến region có latency thấp nhất | Performance optimization |
| Geolocation | Route theo vị trí địa lý user | Compliance, localization |
| Failover | Tự động chuyển khi primary down | Disaster recovery |
| Weighted | Phân chia traffic theo % | Blue/green, canary |
1.3 CloudFront - Global CDN
Các tính năng chính:
- Edge Caching: Cache content gần users
- Lambda@Edge: Run code tại Edge
- Origin Shield: Reduce origin load
- Real-time Logs: Monitor CDN performance
1.4 S3 Cross-Region Replication (CRR)
Use Cases:
- Disaster Recovery
- Compliance (data in multiple regions)
- Reduce latency for global users
- Cross-account replication
1.5 DynamoDB Global Tables
1.6 Aurora Global Database
2. AWS Global Accelerator
2.1 Tổng quan
AWS Global Accelerator là service tối ưu hóa network path từ users đến applications bằng cách sử dụng AWS Global Network.
2.2 Kiến trúc chi tiết
2.3 Thành phần chính
| Component | Mô tả |
|---|---|
| Accelerator | Entry point với 2 static anycast IPs |
| Listener | Process connections (TCP/UDP, port range) |
| Endpoint Group | Nhóm endpoints trong 1 region |
| Endpoints | ALB, NLB, EC2, Elastic IP |
2.4 Tính năng quan trọng
1. Static Anycast IP:
2. Health Checks & Failover:
3. Traffic Dials:
- Điều chỉnh % traffic đến mỗi endpoint group (0-100%)
- Dùng cho Blue/Green deployment, gradual rollout
4. Client Affinity:
NONE: Requests distributed based on health, weightSOURCE_IP: Sticky sessions based on client IP
2.5 Use Cases
| Use Case | Mô tả |
|---|---|
| Gaming | UDP traffic, low latency requirement |
| IoT | MQTT over TCP, stable connections |
| Voice/Video | Real-time communication |
| Financial Trading | Ultra-low latency |
| Health Apps | Static IP for compliance |
3. CloudFront vs Global Accelerator
3.1 So sánh tổng quan
3.2 Bảng so sánh chi tiết
| Feature | CloudFront | Global Accelerator |
|---|---|---|
| Mục đích chính | Content delivery & caching | Network path optimization |
| Caching | ✅ Yes (Edge caching) | ❌ No |
| Protocol | HTTP/HTTPS only | TCP, UDP |
| Static IP | ❌ No (DNS-based) | ✅ Yes (2 Anycast IPs) |
| DDoS Protection | AWS Shield Standard | AWS Shield Standard |
| Origin Types | S3, ALB, EC2, Custom HTTP | ALB, NLB, EC2, EIP |
| Edge Functions | Lambda@Edge, CloudFront Functions | ❌ No |
| WebSocket | ✅ Yes | ✅ Yes |
| Pricing | Data transfer + requests | Fixed hourly + data transfer |
3.3 Khi nào dùng cái nào?
3.4 Use Case Mapping
| Scenario | Recommend | Why |
|---|---|---|
| Static website | CloudFront | Cache HTML, CSS, JS, images |
| API Gateway backend | CloudFront | Cache API responses |
| Gaming (UDP) | Global Accelerator | UDP support, low latency |
| VoIP application | Global Accelerator | UDP, stable connection |
| IoT with fixed IP | Global Accelerator | Static IP for whitelist |
| Streaming video | CloudFront | Cache video segments |
| Dynamic web app (no cache) | Global Accelerator | Network optimization |
| Global failover | Global Accelerator | Health checks, instant failover |
3.5 Kết hợp cả hai
4. Disaster Recovery Patterns
4.1 Các metrics quan trọng
| Metric | Định nghĩa | Ý nghĩa |
|---|---|---|
| RPO (Recovery Point Objective) | Lượng data tối đa có thể mất | "Bao nhiêu data backup bị mất?" |
| RTO (Recovery Time Objective) | Thời gian downtime chấp nhận được | "Bao lâu để recover?" |
4.2 Bốn DR Patterns
4.3 Pattern 1: Backup & Restore
Characteristics:
- ✅ Chi phí thấp nhất
- ❌ Recovery time dài nhất
- Use for: Non-critical workloads, dev/test environments
4.4 Pattern 2: Pilot Light
Characteristics:
- Core infrastructure (DB) luôn chạy và sync
- App servers chỉ start khi cần
- Tên từ "pilot light" trong gas heater - ngọn lửa nhỏ luôn cháy
4.5 Pattern 3: Warm Standby
Characteristics:
- Scaled-down version chạy sẵn trong DR region
- Có thể xử lý traffic ngay lập tức
- Scale up khi failover
4.6 Pattern 4: Active-Active (Multi-Site)
Characteristics:
- Cả 2 regions đều nhận traffic
- Zero downtime
- Chi phí cao nhất (gấp đôi)
- Phức tạp về data consistency
4.7 So sánh các DR Patterns
| Pattern | RPO | RTO | Cost | Complexity | Use Case |
|---|---|---|---|---|---|
| Backup & Restore | Hours | 24+ hours | $ | Low | Dev, non-critical |
| Pilot Light | Minutes | 10-30 min | $$ | Medium | Core business apps |
| Warm Standby | Seconds-Mins | Minutes | $$$ | Medium-High | Business critical |
| Active-Active | ~0 | ~0 | $$$$ | High | Mission critical |
4.8 DR Implementation Checklist
5. Tổng kết
Service Selection Matrix
| Requirement | Primary Service | Alternative |
|---|---|---|
| Low latency content delivery | CloudFront | - |
| Low latency non-HTTP traffic | Global Accelerator | - |
| Static IP required | Global Accelerator | - |
| Global DNS with health checks | Route 53 | - |
| Global NoSQL database | DynamoDB Global Tables | - |
| Global SQL database | Aurora Global Database | - |
| Cross-region data replication | S3 CRR | DynamoDB Streams |
| Fast file uploads globally | S3 Transfer Acceleration | - |
| Edge computing | Local Zones, Wavelength | Outposts |