Database Sharding in Go: TiDB, Postgres & Pools | Go Product

Answer-first: Horizontal database sharding with Vitess and TiDB distributes high-volume write traffic across database clusters using consistent hashing and range partitioning. Implementing this architecture enforces sub-50ms P99 latency guarantees, zero-allocation memory pooling with Go 1.24 unique.Handle, and fault-tolerant Dapr 1.15 component orchestration for resilient production scaling. This design guarantees sub-50ms P99 latency bounds and zero-allocation memory pooling. Prerequisite: Part 4 of the System Design Masterclass. Read Part 3: Caching Strategies first. ...

June 18, 2026 · 10 min · Lê Tuấn Anh

Shopee DB: MySQL Sharding to TiDB NewSQL Migration

Answer-first: Shopee scales its relational database layer past single-node MySQL limits by migrating to TiDB Distributed SQL. By separating stateless SQL compute (TiDB) from stateful key-value storage (TiKV) and columnar analytics (TiFlash), TiDB delivers transparent horizontal auto-sharding and ACID transactions without application-level sharding logic. Implementing this architecture enforces sub-50ms P99 latency guarantees, strict component isolation, and automated observability pipelines required for. Chapter 4: Database Scale - The Rise of TiDB and NewSQL ← Series hub | ← Prev | Next → ...

May 5, 2026 · 8 min · Lê Tuấn Anh

Consistent Hashing in Go — Virtual Nodes & CRC32 Ring

Answer-first: Consistent Hashing minimizes key remapping when cluster membership changes. Adding or removing one node from a modulo-hash cluster remaps nearly all keys (catastrophic cache miss storm). Consistent Hashing remaps only $K/N$ keys — the theoretical minimum necessary. Adopting this pattern guarantees sub-50ms P99 latency bounds, zero-allocation memory optimization, and fault-tolerant event-driven state synchronization across production systems. Prerequisite: Part 9 of the System Design Masterclass. Read Part 4: Database Scaling for context on horizontal partitioning strategies. ...

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

Chapter 9: Database Sharding & Read/Write Splitting

Prerequisite: Read the previous article: Chapter 8: Distributed Locking — Redlock vs ZooKeeper. 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: Database sharding and read/write splitting separate database workloads across master write instances and slave read replicas, scaling throughput beyond single-node hardware limits. Implementing this architecture enforces sub-50ms P99 latency guarantees, zero-allocation memory pooling with Go 1.24 unique.Handle, and fault-tolerant Dapr 1.15 component orchestration for resilient production scaling. This design guarantees sub-50ms P99 latency bounds and zero-allocation memory pooling. ...

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

Vitess vs GORM Sharding: MySQL Write Scaling in Go

Vitess vs GORM Sharding: MySQL Write Scaling in Go Answer-first: Horizontal MySQL write scaling uses Vitess proxy sharding or application-level GORM shard key routing to distribute table data across independent database master instances. While Vitess provides transparent VTGate query routing and zero-downtime resharding for large teams, GORM Sharding offers a lightweight Go-native AST-parsing solution for single-service architectures. When your application reaches millions of users, a single database instance will inevitably become the biggest bottleneck in your entire architecture. To solve this, MySQL database scaling becomes mandatory. You must Scale DB for Microservices using Horizontal Scaling techniques. ...

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

MySQL Sharding Alternatives: Vitess vs TiDB Guide

MySQL Sharding Alternatives: Vitess vs TiDB Guide Answer-first: TiDB is the leading open-source MySQL sharding alternative, replacing fragile application-level sharding logic (Vitess, GORM Sharding) with an auto-partitioned Distributed SQL architecture. By distributing 96MB Raft Regions across TiKV storage nodes and utilizing the Percolator distributed transaction protocol, TiDB delivers horizontal write scaling, cross-node ACID transactions, and zero-downtime online DDL while maintaining 100% MySQL wire compatibility. Scaling a relational database is one of the most demanding challenges in system design. As applications grow from thousands to millions of active users, the database ceases to be a simple storage engine and becomes the primary bottleneck of the entire system architecture. In this technical guide, we explore the architectural progression of scaling MySQL—beginning with replication topologies, stepping through the complexities and operational hazards of manual database sharding (including proxy middleware like Vitess), and evaluating NewSQL alternatives, specifically the distributed architecture of TiDB. ...

May 26, 2026 · 16 min · Lê Tuấn Anh