Skip to content

Vấn đề system design nên biết ở level Senior Software Engineer / Senior Backend / Tech Lead

1) Xác định requirements không đầy đủ

Senior không bao giờ nhảy vào vẽ kiến trúc ngay, mà hỏi lại yêu cầu.

✔ Phải biết hỏi:

  • Functional requirements?
  • Non-functional requirements (latency, SLA, throughput, cost)?
  • Who are the users?
  • Data types?
  • Scale hiện tại vs scale kỳ vọng?
  • Single region hay multi region?
  • Strong consistency hay event consistency?

❌ Red flag: lao vào microservices hay chọn Kafka chỉ vì cool.



2) Ước lượng tải (Capacity / Load Estimation)

Senior phải biết cách:

  • QPS / RPS
  • Peak vs average
  • Growth factor
  • Storage volume / data retention

Ví dụ nếu thiết kế URL shortener:

  • Reads 10x writes?
  • Write 10,000 / s
  • Store 1B entries / 3 years

❌ Red flag: nói kiến trúc cloud nhưng không hề tính được con số.



3) High Availability & Failover

Các câu hỏi hay:

  • Nếu DB chết thì sao?
  • Nếu Redis fail thì degrade thế nào?
  • Active-active vs Active-passive?
  • Multi AZ vs Multi Region?

Senior cần nói được:

✔ Health check, circuit breaker, auto failover, leader election, quorum (Raft/Paxos).

❌ Red flag: nói “dùng cluster là xong”.



4) Scalability bottleneck

Phải nhận ra các điểm nghẽn:

✔ Cache
✔ Queue
✔ Partitioning
✔ Replication
✔ Horizontal scaling

Câu hỏi kinh điển:

Nếu load tăng 10x bạn làm gì?

Senior cần:

  • Scale stateless app horizontally
  • DB – sharding / read replicas
  • Cache invalidation strategy
  • Rate limiting

❌ Red flag: chỉ trả lời “scale server lên” hoặc “dùng microservice”.



5) Consistency vs Availability tradeoffs (CAP theorem)

Ví dụ interviewer hỏi:

  • Why not use Mongo for bank transactions?
  • When to use eventual consistency?
  • What is read-your-own-write?

Senior cần nói:

✔ Strong consistency cho tiền
✔ Eventual consistency cho newsfeed / cart tracking

❌ Red flag: “eventual consistency là đủ cho tất cả”.



6) Data modeling + indexing

Các hệ thống e.g. Course Scheduler, Banking Card System:

✔ Chọn primary key
✔ Partition key (hot key issue)
✔ Secondary index / inverted index

❌ Senior yếu nếu:

  • Không hiểu database scan vs index lookup
  • Không biết composite key
  • Không hiểu write amplification


7) Cache design & cache invalidation

Câu hỏi rất hay:

How do you ensure cache consistency?

Senior phải nói:

✔ TTL + lazy eviction
✔ Write-through / write-behind / read-through
✔ Cache stampede: use mutex / probabilistic early refresh

❌ Red flag: “just put Redis in front”.



8) Messaging / Queueing / Async Processing

Các bài design realtime:

✔ Kafka vs RabbitMQ vs SQS – phải biết tradeoff:

  • Ordering vs throughput
  • At-least-once vs exactly-once
  • Replayability
  • Consumer lag management

❌ Red flag: Kafka là thuốc tiên.



9) Reliability & Observability

Senior phải trả lời:

✔ Retry pattern
✔ Circuit breaker
✔ Dead letter queue
✔ Telemetry: trace, log, metrics
✔ Health endpoint + graceful shutdown

❌ Red flag: nói microservice nhưng không nhắc monitoring.



10) API contracts / versioning / idempotency

Interviewers sẽ hỏi:

  • How do you design idempotent APIs?
  • How do you handle partial failure?
  • How do you structure versioning?

Senior cần:

✔ Request IDs
✔ Operation tokens
✔ Rollback / Saga pattern
✔ Idempotency key for payment



11) Security / Auth / Multi-tenant ( rất hay hỏi )

  • JWT vs session?
  • OAuth2 flows?
  • RBAC vs ABAC?
  • Multi-tenant isolation: schema per tenant / shared schema + tenant_key

❌ Red flag: nghĩ security = JWT là xong.



12) Storage + Database Selection

Senior phải justify:

  • SQL cho consistency
  • NoSQL cho scalable reads
  • Time-series DB vs OLAP vs OLTP

Câu hỏi điển hình:

thiết kế hệ thống payment → bạn dùng DB gì? vì sao?



13) Transaction + Saga vs 2PC

Senior phải biết:

  • Why 2PC is dangerous in distributed system
  • Saga patterns: choreographed vs orchestrated
  • Compensation transaction & state machine


14) Evolution & Maintainability

Interviewers test maturity:

✔ Feature toggle
✔ Backward compatibility
✔ Blue-green / canary deployment
✔ Migration strategy (e.g., schema change)



15) Cost Awareness

Câu hỏi rất “Senior”:

  • If budget limited, how do you re-architect?
  • Avoid over-engineering?
  • Reserved instances / storage lifecycle

Senior phải biết cost trade-off.



16) Real Scenarios thường bị hỏi

⭐ A. Design an URL Shortener

Focus:

  • DB sharding
  • Counter / hash collision
  • Cache
  • Analytics pipeline

⭐ B. Design a Messaging App (WhatsApp / Messenger)

Focus:

  • Delivery semantics
  • Message persistence
  • Fan-out
  • Presence status

⭐ C. Design Payment Gateway

Focus:

  • Idempotency
  • Transaction safety
  • Anti-fraud async process
  • Dead letter

⭐ D. E-commerce Checkout / Flash Sale / Ticket Booking

Focus:

  • Prevent oversell
  • Quota management / locking
  • Queue + rate limiting

⭐ E. Newsfeed / Social Network Feed

Focus:

  • Push vs pull
  • Fan-out vs fan-in
  • Cache + ranking store
Published inAll

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *