TechPartner

← Quay lại Blog
Khóa học System Design cơ bản — thiết kế hệ thống scale 1 → 1 triệu user · Phần 5 / 10

Read replica (5/10): Read/write split ~10.000 user

System design read replica: replication lag, read-your-writes, index SQL, export CSV qua S3 — dashboard ShortLink không làm sập primary.

· 1 min read

Khóa học System Design cơ bản — thiết kế hệ thống scale 1 → 1 triệu user · Phần 5/10
  1. 1Nền tảng metric & CAP
  2. 2Monolith 1 server
  3. 3Tách DB & vận hành
  4. 4Redis + CDN
  5. 5Read replica
  6. 6Load balancer
  7. 7Message queue
  8. 8Sharding & đa vùng
  9. 9Phỏng vấn & cheat sheet
  10. 10Capstone ShortLink
Mục lục
  1. Mục tiêu phần 5
  2. Read/write routing
  3. Replication lag
  4. Index
  5. Object storage
  6. Bài tập
App (read/write split)Primary (writes)Read replicareplication lagIndex + S3 export
Giai đoạn ~10.000 người dùng: read replica và chú ý replication lag.

Mục tiêu phần 5

~10.000 user: dashboard và báo cáo đọc nhiều; thêm read replica, tối ưu index, export lớn qua object storage.


Read/write routing

  • INSERT/UPDATE/DELETE → Primary
  • SELECT dashboard, analytics list → Replica

Replication lag

Sau POST tạo slug, user F5 list → replica chưa có → 404/list thiếu.

Fix: read-your-writes — 30s sau create đọc primary; hoặc cache slug vừa tạo trên client/session.

Index

(slug) unique, (created_at DESC) cho admin list.

Object storage

Export 50k rows → job ghi S3/GCS, user download signed URL — không giữ file trong RAM app.

Bài tập

Vẽ timeline lag 3s — UX nào bị ảnh hưởng?


Điều hướng seri: ← Phần 4 · Phần 6 →

Câu hỏi thường gặp

Phần 5 tập trung vào quy mô nào?

System design read replica: replication lag, read-your-writes, index SQL, export CSV qua S3 — dashboard ShortLink không làm sập primary.

Startup của bạn cần tech partner?

Trao đổi miễn phí về MVP, timeline và mô hình chia lợi nhuận phù hợp.