AlgoViz

Advanced partitioning

hard 30 min

Running a partitioned database means keeping it balanced.

Where it shows up

The same pattern appears across everyday software.

  • MongoDB balancer

    Runs by default and moves ranges when shards differ by at least three times the configured range size. Ranges that hold a single key value cannot be split and become jumbo.

  • CockroachDB

    Cuts its sorted key space into ranges, splits them at the default size, and can also split by load. Small neighbours merge again.

  • Vitess Reshard

    Copies and streams to new shards, compares with VDiff, then switches traffic with one command.

  • DynamoDB

    Documents a limit per partition, adaptive capacity for uneven traffic, and write sharding with random or calculated suffixes.

  • Slack

    Had all data of a workspace on one shard. Very large customers made hot spots that could not be spread, which was one reason to move to Vitess.

  • HBase salting

    Its guide describes adding a prefix to row keys so that neighbouring writes land in different regions, at the cost of more work for reads.

  • Discord message buckets

    Described a composite Cassandra key of channel and time bucket, so that no channel becomes one endless partition.