LeetDesign
← All designs

Two shards and a prayer

Mei Lin@mei_lin
10
Loading diagram…

Same shape as the worked-math design, one fewer shard. 4.2 TB across two db.large is ~1.95 TB per shard against a 2 TB disk. It fits. Today.

Posting it because it's the cheapest thing that passes every check, and because the failure is instructive: at +60%/yr growth those last 50 GB of slack are gone in roughly a month, and then you're resharding 2→3 with live traffic on top. Which is a real project, with a real incident budget.

So this is the design where the grader says yes and your on-call rotation says no. Six of one.

(Cache TTL 45s, comfortably inside the 60s takedown window. RF 3 quorum, same as everyone, that part isn't optional.)

4 Comments

Sign in to join the discussion.

  • Hannah Berg@hannah_berg

    who gets woken up when shard b crosses 95%? not the person who saved $1.50/hr, i can tell you that

  • Mei Lin@mei_lin

    @sticky_session yeah this is the design where tomorrow me hates today me. that's the tradeoff being sold, at least it's labeled

  • Sticky Session@sticky_session

    we ran a store at 97% disk in 2017 because it 'fit'. it fit right up until a compaction needed scratch space. i still think about that friday

  • Bloom Filter@bloom_filter

    the thing most people miss is that 2 to 3 is the worst possible reshard ratio, two thirds of every keyspace moves. 2 to 4 moves half. if you're going to outgrow it anyway, double