Băm Nhất Quán (Consistent Hashing) — Node Ảo, Phương Sai Tải & Vòng CRC32 Trong Go

Băm Nhất Quán (Consistent Hashing) — Node Ảo, Phương Sai Tải & Vòng CRC32 Trong Go

← Chương trước: Mẫu Saga & Giao Dịch Phân Tán (Distributed Transactions) — Temporal, Outbox & Debezium | Mục lục Series | Chương tiếp theo: Khả Năng Quan Sát (Observability) & pprof — Bắt Bệnh Rò Rỉ Bộ Nhớ, Profiling CPU & GODEBUG → Answer-first: Băm Nhất Quán (Consistent Hashing) giải quyết thảm họa Cache Miss Storm của Modulo Hashing bằng cách chỉ dịch chuyển K/N khóa khi thay đổi cụm node. Sử dụng 150-200 Virtual Nodes trên vòng băm CRC32 trong Go giúp giảm độ lệch chuẩn phân phối tải xuống dưới 4%. ...

18 tháng 6, 2026 · 12 phút · Lê Tuấn Anh
Chương 9: Database Sharding & Read/Write Splitting Dành Cho Các

Chương 9: Database Sharding & Read/Write Splitting Dành Cho Các Bảng Dữ Liệu Hàng Tỷ Bản Ghi

← Chương trước: Chương 8 — Distributed Locking: Redlock vs ZooKeeper | Mục lục Series Answer-first: Khi cơ sở dữ liệu phình to hàng tỷ bản ghi, kỹ thuật Read/Write Splitting phân tách cụm Master/Replica qua GORM dbresolver giúp mở rộng năng lực đọc. Với tải ghi cực hạn, Database Sharding kết hợp thuật toán Consistent Hashing (băm nhất quán) phân tán dữ liệu đồng đều và triệt tiêu rủi ro data migration. ...

9 tháng 6, 2026 · 6 phút · Lê Tuấn Anh
MySQL Horizontal Scaling: Vitess & GORM Sharding

MySQL Horizontal Scaling: Vitess & GORM Sharding

🇬🇧 Read the English version of this article on tanhdev.com Answer-first: Khi Primary-Replica Read-Scaling chạm trần tải ghi, mở rộng ngang MySQL (Write-Scaling) được thực thi qua Vitess (Middleware-level với VTGate/VTTablet trong suốt, zero-downtime resharding) hoặc GORM Sharding (App-level trong Go qua SQL AST rewrite). Chọn Vitess cho kiến trúc polyglot quy mô lớn; chọn GORM Sharding cho Go stack tinh gọn. Khi ứng dụng của bạn vươn mình chạm ngưỡng hàng triệu người dùng, một cỗ máy database đơn độc (single database instance) sớm muộn gì cũng trở thành nút thắt cổ chai lớn nhất trong toàn bộ kiến trúc. Để giải quyết bài toán này, việc mở rộng quy mô cơ sở dữ liệu MySQL (MySQL database scaling) là điều bắt buộc. Bạn có thể tham khảo Mở Rộng DB Cho Microservices (Scale DB for Microservices) khi áp dụng các kỹ thuật Horizontal Scaling (Mở rộng ngang). Khám phá thêm tại series High Concurrency Systems. ...

1 tháng 6, 2026 · 8 phút · Lê Tuấn Anh
Replace MySQL Sharding with TiDB: distributed SQL migration guide for Go engineers

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. ...

26 tháng 5, 2026 · 16 phút · Lê Tuấn Anh