चरणों में scale करें: पहले reads के लिए read replicas + caching, फिर writes के लिए sharding (Vitess) — और किसी भी चीज़ से पहले connection pooling जोड़ें, क्योंकि यह सबसे सस्ता 10x है। Reads और writes अलग-अलग scale होते हैं, इसलिए पहले दिन sharding की ओर न बढ़ें।
┌─▶ Cache (Redis) ── hit ──▶ return
App ─▶ Pool(PgBouncer/ProxySQL) miss ▼
│ ┌─▶ Read replica 1 ┐
├──── reads ─────────┼─▶ Read replica 2 ┼─ (async replication)
│ └─▶ Read replica N ┘
└──── writes ──▶ Primary ──▶ (later) Vitess shards ─▶ Primary A / Primary B
Step 0: connection pooling
हर MySQL connection memory और एक thread खर्च करता है। 100x traffic पर आप CPU से बहुत पहले समाप्त कर देंगे। या जैसा एक pooler हज़ारों app connections को कुछ सौ DB connections पर multiplex करता है। यह एक config बदलाव है, rearchitecture नहीं — इसे पहले करें।
