टप्प्याटप्प्याने 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
पायरी 0: connection pooling
प्रत्येक MySQL connection ला memory आणि एक thread लागतो. 100x traffic वर तुम्ही CPU आधी संपवाल. किंवा सारखे pooler हजारो app connections काही शंभर DB connections वर multiplex करते. तो एक config बदल आहे, rearchitecture नव्हे — तो आधी करा.
