PlanetScaleSimeon Griggs6 min readintermediate
Handling hot shards
Summary
This article explains how PlanetScale's Neki, built on Vitess, helps manage hot shards in sharded databases, using Slack's journey from workspace-based to channel-based sharding as a detailed case study. It outlines strategies like vertical scaling, tenant isolation, and resharding specific tables without downtime to adapt to changing data access patterns.
- Sharding by `tenant_id` can lead to hot shards if a single tenant grows excessively, requiring adaptation.
- Temporary fixes for hot shards include vertical scaling the affected shard or isolating the hot tenant to its own shard.
- The long-term solution often involves resharding specific tables with a more appropriate key based on access patterns, like sharding messages by `channel_id` instead of `workspace_id`.
- Neki/Vitess supports declarative data topologies and online resharding, allowing changes to sharding strategies without application downtime.
Engineers designing or operating large-scale sharded databases will find practical strategies and a detailed real-world example for managing uneven data distribution and evolving access patterns.
7/10





