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▼
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?
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.
Bài đọc tiếp theo
Thiết kế hệ thống cơ bản (1/10): Học System Design — metric, QPS, CAP
System design là gì? Khóa miễn phí 10 phần: functional/non-functional, QPS, p99, availability, CAP — ước lượng traffic ShortLink scale 1→1M user. Bản đồ: /blog/hoc-system-design-co-ban-tu-dau
Đọc tiếp →Capstone URL shortener (10/10): System Design 1M MAU + rubric
Đề phỏng vấn URL shortener: 20k RPS redirect, 200 write/s, p99 & availability — rubric 100 điểm và đáp án tham khảo.
Đọc tiếp →Monolith System Design (2/10): Scale 1 user — kiến trúc MVP ShortLink
Thiết kế hệ thống giai đoạn MVP: monolith, Nginx, PostgreSQL một server — API URL shortener, schema SQL, sequence redirect, failure mode trước khi scale.
Đọc tiếp →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.