Distributed Key-Value Store
Định nghĩa
Distributed Key-Value Store là database phân tán lưu dữ liệu theo cặp key-value, scale bằng partition/sharding và replication để phục vụ lookup theo key với latency thấp.
Cách hiểu bằng lời của tôi
Key-value store mạnh khi query chính là “biết key, lấy value”. Để chạy ở quy mô lớn, hệ thống phải quyết định key được map vào shard nào, shard replicate ra sao, ai xử lý read/write, và update/rebuild dữ liệu kiểu batch hay realtime.
Pattern từ Airbnb Mussel
- Shard theo hash của primary key.
- Dùng control plane như Helix để quản lý partition assignment.
- Dùng Kafka như write-ahead log để đồng bộ update.
- Cho replica đọc theo leaderless style để ưu tiên availability/read latency.
- Dùng LSM/HRegion, MemStore, BlockCache và compaction cho storage engine.
Pitfall từ Cloudflare KV
Một key-value store có thể “distributed at edge” nhưng vẫn phụ thuộc source-of-truth tập trung. Nếu cold read/write cần backend đó và không có fallback, outage của storage phụ thuộc có thể kéo theo identity, config, asset delivery và nhiều sản phẩm khác.