Dành cho Solution Architect/Cloud Architect. Câu hỏi scenario-based - thiết kế hạ tầng, capacity planning, CI/CD cho Enterprise.
1. Cloud Architecture & Compute
Câu hỏi lý thuyết
- [Senior] Background Job xử lý Report tốn 10 phút: chọn Azure App Service WebJob, Azure Functions (Consumption Plan) hay Container Apps? Trade-off giữa chi phí và Timeout.
- [Architect] API đang chạy trên App Service. Sale đột biến traffic gấp 100x. Auto-scale startup time quá chậm → requests bị drop. Giải pháp kiến trúc?
🎯 Use Case 1: Thiết Kế Infrastructure cho E-Commerce Launch
Startup e-commerce chuẩn bị launch, dự kiến:
- Ngày thường: 1,000 concurrent users
- Flash sale: 50,000 concurrent users (trong 2 giờ)
- Background: process 10,000 orders/hour, generate PDF receipts
- Budget: trung bình, không quá đắt
- [Architect] Vẽ architecture diagram trên Azure: API layer, background processing, database, cache, CDN. Justify từng service choice.
- [Architect] Flash sale: pre-warm instance hay auto-scale? Azure Front Door + WAF cần thiết không? DDOS protection?
- [Senior] PDF generation 10K/hour: Azure Functions (Consumption) hay Container Apps (dedicated)? Nếu mỗi PDF mất 5 giây, cần bao nhiêu concurrent instances?
🎯 Use Case 2: Cost Optimization - Azure Bill $15K/month
CTO yêu cầu giảm Azure bill từ $15K → $8K/month mà không ảnh hưởng performance. Hệ thống gồm:
- 2x App Service Plan P2v3 (running 24/7)
- Azure SQL S3 (running 24/7)
- 3x Azure Functions (Consumption)
- Redis Cache C2
- Blob Storage 500GB
- [Architect] Những item nào có thể optimize? Reserved Instances? Scale-in ngoài giờ? Downgrade tier dựa vào metrics nào?
- [Senior] Azure Functions Consumption Plan vs Premium: khi nào cold start là deal-breaker?
2. Messaging & Integration
Câu hỏi lý thuyết
- [Senior] Phân biệt Azure Service Bus (Queues/Topics), Event Grid, và Event Hubs. Hệ thống Telemetry 1 triệu thiết bị IoT/giây → dùng service nào?
- [Architect] Azure Service Bus Sessions (FIFO) và Dead-letter queue (DLQ). Use-case Banking mà thiếu Session Id → Race-condition?
🎯 Use Case 3: Order Event Pipeline - Chọn Messaging Service
Hệ thống Order processing cần:
- Order Created event → Inventory Service, Email Service, Analytics
- Order events phải guaranteed delivery (không mất message)
- Analytics cần process 100K events/giây
- Email cần đúng thứ tự per-customer (email 1 → email 2)
- [Architect] Order events: Service Bus Topic (guaranteed) hay Event Hub (high throughput)? Hay dùng CẢ HAI cho từng use case?
- [Senior] Email cần FIFO per-customer: bạn dùng Service Bus Sessions với Session ID = Customer ID. Khi Session lock holders crash → stuck session. Xử lý thế nào?
- [Architect] DLQ chứa 500 failed messages. Workflow: auto-retry? Manual review? Alert + auto-move back to main queue?
🎯 Use Case 4: Event-Driven Integration với Legacy System
Công ty có hệ thống ERP cũ (SQL Server, chạy on-premise). Cần sync data real-time sang Azure cloud:
- Order data từ ERP → cloud e-commerce
- Inventory updates từ cloud → ERP
- Cannot modify ERP source code (no API)
- [Architect] Approach: CDC (Change Data Capture) + Azure Data Factory? Debezium? SQL Server Replication?
- [Architect] Data transformation cần thiết? ETL pipeline hay streaming (Azure Stream Analytics)?
3. Database & Storage Strategy
Câu hỏi lý thuyết
- [Senior] Azure SQL Database vs Cosmos DB: đặc tính dữ liệu nào khiến bạn chọn Cosmos DB? Cảnh báo về Partition Key sai lầm?
- [Architect] Data Pipeline cho siêu thị 500 cửa hàng: Azure Data Factory + Blob Storage (Data Lake) + Databricks?
🎯 Use Case 5: Multi-Region Database cho Finance App
Ứng dụng banking phục vụ 2 regions: Southeast Asia (primary) + East Asia (DR). Requirements:
- RPO = 0 (zero data loss)
- RTO = 15 minutes
- Read traffic cần serve từ cả 2 regions (user gần region nào → read từ region đó)
- Write chỉ cần 1 region active
- [Architect] Azure SQL Failover Group: Active-Passive hay Active-Active? Async vs Sync replication?
- [Architect] RPO = 0 nghĩa là sync replication → latency impact lên write. Chấp nhận trade-off hay dùng approach khác?
- [Senior] Connection string management: khi failover, app cần reconnect thế nào? DNS TTL? Retry policy?
🎯 Use Case 6: Search Performance - SQL Server vs Elasticsearch
Product search cần:
- Full-text search (tiếng Việt + English)
- Faceted filtering (category, price range, brand, rating)
- Autocomplete suggestions
- 500ms max latency
- [Architect] SQL Server Full-Text Search đủ hay cần Elasticsearch/Azure Cognitive Search? Trade-offs: data sync complexity vs search quality?
- [Senior] Nếu dùng Elasticsearch, data sync strategy: double-write (anti-pattern?), CDC, hay scheduled job?
4. DevOps & Observability
Câu hỏi lý thuyết
- [Senior] .NET Aspire làm được gì mà
docker-compose.ymlkhông? Service Discovery và Local Development benefits?
🎯 Use Case 7: Microservices CI/CD Pipeline Design
5 microservices trong 1 monorepo. Team 12 devs. Cần:
- PR builds (unit test + lint)
- Staging deploy (integration test)
- Production deploy (blue-green)
- Rollback < 5 minutes
- [Architect] Monorepo: build ALL services hay chỉ build affected services? Tool: Nx affected, path filters trong CI?
- [Architect] Blue-green deployment trên Azure Container Apps: traffic splitting? Health check? Database migration compatibility (forwards + backwards)?
- [Senior] Secret management: Azure Key Vault + Managed Identity hay Environment variables? Rotation strategy?
🎯 Use Case 8: Production Incident - 500 Errors Spike
Lúc 3AM, alert: 500 error rate tăng từ 0.1% → 15%. On-call engineer cần diagnose.
- [Senior] Observability stack: Application Insights (logs + traces + metrics). Query KQL nào để tìm root cause nhanh nhất?
- [Architect] Correlation ID: request từ API Gateway → Service A → Service Bus → Service B. Làm sao trace end-to-end 1 request qua toàn bộ hệ thống? (OpenTelemetry + Distributed Tracing)
- [Senior] Log structure: tại sao structured logging (
Log.Information("Order {OrderId} created", orderId)) quan trọng hơn string interpolation ($"Order {orderId} created")?
⚠️ Anti-Patterns - Azure & DevOps
| # | Anti-Pattern | Tại sao nguy hiểm |
|---|---|---|
| 1 | Secrets trong appsettings.json hoặc code - "ConnectionString": "Server=...;Password=abc123" | Commit vào Git → leak credentials. Dùng Key Vault + Managed Identity |
| 2 | Không có health check endpoint - App crash nhưng Load Balancer vẫn route traffic | Users see 500 errors. Cần /health endpoint cho readiness/liveness probes |
| 3 | Azure Functions Consumption cho long-running - Function timeout 5-10 phút | Consumption Plan có max timeout. Dùng Premium Plan hoặc Durable Functions |
| 4 | Single Azure Region, no DR - Toàn bộ infrastructure ở 1 region | Region outage = toàn bộ hệ thống down. Ít nhất cần backup/restore plan |
| 5 | Blob Storage access bằng Account Key trong code - new BlobServiceClient(connectionString) | Key leak = full storage access. Dùng Managed Identity + RBAC |
| 6 | Không monitor Azure costs - Chạy idle resources 24/7 | Dev/test environments running weekends = wasted money. Set cost alerts + auto-shutdown |
| 7 | Log.Information($"...") - String interpolation thay vì structured logging | Mất khả năng query, filter, aggregate logs. Structured placeholders allow indexing |
| 8 | Deploy bằng tay (manual deploy) - RDP vào server, copy files | Not reproducible, not auditable, error-prone. CI/CD pipeline mandatory |
| 9 | Cosmos DB không đặt Partition Key đúng - Partition Key = Id → mỗi item 1 partition | Hot partition, RU throttling, cross-partition queries chậm |
| 10 | SQL Server không có Connection Resilience - Không dùng EnableRetryOnFailure() | Transient failures (Azure SQL) → random 500 errors. EF Core retry policy required |
👉 Xem đáp án chi tiết tại: Answers/ans-04-azure-devops.md