Replication
Phân bố & sắp đặt dữ liệuData distribution & placementNhiều bản sao giống nhau của cùng một tập dữ liệu. Một node nhận ghi, các node còn lại sao chép lại và phục vụ đọc.Several identical copies of one dataset. One node takes writes, the rest copy them and serve reads.
Chọn replication là đổi tính nhất quán tức thời khi đọc lấy khả năng chịu lỗi và băng thông đọc.Choosing replication trades read-your-write immediacy for fault tolerance and read bandwidth.
Dùng choGood for
- Sản phẩm đọc nhiều hơn ghi rất nhiều
- Tách báo cáo và phân tích nặng khỏi đường phục vụ
- Dự phòng thảm hoạ và đặt replica gần người dùng
- Products that read far more than they write
- Moving reporting and analytics off the serving path
- Disaster recovery and replicas placed near users
ĐượcYou gain
- Thông lượng đọc tăng gần tuyến tính
- RTO còn vài chục giây nếu failover tự động
- Backup không đụng vào tải sản xuất
- Read throughput scales close to linearly
- RTO drops to tens of seconds with automated failover
- Backups stop touching production load
MấtYou lose
- Replication lag: đọc ra dữ liệu cũ
- Bất đồng bộ thì primary chết là mất dữ liệu
- Ghi không hề được scale — vẫn một máy
- Replication lag serves stale reads
- Async replication means data loss if the primary dies
- Writes don't scale at all — still one machine
Dấu hiệu nhận biếtHow to spot it CPU của primary cạn vì SELECT, không phải vì INSERT.The primary's CPU is burned by SELECT, not by INSERT.