Chapter 9: Database Sharding & Read/Write Splitting for Billion-Record Tables

← Previous | Series hub Chapter 9: Scaling the Final Database Bottleneck When your application reaches tens of millions of users, the Database becomes the ultimate bottleneck. CPU maxes out at 100%, RAM depletes, and queries take seconds instead of milliseconds. This is the stage where you must deploy distributed database strategies. 1. Read/Write Splitting Answer-first: Because 80% of traffic is Read-only, separate your DB into a Write Master and Read Slaves. Use GORM’s dbresolver plugin to route queries automatically without altering business logic. ...

June 9, 2026 · 3 min · Lê Tuấn Anh

Chapter 5: Optimizing Golang Database Connection Pools to Prevent Bottlenecks

← Previous | Series hub | Next → Chapter 5: Unlocking Database Performance via Connection Pooling If your Golang system processes business logic blazingly fast but chokes at the Database layer, 90% of the time, it is due to an incorrectly configured *sql.DB. 1. Understanding *sql.DB Answer-first: In Golang, sql.Open() does NOT create a direct database connection. It instantiates a thread-safe Connection Pool manager. You must initialize the db variable only once during app startup. ...

June 9, 2026 · 3 min · Lê Tuấn Anh