ฐานข้อมูลมักกลายเป็น คอขวด เมื่อระบบเติบโต การสเกลฐานข้อมูลเกี่ยวข้องกับเทคนิคต่าง ๆ เช่น replication (สำเนาเพื่อ read scaling และ availability) sharding (การแยกข้อมูลข้ามเซิร์ฟเวอร์) caching และการเลือกประเภทฐานข้อมูลที่เหมาะสม
Replication — สำเนาของข้อมูล
REPLICATION → maintain COPIES of the database across servers:
→ PRIMARY (writes) + REPLICAS (copies):
- READ SCALING → direct reads to replicas (offload the primary) → handle more reads
- AVAILABILITY → a replica can take over if the primary fails (failover)
⚠️ replication lag → replicas may be slightly behind (eventual consistency for reads)
→ great for READ-heavy workloads and availability (most apps are read-heavy)
