EngineeringSenior DeveloperInterview Sessions

Interview Questions - Phase 4: Azure & DevOps (System Design)

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

  1. [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.
  2. [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
  1. [Architect] Vẽ architecture diagram trên Azure: API layer, background processing, database, cache, CDN. Justify từng service choice.
  2. [Architect] Flash sale: pre-warm instance hay auto-scale? Azure Front Door + WAF cần thiết không? DDOS protection?
  3. [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
  1. [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?
  2. [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

  1. [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?
  2. [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)
  1. [Architect] Order events: Service Bus Topic (guaranteed) hay Event Hub (high throughput)? Hay dùng CẢ HAI cho từng use case?
  2. [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?
  3. [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)
  1. [Architect] Approach: CDC (Change Data Capture) + Azure Data Factory? Debezium? SQL Server Replication?
  2. [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

  1. [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?
  2. [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
  1. [Architect] Azure SQL Failover Group: Active-Passive hay Active-Active? Async vs Sync replication?
  2. [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?
  3. [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
  1. [Architect] SQL Server Full-Text Search đủ hay cần Elasticsearch/Azure Cognitive Search? Trade-offs: data sync complexity vs search quality?
  2. [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

  1. [Senior] .NET Aspire làm được gì mà docker-compose.yml khô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
  1. [Architect] Monorepo: build ALL services hay chỉ build affected services? Tool: Nx affected, path filters trong CI?
  2. [Architect] Blue-green deployment trên Azure Container Apps: traffic splitting? Health check? Database migration compatibility (forwards + backwards)?
  3. [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.

  1. [Senior] Observability stack: Application Insights (logs + traces + metrics). Query KQL nào để tìm root cause nhanh nhất?
  2. [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)
  3. [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-PatternTại sao nguy hiểm
1Secrets trong appsettings.json hoặc code - "ConnectionString": "Server=...;Password=abc123"Commit vào Git → leak credentials. Dùng Key Vault + Managed Identity
2Không có health check endpoint - App crash nhưng Load Balancer vẫn route trafficUsers see 500 errors. Cần /health endpoint cho readiness/liveness probes
3Azure Functions Consumption cho long-running - Function timeout 5-10 phútConsumption Plan có max timeout. Dùng Premium Plan hoặc Durable Functions
4Single Azure Region, no DR - Toàn bộ infrastructure ở 1 regionRegion outage = toàn bộ hệ thống down. Ít nhất cần backup/restore plan
5Blob Storage access bằng Account Key trong code - new BlobServiceClient(connectionString)Key leak = full storage access. Dùng Managed Identity + RBAC
6Không monitor Azure costs - Chạy idle resources 24/7Dev/test environments running weekends = wasted money. Set cost alerts + auto-shutdown
7Log.Information($"...") - String interpolation thay vì structured loggingMất khả năng query, filter, aggregate logs. Structured placeholders allow indexing
8Deploy bằng tay (manual deploy) - RDP vào server, copy filesNot reproducible, not auditable, error-prone. CI/CD pipeline mandatory
9Cosmos DB không đặt Partition Key đúng - Partition Key = Id → mỗi item 1 partitionHot partition, RU throttling, cross-partition queries chậm
10SQL 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