Commit b89b617
persist: place each snapshot part on the least loaded worker
`shard_source` handed each part to a worker chosen at random. The comment
explained why not round robin: parts that alternate large and small would
leave half the workers idle. Random dodges that but accepts balls-in-bins
imbalance, and with the tens of parts a snapshot typically has, the busiest
worker ends up with two to three times the bytes of the least busy one, and
hydration waits for the busiest.
Send each part to the worker that has received the fewest encoded bytes so
far. The size is already computed for the coalescing logic. This handles
both failure modes, since placement follows load rather than position, and
is deterministic for a given part sequence.
Hydrating an index over a 10M-row table on four workers, three repetitions:
1.14s (1.10 to 1.25) to 0.90s (0.89 to 0.91), with the per-worker dataflow
time going from 0.43, 0.60, 1.18, 0.35s to 0.85, 0.55, 0.67, 0.60s. An
index on a distinct view went from 1.07s (1.02 to 1.36) to 1.04s (1.02 to
1.05). A join whose skew comes from a small dimension table was unchanged.
Single-worker hydration is unaffected.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent f17fb27 commit b89b617
1 file changed
Lines changed: 21 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
511 | 510 | | |
512 | 511 | | |
513 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
514 | 516 | | |
515 | 517 | | |
516 | 518 | | |
| |||
598 | 600 | | |
599 | 601 | | |
600 | 602 | | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
610 | 619 | | |
611 | 620 | | |
612 | 621 | | |
| |||
808 | 817 | | |
809 | 818 | | |
810 | 819 | | |
| 820 | + | |
| 821 | + | |
811 | 822 | | |
812 | 823 | | |
813 | 824 | | |
| |||
0 commit comments