AlgoViz

Sharding & replication

medium 30 min

Scale a database past one machine by splitting rows over shards, and keep it available by copying every shard.

What each level should show

The same question is judged differently for mid, senior and staff.

  • Mid

    Must show

    • Separates sharding from replication
    • Chooses a key from the queries
    • Explains a query without the key

    Will be probed on

    • Why modulo hurts
    • What lag looks like

    Stands out

    Puts the shard number into the id.

  • Senior

    Must show

    • Uses logical shards
    • Moves one live
    • Chooses a replication mode for the data

    Will be probed on

    • Unique constraints
    • Transactions over shards
    • Stale routers

    Stands out

    Explains why one hot key survives any hash.

  • Staff

    Must show

    • Plans capacity and triggers
    • Plans a migration with a way back
    • Limits the number of cross-shard features

    Will be probed on

    • Schema changes on every shard
    • Cost of operations

    Stands out

    Argues when to stay on one machine, with numbers.