Skip to content

perf: sticky chunk-group worker routing behind ?sticky=1 - #69

Closed
MPanknin wants to merge 3 commits into
fix/plane-chunk-cachefrom
perf/sticky-worker-routing
Closed

MPanknin wants to merge 3 commits into
fix/plane-chunk-cachefrom
perf/sticky-worker-routing

Conversation

@MPanknin

@MPanknin MPanknin commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Context

Follow-up to #68 (stacked on it). Chunk groups (bricks whose footprint starts in the same chunk, per channel) are hashed onto workers, so two groups can share a worker and evict each other's planes. With 4 channels on 8 workers that happens most of the time.

Changes & Tests

  • ?sticky=1: a group keeps the worker it was first given, new groups go to the worker with the fewest groups. Off = current hash.
  • Groups are keyed by channel chunk, so packed channels stay on one worker; the table keeps the 4096 most recently used groups and a retired group stops counting.
  • Unit tests: separate vs packed channels, stickiness, even spread, the table bound.
  • Headless measurement (same bun harness as fix: size the worker chunk cache for plane chunks #68, this branch, flag off → on). Yeast-like layout = 2048 × 2048 × 25, uint16, 4 channels, 64 central bricks × 4 channels; the others are the 1024 × 1024 × 128 volumes, full LOD 0:
dataset requests downloaded worker caches
yeast-like, 2048² planes 1167 → 100 7.1 GB → 0.61 GB 419 → 839 MB
yeast-like, 1024² tiles 2255 → 600 3.4 GB → 0.91 GB 1101 → 1258 MB
1024² planes 130 → 130 213 MB → 213 MB 273 → 273 MB
512² planes 1103 → 1170 452 MB → 479 MB 578 → 613 MB
64³ cubes 2654 → 1742 1080 MB → 709 MB 537 → 537 MB

Preview: compare ?bench=1 with and without &sticky=1 on the yeast gallery dataset, a bioformats2raw dataset from IDR, and Fly-eFISH (128³ chunks, regression check). Look at bytes, time to converge and the Memory section of ?debug=1.


Generated by Claude Code

Hashing chunk groups onto workers lets two groups share one worker,
e.g. two channels of a plane-chunk slab, whose planes then evict each
other. With ?sticky=1 a group keeps the worker it was first given and
new groups go to the worker with the fewest.
Packed channels share one decoded chunk, so the sticky key now uses the
channel chunk, as the worker's cache does. The group table keeps the
4096 most recently used groups; a retired group no longer counts toward
its worker.
@MPanknin

Copy link
Copy Markdown
Collaborator Author

Closing this for the time being. Bench results were not really convincing enough.

@MPanknin MPanknin closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant