Choosing a Sharding Scheme — Key Range, Fixed Shards, Hash Ranges

Choosing a Sharding Scheme — Key Range, Fixed Shards, Hash Ranges A workflow diagram generated by Archify. 01 / Decision EX / Key Range 03 / Hash — Fixed Count 04 / Hash — Adaptive Ask about the workload Pick the scheme Shard a KV Dataset · spread data and load · Decision › Ask about the workload · goal: no hot spots Shard a KV Dataset spread data and load goal: no hot spots Range Scans on Keys? · queries over key ranges · Decision › Ask about the workload · decide Range Scans on Keys? queries over key ranges decide Shard Count Fixed OK? · volume predictable · Decision › Pick the scheme · decide Shard Count Fixed OK? volume predictable decide Split Shards on Growth? · subranges, not new keys · Decision › Pick the scheme · decide Split Shards on Growth? subranges, not new keys decide Consistent Hashing · reassign scattered keys · Decision › Pick the scheme · rendezvous · jump hash Consistent Hashing reassign scattered keys rendezvous · jump hash Key-Range Sharding · one contiguous range each · Key Range › Ask about the workload · range scans stay fast Key-Range Sharding one contiguous range each range scans stay fast Fixed Number of Shards · hash(key) % 1000 · Hash — Fixed Count › Pick the scheme · move whole shards Fixed Number of Shards hash(key) % 1000 move whole shards Hash-Range Sharding · ranges of hash values · Hash — Adaptive › Pick the scheme · split when too big Hash-Range Sharding ranges of hash values split when too big yes no yes no yes no have a large dataset Legend Agent logic Context / trace External system